处理错误
This commit is contained in:
parent
abdfa0bc28
commit
fe115b963e
|
|
@ -34,11 +34,11 @@ class Test extends Command
|
||||||
|
|
||||||
protected function execute(Input $input, Output $output)
|
protected function execute(Input $input, Output $output)
|
||||||
{
|
{
|
||||||
|
dd(config('system_id'));
|
||||||
|
|
||||||
$order = Order::where('id',140)->find();
|
$order = Order::where('id',140)->find();
|
||||||
AutoDispatchLogic::autoDispatch($order);
|
AutoDispatchLogic::autoDispatch($order);
|
||||||
dd(2);
|
|
||||||
|
|
||||||
$hookParams = [
|
$hookParams = [
|
||||||
'dispatch' => (new OrderDispatch())->where('id', 144)->find(),
|
'dispatch' => (new OrderDispatch())->where('id', 144)->find(),
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ class AutoDispatchLogic
|
||||||
}
|
}
|
||||||
//$admin = Admin::where('id',$order->admin_id)->find();
|
//$admin = Admin::where('id',$order->admin_id)->find();
|
||||||
$insert = [
|
$insert = [
|
||||||
'admin_id' => 1,
|
'admin_id' => config('system_id'),
|
||||||
'admin_user' => '系统',
|
'admin_user' => config('system_name'),
|
||||||
'order_id' => $order->id,
|
'order_id' => $order->id,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
'worker_id' => $worker_id,
|
'worker_id' => $worker_id,
|
||||||
|
|
@ -48,6 +48,7 @@ class AutoDispatchLogic
|
||||||
$order->dispatch_admin_id = 1;
|
$order->dispatch_admin_id = 1;
|
||||||
$order->dispatch_admin_user = '系统';
|
$order->dispatch_admin_user = '系统';
|
||||||
$order->worker_id = $worker_id;
|
$order->worker_id = $worker_id;
|
||||||
|
$order->dispatch_type = 2;
|
||||||
$order->save();
|
$order->save();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -361,9 +361,6 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function smart()
|
public function smart()
|
||||||
{
|
{
|
||||||
$this->success(data: Address::smart(request()->get('str')));
|
$this->success(data: Address::smart(request()->get('str')));
|
||||||
|
|
@ -466,12 +463,13 @@ class Order extends Backend
|
||||||
$result = false;
|
$result = false;
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
|
$abnormal_title = model('abnormal')->get($params['abnormal_id'])->title ?? '';
|
||||||
$insert = [
|
$insert = [
|
||||||
'order_id' => $params['order_id'],
|
'order_id' => $params['order_id'],
|
||||||
'status' => 0,
|
'status' => 0,
|
||||||
'level' => $params['level'],
|
'level' => $params['level'],
|
||||||
'abnormal_id' => $params['abnormal_id'],
|
'abnormal_id' => $params['abnormal_id'],
|
||||||
'abnormal_title' => model('abnormal')->get($params['abnormal_id'])->title ?? '',
|
'abnormal_title' => $abnormal_title,
|
||||||
'detail' => $params['detail'],
|
'detail' => $params['detail'],
|
||||||
'admin_id' => $this->auth->id,
|
'admin_id' => $this->auth->id,
|
||||||
'admin_user' => $this->auth->getUserInfo()['nickname'] ?? '',
|
'admin_user' => $this->auth->getUserInfo()['nickname'] ?? '',
|
||||||
|
|
@ -479,16 +477,59 @@ class Order extends Backend
|
||||||
'update_time' => now()->format('Y-m-d H:m:s'),
|
'update_time' => now()->format('Y-m-d H:m:s'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
if ($params['abnormal_id'] == 2 || $params['abnormal_id'] == 3) {
|
||||||
|
|
||||||
|
$order->status = \app\admin\model\Order::STATUS_CANCEL;
|
||||||
|
$order->save();
|
||||||
|
if (!empty($order->dispatch->id)) {
|
||||||
|
$orderLogic = new OrderLogic();
|
||||||
|
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
|
||||||
|
//日志
|
||||||
|
$hookparams['order'] = $order;
|
||||||
|
$hookparams['role'] = 1;
|
||||||
|
$hookparams['auth'] = $this->auth;
|
||||||
|
$hookparams['remark'] = $params['remark'] ?? '';
|
||||||
|
Hook::listen('order_change', $hookparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
$insert['deal_type'] = 2;
|
||||||
|
$insert['handle_detail'] = '系统取消订单';
|
||||||
|
$insert['handle_admin_user'] = config('system_name');
|
||||||
|
$insert['handle_admin_id'] = config('system_id');
|
||||||
|
$insert['handle_time'] = now()->format('Y-m-d H:i:s');
|
||||||
|
$insert['status'] = 1;
|
||||||
|
|
||||||
|
} else if ($params['abnormal_id'] == 5 || $params['abnormal_id'] == 15) {
|
||||||
|
|
||||||
|
$order->status = \app\admin\model\Order::STATUS_DISPATCHING;
|
||||||
|
$order->save();
|
||||||
|
if (!empty($order->dispatch->id)) {
|
||||||
|
$OrderLogic = new OrderLogic();
|
||||||
|
$OrderLogic->noWorkerCanGetIt($order->dispatch, '系统取消' . $abnormal_title);
|
||||||
|
AutoDispatchLogic::autoDispatch($order);
|
||||||
|
}
|
||||||
|
|
||||||
|
$insert['deal_type'] = 3;
|
||||||
|
$insert['handle_detail'] = '系统重新派单';
|
||||||
|
$insert['handle_admin_user'] = config('system_name');
|
||||||
|
$insert['handle_admin_id'] = config('system_id');
|
||||||
|
$insert['handle_time'] = now()->format('Y-m-d H:i:s');
|
||||||
|
$insert['status'] = 1;
|
||||||
|
} else {
|
||||||
Message::create([
|
Message::create([
|
||||||
'to_id' => $order->admin_id,
|
'to_id' => $order->admin_id,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'title' => '订单报错通知',
|
'title' => '订单报错通知',
|
||||||
'content' => '【订单报错通知】您有一条订单号为' . $order->order_no . '的订单订单信息录入错误,请前往报错订单界面进行查看,并立即处理!'
|
'content' => '【订单报错通知】您有一条订单号为' . $order->order_no . '的订单订单信息录入错误,请前往报错订单界面进行查看,并立即处理!'
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = \model('order_abnormal')->insert($insert);
|
$result = \model('order_abnormal')->insert($insert);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ValidateException | PDOException | Exception $e) {
|
} catch (ValidateException | PDOException | Exception $e) {
|
||||||
|
throw $e;
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -536,11 +577,11 @@ class Order extends Backend
|
||||||
|
|
||||||
if (!empty($order->dispatch->id)) {
|
if (!empty($order->dispatch->id)) {
|
||||||
$orderLogic = new OrderLogic();
|
$orderLogic = new OrderLogic();
|
||||||
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
|
$orderLogic->cancelOrderDispatch($order->dispatch, null, '订单被取消', false);
|
||||||
//日志
|
//日志
|
||||||
$hookparams['order'] = $order;
|
$hookparams['order'] = $order;
|
||||||
$hookparams['role'] = 1;
|
$hookparams['role'] = 1;
|
||||||
$hookparams['auth'] = $this->auth;
|
$hookparams['auth'] = null;
|
||||||
$hookparams['remark'] = $params['remark'] ?? '';
|
$hookparams['remark'] = $params['remark'] ?? '';
|
||||||
Hook::listen('order_change', $hookparams);
|
Hook::listen('order_change', $hookparams);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace app\admin\controller\orders;
|
namespace app\admin\controller\orders;
|
||||||
|
|
||||||
|
use app\admin\controller\AutoDispatchLogic;
|
||||||
use app\admin\model\Order;
|
use app\admin\model\Order;
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
use app\common\Logic\OrderLogic;
|
use app\common\Logic\OrderLogic;
|
||||||
|
|
@ -130,10 +131,7 @@ class Abnormal extends Backend
|
||||||
|
|
||||||
|
|
||||||
if ($params['abnormal_id'] == 2 || $params['abnormal_id'] == 3){
|
if ($params['abnormal_id'] == 2 || $params['abnormal_id'] == 3){
|
||||||
|
|
||||||
$order->status = Order::STATUS_CANCEL;
|
$order->status = Order::STATUS_CANCEL;
|
||||||
$order->abnormal_id = $params['abnormal_id'];
|
|
||||||
$order->abnormal_title = $abnormal_title;
|
|
||||||
$order->save();
|
$order->save();
|
||||||
if (!empty($order->dispatch->id)) {
|
if (!empty($order->dispatch->id)) {
|
||||||
$orderLogic = new OrderLogic();
|
$orderLogic = new OrderLogic();
|
||||||
|
|
@ -146,8 +144,27 @@ class Abnormal extends Backend
|
||||||
Hook::listen('order_change', $hookparams);
|
Hook::listen('order_change', $hookparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$params['deal_type'] = 2;
|
||||||
|
$params['handle_detail'] = '系统取消订单';
|
||||||
|
$params['handle_admin_user'] = config('system_name');
|
||||||
|
$params['handle_admin_id'] = config('system_id');
|
||||||
|
$params['status'] = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($params['abnormal_id'] == 5 || $params['abnormal_id'] == 15){
|
||||||
|
if (!empty($order->dispatch->id)) {
|
||||||
|
$OrderLogic = new OrderLogic();
|
||||||
|
$OrderLogic->noWorkerCanGetIt($order->dispatch,'系统取消'.$abnormal_title);
|
||||||
|
AutoDispatchLogic::autoDispatch($order);
|
||||||
|
}
|
||||||
|
|
||||||
|
$params['deal_type'] =3;
|
||||||
|
$params['handle_detail'] = '系统重新派单';
|
||||||
|
$params['handle_admin_user'] = config('system_name');
|
||||||
|
$params['handle_admin_id'] = config('system_id');
|
||||||
|
$params['status'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = $this->model->allowField(true)->save($params);
|
$result = $this->model->allowField(true)->save($params);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Source')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">处理方式:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[source]" class="form-control show-tick">
|
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[source]" class="form-control show-tick">
|
||||||
<option value="0"> 无</option>
|
<option value="0"> 无</option>
|
||||||
|
|
|
||||||
|
|
@ -92,11 +92,13 @@ class OrderLogic
|
||||||
* 师傅超时未接单的处理逻辑
|
* 师傅超时未接单的处理逻辑
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function noWorkerCanGetIt(OrderDispatch $dispatch)
|
public function noWorkerCanGetIt(OrderDispatch $dispatch,$remark = null)
|
||||||
{//超过三次,直接取消
|
{//超过三次,直接取消
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
|
if (is_null($remark)){
|
||||||
$remark = '师傅超时未接单,任务取消';
|
$remark = '师傅超时未接单,任务取消';
|
||||||
|
}
|
||||||
$this->cancelOrderDispatch($dispatch,null,$remark);
|
$this->cancelOrderDispatch($dispatch,null,$remark);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
}catch (Exception $exception){
|
}catch (Exception $exception){
|
||||||
|
|
@ -121,7 +123,7 @@ class OrderLogic
|
||||||
if(!empty($auth)){
|
if(!empty($auth)){
|
||||||
$dispatch->admin_user = '管理员:'.$auth->nickname;
|
$dispatch->admin_user = '管理员:'.$auth->nickname;
|
||||||
}else{
|
}else{
|
||||||
$dispatch->admin_user = 'sys';
|
$dispatch->admin_user = config('system_name');
|
||||||
}
|
}
|
||||||
$hookParams = [
|
$hookParams = [
|
||||||
'dispatch' => $dispatch,
|
'dispatch' => $dispatch,
|
||||||
|
|
|
||||||
|
|
@ -324,5 +324,7 @@ return [
|
||||||
'mini_program' => [
|
'mini_program' => [
|
||||||
'app_id' => Env::get('mini_program.app_id', ''),
|
'app_id' => Env::get('mini_program.app_id', ''),
|
||||||
'secret' => Env::get('mini_program.secret', ''),
|
'secret' => Env::get('mini_program.secret', ''),
|
||||||
]
|
],
|
||||||
|
'system_id' => 100,
|
||||||
|
'system_name' => '系统',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
{field: 'abnormal_id', title: __('Abnormal_id'),visible:false},
|
{field: 'abnormal_id', title: __('Abnormal_id'),visible:false},
|
||||||
{field: 'abnormal_title', title: __('Abnormal_title'), operate: false},
|
{field: 'abnormal_title', title: __('Abnormal_title'), operate: false},
|
||||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
|
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
|
||||||
|
{field: 'deal_type', title: '处理方式', operate: false,
|
||||||
|
searchList: {"1": '修改订单', "2": '取消订单', '3': '重新派单','0':'无'},
|
||||||
|
formatter: Table.api.formatter.label,},
|
||||||
//{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
|
//{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
|
||||||
//{field: 'order.tel', title: __('Order.tel'), operate: 'LIKE'},
|
//{field: 'order.tel', title: __('Order.tel'), operate: 'LIKE'},
|
||||||
// {field: 'order.worker_name', title: __('Order.worker_name'), operate: 'LIKE'},
|
// {field: 'order.worker_name', title: __('Order.worker_name'), operate: 'LIKE'},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user