Merge remote-tracking branch 'origin/develop' into feature/hant

This commit is contained in:
hant 2025-06-05 21:16:33 +08:00
commit abdfa0bc28
8 changed files with 33 additions and 31 deletions

View File

@ -29,7 +29,7 @@ class OrderDispatchLog
'status' => $dispatch->status,
'status_text' => $statusList[$dispatch->status],
'remark' => $remark,
'admin_user' => $dispatch->admin_user??'sys',
'admin_user' => $dispatch->admin_user??'系统',
];
\app\admin\model\OrderDispatchLog::create($data);
@ -63,7 +63,7 @@ class OrderDispatchLog
}
}
}catch (Exception $exception){
echo $exception->getMessage();
}
}
}

View File

@ -27,7 +27,7 @@ class OrderLog
'role' => $role,
'remark' => $remark,
'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);
}

View File

@ -13,7 +13,7 @@ use think\Hook;
class AutoDispatchLogic
{
public static function autoDispatch($order)
public static function autoDispatch($order,$auth=null)
{
//
// if ($order->dispatch_type != 2) {
@ -22,13 +22,12 @@ class AutoDispatchLogic
$worker_id = (new DispatchLogic())->getMaxScoreWorker($order);
// dd($worker_id);
if (!$worker_id) {
$order->dispatch_type = 1;
$order->save();
return false;
}
// $admin = Admin::where('id',$order->admin_id)->find();
//$admin = Admin::where('id',$order->admin_id)->find();
$insert = [
'admin_id' => 1,
'admin_user' => '系统',
@ -46,10 +45,19 @@ class AutoDispatchLogic
$res = $orderDispatch->allowField(true)->save($insert);
$order->status = \app\admin\model\Order::STATUS_DISPATCHED;
$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->save();
//日志
$hookparams['order'] = $order;
$hookparams['role'] = 1;
$hookparams['auth'] = $auth;
$hookparams['remark'] = '系统自动完成派单';//. $worker->name.'('.$worker->tel.')';
Hook::listen('order_change', $hookparams);
//日志
$hookParams = [
'dispatch' => (new OrderDispatch())->where('id', $orderDispatch->id)->find(),

View File

@ -129,7 +129,8 @@ class Message extends Backend
{
$count = 0;
//超管不提醒新消息
// if(!$this->auth->isSuperAdmin()){
//if(!$this->auth->isSuperAdmin()){
if(!$this->auth->id != 1){
$count = $this->model
->where('type',1)
->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")
->whereTime('create_time', '>=', '-3 days')
->count();
// }
}
return [
'count' => $count
];

View File

@ -248,16 +248,8 @@ class Order extends Backend
$result = $this->model->allowField(true)->save($params);
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();
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();

View File

@ -167,7 +167,7 @@ class Dispatch extends Backend
$hookparams['order'] = $order;
$hookparams['role'] = 1;
$hookparams['auth'] = $this->auth;
$hookparams['remark'] = '';
$hookparams['remark'] = '手动完成派单';
Hook::listen('order_change', $hookparams);
$dispatch = $this->model->get($this->model->id);

View File

@ -131,23 +131,24 @@ class OrderLogic
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->save();
if(empty($order)){
throw new Exception('未找到关联订单');
}
//回退订单状态
$order->status = Order::STATUS_DISPATCHING;
$order->save();
$params['order'] = $order;
$params['role'] = 1;
$params['auth'] = $auth;
$params['remark'] = '任务被取消[ID' . $dispatch->id . '],订单状态回退';
if (!empty($remark)) {
$params['remark'] .= ',备注:' . $remark;
if($order->status != Order::STATUS_DISPATCHING){
$order->status = Order::STATUS_DISPATCHING;
$order->save();
$params['order'] = $order;
$params['role'] = 1;
$params['auth'] = $auth;
$params['remark'] = '任务被取消[ID' . $dispatch->id . '],订单状态回退';
if (!empty($remark)) {
$params['remark'] .= ',备注:' . $remark;
}
Hook::listen('order_change', $params);
}
Hook::listen('order_change', $params);
}
}

View File

@ -22,7 +22,7 @@ class CheckOrderDispatchGotCommand extends Command
protected function execute(Input $input, Output $output){
//$this->_toget();
$this->_toget();
$this->_toarrive();
$output->info('OVER');
}