From 2f267ddf98a76671c72a96804c85a8d2b6ba0719 Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Wed, 31 Jan 2024 15:30:54 +0800 Subject: [PATCH] 1 --- app/api/controller/Server.php | 4 +++- app/api/service/identity/PaySuccess.php | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/api/controller/Server.php b/app/api/controller/Server.php index 20f6f6d1..2239f25e 100644 --- a/app/api/controller/Server.php +++ b/app/api/controller/Server.php @@ -47,6 +47,8 @@ class Server extends Controller { $server_name = $this->request->post('server_name'); $category_id = intval($this->request->post('category_id')); + $order_field = $this->request->post('order_field'); + $order_sort = $this->request->post('order_sort', 'desc'); $where = []; if ($server_name) { $where[] = ['server.server_name', 'like', "%$server_name%"]; @@ -56,7 +58,7 @@ class Server extends Controller } $where[] = ['server.status', '=', 1]; $model = new \app\api\model\Server(); - $list = $model->getList($where); + $list = $model->getList($where, $order_field, $order_sort); $data['list'] = $list->items(); $data['total'] = $list->total(); if (!$list->isEmpty()) { diff --git a/app/api/service/identity/PaySuccess.php b/app/api/service/identity/PaySuccess.php index d12bc926..c10b34f5 100644 --- a/app/api/service/identity/PaySuccess.php +++ b/app/api/service/identity/PaySuccess.php @@ -356,7 +356,7 @@ class PaySuccess extends BaseService $orderInfo = $this->orderInfo; $userInfo = $this->userInfo; //判断当前用户角色 - $orderType = $orderInfo['type']; + $orderType = $orderInfo['order_type']; $userType = $userInfo['user_type']; if ($userType == UserTypeEnum::STORE) { return; @@ -364,15 +364,25 @@ class PaySuccess extends BaseService $userModel = new UserModel(); $up = []; $time = date('Y-m-d'); - if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) { - $time = $userInfo['effective_time']; - } //已经是会员或者未开通会员 if ($orderType == IdentityEnum::MEMBER && $userType != UserTypeEnum::DEALER) { $up['user_type'] = UserTypeEnum::MEMBER; + //已经是会员 + if ($userType == UserTypeEnum::MEMBER) { + //是否到期 + if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) { + $time = $userInfo['effective_time']; + } + } } else { - //分销商 $up['user_type'] = UserTypeEnum::DEALER; + //已经是分销商 + if ($userType == UserTypeEnum::DEALER) { + //是否到期 + if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) { + $time = $userInfo['effective_time']; + } + } if (!User::isDealerUser($userInfo['user_id'])) { // 新增分销商用户 User::add($userInfo['user_id'], [ @@ -383,5 +393,6 @@ class PaySuccess extends BaseService } $up['effective_time'] = date("Y-m-d", strtotime("+{$orderInfo['month']} months", strtotime($time))); $userModel->where(['user_id' => $userInfo['user_id']])->save($up); + } } \ No newline at end of file