diff --git a/app/command/brand.php b/app/command/brand.php index aab9536..763d67f 100644 --- a/app/command/brand.php +++ b/app/command/brand.php @@ -96,7 +96,12 @@ class brand extends Command $all_value = $brandGongxian+$v['all_value']; //贡献值自动转换为超级积分 暂定1:1 $superBrand = $all_value; - //超级积分自动转换为增值积分 按照每天的比例 + //超级积分自动转换为增值积分 按照每天的比例 这个是重点 + + + + + $brandAdd = $superBrand; $user = userModel::getDB()->where('uid', $v['uid'])->find(); diff --git a/app/common/repositories/store/order/PresellOrderRepository.php b/app/common/repositories/store/order/PresellOrderRepository.php index 6a1aff5..a692cc7 100644 --- a/app/common/repositories/store/order/PresellOrderRepository.php +++ b/app/common/repositories/store/order/PresellOrderRepository.php @@ -110,7 +110,7 @@ class PresellOrderRepository extends BaseRepository ]); $this->paySuccess($order); }); - return app('json')->status('success', '余额支付成功', ['order_id' => $order['presell_order_id']]); + return app('json')->status('success', '支付成功', ['order_id' => $order['presell_order_id']]); } public function paySuccess(PresellOrder $order, $is_combine = 0, array $subOrders = []) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index c70250f..5dcaea7 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -899,7 +899,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository ) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus]; } - public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post) + public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, $pay_image = '', $pay_type_2 = '') { $uid = $user->uid; $orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true); @@ -1094,6 +1094,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository 'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'], 'pay_type' => $pay_type, 'user_address_id' => $user_address['address_id'] ?? 0, + 'pay_image' => $pay_image ?? '', + 'pay_type_2' => $pay_type_2 ?? '' ]; $allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']); $orderList[] = $_order; diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index a847aa9..a506888 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -80,7 +80,7 @@ class StoreOrderRepository extends BaseRepository const TYPE_SN_PRESELL = 'wxp'; const TYPE_SN_USER_ORDER = 'wxs'; const TYPE_SN_USER_RECHARGE = 'wxu'; - + public $pay_type_2; const TYPE_SN_REFUND = 'rwx'; /** @@ -101,11 +101,11 @@ class StoreOrderRepository extends BaseRepository * @author xaboy * @day 2020/10/22 */ - public function pay(string $type, User $user, StoreGroupOrder $groupOrder, $return_url = '', $isApp = false) + public function pay(string $type, User $user, StoreGroupOrder $groupOrder, $return_url = '', $isApp = false, $pay_type_2 = '') { if ($type === 'balance') { - return $this->payBalance($user, $groupOrder); + return $this->payBalance($user, $groupOrder, $pay_type_2); } if (in_array($type, ['weixin', 'alipay'], true) && $isApp) { @@ -128,27 +128,34 @@ class StoreOrderRepository extends BaseRepository * @author xaboy * @day 2020/6/9 */ - public function payBalance(User $user, StoreGroupOrder $groupOrder) + public function payBalance(User $user, StoreGroupOrder $groupOrder, $pay_type_2 = '') { + $this->pay_type_2 = $pay_type_2; if (!systemConfig('yue_pay_status')) throw new ValidateException('未开启余额支付'); - if ($user['now_money'] < $groupOrder['pay_price']) + if ($user['now_money'] < $groupOrder['pay_price'] && $pay_type_2 != 1) throw new ValidateException('余额不足,请更换支付方式'); Db::transaction(function () use ($user, $groupOrder) { $user->now_money = bcsub($user->now_money, $groupOrder['pay_price'], 2); $user->save(); $userBillRepository = app()->make(UserBillRepository::class); + + $memo = '余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品'; + if ($this->pay_type_2 == 1) { + $memo = '线下支付' . floatval($groupOrder['pay_price']) . '元购买商品'; + } + $userBillRepository->decBill($user['uid'], 'now_money', 'pay_product', [ 'link_id' => $groupOrder['group_order_id'], 'status' => 1, 'title' => '购买商品', 'number' => $groupOrder['pay_price'], - 'mark' => '余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品', + 'mark' => $memo, 'balance' => $user->now_money ]); $this->paySuccess($groupOrder); }); - return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]); + return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]); } public function changePayType(StoreGroupOrder $groupOrder, int $pay_type) @@ -193,6 +200,8 @@ class StoreOrderRepository extends BaseRepository $groupOrder->paid = 1; $groupOrder->pay_time = $time; $groupOrder->is_combine = $is_combine; + + $orderStatus = []; $groupOrder->append(['orderList.orderProduct']); $flag = true; diff --git a/app/controller/api/store/order/StoreOrder.php b/app/controller/api/store/order/StoreOrder.php index d3dc3ac..6f2a987 100644 --- a/app/controller/api/store/order/StoreOrder.php +++ b/app/controller/api/store/order/StoreOrder.php @@ -71,7 +71,6 @@ class StoreOrder extends BaseController public function v2CreateOrder(StoreCartRepository $cartRepository, StoreOrderCreateRepository $orderCreateRepository) { //是线下还是线上 - $cartId = (array)$this->request->param('cart_id', []); $addressId = (int)$this->request->param('address_id'); $couponIds = (array)$this->request->param('use_coupon', []); @@ -104,7 +103,8 @@ class StoreOrder extends BaseController // return app('json')->fail('请选择地址'); $groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post) { - return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post); + return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, + $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post,$this->request->param('pay_image'),$this->request->param('pay_type_2')); }); if ($groupOrder['pay_price'] == 0) { @@ -115,7 +115,8 @@ class StoreOrder extends BaseController return app('json')->success(['order_id' => $groupOrder->group_order_id]); } try { - return $this->repository->pay($payType, $this->request->userInfo(), $groupOrder, $this->request->param('return_url'), $this->request->isApp()); + + return $this->repository->pay($payType, $this->request->userInfo(), $groupOrder, $this->request->param('return_url'), $this->request->isApp(),$this->request->param('pay_type_2')); } catch (\Exception $e) { return app('json')->status('error', $e->getMessage(), ['order_id' => $groupOrder->group_order_id]); } diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index 1ade3f8..8a6cc16 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -413,7 +413,7 @@ class User extends BaseController 'image' => $this->request->param('image'), 'price' => $price, 'ctime' => date('Y-m-d H:i:s'), - 'memo' => '发起提现申请' .$price.'贡献值', + 'memo' => '发起提现申请' . $price . '贡献值', 'user_id' => $this->user->uid, ]); @@ -434,18 +434,43 @@ class User extends BaseController //获取提现记录 public function getAreaList() { - $type = ','.$this->request->param('type').','; + $type = ',' . $this->request->param('type') . ','; - $product_list = Product::getDB()->alias('a') + $info = Product::getDB()->alias('a') ->leftJoin('StoreSpu b', 'a.product_id = b.product_id') ->field('a.*,b.mer_labels') - ->where('b.is_del',0) - ->where('a.is_del',0) - ->where('a.is_show',1) - ->where('a.status',1) - ->where('a.is_used',1) - ->where('b.mer_labels',$type) - ->page((int)$this->request->param('page'), $this->request->param('limit'))->select()->toArray(); + ->where('b.is_del', 0) + ->where('a.is_del', 0) + ->where('a.is_show', 1) + ->where('a.status', 1) + ->where('a.is_used', 1) + ->where('b.mer_labels', $type); + + if(!empty($this->request->param('priceSort'))){ + if($this->request->param('priceSort') == 1){ + $info->order('a.price asc'); + } + + if($this->request->param('priceSort') == 2){ + $info->order('a.price desc'); + } + } + + if(!empty($this->request->param('timeSort'))){ + if($this->request->param('timeSort') == 1){ + $info->order('a.create_time asc'); + } + + if($this->request->param('timeSort') == 2){ + $info->order('a.create_time desc'); + } + } + + if(!empty($this->request->param('keyword'))){ + $info->whereLike('a.store_name', "%{$this->request->param('keyword')}%"); + } + + $product_list = $info->page((int)$this->request->param('page'), $this->request->param('limit'))->select()->toArray(); return app('json')->success($product_list);