Commit de649a99 by 汪伟伟

1

parent 30a1c57d
...@@ -35,7 +35,7 @@ class BatchReceiveAction extends BatchAction ...@@ -35,7 +35,7 @@ class BatchReceiveAction extends BatchAction
// 获取选中的ID数组 // 获取选中的ID数组
$keys = $this->getKey(); $keys = $this->getKey();
$user = \Admin::user(); $user = \Admin::user();
$counts = TasksReceive::query()->where('user_id',$user->id)->where('status',0)->count(); $counts = TasksReceive::query()->where('user_id',$user->id)->whereIn('status',[0,2])->count();
if (count($keys) + $counts > 10){ if (count($keys) + $counts > 10){
return $this->response()->error('最多只能领取十个任务'); return $this->response()->error('最多只能领取十个任务');
} }
......
...@@ -54,6 +54,11 @@ class ReceiveAction extends RowAction ...@@ -54,6 +54,11 @@ class ReceiveAction extends RowAction
$exists= TasksReceive::query()->where('task_id',$id)->where('user_id',$user->id)->exists(); $exists= TasksReceive::query()->where('task_id',$id)->where('user_id',$user->id)->exists();
$task = Task::query()->find($id); $task = Task::query()->find($id);
$counts = TasksReceive::query()->where('user_id',$user->id)->whereIn('status',[0,2])->count();
if ($counts > 9){
return $this->response()->error('最多只能领取十个任务');
}
if (!$exists && $task->num > 0){ if (!$exists && $task->num > 0){
$receive = TasksReceive::query()->create([ $receive = TasksReceive::query()->create([
'task_id'=>$id, 'task_id'=>$id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment