From 196a4a200165eb0fb2ba584245e0ef34d02e8f92 Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Thu, 20 Mar 2025 16:40:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/CustomerController.php | 3 +++ app/middleware/AuthMiddleware.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controller/CustomerController.php b/app/controller/CustomerController.php index 7df359c..87bc1bb 100644 --- a/app/controller/CustomerController.php +++ b/app/controller/CustomerController.php @@ -268,6 +268,8 @@ class CustomerController return Util::fail([], 'created' . trans('not_null')); } $userId = $request->user['id']; + $created_at = $request->user['created_at']; + $day = ceil((time()-$created_at+1)/60/60/24); $id = Util::getParam($request, 'id'); $where[] = ['user_id', '=', $userId]; $where[] = ['created_at', '>', strtotime($created.'-01')]; @@ -283,6 +285,7 @@ class CustomerController 'customer'=>$customer, 'visit'=>$visit, 'follow'=>$follow, + 'day'=>$day, ]; if ($res) { return Util::success($res, trans('success')); diff --git a/app/middleware/AuthMiddleware.php b/app/middleware/AuthMiddleware.php index c178cd9..8bb6693 100644 --- a/app/middleware/AuthMiddleware.php +++ b/app/middleware/AuthMiddleware.php @@ -70,7 +70,7 @@ class AuthMiddleware implements MiddlewareInterface $userId = $decoded->sub; - $user = User::select(['id','name','sex','role','avatar','email','password','language']) + $user = User::select(['id','name','sex','role','avatar','email','password','language','created_at']) ->find($userId); if(!$user){ return Util::fail(['user'=>$user],trans('user_none'));