From 1d97d0a0db74e447579370959c792ec4bbaa8e80 Mon Sep 17 00:00:00 2001 From: zengyyh Date: Mon, 22 Jul 2024 23:48:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Retail.php | 1 + app/api/controller/User.php | 8 ++++++++ app/api/model/RetailOrder.php | 5 ++++- app/api/service/Retail/Payment.php | 16 ++++++++-------- app/common/model/Retail.php | 4 ---- app/store/controller/Retail.php | 7 ++++--- app/store/model/Retail.php | 7 ++++--- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/app/api/controller/Retail.php b/app/api/controller/Retail.php index a0613ede..74227634 100644 --- a/app/api/controller/Retail.php +++ b/app/api/controller/Retail.php @@ -17,6 +17,7 @@ use app\api\model\RetailOrder as RetailOrderModel; use app\api\model\Agreement as AgreementModel; use app\common\model\RetailDescribe as RetailDescribeModel; use app\api\service\order\Checkout as CheckoutService; +use app\api\service\User as UserService; class Retail extends Controller { diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 58283d10..afd73588 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -19,6 +19,7 @@ use app\api\model\User as UserModel; use app\api\model\user\BalanceLog; use app\api\model\user\GoodSource as GoodsSourceModel; use app\api\model\user\InvoiceOrder; +use app\api\model\RetailOrder as RetailOrderModel; use app\api\model\user\UserCoupon; use app\api\model\user\UserInvoice; use app\api\model\UserCoupon as UserCouponModel; @@ -51,6 +52,7 @@ class User extends Controller { $user_id = UserService::getCurrentLoginUserId(); UserModel::where('user_id', $user_id)->update(['is_delete' => 1, 'update_time' => time()]); + return $this->renderSuccess('注销成功'); } /** @@ -80,6 +82,12 @@ class User extends Controller $userInfo['withdrawal_money'] = !empty($dealer_info->money) ? $dealer_info->money : 0; $userInfo['freeze_money'] = !empty($dealer_info->freeze_money) ? $dealer_info->freeze_money : 0; } + $retailOrderList = RetailOrderModel::getRetailOrder($userInfo['user_id']); + if(!empty($retailOrderList)){ + $userInfo['retail'] = 1; + }else{ + $userInfo['retail'] = 0; + } return $this->renderSuccess(compact('userInfo')); } diff --git a/app/api/model/RetailOrder.php b/app/api/model/RetailOrder.php index 2d682503..81c2c4d7 100644 --- a/app/api/model/RetailOrder.php +++ b/app/api/model/RetailOrder.php @@ -15,6 +15,9 @@ use app\common\model\RetailOrder as RetailOrderModel; class RetailOrder extends RetailOrderModel { - + public static function getRetailOrder($order_id) + { + return self::where('order_id', $order_id)->where('pay_status',20)->select(); + } } \ No newline at end of file diff --git a/app/api/service/Retail/Payment.php b/app/api/service/Retail/Payment.php index 9e9ea07f..23f78af5 100644 --- a/app/api/service/Retail/Payment.php +++ b/app/api/service/Retail/Payment.php @@ -100,11 +100,11 @@ class Payment extends BaseService // 构建第三方支付请求的参数 $payment = $this->unifiedorder($extra); // 记录第三方交易信息 - $order_type = OrderTypeEnum::MEMBER;//开通会员 - if ($this->orderInfo['order_type'] == IdentityEnum::DEALER) { - $order_type = OrderTypeEnum::DEALER;//开通分销商 - } - $this->recordPaymentTrade($payment, $order_type); + // $order_type = OrderTypeEnum::MEMBER;//开通会员 + // if ($this->orderInfo['order_type'] == IdentityEnum::DEALER) { + // $order_type = OrderTypeEnum::DEALER;//开通分销商 + // } + // $this->recordPaymentTrade($payment, $order_type); // 返回结果 return compact('payment'); } @@ -167,9 +167,9 @@ class Payment extends BaseService if (UserService::isStore()) { throwError('非法操作'); } - if (UserService::isDealerMember() && $info['type'] != IdentityEnum::DEALER) { - throwError('非法操作'); - } + // if (UserService::isDealerMember() && $info['type'] != IdentityEnum::DEALER) { + // throwError('非法操作'); + // } if (!$model->createOrder($info->toArray(), $this->method)) { throwError($model->getError() ?: '创建订单失败'); } diff --git a/app/common/model/Retail.php b/app/common/model/Retail.php index 8cc5eb98..7bf12dfd 100644 --- a/app/common/model/Retail.php +++ b/app/common/model/Retail.php @@ -30,10 +30,6 @@ class Retail extends BaseModel // 更新时间字段 protected $updateTime = 'update_time'; - public function getList(array $where) - { - return $this->where($where)->order('sort', 'asc')->select(); - } /** * @notes:详情 diff --git a/app/store/controller/Retail.php b/app/store/controller/Retail.php index 73aebb0c..d1466370 100644 --- a/app/store/controller/Retail.php +++ b/app/store/controller/Retail.php @@ -27,13 +27,14 @@ class Retail extends Controller public function list(): Json { $where = []; - $type = $this->request->post('retailType'); + $type = $this->request->get('retailType'); + $pageSize = intval($this->request->get('pageSize')); if ($type) { $where['retail_type'] = $type; } - // $model = new RetailModel(); + $model = new RetailModel(); // $list = $model->getList($where); - $list = RetailModel::withoutGlobalScope()->where($where)->select(); + $list = $model->getList($where,$pageSize); return $this->renderSuccess(compact('list')); } diff --git a/app/store/model/Retail.php b/app/store/model/Retail.php index 5e22ff2a..b53a9963 100644 --- a/app/store/model/Retail.php +++ b/app/store/model/Retail.php @@ -17,9 +17,10 @@ use app\common\model\Retail as RetailModel; class Retail extends RetailModel { - public function getList(array $where) - { - return $this->where($where)->order('sort', 'asc')->select(); + public function getList(array $where ,int $pageSize ): \think\Paginator + { + return $this->where($where)->order('sort', 'asc') + ->paginate($pageSize); } /**