From c2193ab3a210a118d38f5cefa17900b42f90623a Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 13:53:00 +0800 Subject: [PATCH 1/7] ... --- webapp/controller/ShopController.class.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 54ff9a3d..da8260bc 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -844,10 +844,10 @@ class ShopController extends BaseAuthedController public function buyGoodsNormal() { $address = $this->_getAddress(); - // if (empty($address)) { - // $this->_rspErr(4, 'address is empty'); - // return; - // } + if (empty($address)) { + $this->_rspErr(4, 'address is empty'); + return; + } $id = getReqVal('id', 0); $token_type = getReqVal('token_type', ''); $goods_num = getReqVal('goods_num', 0); @@ -1170,14 +1170,23 @@ class ShopController extends BaseAuthedController public function buyGoodsDS() { $idx = getReqVal('idx', 0); - $grid = getReqVal('grid', 0); - $count = getReqVal('count', 0); + if ($idx <= 0) { + $this->_rspErr(2, 'idx is invalid'); + return; + } + $grid = getReqVal('grid', 0); if ($grid < 1 || $grid > 6) { $this->_rspErr(2, 'grid is invalid'); return; } + $count = getReqVal('count', 0); + if ($count<=0) { + $this->_rspErr(2, 'count is invalid'); + return; + } + $conn = $this->_getMysql(''); $row = SqlHelper::selectOne( From 2b6efb53c5b7bb0f0f08f7fc3dc73df277ef08b0 Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 14:03:45 +0800 Subject: [PATCH 2/7] ... --- webapp/controller/ShopController.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index da8260bc..2a4cac58 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -1857,10 +1857,10 @@ class ShopController extends BaseAuthedController } $propertyChgService = new services\PropertyChgService(); if ($item['item_type'] == 2) { - $this->internalAddItem($propertyChgService, $itemMeta, $item['num'], 1, $grade); + $this->internalAddItem($propertyChgService, $itemMeta, $item['num'], 0, $grade); } else { for ($j = 0; $j < $item['num']; $j++) { - $this->internalAddItem($propertyChgService, $itemMeta, 1, 1, $grade); + $this->internalAddItem($propertyChgService, $itemMeta, 1, 0, $grade); } } $record[$key] = array("item_id" => $item['item_id'], "item_num" => $item['num']); From d6e65e6bf773f37bbc765dd836b912239e0f6edf Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 14:04:04 +0800 Subject: [PATCH 3/7] ... --- webapp/controller/ShopController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 2a4cac58..58cee966 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -1658,7 +1658,7 @@ class ShopController extends BaseAuthedController $propertyChgService->addUserChg(); // 充值就尝试开启首充活动 if ($sysAdd != 1) { - if ($itemMeta['id'] == 10001) { + if ($itemMeta['id'] == V_ITEM_DIAMOND) { $this->beginFirstTupop(); } } From 6d18fdb644b2512243d65e52fdf4c56a59794b3f Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 14:10:29 +0800 Subject: [PATCH 4/7] ... --- webapp/controller/ShopController.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 58cee966..cb3e8bcc 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -407,6 +407,7 @@ class ShopController extends BaseAuthedController 'val' => $item_num ]; LogService::productDiamond(['account_id' => $account_id], $event); + $this->beginFirstTupop($address); } error_log("buyGoodsDirect---" . $address . "---" . $item_id . "---" . $item_num); @@ -1711,15 +1712,18 @@ class ShopController extends BaseAuthedController return true; } - private function beginFirstTupop() + private function beginFirstTupop($address) { + if (!$address) { + $address = myself()->_getAddress(); + } $conn = myself()->_getMysql(''); $exist = SqlHelper::selectOne( $conn, 't_first_topup', array('address'), - array('address' => myself()->_getAddress()) + array('address' => $address) ); if ($exist) { return; @@ -1730,7 +1734,7 @@ class ShopController extends BaseAuthedController $conn, 't_first_topup', array( - 'address' => myself()->_getAddress(), + 'address' => $address, 'createtime' => myself()->_getNowTime(), 'status1' => 0, 'status2' => 0, From 9320e2bb2baaa145ab64586152f88e4cd077bad4 Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 14:18:48 +0800 Subject: [PATCH 5/7] ... --- webapp/controller/ShopController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index cb3e8bcc..55396dde 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -1712,7 +1712,7 @@ class ShopController extends BaseAuthedController return true; } - private function beginFirstTupop($address) + private function beginFirstTupop($address = null) { if (!$address) { $address = myself()->_getAddress(); From 71647e981f94bfa160542f1df09a61b276cc2527 Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 14:33:30 +0800 Subject: [PATCH 6/7] ... --- webapp/controller/ShopController.class.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 55396dde..a694a459 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -365,6 +365,7 @@ class ShopController extends BaseAuthedController $id = $order['id']; $goods_num = $order['goods_num']; $o_status = $order['status']; + $address = $order['address']; if ($o_status != 0) { $this->_rspErr(1, "order status error, status: {$o_status}"); @@ -375,6 +376,8 @@ class ShopController extends BaseAuthedController switch ($status) { case "9": $buyStatus = 1; + // 充值成功,开始首充奖励 + $this->beginFirstTupop($address); break; case "99": case "98": @@ -398,7 +401,7 @@ class ShopController extends BaseAuthedController $meta = mt\Item::get($item_id); error_log("buyGoodsDirect---" . $item_id . "---" . $item_num . "---" . $bundle_size . "---" . $meta['name']); if ($meta && $item_num > 0) { - $address = $order['address']; + // $address = $order['address']; $account_id = $this->getAccountId($address); if ($item_id == V_ITEM_DIAMOND) { @@ -407,7 +410,6 @@ class ShopController extends BaseAuthedController 'val' => $item_num ]; LogService::productDiamond(['account_id' => $account_id], $event); - $this->beginFirstTupop($address); } error_log("buyGoodsDirect---" . $address . "---" . $item_id . "---" . $item_num); @@ -1133,6 +1135,15 @@ class ShopController extends BaseAuthedController public function buyDiamond() { $num = getReqVal('num', 0); + if (!is_numeric($num)) { + $this->_rspErr(1, "num is invalid, {$num}"); + return; + } + if ($num <= 0) { + $this->_rspErr(1, "num is invalid, {$num}"); + return; + } + $price = $this->normalizeWeb3Price($num); $item_id = V_ITEM_DIAMOND; $item_count = $num; From 65bca5d375fee1e0a986a28b020a2ce65f2f7d8d Mon Sep 17 00:00:00 2001 From: songliang Date: Sun, 16 Jul 2023 14:35:02 +0800 Subject: [PATCH 7/7] ... --- webapp/controller/ShopController.class.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index a694a459..7c717980 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -1668,12 +1668,6 @@ class ShopController extends BaseAuthedController if ($this->_isVirtualItem($itemMeta['id'])) { $this->_addVirtualItem($itemMeta['id'], $count, null, $propertyChgService); $propertyChgService->addUserChg(); - // 充值就尝试开启首充活动 - if ($sysAdd != 1) { - if ($itemMeta['id'] == V_ITEM_DIAMOND) { - $this->beginFirstTupop(); - } - } } else { Bag::addItem($itemMeta['id'], $count); $propertyChgService->addBagChg();