diff --git a/application/api/model/Tasks.php b/application/api/model/Tasks.php index f71c698a..2fe30d44 100644 --- a/application/api/model/Tasks.php +++ b/application/api/model/Tasks.php @@ -276,12 +276,17 @@ class Tasks extends Model return ['code' => 0, 'msg' => '任务不存在或已删除','data' => null]; } if($ext_value==1){ - $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; + if($task_info['target_quantity'] >= $task_student['value']){ + return ['code' => 1, 'msg' => '操作成功','data' => ['is_completed'=>1]]; + }else{ + $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; } - $task_student_data['value'] = $current_progress; + }else{ $current_progress = $task_student['value']; if($task_info['target_quantity']==$current_progress){ @@ -409,7 +414,7 @@ class Tasks extends Model $op_bag_re = $this->open_tasks_bag($user_id,$task_info['tasks_bag_id']); if ($op_bag_re['code'] != 1) { Db::rollback(); - return ['code' => 0, 'msg' => '操作失败', 'data' => null]; + return ['code' => 0, 'msg' => $op_bag_re['msg'], 'data' => null]; } // 提交事务 Db::commit();