From 6ec59dfaa177a36a566e3ff86628dfc7662a94ab Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Sat, 22 Feb 2025 21:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E6=8C=82?= =?UTF-8?q?=E6=9C=BA=E6=80=BB=E6=97=B6=E9=95=BF=E8=8E=B7=E5=8F=96=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/TaskController.php | 2 +- app/dao/UserDao.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controller/api/TaskController.php b/app/controller/api/TaskController.php index d1b404e..2b9d32c 100644 --- a/app/controller/api/TaskController.php +++ b/app/controller/api/TaskController.php @@ -44,7 +44,7 @@ class TaskController { $user_id = $request->data['id']; //挂机总时长 单位秒 - $res['time'] = UserDao::all_task_income($user_id) / 20 * 3600; + $res['time'] = UserDao::Totalduration($user_id); //今天积分=0; $res['today_money'] = UserDao::today_task_income($user_id); //昨天积分 diff --git a/app/dao/UserDao.php b/app/dao/UserDao.php index b479fc3..9cde2e9 100644 --- a/app/dao/UserDao.php +++ b/app/dao/UserDao.php @@ -139,4 +139,16 @@ class UserDao Signlog::where('user_id',$user_id)->delete(); return 0; } + /** + * 获取用户挂机总时长 + * 返回秒 + */ + public static function Totalduration($user_id){ + $UserPhone=UserPhone::where('user_id',$user_id)->get(); + $time=0; + foreach($UserPhone as $v){ + $time+=UserPhoneLog::where('phone',$v->phone)->sum('time'); + } + return $time; + } }