From 7902c1bd336138a076be217f81ab0a0fe94e8853 Mon Sep 17 00:00:00 2001 From: wangwei01 Date: Fri, 10 May 2019 16:04:22 +0800 Subject: [PATCH] 1 --- webapp/controller/QuestController.class.php | 22 +++++++-------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/webapp/controller/QuestController.class.php b/webapp/controller/QuestController.class.php index 5415b66..2d9aea6 100644 --- a/webapp/controller/QuestController.class.php +++ b/webapp/controller/QuestController.class.php @@ -72,11 +72,10 @@ class QuestController{ return $d; } - protected function insertActive($account_id) + protected function insertActive($account_id, $active_id, $task_num) { $conn = $this->getMysql($account_id); - - for ($i = 73001; $i < 73006; $i++) { + for ($i = $active_id; $i < $active_id + $task_num; $i++) { $ret = $conn->execScript('INSERT INTO quest(accountid, quest_id, quest_type, quest_state) ' . ' VALUES(:accountid, :quest_id, :quest_type, :quest_state);', array( @@ -86,16 +85,6 @@ class QuestController{ ':quest_state'=> 0 )); } - for ($j = 74001; $j < 74004; $j++) { - $ret = $conn->execScript('INSERT INTO quest(accountid, quest_id, quest_type, quest_state) ' . - ' VALUES(:accountid, :quest_id, :quest_type, :quest_state);', - array( - ':accountid' => $account_id, - ':quest_id' => $j, - ':quest_type' => 0, - ':quest_state'=> 0 - )); - } } public function updateActive($account_id, $active_num, $active_sum) @@ -125,7 +114,7 @@ class QuestController{ } } - for ($j = 74001; $j < 74003; $j++) { + for ($j = 74001; $j < 74004; $j++) { $quest_id = $j; $row = $conn->execQueryOne('SELECT * FROM quest WHERE accountid=:accountid AND quest_id=:quest_id;', array( @@ -200,6 +189,7 @@ class QuestController{ //每周更新活跃度 if (phpcommon\getMondayseconds(time()) - phpcommon\getMondayseconds($row['sum_time']) > 0) { $this->updateActiveTime($account_id, 75000, 2); + $this->insertActive($account_id, 74001, 3); } else { $active_sum = $row['active_sum']; } @@ -212,6 +202,7 @@ class QuestController{ //每日更新活跃度 if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['num_time']) > 0) { $this->updateActiveTime($account_id, 74000, 1); + $this->insertActive($account_id, 73001, 5); } else { $active_num = $row['active_num']; } @@ -383,7 +374,8 @@ class QuestController{ )); //增加活跃度 if (!$active) { - $this->insertActive($account_id); + $this->insertActive($account_id, 73001, 5); + $this->insertActive($account_id, 74001, 3); $ret = $conn->execScript('INSERT INTO active(accountid, active_num, num_time, active_sum, sum_time) ' . ' VALUES(:accountid, :active_num, :num_time, :active_sum, :sum_time);', array(