From 2223747fe2cdbd3166353792681af876e246e419 Mon Sep 17 00:00:00 2001 From: yaosen <741606767@qq.com> Date: Thu, 27 Jun 2024 14:09:12 +0800 Subject: [PATCH] a --- .../app/admin/controller/AdminController.php | 3 +++ .../app/admin/controller/DataController.php | 23 +++++++++++++++++-- .../app/admin/controller/IndexController.php | 16 +++++++++---- .../app/admin/controller/OrderController.php | 3 +++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/service/app/admin/controller/AdminController.php b/service/app/admin/controller/AdminController.php index a7686c9a..f3a63cf7 100644 --- a/service/app/admin/controller/AdminController.php +++ b/service/app/admin/controller/AdminController.php @@ -75,6 +75,9 @@ class AdminController extends base if(!empty($name) && $item->name != $name) { $item->name = $name; } + if(!empty($username) && $item->username != $username) { + $item->username = $username; + } if(!empty($password) && strlen($password) < 6) return $this->error(2001, '密码长度错误'); if(!empty($password)) { $item->password = $password; diff --git a/service/app/admin/controller/DataController.php b/service/app/admin/controller/DataController.php index 81d9cf89..51251a46 100644 --- a/service/app/admin/controller/DataController.php +++ b/service/app/admin/controller/DataController.php @@ -19,8 +19,27 @@ class DataController extends base ->leftJoin('admins a','a.id = o.admin_id') ->order('o.admin_id','desc') ->group('a.id,a.name,o.admin_id') - ->having('o.admin_id>0') - ->fieldRaw('count(o.id) as orders, SUM(o.total_price) as total_price, SUM(IF(o.asset_price>0 AND o.status=2,1,0)) as assets, SUM(IF(o.asset_price>0 AND o.status=2,o.asset_price,0)) as asset_price, sum(if(o.order_status=0,1,0)) as nopays, sum(if(o.order_status=0,o.total_price,0)) as nopay_price, o.admin_id,a.name'); + ->fieldRaw(' + count(o.id) as orders, + SUM(o.total_price) as total_price, + + SUM(CASE + WHEN (o.os = 1 AND o.order_status = 4) OR (o.os = 3 AND o.order_status = 2) OR (o.os = 2 AND o.order_status = 5) THEN 1 + ELSE 0 + END) as assets, + SUM(CASE + WHEN (o.os = 1 AND o.order_status = 4) OR (o.os = 3 AND o.order_status = 2) OR (o.os = 2 AND o.order_status = 5) THEN asset_price + ELSE 0 + END) as asset_price, + SUM(CASE + WHEN (o.os = 1 AND o.order_status = 5) OR (o.os = 3 AND o.order_status = 4) OR (o.os = 2 AND o.order_status = 1) THEN 1 + ELSE 0 + END) AS nopays, + SUM(CASE + WHEN (o.os = 1 AND o.order_status = 5) OR (o.os = 3 AND o.order_status = 4) OR (o.os = 2 AND o.order_status = 1) THEN actual_price + ELSE 0 + END) AS nopay_price, + o.admin_id,a.name'); if($times) { $query->whereBetween('o.create_at',[strtotime($times[0])*1000,strtotime($times[1])*1000+999]); diff --git a/service/app/admin/controller/IndexController.php b/service/app/admin/controller/IndexController.php index 6f87130b..ca01b3ee 100644 --- a/service/app/admin/controller/IndexController.php +++ b/service/app/admin/controller/IndexController.php @@ -195,21 +195,27 @@ class IndexController extends base $limit = $request->get('limit', 10); $product_name = $request->get('product_name'); $os = $request->get('os_status'); - $list = Orders::where('sn','>',0) + $list = Orders::where('id','>',0) ->fieldRaw(' os,product_name, SUM(IF(status=0,1,0)) as wait, SUM(IF(status=1,1,0)) as doing, SUM(total_price) as total, count(id) as `all`, - SUM(IF(asset_price>0 AND status=2,1,0)) as asset, - SUM(IF(asset_price>0 AND status=2,asset_price,0)) as asset_price, SUM(CASE - WHEN (os = 1 AND STATUS = 5) OR (os = 3 AND STATUS = 4) OR (os = 2 AND STATUS = 1) THEN 1 + WHEN (os = 1 AND order_status = 4) OR (os = 3 AND order_status = 2) OR (os = 2 AND order_status = 5) THEN 1 + ELSE 0 + END) as asset, + SUM(CASE + WHEN (os = 1 AND order_status = 4) OR (os = 3 AND order_status = 2) OR (os = 2 AND order_status = 5) THEN asset_price + ELSE 0 + END) as asset_price, + SUM(CASE + WHEN (os = 1 AND order_status = 5) OR (os = 3 AND order_status = 4) OR (os = 2 AND order_status = 1) THEN 1 ELSE 0 END) AS refund, SUM(CASE - WHEN (os = 1 AND STATUS = 5) OR (os = 3 AND STATUS = 4) OR (os = 2 AND STATUS = 1) THEN actual_price + WHEN (os = 1 AND order_status = 5) OR (os = 3 AND order_status = 4) OR (os = 2 AND order_status = 1) THEN actual_price ELSE 0 END) AS refund_price ') diff --git a/service/app/admin/controller/OrderController.php b/service/app/admin/controller/OrderController.php index ab04b8e6..b4953007 100644 --- a/service/app/admin/controller/OrderController.php +++ b/service/app/admin/controller/OrderController.php @@ -200,6 +200,9 @@ class OrderController extends base if(empty($desc) || empty($status)) return $this->error(2004, '跟进说明需要填写!'); if(empty($personnel)) return $this->error(2004, '人员情况需要填写!'); if(empty($travel_date)) return $this->error(2004, '出游时间需要填写!'); + if ($status != 2){ + if(empty($next_follow)) return $this->error(2004, '下次跟进时间需要填写!'); + } $lock = 'Travel:Order:'.$id.':lock'; $back = Redis::set($lock, $request->admin->id, 'EX', 6, 'NX');