diff --git a/application/api/model/Tasks.php b/application/api/model/Tasks.php index 05ecec1e..d0ed1341 100644 --- a/application/api/model/Tasks.php +++ b/application/api/model/Tasks.php @@ -268,6 +268,7 @@ class Tasks extends Model if ($user_daily_tasks && $user_daily_tasks['is_completed'] == 1) { return ['code' => 0, 'msg' => '您已完成该任务','data' => null]; } + $is_completed = 0; if(in_array($task_id,[21,22,23])){ $task_student_data =[]; $task_student = Db::name('vs_tasks_student')->where(['user_id'=>$user_id,'task_id'=>$task_id,'student_id'=>$student_id,'status'=>0,'delete_time'=>0])->find(); @@ -278,18 +279,19 @@ class Tasks extends Model $current_progress = $task_student['value']+1; if($task_info['target_quantity']==$current_progress && $task_student['is_reward']==1){ $task_student_data['status'] = 1; + $is_completed = 1; } $task_student_data['value'] = $current_progress; }else{ $current_progress = $task_student['value']; if($task_info['target_quantity']==$current_progress){ $task_student_data['status'] = 1; + $is_completed = 1; } $task_student_data['is_reward'] = 1; } $reslut = Db::name('vs_tasks_student')->where('id',$task_student['id'])->update($task_student_data); }else{ - $is_completed = 0; if($task_info['target_quantity']==$current_progress){ $is_completed = 1; }