添加回调的日志
This commit is contained in:
parent
4c16ed0904
commit
32ebc4bde5
@ -4,6 +4,7 @@
|
|||||||
namespace services;
|
namespace services;
|
||||||
|
|
||||||
require_once('mt/BattlePass.php');
|
require_once('mt/BattlePass.php');
|
||||||
|
require_once ('services/callback/ShopAddItemService.php');
|
||||||
|
|
||||||
use mt\BattlePass;
|
use mt\BattlePass;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
@ -11,16 +12,46 @@ use phpcommon\SqlHelper;
|
|||||||
class BuyPassCbService
|
class BuyPassCbService
|
||||||
{
|
{
|
||||||
public function process($order){
|
public function process($order){
|
||||||
|
$itemService = new ShopAddItemService();
|
||||||
switch ($order['item_id']){
|
switch ($order['item_id']){
|
||||||
//购买通行证回调
|
//购买通行证回调
|
||||||
case V_ITEM_PASS : {
|
case V_ITEM_PASS : {
|
||||||
|
$itemService->addGameLog($order['address'],"buyItem","begin",array(
|
||||||
|
'param1' => $order['order_id'],
|
||||||
|
'param2' => json_encode(array(
|
||||||
|
'item_id' => $order['item_id'],
|
||||||
|
'item_num' => $order['item_num'],
|
||||||
|
)),
|
||||||
|
));
|
||||||
$this->_activateUser($order['address']);
|
$this->_activateUser($order['address']);
|
||||||
|
error_log("callback buyBattlePass address: {$order['address']}, order_id: {$order['order_id']}, item_id: {$order['item_id']}, item_num: {$order['item_num']}");
|
||||||
|
$itemService->addGameLog($order['address'],"buyItem","end",array(
|
||||||
|
'param1' => $order['order_id'],
|
||||||
|
'param2' => json_encode(array(
|
||||||
|
'item_id' => $order['item_id'],
|
||||||
|
'item_num' => $order['item_num'],
|
||||||
|
)),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//购买等级回调
|
//购买等级回调
|
||||||
case V_ITEM_EXP : {
|
case V_ITEM_EXP : {
|
||||||
|
$itemService->addGameLog($order['address'],"buyItem","begin",array(
|
||||||
|
'param1' => $order['order_id'],
|
||||||
|
'param2' => json_encode(array(
|
||||||
|
'item_id' => $order['item_id'],
|
||||||
|
'item_num' => $order['item_num'],
|
||||||
|
)),
|
||||||
|
));
|
||||||
$this->_updateUserLevel($order['address'],$order['item_num']);
|
$this->_updateUserLevel($order['address'],$order['item_num']);
|
||||||
|
error_log("callback buyPassExp address: {$order['address']}, order_id: {$order['order_id']}, item_id: {$order['item_id']}, item_num: {$order['item_num']}");
|
||||||
|
$itemService->addGameLog($order['address'],"buyItem","end",array(
|
||||||
|
'param1' => $order['order_id'],
|
||||||
|
'param2' => json_encode(array(
|
||||||
|
'item_id' => $order['item_id'],
|
||||||
|
'item_num' => $order['item_num'],
|
||||||
|
)),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
default : {
|
default : {
|
||||||
|
|
||||||
|
@ -22,21 +22,37 @@ class GameItemMallBuyOk {
|
|||||||
'order_id' => $orderId
|
'order_id' => $orderId
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
//1:已发货 2:订单不存在
|
||||||
|
if (!$orderDb){
|
||||||
|
return json_encode(array(
|
||||||
|
'errcode' => 2,
|
||||||
|
'errmsg' => "Order does not exist",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if ($orderDb['status'] == 1){
|
||||||
|
return json_encode(array(
|
||||||
|
'errcode' => 1,
|
||||||
|
'errmsg' => "Order shipped",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改订单状态
|
||||||
|
$this->_updateOrderState($address,$orderId);
|
||||||
|
|
||||||
// 小胡 回调的处理
|
// 小胡 回调的处理
|
||||||
if ($this->_isVirtualItem($orderDb['item_id'])){
|
if ($this->_isVirtualItem($orderDb['item_id'])){
|
||||||
$passCbService = new BuyPassCbService();
|
$passCbService = new BuyPassCbService();
|
||||||
$passCbService->process($orderDb);
|
$passCbService->process($orderDb);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 老宋 处理...
|
// 老宋 处理...
|
||||||
$shopGoodsCbService = new BuyShopGoodsCbService();
|
$shopGoodsCbService = new BuyShopGoodsCbService();
|
||||||
$shopGoodsCbService->process($orderDb);
|
$shopGoodsCbService->process($orderDb);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return json_encode(array(
|
||||||
// 修改订单状态
|
'errcode' => 0,
|
||||||
$this->_updateOrderState($address,$orderId);
|
'errmsg' => "callback success",
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _isVirtualItem($itemId){
|
private function _isVirtualItem($itemId){
|
||||||
|
@ -10,6 +10,25 @@ use phpcommon\SqlHelper;
|
|||||||
use mt;
|
use mt;
|
||||||
class ShopAddItemService
|
class ShopAddItemService
|
||||||
{
|
{
|
||||||
|
public function addGameLog($address,$type, $subtype, $params){
|
||||||
|
$accountId = $this->getAccountId($address);
|
||||||
|
$conn = myself()->_getMysql($address);
|
||||||
|
SqlHelper::insert(
|
||||||
|
$conn,
|
||||||
|
't_game_log',
|
||||||
|
array(
|
||||||
|
'account_id' => $accountId,
|
||||||
|
'type' => $type,
|
||||||
|
'subtype' => $subtype,
|
||||||
|
'param1' => getXVal($params, 'param1', ''),
|
||||||
|
'param2' => getXVal($params, 'param2', ''),
|
||||||
|
'param3' => getXVal($params, 'param3', ''),
|
||||||
|
'param4' => getXVal($params, 'param4', ''),
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function addItem($address,$itemId,$itemNum){
|
public function addItem($address,$itemId,$itemNum){
|
||||||
if ($itemNum < 1){
|
if ($itemNum < 1){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user