|
@@ -1,11 +1,5 @@
|
|
|
<?php
|
|
|
|
|
|
-/*
|
|
|
- * To change this license header, choose License Headers in Project Properties.
|
|
|
- * To change this template file, choose Tools | Templates
|
|
|
- * and open the template in the editor.
|
|
|
- */
|
|
|
-
|
|
|
namespace loyalsoft;
|
|
|
|
|
|
/**
|
|
@@ -14,6 +8,7 @@ namespace loyalsoft;
|
|
|
* @author cyzhao
|
|
|
*/
|
|
|
class AuctionProc {
|
|
|
+
|
|
|
static function procMain() {
|
|
|
switch (req()->cmd) {
|
|
|
case CmdCode::cmd_Auction_GetUserAuctionItemsInfo: # 7401 获取全部拍卖信息
|
|
@@ -25,97 +20,97 @@ class AuctionProc {
|
|
|
case CmdCode::cmd_Auction_UserAuctionBidItem: # 7404 竞拍/一口价
|
|
|
return AuctionProc::UserAuctionBidItem();
|
|
|
case CmdCode::cmd_Auction_CancelAuction: # 7405 取消出售
|
|
|
- return AuctionProc::CancelAuction();
|
|
|
+ return AuctionProc::CancelAuction();
|
|
|
case CmdCode::cmd_Auction_UploadAuctionItems: # 7406 上传拍品
|
|
|
- return AuctionProc::UploadAuctionItems();
|
|
|
+ return AuctionProc::UploadAuctionItems();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 获取全部拍卖信息
|
|
|
*/
|
|
|
static function GetAuctionItemsInfo() {
|
|
|
$obj = self::getAuctionUserItemListCache(req()->zoneid);
|
|
|
-
|
|
|
+
|
|
|
$ret = array(
|
|
|
"auctionitems" => $obj->data,
|
|
|
- //"bidRecord" => $req->userInfo->privateState->arrUserlAucBidItems # 加一个出价记录
|
|
|
- );
|
|
|
-
|
|
|
- UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ //"bidRecord" => $req->userInfo->privateState->arrUserlAucBidItems # 加一个出价记录
|
|
|
+ );
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
- "ret" => $ret,
|
|
|
+ "ret" => $ret,
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 玩家上架拍品信息
|
|
|
*/
|
|
|
static function GetUserUploadAuctionItems() {
|
|
|
- UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
- "store" => "ok",
|
|
|
+ "store" => "ok",
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 玩家竞拍信息
|
|
|
*/
|
|
|
static function GetUserAuctionItems() {
|
|
|
- UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
- "store" => "ok",
|
|
|
+ "store" => "ok",
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 竞拍/一口价
|
|
|
*/
|
|
|
static function UserAuctionBidItem() {
|
|
|
-
|
|
|
-
|
|
|
- UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
- "store" => "ok",
|
|
|
+ "store" => "ok",
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 取消出售
|
|
|
*/
|
|
|
static function CancelAuction() {
|
|
|
- UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
- "store" => "ok",
|
|
|
+ "store" => "ok",
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 上传拍品
|
|
|
* @return type
|
|
|
- */
|
|
|
+ */
|
|
|
static function UploadAuctionItems() {
|
|
|
- list($itemId,$num,$price,$buyoutPrice) = req()->paras;//上传拍品的 id 数量 竞拍价 一口价
|
|
|
-
|
|
|
+ list($itemId, $num, $price, $buyoutPrice) = req()->paras; //上传拍品的 id 数量 竞拍价 一口价
|
|
|
+
|
|
|
$user = req()->userInfo->game;
|
|
|
//$items = $user->store->items;
|
|
|
-
|
|
|
- my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId), ErrCode::store_itemno_err); # 参数合法性判断
|
|
|
+
|
|
|
+ my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId), ErrCode::store_itemno_err); # 参数合法性判断
|
|
|
$auctionPrice = GameConfig::item_base_getItem($itemId)->auctionPrice;
|
|
|
- my_Assert($auctionPrice*$num <= $price && $auctionPrice*$num <= $buyoutPrice, ErrCode::store_itemno_err); # 参数合法性判断
|
|
|
-
|
|
|
+ my_Assert($auctionPrice * $num <= $price && $auctionPrice * $num <= $buyoutPrice, ErrCode::store_itemno_err); # 参数合法性判断
|
|
|
+
|
|
|
StoreProc::removeItemFromStore($user->store, $itemId, $num);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
$aucItem = new Ins_AuctionItemModel();
|
|
|
$aucItem->addstep = 1;
|
|
|
$aucItem->startprice = $price;
|
|
|
$aucItem->buyoutPrice = $buyoutPrice;
|
|
|
- $aucItem->cxtId = $itemId;
|
|
|
- $aucItem->cxtNum = $num;
|
|
|
+// $aucItem->cxtId = $itemId;
|
|
|
+// $aucItem->cxtNum = $num;
|
|
|
$aucItem->startts = time();
|
|
|
- $aucItem->endts = glc()->AuctionEndTs*60*60 + time(); # 24小时
|
|
|
+ $aucItem->endts = glc()->AuctionEndTs * 60 * 60 + time(); # 24小时
|
|
|
if (!GAME_ONLINE) {
|
|
|
$aucItem->endts = self::tsCurrHour(1); # 内网1小时。
|
|
|
}
|
|
@@ -124,35 +119,36 @@ class AuctionProc {
|
|
|
$aucItem->zoneid = $req->zoneid;
|
|
|
$err = self::insertNewUserAuctionItem($aucItem);
|
|
|
if ($err != ErrCode::succeed) { # 数据库操作失误
|
|
|
- $resp = ResponseVo ::myErrResponse($req, $err);
|
|
|
- } else { # 插入成功后,更新缓存
|
|
|
- # 写入玩家数据
|
|
|
- UserProc::updateUserInfo($req); # 包括手续费
|
|
|
- self::updateAuctionUserItemListCache($req); # 更新缓存
|
|
|
- $resp = ResponseVo ::myRetResponse($req, "succeed"); # 更新下客户端的拍品列表
|
|
|
- }
|
|
|
-
|
|
|
- UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ $resp = ResponseVo ::myErrResponse($req, $err);
|
|
|
+ } else { # 插入成功后,更新缓存
|
|
|
+ # 写入玩家数据
|
|
|
+ UserProc::updateUserInfo($req); # 包括手续费
|
|
|
+ self::updateAuctionUserItemListCache($req); # 更新缓存
|
|
|
+ $resp = ResponseVo ::myRetResponse($req, "succeed"); # 更新下客户端的拍品列表
|
|
|
+ }
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
- "store" => "ok",
|
|
|
+ "store" => "ok",
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取当前的玩家拍卖缓存
|
|
|
* @param type $mem
|
|
|
* @return array
|
|
|
*/
|
|
|
- static function getAuctionUserItemListCache($zoneid) {
|
|
|
+ static function getAuctionUserItemListCache($zoneid) {
|
|
|
// gMem()->hget($key, $itemId);
|
|
|
// return $mem->get(MemKey::auctionItemListCache($zoneid));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 玩家拍卖的拍品列表缓存
|
|
|
* @return string
|
|
|
*/
|
|
|
static function auctionItemListCache($zoneid) {
|
|
|
- return "auction-user-itemlist" ."-zone" . $zoneid;
|
|
|
+ return "auction-user-itemlist" . "-zone" . $zoneid;
|
|
|
}
|
|
|
+
|
|
|
}
|