|
|
@ -327,8 +327,8 @@ class OrderController extends Controller |
|
|
{ |
|
|
{ |
|
|
$id = (int)request()->input('id'); |
|
|
$id = (int)request()->input('id'); |
|
|
|
|
|
|
|
|
$fields = ['id', 'order_no', 'agent_product_id', 'num', 'price', 'title', 'picture', |
|
|
|
|
|
'status', 'pay_type', 'coupon_id', 'paid_money', 'paid_at', 'refund_info', 'created_at']; |
|
|
|
|
|
|
|
|
$fields = ['id', 'order_no', 'agent_product_id', 'num', 'price', 'title', 'picture', 'status', |
|
|
|
|
|
'pay_type', 'coupon_id', 'paid_money', 'paid_at', 'refund_info', 'verify_code', 'created_at']; |
|
|
$order = Order::query() |
|
|
$order = Order::query() |
|
|
->where('user_id', $this->user_id) |
|
|
->where('user_id', $this->user_id) |
|
|
->find($id, $fields); |
|
|
->find($id, $fields); |
|
|
@ -337,6 +337,9 @@ class OrderController extends Controller |
|
|
return $this->error('订单不存在'); |
|
|
return $this->error('订单不存在'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//订单ID和核销码拼接,查询时通过订单ID和核销码来查询,这样核销码不用建索引
|
|
|
|
|
|
$order->verify_code = $order->id . '-' . $order->verify_code; |
|
|
|
|
|
|
|
|
$order->coupon = Coupon::query() |
|
|
$order->coupon = Coupon::query() |
|
|
->whereIn('id', $order->coupon_id) |
|
|
->whereIn('id', $order->coupon_id) |
|
|
->where(['agent_id' => $this->agent_id, 'agent_product_id' => $order->agent_product_id,]) |
|
|
->where(['agent_id' => $this->agent_id, 'agent_product_id' => $order->agent_product_id,]) |
|
|
|