|
@@ -190,7 +190,7 @@ class TaskService extends BaseService
|
|
|
* @param int $sourceId 任务完成对象来源ID
|
|
|
* @return false
|
|
|
*/
|
|
|
- public function updateLogData($userId, $taskId, $type=1, $checkType=1, $sourceId=0)
|
|
|
+ public function updateLogData($userId, $taskId, $type=1, $checkType=1, $sourceId=0, $time=0)
|
|
|
{
|
|
|
$cacheKey = "caches:task:scene_update_{$userId}_{$taskId}_{$type}";
|
|
|
if(RedisService::get($cacheKey)){
|
|
@@ -225,7 +225,7 @@ class TaskService extends BaseService
|
|
|
if($checkType == 1){
|
|
|
$updateData = ['num'=> DB::raw('num + 1'),'update_time'=>time()];
|
|
|
}else{
|
|
|
- $updateData = ['num'=> 1,'update_time'=>time()];
|
|
|
+ $updateData = ['num'=> $time>0? $time: 1,'update_time'=>time()];
|
|
|
}
|
|
|
|
|
|
return TaskLogModel::where(['id'=> $logId])->update($updateData);
|
|
@@ -234,7 +234,7 @@ class TaskService extends BaseService
|
|
|
'user_id'=> $userId,
|
|
|
'task_id'=> $taskId,
|
|
|
'source_id'=> $sourceId,
|
|
|
- 'num'=> 1,
|
|
|
+ 'num'=> $checkType==1? 1 : $time,
|
|
|
'date'=> date('Y-m-d'),
|
|
|
'create_time'=> time(),
|
|
|
'update_time'=> time(),
|
|
@@ -269,7 +269,7 @@ class TaskService extends BaseService
|
|
|
|
|
|
// 验证更新完成记录,若无数据更新则跳过
|
|
|
$errorKey = "caches:task:scene_error:{$taskId}_{$userId}";
|
|
|
- if(!$this->updateLogData($userId, $taskId, $type, $checkType, $sourceId)){
|
|
|
+ if(!$this->updateLogData($userId, $taskId, $type, $checkType, $sourceId, $time)){
|
|
|
RedisService::set("{$errorKey}_error", ['info'=> $item,'user_id'=> $userId,'source_id'=> $sourceId,'error'=>'该任务已完成'], rand(300, 600));
|
|
|
continue;
|
|
|
}
|