|
@@ -56,17 +56,19 @@ class Cron
|
|
|
|
|
|
if ($data) {
|
|
|
foreach ($data as $k => $v) {
|
|
|
- $update['where_id'] = $v['id'];
|
|
|
- $update['score_status'] = 2;
|
|
|
- Dever::db('task/user_report')->update($update);
|
|
|
+ $state = $this->updateUserScore($v['uid'], $v['score']);
|
|
|
|
|
|
- $this->updateUserScore($v['uid'], $v['score']);
|
|
|
+ if ($state) {
|
|
|
+ $update['where_id'] = $v['id'];
|
|
|
+ $update['score_status'] = 2;
|
|
|
+ Dever::db('task/user_report')->update($update);
|
|
|
|
|
|
- $this->updateScoreLog($v['uid'], $v['score'], 4, 2, $v['task_id'], $v['id']);
|
|
|
+ $this->updateScoreLog($v['uid'], $v['score'], 4, 2, $v['task_id'], $v['id']);
|
|
|
|
|
|
- $this->updateMsg($v['uid'], $v['score'], 4, $v['task_id']);
|
|
|
+ $this->updateMsg($v['uid'], $v['score'], 4, $v['task_id']);
|
|
|
|
|
|
- $this->group($v['uid'], $v['group_score'], $v['task_id'], $v['id'], 1);
|
|
|
+ $this->group($v['uid'], $v['group_score'], $v['task_id'], $v['id'], 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -169,9 +171,12 @@ class Cron
|
|
|
*/
|
|
|
private function updateUserScore($uid, $score)
|
|
|
{
|
|
|
- $update['where_uid'] = $uid;
|
|
|
- $update['set_score'] = $score;
|
|
|
- Dever::db('task/user_score')->updateScore($update);
|
|
|
+ if ($score > 0) {
|
|
|
+ $update['where_uid'] = $uid;
|
|
|
+ $update['score'] = $score;
|
|
|
+ return Dever::db('task/user_score')->updateScore($update);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/**
|