Browse Source

fix: include_cancel支持拒单显示/完整时间格式Y-m-d H:i:s

dev
mac 1 day ago
parent
commit
ca121c4711
3 changed files with 14 additions and 11 deletions
  1. +1
    -1
      app/controller/Message.php
  2. +12
    -9
      app/controller/Staff.php
  3. +1
    -1
      app/service/OrderService.php

+ 1
- 1
app/controller/Message.php View File

@ -29,7 +29,7 @@ class Message extends BaseController
'cardNo' => $m['card_no'], 'cardNo' => $m['card_no'],
'senderType' => $m['sender_type'], 'senderType' => $m['sender_type'],
'content' => $m['content'], 'content' => $m['content'],
'time' => date('m-d H:i', strtotime($m['created_at'])),
'time' => date('Y-m-d H:i:s', strtotime($m['created_at'])),
'staffId' => $m['staff_id'] ?? null, 'staffId' => $m['staff_id'] ?? null,
]; ];
}, $messages); }, $messages);


+ 12
- 9
app/controller/Staff.php View File

@ -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);


+ 1
- 1
app/service/OrderService.php View File

@ -79,7 +79,7 @@ class OrderService
'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'],


Loading…
Cancel
Save