diff --git a/app/common/repositories/store/order/StoreOtherOrderRepository.php b/app/common/repositories/store/order/StoreOtherOrderRepository.php index 8a6b4c84..8d6a19e0 100644 --- a/app/common/repositories/store/order/StoreOtherOrderRepository.php +++ b/app/common/repositories/store/order/StoreOtherOrderRepository.php @@ -201,42 +201,7 @@ class StoreOtherOrderRepository extends BaseRepository $order->transaction_id = $subOrders[$order->order_sn]['transaction_id']; } $presell = false; - //todo 等待付尾款 - if ($order->activity_type == 2) { - $_make = app()->make(ProductPresellSkuRepository::class); - if ($order->orderProduct[0]['cart_info']['productPresell']['presell_type'] == 2) { - $order->status = 10; - $presell = true; - } else { - $_make->incCount($order->orderProduct[0]['activity_id'], $order->orderProduct[0]['product_sku'], 'two_pay'); - } - $_make->incCount($order->orderProduct[0]['activity_id'], $order->orderProduct[0]['product_sku'], 'one_pay'); - } else if ($order->activity_type == 4) { - $order->status = 9; - $order->save(); - $group_buying_id = app()->make(ProductGroupBuyingRepository::class)->create( - $groupOrder->user, - $order->orderProduct[0]['cart_info']['activeSku']['product_group_id'], - $order->orderProduct[0]['activity_id'], - $order->order_id - ); - $order->orderProduct[0]->activity_id = $group_buying_id; - $order->orderProduct[0]->save(); - } else if ($order->activity_type == 3) { - //更新助力状态 - app()->make(ProductAssistSetRepository::class)->changStatus($order->orderProduct[0]['activity_id']); - } - - //更新委托订单处理 - if ($order->activity_type == 99) { - $cartIdArray = explode(',', $order->cart_id); - $ecartList = Db::name('store_cart')->whereIn('cart_id', $cartIdArray)->select(); - foreach ($ecartList as $ecart) { - if (!empty($ecart['source_id'])) { - Db::name('community')->where('community_id', $ecart['source_id'])->update(['entrust_order_id' => $order->order_id ?? 0]); - } - } - } + // 订单的类型 0 发货 1 自提 if ($order->order_type == 1 && $order->status != 10) { $order->verify_code = $this->verifyCode(); @@ -253,13 +218,6 @@ class StoreOtherOrderRepository extends BaseRepository 'user_type' => $storeOrderStatusRepository::U_TYPE_USER, ]; - //TODO 成为推广员 - foreach ($order->orderProduct as $product) { - if ($flag && $product['cart_info']['product']['is_gift_bag']) { - app()->make(UserRepository::class)->promoter($order->uid); - $flag = false; - } - } if ($order->order_type == 0) { //发起队列物流信息处理 //event('order.sendGoodsCode', $order); @@ -305,36 +263,7 @@ class StoreOtherOrderRepository extends BaseRepository } if (!$presell) { - if ($order['extension_one'] > 0) { - $finance[] = [ - 'order_id' => $order->order_id, - 'order_sn' => $order->order_sn, - 'user_info' => $groupOrder->user->nickname, - 'user_id' => $uid, - 'financial_type' => 'brokerage_one', - 'financial_pm' => 0, - 'type' => 1, - 'number' => $order['extension_one'], - 'mer_id' => $order->mer_id, - 'financial_record_sn' => $financeSn . ($i++) - ]; - } - - if ($order['extension_two'] > 0) { - $finance[] = [ - 'order_id' => $order->order_id, - 'order_sn' => $order->order_sn, - 'user_info' => $groupOrder->user->nickname, - 'user_id' => $uid, - 'financial_type' => 'brokerage_two', - 'financial_pm' => 0, - 'type' => 1, - 'number' => $order['extension_two'], - 'mer_id' => $order->mer_id, - 'financial_record_sn' => $financeSn . ($i++) - ]; - } - + if ($order['commission_rate'] > 0) { $finance[] = [ 'order_id' => $order->order_id, @@ -409,14 +338,8 @@ class StoreOtherOrderRepository extends BaseRepository 'id' => $order->order_id ] ], $order->mer_id); - //自动打印订单 - $this->autoPrinter($order->order_id, $order->mer_id); } - //分销判断 - // if ($groupOrder->user->spread_uid) { - // Queue::push(UserBrokerageLevelJob::class, ['uid' => $groupOrder->user->spread_uid, 'type' => 'spread_pay_num', 'inc' => 1]); - // Queue::push(UserBrokerageLevelJob::class, ['uid' => $groupOrder->user->spread_uid, 'type' => 'spread_money', 'inc' => $groupOrder->pay_price]); - // } + app()->make(UserRepository::class)->update($groupOrder->uid, [ 'pay_count' => Db::raw('pay_count+' . count($groupOrder->orderList)), 'pay_price' => Db::raw('pay_price+' . $groupOrder->pay_price), @@ -445,21 +368,6 @@ class StoreOtherOrderRepository extends BaseRepository Queue::push(UserBrokerageLevelJob::class, ['uid' => $groupOrder->uid, 'type' => 'pay_money', 'inc' => $groupOrder->pay_price]); Queue::push(UserBrokerageLevelJob::class, ['uid' => $groupOrder->uid, 'type' => 'pay_num', 'inc' => 1]); app()->make(UserBrokerageRepository::class)->incMemberValue($groupOrder->uid, 'member_pay_num', $groupOrder->group_order_id); - $groupOrder = $groupOrder->toArray(); - event('order.paySuccess', compact('groupOrder')); - //店内扫码支付 - if (isset($groupOrder['micro_pay']) && $groupOrder['micro_pay'] == 1) { - $order = $this->dao->search(['uid' => $groupOrder->uid])->where('group_order_id', $groupOrder->group_order_id)->find(); - $order->status = 2; - $order->verify_time = date('Y-m-d H:i:s'); - $user = $order->user; - event('order.take.before', compact('order')); - Db::transaction(function () use ($order, $user) { - $this->takeAfter($order, $user); - $order->save(); - }); - event('order.take', compact('order')); - } } diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index ecbacbe2..fa29b0a6 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -2587,15 +2587,17 @@ class ProductRepository extends BaseRepository if ($data['product_id'] && $data['type']) { switch ($data['type']) { case 'five': - $data['five'] = 5; + $data['type'] = 5; break; case 'two': $data['type'] = 6; break; case 'three': - $data['mer_id'] = 7; + $data['type'] = 7; + break; case 'seven': $data['type'] = 8; + break; } $store_product=Db::name('store_product')->where('product_id',$data['product_id'])->find(); $datas = [ diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 6d70db10..f697f7b9 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -1593,19 +1593,12 @@ class Auth extends BaseController if ($status == 1) { $repository->updateStatus($id, $data); $intention = Db::name('merchant_intention')->where('mer_intention_id', $id)->where('type', 1)->find(); - $merLicenseImage = ''; if (!empty($intention['images'])) { $merLicenseImageArray = explode(',', $intention['images']); - $merLicenseImage = $merLicenseImageArray[0] ?? ''; + app()->make(ConfigValueRepository::class)->setFormData([ + 'mer_certificate' => $merLicenseImageArray + ], $intention['mer_id']); } - $merCertificate = merchantConfig($intention['mer_id'], 'mer_certificate'); - if (!is_array($merCertificate)) { - $merCertificate = explode(',', $merCertificate); - } - $merCertificate[0] = $merLicenseImage; - app()->make(ConfigValueRepository::class)->setFormData([ - 'mer_certificate' => $merCertificate - ], $intention['mer_id']); } Db::name('merchant_intention')->where('mer_intention_id', $id)->where('type', 1)->update($updData); } else { diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index 4e899fab..576fd5d4 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -45,17 +45,21 @@ class CloudWarehouse extends BaseController */ public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '') { + + $cloud_where['street_code']=$street_code; + $cloud_where['status']=1; if($cate_pid!=0){ $cate_id=Db::name('store_category')->where('pid',$cate_pid)->where('is_show',1)->column('store_category_id'); } + if($cate_id>0){ + $cloud_where['cate_id']=$cate_id; + } $cloud_product_arr = Db::name('cloud_product') - ->whereIn('cate_id', $cate_id) - ->where('street_code', $street_code) + ->where($cloud_where) ->where(function($query){ $query->whereOr('mer_labels', '') ->whereOr('mer_labels',',5,'); - }) - ->where('status', 1)->page($page)->field('product_id,mer_labels')->select(); + })->page($page)->field('product_id,mer_labels')->select(); $cloud_product = []; foreach ($cloud_product_arr as $key => $value) { $cloud_product[] = $value['product_id']; @@ -72,13 +76,12 @@ class CloudWarehouse extends BaseController if (!$cloud_product) { return app('json')->success(['count' => 0, 'list' => []]); } - $count = Db::name('cloud_product')->whereIn('cate_id', $cate_id) - ->where('street_code', $street_code) + $count = Db::name('cloud_product') + ->where($cloud_where) ->where(function($query){ $query->whereOr('mer_labels', '') ->whereOr('mer_labels',',5,'); - }) - ->where('status', 1)->count(); + })->count(); $products = $this->spuRepository->getApiSearch($where, $page, 10, false, true); if ($products['list']) { diff --git a/app/controller/merchant/store/product/Product.php b/app/controller/merchant/store/product/Product.php index f2cd09af..54a5c341 100644 --- a/app/controller/merchant/store/product/Product.php +++ b/app/controller/merchant/store/product/Product.php @@ -454,10 +454,27 @@ class Product extends BaseController public function cloud_product_list(){ [$page, $limit] = $this->getPage(); - $product_ids=Db::name('cloud_product')->where('mer_id',$this->request->merId()) - ->page($page)->limit($limit)->column('product_id'); - $select = Db::name('store_product')->where('mer_id', $this->request->merId())->whereIn('product_id',$product_ids)->select()->toArray(); + $cloud_product_arr=Db::name('cloud_product')->where('mer_id',$this->request->merId()) + ->page($page)->limit($limit)->field('product_id,mer_labels')->select(); + $cloud_product = []; + foreach ($cloud_product_arr as $key => $value) { + $cloud_product[] = $value['product_id']; + } + $select = Db::name('store_product')->where('mer_id', $this->request->merId())->whereIn('product_id',$cloud_product)->select()->toArray(); $count = Db::name('cloud_product')->where('mer_id',$this->request->merId())->count(); + if ($select) { + foreach ($cloud_product_arr as $key => $value) { + foreach ($select as $k => $v) { + if ($value['product_id'] == $v['product_id']) { + if ($value['mer_labels'] == ',5,') { + $select[$k]['mer_labels_name'] = '五日达'; + } else { + $select[$k]['mer_labels_name'] = '次日达'; + } + } + } + } + } return app('json')->success(['list'=>$select,'count'=>$count]); } diff --git a/app/validate/merchant/MerchantUpdateValidate.php b/app/validate/merchant/MerchantUpdateValidate.php index 33e0732f..0a55eb65 100644 --- a/app/validate/merchant/MerchantUpdateValidate.php +++ b/app/validate/merchant/MerchantUpdateValidate.php @@ -21,7 +21,7 @@ class MerchantUpdateValidate extends Validate protected $failException = true; protected $rule = [ - 'mer_info|店铺简介' => 'require|max:200', + // 'mer_info|店铺简介' => 'require|max:200', 'mer_avatar|店铺头像' => 'require|max:128', 'mer_banner|店铺banner' => 'require|max:128', 'mini_banner|店铺街banner' => 'max:128',