This commit is contained in:
commit
5398a59322
|
@ -75,6 +75,9 @@ class AdminController extends base
|
||||||
if(!empty($name) && $item->name != $name) {
|
if(!empty($name) && $item->name != $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) && strlen($password) < 6) return $this->error(2001, '密码长度错误');
|
||||||
if(!empty($password)) {
|
if(!empty($password)) {
|
||||||
$item->password = $password;
|
$item->password = $password;
|
||||||
|
|
|
@ -19,8 +19,27 @@ class DataController extends base
|
||||||
->leftJoin('admins a','a.id = o.admin_id')
|
->leftJoin('admins a','a.id = o.admin_id')
|
||||||
->order('o.admin_id','desc')
|
->order('o.admin_id','desc')
|
||||||
->group('a.id,a.name,o.admin_id')
|
->group('a.id,a.name,o.admin_id')
|
||||||
->having('o.admin_id>0')
|
->fieldRaw('
|
||||||
->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');
|
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) {
|
if($times) {
|
||||||
$query->whereBetween('o.create_at',[strtotime($times[0])*1000,strtotime($times[1])*1000+999]);
|
$query->whereBetween('o.create_at',[strtotime($times[0])*1000,strtotime($times[1])*1000+999]);
|
||||||
|
|
|
@ -195,21 +195,27 @@ class IndexController extends base
|
||||||
$limit = $request->get('limit', 10);
|
$limit = $request->get('limit', 10);
|
||||||
$product_name = $request->get('product_name');
|
$product_name = $request->get('product_name');
|
||||||
$os = $request->get('os_status');
|
$os = $request->get('os_status');
|
||||||
$list = Orders::where('sn','>',0)
|
$list = Orders::where('id','>',0)
|
||||||
->fieldRaw('
|
->fieldRaw('
|
||||||
os,product_name,
|
os,product_name,
|
||||||
SUM(IF(status=0,1,0)) as wait,
|
SUM(IF(status=0,1,0)) as wait,
|
||||||
SUM(IF(status=1,1,0)) as doing,
|
SUM(IF(status=1,1,0)) as doing,
|
||||||
SUM(total_price) as total,
|
SUM(total_price) as total,
|
||||||
count(id) as `all`,
|
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
|
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
|
ELSE 0
|
||||||
END) AS refund,
|
END) AS refund,
|
||||||
SUM(CASE
|
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
|
ELSE 0
|
||||||
END) AS refund_price
|
END) AS refund_price
|
||||||
')
|
')
|
||||||
|
|
|
@ -200,6 +200,9 @@ class OrderController extends base
|
||||||
if(empty($desc) || empty($status)) return $this->error(2004, '跟进说明需要填写!');
|
if(empty($desc) || empty($status)) return $this->error(2004, '跟进说明需要填写!');
|
||||||
if(empty($personnel)) return $this->error(2004, '人员情况需要填写!');
|
if(empty($personnel)) return $this->error(2004, '人员情况需要填写!');
|
||||||
if(empty($travel_date)) 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';
|
$lock = 'Travel:Order:'.$id.':lock';
|
||||||
$back = Redis::set($lock, $request->admin->id, 'EX', 6, 'NX');
|
$back = Redis::set($lock, $request->admin->id, 'EX', 6, 'NX');
|
||||||
|
|
Loading…
Reference in New Issue