huazhiyu_new
lqmac 1 year ago
parent c0c243af0e
commit 49dcded9af
  1. 12
      application/api/controller/Order.php

@ -251,15 +251,15 @@ class Order extends Api
$user = $this->auth->getUserinfo(); $user = $this->auth->getUserinfo();
$order = OrderModel::where('id', $id)->where('order_type',1)->where('status', 3)->where('user_id', "<>", $user['id'])->field("id,user_id,order_amount,pay_amount,warehouse_id")->find(); $order = OrderModel::where('id', $id)->where('order_type',1)->where('status', 3)->where('user_id', "<>", $user['id'])->field("id,user_id,order_amount,pay_amount,warehouse_id")->find();
if (!$order) { if (!$order) {
$this->error("售卖商品不存在"); $this->error("商品已售罄");
} }
$detail = Detail::where('order_id', $order['id'])->find(); $detail = Detail::where('order_id', $order['id'])->find();
if (!$detail) { if (!$detail) {
$this->error("售卖商品不存在"); $this->error("商品已售罄");
} }
$goods = Goods::where('id', $detail['goods_id'])->find(); $goods = Goods::where('id', $detail['goods_id'])->find();
if (!$goods) { if (!$goods) {
$this->error("售卖商品不存在"); $this->error("商品已售罄");
} }
$warehouse = Warehouse::where('id', $order['warehouse_id'])->find(); $warehouse = Warehouse::where('id', $order['warehouse_id'])->find();
$is_allow_access = $this->limitBuyNum($user, $warehouse); $is_allow_access = $this->limitBuyNum($user, $warehouse);
@ -300,15 +300,15 @@ class Order extends Api
//通过订单去找商品 //通过订单去找商品
$order = OrderModel::where('id', $seller_order_id)->where('order_type',1)->where('status', 3)->where('user_id', "<>", $user['id'])->field("id,user_id,order_amount,pay_amount,warehouse_id")->find(); $order = OrderModel::where('id', $seller_order_id)->where('order_type',1)->where('status', 3)->where('user_id', "<>", $user['id'])->field("id,user_id,order_amount,pay_amount,warehouse_id")->find();
if (!$order) { if (!$order) {
$this->error("售卖商品不存在"); $this->error("商品已售罄");
} }
$detail = Detail::where('order_id', $order['id'])->find(); $detail = Detail::where('order_id', $order['id'])->find();
if (!$detail) { if (!$detail) {
$this->error("售卖商品不存在"); $this->error("商品已售罄");
} }
$goods = Goods::where('id', $detail['goods_id'])->where('status','normal')->find(); $goods = Goods::where('id', $detail['goods_id'])->where('status','normal')->find();
if (!$goods) { if (!$goods) {
$this->error("售卖商品不存在"); $this->error("商品已售罄");
} }
$warehouse = Warehouse::where('id', $goods['warehouse_id'])->find(); $warehouse = Warehouse::where('id', $goods['warehouse_id'])->find();

Loading…
Cancel
Save