From 472046c2b055b2c1c6d6572c57c80feb17d17fd3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 24 Mar 2020 13:42:37 +0800 Subject: [PATCH] 1 --- webapp/classes/AddReward.php | 9 +++++---- webapp/controller/BagController.class.php | 2 +- webapp/controller/ShopController.class.php | 7 +++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index 0238c18..62e3be0 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -204,11 +204,12 @@ class AddReward { $this->addDiamond($item_id, $item_num, $accountid); } else { $nowTime = $row['active_time']; - if ($row['active_time'] < time() + $time * 3600) { - $nowTime = time() + $time * 3600; + if ($time == 0) { + $nowTime = 0; + $status = 1; } else { - if ($time == 0) { - $nowTime = 0; + if ($row['active_time'] < time() + $time * 3600) { + $nowTime = time() + $time * 3600; } } $ret = $conn->execScript('UPDATE bag SET active_time=:active_time, status=:status, modify_time=:modify_time ' . diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index c7e0366..2c966a0 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -110,7 +110,7 @@ class BagController{ )); } } else { - $ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time) ' . + $ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time) ' . ' VALUES(:account_id, :id, 0, :status, :active_time, :create_time, :modify_time) ' . ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, active_time=:active_time, modify_time=:modify_time;', array( diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 6791efa..3083d39 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -165,6 +165,7 @@ class ShopController{ public function buyItem() { + error_log(11111111111); $account_id = $_REQUEST['account_id']; //登录校验 $login = loginVerify($account_id, $_REQUEST['session_id']); @@ -177,6 +178,8 @@ class ShopController{ return; } $shop_uuid = $_REQUEST['shop_uuid']; + error_log($shop_uuid); + error_log($shop_id); $item_id = 0; $item_num = 0; $price = 0; @@ -225,6 +228,10 @@ class ShopController{ $r->set($shop_uuid, json_encode($user_db)); $r -> pexpire($shop_uuid, 1000 * 3600 * 24); //增加奖励 + error_log(2222222222222222); + error_log($item_id); + error_log($item_num); + error_log($time); $addreward = new classes\AddReward(); $all_item_list = $addreward->addReward($item_id, $item_num, $account_id, $time); $coin_num = $addreward->getCoinNum($account_id);