|
|
@ -47,10 +47,16 @@ class Staff extends BaseController |
|
|
|
|
|
|
|
|
public function orders() |
|
|
public function orders() |
|
|
{ |
|
|
{ |
|
|
$status = $this->request->get('status', 0); |
|
|
|
|
|
$orders = OrderModel::with('items') |
|
|
|
|
|
->where('status', intval($status)) |
|
|
|
|
|
->order('remind_count', 'desc') |
|
|
|
|
|
|
|
|
$status = $this->request->get('status', 0); |
|
|
|
|
|
$includeCancel = $this->request->get('include_cancel', 0); |
|
|
|
|
|
|
|
|
|
|
|
$query = OrderModel::with('items'); |
|
|
|
|
|
if ($status == 2 && $includeCancel) { |
|
|
|
|
|
$query->whereIn('status', [2, 3]); |
|
|
|
|
|
} else { |
|
|
|
|
|
$query->where('status', intval($status)); |
|
|
|
|
|
} |
|
|
|
|
|
$orders = $query->order('remind_count', 'desc') |
|
|
->order('submitted_at', 'asc') |
|
|
->order('submitted_at', 'asc') |
|
|
->select() |
|
|
->select() |
|
|
->toArray(); |
|
|
->toArray(); |
|
|
@ -63,7 +69,7 @@ class Staff extends BaseController |
|
|
'status' => $o['status'], |
|
|
'status' => $o['status'], |
|
|
'note' => $o['note'] ?? '', |
|
|
'note' => $o['note'] ?? '', |
|
|
'remindCount' => $o['remind_count'] ?? 0, |
|
|
'remindCount' => $o['remind_count'] ?? 0, |
|
|
'submittedAt' => date('m-d H:i', strtotime($o['submitted_at'])), |
|
|
|
|
|
|
|
|
'submittedAt' => date('Y-m-d H:i:s', strtotime($o['submitted_at'])), |
|
|
'items' => array_map(function ($i) { |
|
|
'items' => array_map(function ($i) { |
|
|
return [ |
|
|
return [ |
|
|
'name' => $i['product_name'], |
|
|
'name' => $i['product_name'], |
|
|
@ -108,14 +114,13 @@ class Staff extends BaseController |
|
|
'status' => $order->status, |
|
|
'status' => $order->status, |
|
|
'note' => $order->note ?? '', |
|
|
'note' => $order->note ?? '', |
|
|
'remindCount' => $order->remind_count ?? 0, |
|
|
'remindCount' => $order->remind_count ?? 0, |
|
|
'submittedAt' => date('m-d H:i', strtotime($order->submitted_at)), |
|
|
|
|
|
|
|
|
'submittedAt' => date('Y-m-d H:i:s', strtotime($order->submitted_at)), |
|
|
'items' => $items, |
|
|
'items' => $items, |
|
|
], |
|
|
], |
|
|
'msg' => 'ok', |
|
|
'msg' => 'ok', |
|
|
]); |
|
|
]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// BUG-02: 增加状态机校验 — confirm仅允许 status=0
|
|
|
|
|
|
public function confirm() |
|
|
public function confirm() |
|
|
{ |
|
|
{ |
|
|
$id = $this->request->param('id', 0); |
|
|
$id = $this->request->param('id', 0); |
|
|
@ -136,7 +141,6 @@ class Staff extends BaseController |
|
|
return json(['code' => 0, 'data' => null, 'msg' => '已接单']); |
|
|
return json(['code' => 0, 'data' => null, 'msg' => '已接单']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// BUG-02: 增加状态机校验 — done仅允许 status=1
|
|
|
|
|
|
public function done(CardService $cardService) |
|
|
public function done(CardService $cardService) |
|
|
{ |
|
|
{ |
|
|
$id = $this->request->param('id', 0); |
|
|
$id = $this->request->param('id', 0); |
|
|
@ -160,7 +164,6 @@ class Staff extends BaseController |
|
|
]); |
|
|
]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// BUG-02: 增加状态机校验 — cancel仅允许 status=0
|
|
|
|
|
|
public function cancel() |
|
|
public function cancel() |
|
|
{ |
|
|
{ |
|
|
$id = $this->request->param('id', 0); |
|
|
$id = $this->request->param('id', 0); |
|
|
|