地址
This commit is contained in:
parent
a070703342
commit
18e48f793b
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\OrderDispatch;
|
||||
use app\common\controller\Backend;
|
||||
use app\common\exception\UploadException;
|
||||
use app\common\library\Upload;
|
||||
|
|
@ -324,4 +325,46 @@ class Ajax extends Backend
|
|||
$response = Response::create($data, '', 200, $header);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function get_config(){
|
||||
|
||||
|
||||
$order = new \app\admin\model\Order();
|
||||
$user = \model('admin')->find($this->auth->id);
|
||||
|
||||
$group = \model('auth_group_access')->where('uid',$this->auth->id)->find()->group_id ?? 0;
|
||||
|
||||
if ($group == 2 || $group == 6) {
|
||||
// 生成 SQL 语句
|
||||
$ids = $user->area_ids??'';
|
||||
if ($ids == ''){
|
||||
$to_dispatch = 0;
|
||||
}else{
|
||||
$ids = explode(',',$ids);
|
||||
$area_codes = $this->filterAreaCodes($ids);
|
||||
|
||||
$order->where(function ($q) use ($area_codes) {
|
||||
foreach ($area_codes as $area_code) {
|
||||
$q->whereOr('area_id', 'like', $area_code . '%');
|
||||
}
|
||||
});
|
||||
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
|
||||
}
|
||||
}else{
|
||||
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
|
||||
}
|
||||
//待跟进
|
||||
$to_follow = OrderDispatch::where('follow',0)->auth($this->auth)->count();
|
||||
|
||||
// return [
|
||||
// 'order/index' => $to_dispatch,
|
||||
// 'orders/dispatch2' => $to_follow
|
||||
// ];
|
||||
$rs = [
|
||||
'order/index' => [$to_dispatch, 'red', 'badge'], //待派单
|
||||
'orders/dispatch2' => [$to_follow, 'yellow', 'badge'], //待跟进
|
||||
];
|
||||
|
||||
return json_encode($rs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -444,5 +444,19 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
|
|||
|
||||
},60*1000);
|
||||
|
||||
|
||||
var s =5;//几秒刷新
|
||||
setInterval(f5,s*1000);
|
||||
//定时器刷新
|
||||
function f5() {
|
||||
$.post("/admin/ajax/get_config?",{field:'addr2'},function(data,status){
|
||||
// alert("Data: " + data.data + "nStatus: " + status);
|
||||
// console.log(data);
|
||||
Backend.api.sidebar(JSON.parse(data));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return Controller;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user