|
|
|
@ -175,7 +175,7 @@ class Order extends Api |
|
|
|
|
*/ |
|
|
|
|
public function getGoodsList(){ |
|
|
|
|
$page = $this->request->post("page", 1); |
|
|
|
|
$limit = $this->request->post("limit", 10); |
|
|
|
|
$limit = $this->request->post("limit", 20); |
|
|
|
|
$warehouse_id = $this->request->post("warehouse_id", 3); |
|
|
|
|
$user = $this->auth->getUserinfo(); |
|
|
|
|
$warehouse = Warehouse::where('id', $warehouse_id)->find(); |
|
|
|
@ -186,14 +186,31 @@ class Order extends Api |
|
|
|
|
if ($is_allow_access > 0 ) { |
|
|
|
|
$this->error("抢购次数被限制"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$list = OrderModel::where('warehouse_id', $warehouse_id)->where('order_type',1)->where('status', 3)->where('user_id', "<>", $user['id'])->field("id,user_id,order_amount,pay_amount,warehouse_id")->order('id', 'desc')->paginate($this->request->param('list_rows', 20))->each(function ($item, $key){ |
|
|
|
|
$detail = Detail::where('order_id', $item['id'])->find(); |
|
|
|
|
$goods = Goods::where('id', $detail['goods_id'])->find(); |
|
|
|
|
$goods['image'] = cdnurl($goods['image'], true); |
|
|
|
|
$item['goods'] = $goods; |
|
|
|
|
return $item; |
|
|
|
|
}); |
|
|
|
|
$list = Db::name('order')->alias('order') |
|
|
|
|
->join("order_detail order_detail","order_detail.order_id = order.id") |
|
|
|
|
->join("goods goods","goods.id = order_detail.goods_id") |
|
|
|
|
->field("order.id,order.user_id,order.order_amount,order.pay_amount,order.warehouse_id") |
|
|
|
|
->where('order.warehouse_id', $warehouse_id) |
|
|
|
|
->where('order.order_type',1) |
|
|
|
|
->where('order.status', 3) |
|
|
|
|
->where('order.user_id', "<>", $user['id']) |
|
|
|
|
->group('order.id') |
|
|
|
|
->order('goods.status', 'desc') |
|
|
|
|
->order("order.id desc") |
|
|
|
|
->paginate($limit, false, [])->each(function ($item, $key){ |
|
|
|
|
$detail = Detail::where('order_id', $item['id'])->find(); |
|
|
|
|
$goods = Goods::where('id', $detail['goods_id'])->find(); |
|
|
|
|
$goods['image'] = cdnurl($goods['image'], true); |
|
|
|
|
$item['goods'] = $goods; |
|
|
|
|
return $item; |
|
|
|
|
}); |
|
|
|
|
// $list = OrderModel::where('warehouse_id', $warehouse_id)->where('order_type',1)->where('status', 3)->where('user_id', "<>", $user['id'])->field("id,user_id,order_amount,pay_amount,warehouse_id")->order('id', 'desc')->paginate($this->request->param('list_rows', 20))->each(function ($item, $key){ |
|
|
|
|
// $detail = Detail::where('order_id', $item['id'])->find(); |
|
|
|
|
// $goods = Goods::where('id', $detail['goods_id'])->find(); |
|
|
|
|
// $goods['image'] = cdnurl($goods['image'], true); |
|
|
|
|
// $item['goods'] = $goods; |
|
|
|
|
// return $item; |
|
|
|
|
// }); |
|
|
|
|
$this->success("succ", $list); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
@ -285,6 +302,7 @@ class Order extends Api |
|
|
|
|
"warehouse_id" => $goods['warehouse_id'], |
|
|
|
|
"order_amount" => $order_amount, |
|
|
|
|
"pay_amount" => $pay_amount, |
|
|
|
|
"actual_amount" => -$pay_amount, |
|
|
|
|
"coupon_price" => 0, |
|
|
|
|
"coupon_id" => 0, |
|
|
|
|
"consignee" => $address['consignee'], |
|
|
|
@ -613,6 +631,7 @@ class Order extends Api |
|
|
|
|
"warehouse_id" => $order['warehouse_id'], |
|
|
|
|
"order_amount" => intval($goods_price), |
|
|
|
|
"pay_amount" => intval($goods_price), |
|
|
|
|
"actual_amount" => intval($goods_price), |
|
|
|
|
"coupon_price" => 0, |
|
|
|
|
"coupon_id" => 0, |
|
|
|
|
"status" => 3, |
|
|
|
@ -742,6 +761,7 @@ class Order extends Api |
|
|
|
|
"warehouse_id" => $order_info['warehouse_id'], |
|
|
|
|
"order_amount" => intval($goods_price), |
|
|
|
|
"pay_amount" => intval($goods_price), |
|
|
|
|
"actual_amount" => intval($goods_price), |
|
|
|
|
"coupon_price" => 0, |
|
|
|
|
"coupon_id" => 0, |
|
|
|
|
"status" => 3, |
|
|
|
|