...
This commit is contained in:
parent
59695d2738
commit
a33db90313
@ -1298,6 +1298,7 @@ CREATE TABLE `t_web2_order` (
|
||||
DROP TABLE IF EXISTS `t_market_store`;
|
||||
CREATE TABLE `t_market_store` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`order_id` bigint(20) NOT NULL COMMENT '订单id',
|
||||
`o_link` varchar(64) DEFAULT NULL COMMENT '关联的链上上架单号',
|
||||
`status` int(11) NOT NULL COMMENT '订单状态 0:出售中 1:已下架 2:已售出 3:购买中',
|
||||
`owner_address` varchar(60) NOT NULL COMMENT '当前拥有者',
|
||||
@ -1331,7 +1332,8 @@ CREATE TABLE `t_market_store` (
|
||||
KEY `c_lv` (`c_lv`),
|
||||
KEY `c_quality` (`c_quality`),
|
||||
KEY `c_durability` (`c_durability`),
|
||||
KEY `c_id` (`c_id`)
|
||||
KEY `c_id` (`c_id`),
|
||||
KEY `order_id` (`order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10014 DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_market_transaction_record`;
|
||||
|
@ -2,6 +2,7 @@ begin;
|
||||
|
||||
CREATE TABLE `t_market_store` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`order_id` bigint(20) NOT NULL COMMENT '订单id',
|
||||
`o_link` varchar(64) DEFAULT NULL COMMENT '关联的链上上架单号',
|
||||
`status` int(11) NOT NULL COMMENT '订单状态 0:出售中 1:已下架 2:已售出 3:购买中',
|
||||
`owner_address` varchar(60) NOT NULL COMMENT '当前拥有者',
|
||||
@ -35,7 +36,8 @@ CREATE TABLE `t_market_store` (
|
||||
KEY `c_lv` (`c_lv`),
|
||||
KEY `c_quality` (`c_quality`),
|
||||
KEY `c_durability` (`c_durability`),
|
||||
KEY `c_id` (`c_id`)
|
||||
KEY `c_id` (`c_id`),
|
||||
KEY `order_id` (`order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10014 DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `t_market_transaction_record` (
|
||||
|
@ -45,6 +45,7 @@ use mt\Shop;
|
||||
use mt\PayMethod;
|
||||
use mt\Dailyselection;
|
||||
use mt\ShopChest;
|
||||
use mt\ShopGoods;
|
||||
use models\Transaction;
|
||||
use models\BcOrder;
|
||||
use services\LogService;
|
||||
@ -219,8 +220,8 @@ class ShopController extends BaseAuthedController
|
||||
return;
|
||||
}
|
||||
|
||||
$goods_str = json_encode($goods);
|
||||
error_log("address: {$address}, id: {$id}, token_type: {$token_type}, goods_num: {$goods_num} goods_str: {$goods_str}");
|
||||
// $goods_str = json_encode($goods);
|
||||
// error_log("address: {$address}, id: {$id}, token_type: {$token_type}, goods_num: {$goods_num} goods_str: {$goods_str}");
|
||||
|
||||
$chk = SqlHelper::insert(
|
||||
$conn,
|
||||
@ -324,9 +325,9 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
$conn = myself()->_getMysql('');
|
||||
|
||||
$order = SqlHelper::selectOne($conn, 't_shop_buy_order', array('address', 'item_id', 'goods_num', 'status'), array('idx' => $order_id));
|
||||
$order = SqlHelper::selectOne($conn, 't_shop_buy_order', array('address', 'id', 'item_id', 'goods_num', 'status'), array('idx' => $order_id));
|
||||
|
||||
$id = $order['item_id'];
|
||||
$id = $order['id'];
|
||||
$goods_num = $order['goods_num'];
|
||||
$o_status = $order['status'];
|
||||
|
||||
@ -348,29 +349,32 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
SqlHelper::update($conn, 't_shop_buy_order', array('idx' => $order_id), array('status' => $buyStatus));
|
||||
|
||||
// 以下是看商品表中是否配置了充值额外奖励
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
// 这里命名混乱了, 购买个数,一捆个数命名冲突
|
||||
$goods_num = $order['goods_num'];
|
||||
$bundle_size = $goods['bonus_num'];
|
||||
$bundle_size = $goods['bonus_num'] ? $goods['bonus_num'] : 0;
|
||||
$item_num = $goods_num * $bundle_size;
|
||||
$item_id = $goods['bonus'];
|
||||
$address = $order['address'];
|
||||
$account_id = $this->getAccountId($address);
|
||||
$meta = mt\Item::get($item_id);
|
||||
if ($meta && $item_num > 0) {
|
||||
$address = $order['address'];
|
||||
$account_id = $this->getAccountId($address);
|
||||
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
'name' => LogService::RECHARGE_CEBG_BONUS,
|
||||
'val' => $item_num
|
||||
];
|
||||
LogService::productDiamond(['account_id' => $account_id], $event);
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
'name' => LogService::RECHARGE_CEBG_BONUS,
|
||||
'val' => $item_num
|
||||
];
|
||||
LogService::productDiamond(['account_id' => $account_id], $event);
|
||||
}
|
||||
|
||||
$this->_addGoods($address, array(
|
||||
'goods_id' => $item_id,
|
||||
'goods_num' => $item_num,
|
||||
'id' => $id,
|
||||
));
|
||||
}
|
||||
|
||||
$this->_addGoods($address, array(
|
||||
'goods_id' => $item_id,
|
||||
'goods_num' => $item_num,
|
||||
'id' => $id,
|
||||
));
|
||||
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
@ -397,6 +401,10 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
$account_id = $self->_getAccountId();
|
||||
$address = $self->_getAddress();
|
||||
if (empty($address)) {
|
||||
$this->_rspErr(4, "start purchase failed");
|
||||
return;
|
||||
}
|
||||
|
||||
$item_id = $goods['goods_id'];
|
||||
$item_num = $goods['goods_num'] * $goods_num;
|
||||
@ -416,7 +424,7 @@ class ShopController extends BaseAuthedController
|
||||
));
|
||||
|
||||
if (!$chk) {
|
||||
$this->_rspErr(4, "start purchase failed");
|
||||
$this->_rspErr(5, "start purchase failed");
|
||||
return;
|
||||
}
|
||||
$lastId = $this->lastInsertId($conn);
|
||||
@ -424,7 +432,7 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
$test = SqlHelper::update($conn, 't_web2_order', array('idx' => $lastId), array('order_id' => $order_id));
|
||||
if (!$test) {
|
||||
$this->_rspErr(5, "start purchase failed");
|
||||
$this->_rspErr(6, "start purchase failed");
|
||||
return;
|
||||
}
|
||||
$this->_rspData(array(
|
||||
@ -432,7 +440,8 @@ class ShopController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
private function genOrderId($id) {
|
||||
private function genOrderId($id)
|
||||
{
|
||||
$order_id_base = date('YmdHis') . "10000000";
|
||||
$divIdx = gmp_mod($id, 9999999);
|
||||
$order_id = phpcommon\bnAdd_s($order_id_base, $divIdx);
|
||||
@ -453,6 +462,7 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
public function inappPurchaseDiamonds()
|
||||
{
|
||||
error_log('ShopInappPurchaseDiamonds:' . json_encode($_REQUEST, JSON_PRETTY_PRINT));
|
||||
error_log('----- inappPurchaseDiamonds -----');
|
||||
$body = json_decode(file_get_contents('php://input'), true);
|
||||
error_log('body:' . json_encode($body));
|
||||
@ -542,14 +552,22 @@ class ShopController extends BaseAuthedController
|
||||
SqlHelper::update($conn, 't_web2_order', array('order_id' => $order_id), array('status' => $status, 'channel' => $channel, 'out_order_id' => $out_order_id));
|
||||
|
||||
$id = $order['id'];
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
$goods = 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 (empty($address)) {
|
||||
$this->_rspErr(4, "address is empty");
|
||||
return;
|
||||
}
|
||||
$account_id = $this->getAccountId($address);
|
||||
if (empty($account_id)) {
|
||||
$this->_rspErr(5, "account_id is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
@ -586,14 +604,22 @@ class ShopController extends BaseAuthedController
|
||||
SqlHelper::update($conn, 't_web2_order', array('order_id' => $order_id), array('status' => $status));
|
||||
|
||||
$id = $order['id'];
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
$goods = 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 (empty($address)) {
|
||||
$this->_rspErr(4, "address is empty");
|
||||
return;
|
||||
}
|
||||
$account_id = $this->getAccountId($address);
|
||||
if (empty($account_id)) {
|
||||
$this->_rspErr(5, "account_id is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
@ -1819,7 +1845,7 @@ class ShopController extends BaseAuthedController
|
||||
if (empty($grade)) {
|
||||
$grade = 0;
|
||||
}
|
||||
switch($grade) {
|
||||
switch ($grade) {
|
||||
case 1: {
|
||||
Hero::addHero1($itemMeta);
|
||||
}
|
||||
|
@ -2,87 +2,104 @@
|
||||
|
||||
namespace services;
|
||||
|
||||
require_once("mt/ShopGoods.php");
|
||||
require_once("mt/Item.php");
|
||||
require_once("models/ShopBuyRecord.php");
|
||||
require_once("services/LogService.php");
|
||||
require_once("ShopAddItemService.php");
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
use mt\ShopGoods;
|
||||
use mt\Item;
|
||||
use models\ShopBuyRecord;
|
||||
|
||||
use services\LogService;
|
||||
|
||||
class ShopBuyGoodsDirect
|
||||
{
|
||||
public function process()
|
||||
{
|
||||
error_log('ShopBuyGoodsDirect:' . json_encode($_REQUEST, JSON_PRETTY_PRINT));
|
||||
// let repdata = {
|
||||
// account_id: string
|
||||
// order_id: string
|
||||
// status: string
|
||||
// id: string
|
||||
// txhash: string
|
||||
// }
|
||||
// 我返回给你这些数据和一个sign字段,
|
||||
// sign使用上面 repdata 按key 顺序排后, 组成key1=val1&key2=val2后, 使用hmac_sha256 hash, key是 iG4Rpsa)6U31$H#^T85$^^3
|
||||
// PENDING = 0, // 初始状态
|
||||
// TRANSFERING = 1, //只有国库模式才会有该状态
|
||||
// TRANSFERED = 2, //只有国库模式才会有该状态
|
||||
// SUCCESS = 9, // 成功的最终状态
|
||||
// TRANSFER_FAIL = 98, // 转账错误
|
||||
// FAIL = 99, // 也是错误
|
||||
//
|
||||
error_log("buyGoodsDirect --- " . json_encode($_REQUEST));
|
||||
|
||||
$account_id = getReqVal('account_id', '');
|
||||
$order_id = getReqVal('order_id', '');
|
||||
$status = getReqVal('status', '');
|
||||
$id = getReqVal('id', '');
|
||||
$txhash = getReqVal('txhash', '');
|
||||
// let repdata = {
|
||||
// account_id: string
|
||||
// order_id: string
|
||||
// status: string
|
||||
// id: string
|
||||
// txhash: string
|
||||
// }
|
||||
// 我返回给你这些数据和一个sign字段,
|
||||
// sign使用上面 repdata 按key 顺序排后, 组成key1=val1&key2=val2后, 使用hmac_sha256 hash, key是 iG4Rpsa)6U31$H#^T85$^^3
|
||||
// PENDING = 0, // 初始状态
|
||||
// TRANSFERING = 1, //只有国库模式才会有该状态
|
||||
// TRANSFERED = 2, //只有国库模式才会有该状态
|
||||
// SUCCESS = 9, // 成功的最终状态
|
||||
// TRANSFER_FAIL = 98, // 转账错误
|
||||
// FAIL = 99, // 也是错误
|
||||
//
|
||||
|
||||
$sign = getReqVal('sign', '');
|
||||
$account_id = getReqVal('account_id', '');
|
||||
$order_id = getReqVal('order_id', '');
|
||||
$status = getReqVal('status', '');
|
||||
$id = getReqVal('id', '');
|
||||
$txhash = getReqVal('txhash', '');
|
||||
|
||||
$data = array(
|
||||
'account_id' => $account_id,
|
||||
'id' => $id,
|
||||
'order_id' => $order_id,
|
||||
'status' => $status,
|
||||
'txhash' => $txhash,
|
||||
);
|
||||
$sign = getReqVal('sign', '');
|
||||
|
||||
$hash_data = http_build_query($data);
|
||||
$data = array(
|
||||
'account_id' => $account_id,
|
||||
'id' => $id,
|
||||
'order_id' => $order_id,
|
||||
'status' => $status,
|
||||
'txhash' => $txhash,
|
||||
);
|
||||
|
||||
$signature = hash_hmac('sha256', $hash_data, 'iG4Rpsa)6U31$H#^T85$^^3');
|
||||
$hash_data = http_build_query($data);
|
||||
|
||||
if ($signature != $sign) {
|
||||
$this->_rspErr(1, "signature error, signature: {$signature}, sign: {$sign}");
|
||||
return;
|
||||
}
|
||||
$signature = hash_hmac('sha256', $hash_data, 'iG4Rpsa)6U31$H#^T85$^^3');
|
||||
|
||||
error_log("buyGoodsDirect-------" . $order_id . "---" . $status);
|
||||
if ($signature != $sign) {
|
||||
$this->_rspErr(1, "signature error, signature: {$signature}, sign: {$sign}");
|
||||
return;
|
||||
}
|
||||
|
||||
$conn = myself()->_getMysql('');
|
||||
error_log("buyGoodsDirect-------" . $order_id . "---" . $status);
|
||||
|
||||
$order = SqlHelper::selectOne($conn, 't_shop_buy_order', array('address', 'item_id', 'goods_num', 'status'), array('idx' => $order_id));
|
||||
$conn = myself()->_getMysql('');
|
||||
|
||||
$id = $order['item_id'];
|
||||
$goods_num = $order['goods_num'];
|
||||
$o_status = $order['status'];
|
||||
$order = SqlHelper::selectOne($conn, 't_shop_buy_order', array('address', 'id', 'item_id', 'goods_num', 'status'), array('idx' => $order_id));
|
||||
|
||||
if ($o_status != 0) {
|
||||
$this->_rspErr(1, "order status error, status: {$o_status}");
|
||||
return;
|
||||
}
|
||||
$id = $order['id'];
|
||||
$goods_num = $order['goods_num'];
|
||||
$o_status = $order['status'];
|
||||
|
||||
$buyStatus = 0; // 1: 成功, 2: 失败
|
||||
switch ($status) {
|
||||
case "9":
|
||||
$buyStatus = 1;
|
||||
break;
|
||||
case "99":
|
||||
case "98":
|
||||
$buyStatus = 2;
|
||||
break;
|
||||
}
|
||||
if ($o_status != 0) {
|
||||
$this->_rspErr(1, "order status error, status: {$o_status}");
|
||||
return;
|
||||
}
|
||||
|
||||
SqlHelper::update($conn, 't_shop_buy_order', array('idx' => $order_id), array('status' => $buyStatus));
|
||||
$buyStatus = 0; // 1: 成功, 2: 失败
|
||||
switch ($status) {
|
||||
case "9":
|
||||
$buyStatus = 1;
|
||||
break;
|
||||
case "99":
|
||||
case "98":
|
||||
$buyStatus = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
// 这里命名混乱了, 购买个数,一捆个数命名冲突
|
||||
$goods_num = $order['goods_num'];
|
||||
$bundle_size = $goods['bonus_num'];
|
||||
$item_num = $goods_num * $bundle_size;
|
||||
$item_id = $goods['bonus'];
|
||||
SqlHelper::update($conn, 't_shop_buy_order', array('idx' => $order_id), array('status' => $buyStatus));
|
||||
|
||||
// 以下是看商品表中是否配置了充值额外奖励
|
||||
$goods = ShopGoods::get($id);
|
||||
$goods_num = $order['goods_num'];
|
||||
$bundle_size = $goods['bonus_num'] ? $goods['bonus_num'] : 0;
|
||||
$item_num = $goods_num * $bundle_size;
|
||||
$item_id = $goods['bonus'];
|
||||
$meta = Item::get($item_id);
|
||||
if ($meta && $item_num > 0) {
|
||||
$address = $order['address'];
|
||||
$account_id = $this->getAccountId($address);
|
||||
|
||||
@ -99,7 +116,58 @@ class ShopBuyGoodsDirect
|
||||
'goods_num' => $item_num,
|
||||
'id' => $id,
|
||||
));
|
||||
}
|
||||
|
||||
$this->_rspOk();
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
private function getAccountId($address)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($address),
|
||||
't_user',
|
||||
array(
|
||||
'address' => $address
|
||||
)
|
||||
);
|
||||
return $row['account_id'];
|
||||
}
|
||||
|
||||
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('_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);
|
||||
}
|
||||
}
|
||||
|
||||
private function _rspOk() {
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => "callback success",
|
||||
));
|
||||
}
|
||||
|
||||
private function _rspErr($errcode, $errmsg) {
|
||||
if (SERVER_ENV != _ONLINE) {
|
||||
error_log(json_encode(array(
|
||||
'errcode' => $errcode,
|
||||
'errmsg' => $errmsg,
|
||||
)));
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => $errcode,
|
||||
'errmsg' => $errmsg,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,17 @@
|
||||
|
||||
namespace services;
|
||||
|
||||
require_once("models/ShopBuyRecord.php");
|
||||
require_once("mt/ShopGoods.php");
|
||||
require_once("services/LogService.php");
|
||||
require_once("ShopAddItemService.php");
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
use mt\ShopGoods;
|
||||
use models\ShopBuyRecord;
|
||||
use services\LogService;
|
||||
|
||||
class ShopInappPurchaseDiamonds
|
||||
{
|
||||
|
||||
@ -97,14 +108,22 @@ class ShopInappPurchaseDiamonds
|
||||
SqlHelper::update($conn, 't_web2_order', array('order_id' => $order_id), array('status' => $status, 'channel' => $channel, 'out_order_id' => $out_order_id));
|
||||
|
||||
$id = $order['id'];
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
$goods = 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 (empty($address)) {
|
||||
$this->_rspErr(4, "address is empty");
|
||||
return;
|
||||
}
|
||||
$account_id = $this->getAccountId($address);
|
||||
if (empty($account_id)) {
|
||||
$this->_rspErr(5, "account_id is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
@ -141,14 +160,22 @@ class ShopInappPurchaseDiamonds
|
||||
SqlHelper::update($conn, 't_web2_order', array('order_id' => $order_id), array('status' => $status));
|
||||
|
||||
$id = $order['id'];
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
$goods = 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 (empty($address)) {
|
||||
$this->_rspErr(4, "address is empty");
|
||||
return;
|
||||
}
|
||||
$account_id = $this->getAccountId($address);
|
||||
if (empty($account_id)) {
|
||||
$this->_rspErr(5, "account_id is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
@ -172,4 +199,64 @@ class ShopInappPurchaseDiamonds
|
||||
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
private function getAccountId($address)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($address),
|
||||
't_user',
|
||||
array(
|
||||
'address' => $address
|
||||
)
|
||||
);
|
||||
return $row['account_id'];
|
||||
}
|
||||
|
||||
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('_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);
|
||||
}
|
||||
}
|
||||
|
||||
private function _decGoods($address, $goods)
|
||||
{
|
||||
$itemService = new ShopAddItemService();
|
||||
$item_id = $goods['goods_id'];
|
||||
$goods_num = $goods['goods_num'];
|
||||
|
||||
error_log('_decGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num);
|
||||
$itemService->decItem($address, $item_id, $goods_num);
|
||||
}
|
||||
|
||||
private function _rspOk() {
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => "callback success",
|
||||
));
|
||||
}
|
||||
|
||||
private function _rspErr($errcode, $errmsg) {
|
||||
if (SERVER_ENV != _ONLINE) {
|
||||
error_log(json_encode(array(
|
||||
'errcode' => $errcode,
|
||||
'errmsg' => $errmsg,
|
||||
)));
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => $errcode,
|
||||
'errmsg' => $errmsg,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user