diff --git a/app/controller/api/store/order/StoreOrder.php b/app/controller/api/store/order/StoreOrder.php index 10de3c70..3d4ae0d7 100644 --- a/app/controller/api/store/order/StoreOrder.php +++ b/app/controller/api/store/order/StoreOrder.php @@ -304,6 +304,9 @@ class StoreOrder extends BaseController return app('json')->success(['qrcode' => $this->repository->wxQrcode($id, $order->verify_code)]); } + /** + * 生成二维码 + */ public function logisticsCode($id) { $storeInfo = Db::name('store_service')->where('uid', $this->request->uid())->find(); diff --git a/app/controller/api/store/order/StoreOrderBehalf.php b/app/controller/api/store/order/StoreOrderBehalf.php index 17e81376..dd3a6523 100644 --- a/app/controller/api/store/order/StoreOrderBehalf.php +++ b/app/controller/api/store/order/StoreOrderBehalf.php @@ -67,15 +67,14 @@ class StoreOrderBehalf extends BaseController [$page, $limit] = $this->getPage(); $status = $this->request->param('status',1); - $uid= $this->request->userInfo()['uid']; - $mer_id= Db::name('store_service')->where('uid',$uid)->where('is_del',0)->value('mer_id'); - if($mer_id){ - $column= Db::name('store_order_behalf')->where('mer_id',$mer_id)->where('status',$status)->page($page)->limit($limit)->column('order_id'); - if($column){ - $where['order_id']=$column; - return app('json')->success($this->repository->getList($where, 1, 100)); - - } + $uid = $this->request->userInfo()['uid']; + $mer_id = Db::name('store_service')->where('uid', $uid)->where('is_del', 0)->value('mer_id'); + if ($mer_id) { + $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where('status', $status)->page($page)->limit($limit)->column('order_id'); + if ($column) { + $where['order_id'] = $column; + return app('json')->success($this->repository->getList($where, 1, 100)); + } } return app('json')->success([]); } @@ -98,14 +97,22 @@ class StoreOrderBehalf extends BaseController } /** - * @return mixed - * @author xaboy - * @day 2020/6/10 + * 生成二维码 */ - public function number() + public function logisticsCode($id) { - $productType = $this->request->param('product_type', 0); - return app('json')->success($this->repository->userOrderNumber($this->request->uid(), $productType)); - } + $status = $this->request->param('status',1); + $order_id = $this->request->param('order_id',0); + $uid = $this->request->userInfo()['uid']; + $mer_id = Db::name('store_service')->where('uid', $uid)->where('is_del', 0)->value('mer_id'); + if ($mer_id) { + $order_id = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where('status', $status)->where('order_id',$order_id)->value('order_id'); + if ($order_id) { + $order = $this->repository->getWhere(['order_id' => $id,'is_del' => 0]); + return app('json')->success(['qrcode' => $this->repository->logisticsQrcode($id, $order->order_sn)]); + } + } + return app('json')->fail('信息有误:请联系官方人员'); + } } diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index b30d91f0..4e7263a3 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -115,6 +115,10 @@ class CloudWarehouse extends BaseController ->withAttr('merchant',function($value,$data){ return Db::name('merchant')->where('mer_id',$data['mer_id'])->field('mer_id,mer_name')->find(); }) + ->withAttr('sku',function($value,$data){ + $find= Db::name('store_product_attr_value')->where('mer_id',$data['mer_id'])->where('product_id',$data['product_id'])->find(); + return[''=>$find]; + }) // ->field('product_id,mer_id,store_name,bar_code,price,stock,product_type,image') ->select(); return app('json')->success(['count'=>$count,'list'=>$select]); diff --git a/app/listener/paySuccess.php b/app/listener/paySuccess.php index d528f5cd..18360221 100644 --- a/app/listener/paySuccess.php +++ b/app/listener/paySuccess.php @@ -34,7 +34,8 @@ class paySuccess $orderList = $event['groupOrder']['orderList']; foreach ($orderList as $k => $order) { $merchant = Merchant::find($order['mer_id']); - if($merchant['type_id']==13){ + //添加到代发订单表里 + if($merchant['type_id']==Merchant::TypeSupplyChain){ $codes=explode(',',$order['user_address_code']); if(count($codes)>4){ $merchant_two= Db::name('merchant')->where('street_id',$codes[3])->where('type_id',17)->where('category_id',$merchant['category_id'])->find(); diff --git a/route/api.php b/route/api.php index ca939186..264cfb1e 100644 --- a/route/api.php +++ b/route/api.php @@ -347,6 +347,7 @@ Route::group('api/', function () { //代发货订单 Route::group('behalf_admin', function () { Route::get('/order_list', '/lst'); + Route::get('/code', '/logisticsCode'); })->prefix('api.store.order.StoreOrderBehalf'); //管理员申请转账 Route::get('admin/:merId/apply', 'api.store.merchant.Merchant/apply');