...
This commit is contained in:
parent
522c121d8d
commit
76cb211997
83
webapp/services/callback/GameItemMarketBuyOk.php
Normal file
83
webapp/services/callback/GameItemMarketBuyOk.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace services;
|
||||||
|
|
||||||
|
require_once('phpcommon/bchelper.php');
|
||||||
|
require_once ('services/callback/BuyPassCbService.php');
|
||||||
|
require_once ('services/callback/BuyShopGoodsCbService.php');
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
|
class GameItemMallBuyOk {
|
||||||
|
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
|
$address = getReqVal('address', '');
|
||||||
|
$orderId = getReqVal('order_id', '');
|
||||||
|
|
||||||
|
error_log("GameItemMallBuyOk-------------------");
|
||||||
|
$orderDb = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getMysql($address),
|
||||||
|
't_bc_order',
|
||||||
|
array(
|
||||||
|
'order_id' => $orderId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
//1:已发货 2:订单不存在
|
||||||
|
if (!$orderDb){
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 2,
|
||||||
|
'errmsg' => "Order does not exist",
|
||||||
|
));
|
||||||
|
die ;
|
||||||
|
}
|
||||||
|
if ($orderDb['status'] == 1){
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 1,
|
||||||
|
'errmsg' => "Order shipped",
|
||||||
|
));
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
// 修改订单状态
|
||||||
|
$this->_updateOrderState($address,$orderId);
|
||||||
|
|
||||||
|
// 小胡 回调的处理
|
||||||
|
if ($this->_isVirtualItem($orderDb['item_id'])){
|
||||||
|
$passCbService = new BuyPassCbService();
|
||||||
|
$passCbService->process($orderDb);
|
||||||
|
} else {
|
||||||
|
// 老宋 处理...
|
||||||
|
$shopGoodsCbService = new BuyShopGoodsCbService();
|
||||||
|
$shopGoodsCbService->process($orderDb);
|
||||||
|
|
||||||
|
}
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 0,
|
||||||
|
'errmsg' => "callback success",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _isVirtualItem($itemId){
|
||||||
|
return in_array($itemId, array(
|
||||||
|
V_ITEM_EXP,
|
||||||
|
V_ITEM_PASS,
|
||||||
|
V_ITEM_RESET_CARD,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _updateOrderState($address,$transId){
|
||||||
|
SqlHelper::update
|
||||||
|
(myself()->_getMysql($address),
|
||||||
|
't_bc_order',
|
||||||
|
array(
|
||||||
|
'order_id' => $transId
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'status' => 1,
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user