...
This commit is contained in:
parent
16e7aa8c2c
commit
8f06131b7a
@ -28,6 +28,7 @@ require_once('services/BlockChainService.php');
|
|||||||
require_once('phpcommon/bignumber.php');
|
require_once('phpcommon/bignumber.php');
|
||||||
|
|
||||||
require_once('services/LogService.php');
|
require_once('services/LogService.php');
|
||||||
|
require_once('ShopAddItemService.php');
|
||||||
|
|
||||||
// use phpcommon;
|
// use phpcommon;
|
||||||
use phpcommon\HttpClient;
|
use phpcommon\HttpClient;
|
||||||
@ -47,6 +48,7 @@ use mt\ShopChest;
|
|||||||
use models\Transaction;
|
use models\Transaction;
|
||||||
use models\BcOrder;
|
use models\BcOrder;
|
||||||
use services\LogService;
|
use services\LogService;
|
||||||
|
use services\ShopAddItemService;
|
||||||
|
|
||||||
if (!function_exists('array_column')) {
|
if (!function_exists('array_column')) {
|
||||||
function array_column($arr2, $column_key)
|
function array_column($arr2, $column_key)
|
||||||
@ -366,11 +368,63 @@ class ShopController extends BaseAuthedController
|
|||||||
// 2. 站外充值钻石,没有订单号
|
// 2. 站外充值钻石,没有订单号
|
||||||
// 3. appstore 退款,没有订单号
|
// 3. appstore 退款,没有订单号
|
||||||
|
|
||||||
|
$order_id = getReqVal('order_id', '');
|
||||||
|
|
||||||
error_log('----- inappPurchaseDiamonds -----');
|
error_log('----- inappPurchaseDiamonds -----');
|
||||||
|
|
||||||
|
$conn = myself()->_getMysql('');
|
||||||
|
|
||||||
|
$order = SqlHelper::selectOne($conn, 't_shop_buy_order', array('address', 'id', 'item_id', 'goods_num', 'status'), array('idx' => $order_id));
|
||||||
|
|
||||||
|
$buyStatus = 1;
|
||||||
|
|
||||||
|
SqlHelper::update($conn, 't_shop_buy_order', array('idx' => $order_id), array('status' => $buyStatus));
|
||||||
|
|
||||||
|
$id = $order['id'];
|
||||||
|
$goods = mt\ShopGoods::get($id);
|
||||||
|
// 这里命名混乱了, 购买个数,一捆个数命名冲突
|
||||||
|
$goods_num = $order['goods_num'];
|
||||||
|
$bundle_size = $goods['goods_num'];
|
||||||
|
$item_num = $goods_num * $bundle_size;
|
||||||
|
$item_id = $goods['goods_id'];
|
||||||
|
$address = $order['address'];
|
||||||
|
|
||||||
|
if ($item_id == V_ITEM_DIAMOND) {
|
||||||
|
$event = [
|
||||||
|
'name' => LogService::RECHARGE_DIAMOND,
|
||||||
|
'val' => $item_num
|
||||||
|
];
|
||||||
|
LogService::productDiamond($event);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_addGoods($address, array(
|
||||||
|
'goods_id' => $item_id,
|
||||||
|
'goods_num' => $item_num,
|
||||||
|
'id' => $id,
|
||||||
|
));
|
||||||
|
|
||||||
$this->_rspOk();
|
$this->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _addGoods($address, $goods)
|
||||||
|
{
|
||||||
|
$itemService = new ShopAddItemService();
|
||||||
|
$item_id = $goods['goods_id'];
|
||||||
|
$goods_num = $goods['goods_num'];
|
||||||
|
|
||||||
|
$id = null;
|
||||||
|
if ($goods['id']) {
|
||||||
|
$id = $goods['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
error_log(json_encode($goods));
|
||||||
|
error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id);
|
||||||
|
$itemService->addItem($address, $item_id, $goods_num);
|
||||||
|
if ($id) {
|
||||||
|
ShopBuyRecord::addWithAddress($address, $id, $goods_num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getPayMethods()
|
public function getPayMethods()
|
||||||
{
|
{
|
||||||
$token_type = getReqVal('token_type', 99);
|
$token_type = getReqVal('token_type', 99);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user