fix: 修改小程序收货bug

This commit is contained in:
Gosowong 2023-05-18 18:05:39 +08:00
parent 852fa790ed
commit aa39909ab5
2 changed files with 7 additions and 2 deletions

View File

@ -978,6 +978,11 @@ class StoreOrderDao extends BaseDao
})->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
}
public function getSubOrderNotSendList(int $pid)
{
return $this->getModel()->where('pid', $pid)->where('status', 1)->select()->toArray();
}
public function getSubOrderNotSend(int $pid, int $order_id)
{
return $this->getModel()->where('pid', $pid)->where('status', 0)->where('id', '<>', $order_id)->count();

View File

@ -60,9 +60,9 @@ class StoreOrderTakeServices extends BaseServices
if (!$order) {
throw new ApiException(410173);
}
if ($order == -1) { // 有子订单
if ($order['pid'] == -1) { // 有子订单
// 查找待收货的子订单
$son_order_list = $this->dao->getList(['pid' => $order['id'], 'pay_type' => 'weixin', 'is_channel' => 1, 'status' => 1, 'refund_status' => 0], ['*']);
$son_order_list = $this->dao->getSubOrderNotSendList((int)$order['id']);
foreach ($son_order_list as $son_order) {
$this->takeOrder($son_order['order_id'], $son_order['uid']);
}