From e681918ca0699fc40d9d2d5544c7a71747a418ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Tue, 16 Dec 2025 12:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E9=A2=86=E5=8F=96=E5=A5=96=E5=8A=B1?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=95=B0=E9=87=8F=E6=8E=A5=E5=8F=A3=E6=8F=90?= =?UTF-8?q?=E4=BA=A4-=E5=BF=83=E8=B7=B3=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/Tasks.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/application/api/model/Tasks.php b/application/api/model/Tasks.php index 3a1207b5..d94aa9bc 100644 --- a/application/api/model/Tasks.php +++ b/application/api/model/Tasks.php @@ -803,12 +803,24 @@ class Tasks extends Model //未完成任务数量 public function daily_tasks_unfinished_count($user_id){ - $task_ids = Db::name('vs_tasks')->where('delete_time',0)->where('is_active',1)->value('id'); + $task_ids = Db::name('vs_tasks')->where('delete_time',0)->where(['is_active'=>1,'id'=>['<>',1]])->select(); $result = []; - $task_user_count = Db::name('vs_tasks_user_daily') - ->where(['user_id'=>$user_id,'is_claimed'=>0,'is_completed'=>1]) - ->whereIn('task_id',$task_ids) - ->count(); + $task_user_count = 0; + foreach($task_ids as $k=>$v){ + if($v['task_type']==2){ + $task_user = Db::name('vs_tasks_user_daily') + ->where(['user_id'=>$user_id,'is_claimed'=>0,'is_completed'=>1]) + ->where('task_id',$v['id']) + ->whereTime('createtime', 'today') + ->count(); + }else{ + $task_user = Db::name('vs_tasks_user_daily') + ->where(['user_id'=>$user_id,'is_claimed'=>0,'is_completed'=>1]) + ->where('task_id',$v['id']) + ->count(); + } + $task_user_count +=$task_user; + } $result['num'] = $task_user_count; return ['code' => 1, 'msg' => '成功','data' => $result]; }