Merge remote-tracking branch 'origin/develop' into feature/hant
This commit is contained in:
commit
abdfa0bc28
|
|
@ -29,7 +29,7 @@ class OrderDispatchLog
|
||||||
'status' => $dispatch->status,
|
'status' => $dispatch->status,
|
||||||
'status_text' => $statusList[$dispatch->status],
|
'status_text' => $statusList[$dispatch->status],
|
||||||
'remark' => $remark,
|
'remark' => $remark,
|
||||||
'admin_user' => $dispatch->admin_user??'sys',
|
'admin_user' => $dispatch->admin_user??'系统',
|
||||||
];
|
];
|
||||||
\app\admin\model\OrderDispatchLog::create($data);
|
\app\admin\model\OrderDispatchLog::create($data);
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ class OrderDispatchLog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception $exception){
|
}catch (Exception $exception){
|
||||||
|
echo $exception->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class OrderLog
|
||||||
'role' => $role,
|
'role' => $role,
|
||||||
'remark' => $remark,
|
'remark' => $remark,
|
||||||
'admin_id' => $auth->id ?? 0,
|
'admin_id' => $auth->id ?? 0,
|
||||||
'admin_user' => $role==1 ? ($auth->nickname ?? 'sys') : $auth->name
|
'admin_user' => $role==1 ? ($auth->nickname ?? '系统') : $auth->name
|
||||||
];
|
];
|
||||||
(new \app\admin\model\OrderLog())->save($data);
|
(new \app\admin\model\OrderLog())->save($data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use think\Hook;
|
||||||
class AutoDispatchLogic
|
class AutoDispatchLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function autoDispatch($order)
|
public static function autoDispatch($order,$auth=null)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// if ($order->dispatch_type != 2) {
|
// if ($order->dispatch_type != 2) {
|
||||||
|
|
@ -22,13 +22,12 @@ class AutoDispatchLogic
|
||||||
|
|
||||||
|
|
||||||
$worker_id = (new DispatchLogic())->getMaxScoreWorker($order);
|
$worker_id = (new DispatchLogic())->getMaxScoreWorker($order);
|
||||||
// dd($worker_id);
|
|
||||||
if (!$worker_id) {
|
if (!$worker_id) {
|
||||||
$order->dispatch_type = 1;
|
$order->dispatch_type = 1;
|
||||||
$order->save();
|
$order->save();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// $admin = Admin::where('id',$order->admin_id)->find();
|
//$admin = Admin::where('id',$order->admin_id)->find();
|
||||||
$insert = [
|
$insert = [
|
||||||
'admin_id' => 1,
|
'admin_id' => 1,
|
||||||
'admin_user' => '系统',
|
'admin_user' => '系统',
|
||||||
|
|
@ -46,10 +45,19 @@ class AutoDispatchLogic
|
||||||
$res = $orderDispatch->allowField(true)->save($insert);
|
$res = $orderDispatch->allowField(true)->save($insert);
|
||||||
$order->status = \app\admin\model\Order::STATUS_DISPATCHED;
|
$order->status = \app\admin\model\Order::STATUS_DISPATCHED;
|
||||||
$order->dispatch_time = date('Y-m-d H:i:s');
|
$order->dispatch_time = date('Y-m-d H:i:s');
|
||||||
// $order->dispatch_admin_id = $this->auth->id;
|
$order->dispatch_admin_id = 1;
|
||||||
|
$order->dispatch_admin_user = '系统';
|
||||||
$order->worker_id = $worker_id;
|
$order->worker_id = $worker_id;
|
||||||
$order->save();
|
$order->save();
|
||||||
|
|
||||||
|
|
||||||
|
//日志
|
||||||
|
$hookparams['order'] = $order;
|
||||||
|
$hookparams['role'] = 1;
|
||||||
|
$hookparams['auth'] = $auth;
|
||||||
|
$hookparams['remark'] = '系统自动完成派单';//. $worker->name.'('.$worker->tel.')';
|
||||||
|
Hook::listen('order_change', $hookparams);
|
||||||
|
|
||||||
//日志
|
//日志
|
||||||
$hookParams = [
|
$hookParams = [
|
||||||
'dispatch' => (new OrderDispatch())->where('id', $orderDispatch->id)->find(),
|
'dispatch' => (new OrderDispatch())->where('id', $orderDispatch->id)->find(),
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,8 @@ class Message extends Backend
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
//超管不提醒新消息
|
//超管不提醒新消息
|
||||||
// if(!$this->auth->isSuperAdmin()){
|
//if(!$this->auth->isSuperAdmin()){
|
||||||
|
if(!$this->auth->id != 1){
|
||||||
$count = $this->model
|
$count = $this->model
|
||||||
->where('type',1)
|
->where('type',1)
|
||||||
->where('to_id',$this->auth->id)
|
->where('to_id',$this->auth->id)
|
||||||
|
|
@ -138,7 +139,7 @@ class Message extends Backend
|
||||||
->whereRaw("FIND_IN_SET({$this->auth->id}, read_uid) = 0 OR read_uid = '' or read_uid is null")
|
->whereRaw("FIND_IN_SET({$this->auth->id}, read_uid) = 0 OR read_uid = '' or read_uid is null")
|
||||||
->whereTime('create_time', '>=', '-3 days')
|
->whereTime('create_time', '>=', '-3 days')
|
||||||
->count();
|
->count();
|
||||||
// }
|
}
|
||||||
return [
|
return [
|
||||||
'count' => $count
|
'count' => $count
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -248,16 +248,8 @@ class Order extends Backend
|
||||||
$result = $this->model->allowField(true)->save($params);
|
$result = $this->model->allowField(true)->save($params);
|
||||||
|
|
||||||
if ($params['dispatch_type'] == 2) {
|
if ($params['dispatch_type'] == 2) {
|
||||||
AutoDispatchLogic::autoDispatch($this->model);
|
AutoDispatchLogic::autoDispatch($this->model,$this->auth);
|
||||||
}
|
}
|
||||||
//日志
|
|
||||||
|
|
||||||
$hookparams['order'] = $this->model;
|
|
||||||
$hookparams['role'] = 1;
|
|
||||||
$hookparams['auth'] = $this->auth;
|
|
||||||
$hookparams['remark'] = $params['remark'] ?? '';
|
|
||||||
Hook::listen('order_change', $hookparams);
|
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ValidateException | PDOException | Exception $e) {
|
} catch (ValidateException | PDOException | Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ class Dispatch extends Backend
|
||||||
$hookparams['order'] = $order;
|
$hookparams['order'] = $order;
|
||||||
$hookparams['role'] = 1;
|
$hookparams['role'] = 1;
|
||||||
$hookparams['auth'] = $this->auth;
|
$hookparams['auth'] = $this->auth;
|
||||||
$hookparams['remark'] = '';
|
$hookparams['remark'] = '手动完成派单';
|
||||||
Hook::listen('order_change', $hookparams);
|
Hook::listen('order_change', $hookparams);
|
||||||
|
|
||||||
$dispatch = $this->model->get($this->model->id);
|
$dispatch = $this->model->get($this->model->id);
|
||||||
|
|
|
||||||
|
|
@ -131,23 +131,24 @@ class OrderLogic
|
||||||
|
|
||||||
|
|
||||||
if($nocancelOrder){
|
if($nocancelOrder){
|
||||||
$order = Order::where('id',$dispatch->order_id)->where('status',Order::STATUS_DISPATCHED)->find();
|
$order = Order::where('id',$dispatch->order_id)->find();
|
||||||
$order->worker_id = 0;
|
$order->worker_id = 0;
|
||||||
$order->save();
|
|
||||||
if(empty($order)){
|
if(empty($order)){
|
||||||
throw new Exception('未找到关联订单');
|
throw new Exception('未找到关联订单');
|
||||||
}
|
}
|
||||||
//回退订单状态
|
//回退订单状态
|
||||||
$order->status = Order::STATUS_DISPATCHING;
|
if($order->status != Order::STATUS_DISPATCHING){
|
||||||
$order->save();
|
$order->status = Order::STATUS_DISPATCHING;
|
||||||
$params['order'] = $order;
|
$order->save();
|
||||||
$params['role'] = 1;
|
$params['order'] = $order;
|
||||||
$params['auth'] = $auth;
|
$params['role'] = 1;
|
||||||
$params['remark'] = '任务被取消[ID:' . $dispatch->id . '],订单状态回退';
|
$params['auth'] = $auth;
|
||||||
if (!empty($remark)) {
|
$params['remark'] = '任务被取消[ID:' . $dispatch->id . '],订单状态回退';
|
||||||
$params['remark'] .= ',备注:' . $remark;
|
if (!empty($remark)) {
|
||||||
|
$params['remark'] .= ',备注:' . $remark;
|
||||||
|
}
|
||||||
|
Hook::listen('order_change', $params);
|
||||||
}
|
}
|
||||||
Hook::listen('order_change', $params);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class CheckOrderDispatchGotCommand extends Command
|
||||||
|
|
||||||
protected function execute(Input $input, Output $output){
|
protected function execute(Input $input, Output $output){
|
||||||
|
|
||||||
//$this->_toget();
|
$this->_toget();
|
||||||
$this->_toarrive();
|
$this->_toarrive();
|
||||||
$output->info('OVER');
|
$output->info('OVER');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user