From 625a2335b4a512726250a649ff9196d776db9304 Mon Sep 17 00:00:00 2001 From: yangduo Date: Tue, 14 Jan 2025 14:56:28 +0800 Subject: [PATCH] fix --- .../controller/RechargeController.class.php | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/webapp/controller/RechargeController.class.php b/webapp/controller/RechargeController.class.php index 34a3022..f14f442 100644 --- a/webapp/controller/RechargeController.class.php +++ b/webapp/controller/RechargeController.class.php @@ -339,10 +339,10 @@ class RechargeController 'orderid' => $_REQUEST['orderid'], 'amount' => $_REQUEST['amount'], ); - $oristr = 'account_id='.$_REQUEST['account_id'].'&goodsid='.$_REQUEST['goodsid'].'&orderid='.$_REQUEST['orderid'].'&amount='.$_REQUEST['amount'].':'.$_REQUEST['timestamp'].'NrN3zkVOzXF1vRzUc9eJM9ZKRO5eLooD'; + $oristr = 'account_id=' . $_REQUEST['account_id'] . '&goodsid=' . $_REQUEST['goodsid'] . '&orderid=' . $_REQUEST['orderid'] . '&amount=' . $_REQUEST['amount'] . ':' . $_REQUEST['timestamp'] . 'NrN3zkVOzXF1vRzUc9eJM9ZKRO5eLooD'; // $sign = phpcommon\md5Sign($params, 'NrN3zkVOzXF1vRzUc9eJM9ZKRO5eLooD', $_REQUEST['timestamp']); $sign = md5($oristr); - error_log('src:'.$oristr.'|'.$sign.'|'.$_REQUEST['sign']); + error_log('src:' . $oristr . '|' . $sign . '|' . $_REQUEST['sign']); if ($sign != $_REQUEST['sign']) { error_log('game2004api payNotify sign error:' + $sign + '|' + json_encode($_REQUEST)); echo json_encode(array( @@ -494,11 +494,37 @@ class RechargeController ); } } else { - $item_list = $addreward->addReward($shopgoods['item_id'], 1, $_REQUEST['account_id'], 0, 0); - - foreach ($item_list as &$value) { - $value['itemnum'] = (float)$value['itemnum']; + $itemconf = metatable\getItemById($shopgoods['item_id']); + if (!$itemconf) { + error_log('game2004api purchaseNotify daily goods config error:' . json_encode($_REQUEST)); + echo json_encode(array( + 'errcode' => 4, + 'errmsg' => 'privilege card error 2' + )); + die(); } + + $dropconf = $this->getDrop($itemconf['fuctionindex']); + if (!$dropconf) { + error_log('game2004api purchaseNotify daily goods config error 1:' . json_encode($_REQUEST)); + echo json_encode(array( + 'errcode' => 4, + 'errmsg' => 'privilege card error 3' + )); + die(); + } + $itemidlist = explode('|', $dropconf['item_id']); + $itemnumlist = explode('|', $dropconf['item_num']); + $item_list = array(); + foreach ($itemidlist as $key => $itemid) { + array_push($item_list, array( + 'item_id' => $itemid, + 'item_num' => $itemnumlist[$key], + 'time' => 0, + )); + $addreward->addReward($itemid, $itemnumlist[$key], $account_id, 0, 0); + } + error_log(json_encode($item_list)); //update daily purchase @@ -840,7 +866,7 @@ class RechargeController $itemnumlist = explode('|', $dropconf['num']); $addreward = new classes\AddReward(); $all_item_list = array(); - foreach ($itemidlist as $index => $itemid) { + foreach ($itemidlist as $key => $itemid) { array_push($item_list, array( 'item_id' => $itemid, 'item_num' => $itemnumlist[$key],