diff --git a/app/data/controller/User.php b/app/data/controller/User.php index 4101c5c6d..5bd678f86 100644 --- a/app/data/controller/User.php +++ b/app/data/controller/User.php @@ -2,6 +2,7 @@ namespace app\data\controller; +use app\data\service\UserService; use think\admin\Controller; /** @@ -34,6 +35,15 @@ class User extends Controller $query->order('id desc')->equal('status')->dateBetween('create_at')->page(); } + /** + * 数据列表处理 + * @param array $data + */ + protected function _page_filter(array &$data) + { + UserService::instance()->buildByUid($data, 'from', 'fromer'); + } + /** * 修改用户状态 * @auth true diff --git a/app/data/service/PaymentService.php b/app/data/service/PaymentService.php index 0b937a13a..782cf8319 100644 --- a/app/data/service/PaymentService.php +++ b/app/data/service/PaymentService.php @@ -5,7 +5,6 @@ namespace app\data\service; use app\data\service\payment\AlipayPaymentService; use app\data\service\payment\JoinPaymentService; use app\data\service\payment\WechatPaymentService; -use think\admin\Service; use think\App; use think\Container; use think\Exception; @@ -158,30 +157,33 @@ abstract class PaymentService } elseif (stripos($type, 'joinpay_') === 0) { return static::$driver[$code] = Container::getInstance()->make(JoinPaymentService::class, $vars); } else { - throw new \think\Exception(sprintf('支付驱动[%s]未定义', $type)); + throw new Exception(sprintf('支付驱动[%s]未定义', $type)); } } /** - * 根据通道编号获取配置参数 + * 获取通道配置参数 * @param string $code + * @param array $payment * @return array [code,type,params] * @throws Exception */ - public static function config(string $code): array + public static function config(string $code, array $payment = []): array { try { - $map = ['code' => $code, 'status' => 1, 'deleted' => 0]; - $payment = app()->db->name('DataPayment')->where($map)->find(); if (empty($payment)) { - throw new \think\Exception("支付通道[#{$code}]禁用关闭"); + $map = ['code' => $code, 'status' => 1, 'deleted' => 0]; + $payment = app()->db->name('DataPayment')->where($map)->find(); + } + if (empty($payment)) { + throw new Exception("支付通道[#{$code}]禁用关闭"); } $params = @json_decode($payment['content'], true); if (empty($params)) { - throw new \think\Exception("支付通道[#{$code}]配置无效"); + throw new Exception("支付通道[#{$code}]配置无效"); } if (empty(static::TYPES[$payment['type']])) { - throw new \think\Exception("支付通道[@{$payment['type']}]匹配失败"); + throw new Exception("支付通道[@{$payment['type']}]匹配失败"); } return [$payment['code'], $payment['type'], $params]; } catch (\Exception $exception) { @@ -233,10 +235,9 @@ abstract class PaymentService */ protected function createPaymentAction(string $orderNo, string $paymentTitle, string $paymentAmount) { - // 创建支付记录 $this->app->db->name('DataPaymentItem')->insert([ 'payment_code' => $this->code, 'payment_type' => $this->type, - 'order_name' => $paymentTitle, 'order_amount' => $paymentAmount, 'order_no' => $orderNo, + 'order_amount' => $paymentAmount, 'order_name' => $paymentTitle, 'order_no' => $orderNo, ]); } diff --git a/app/data/service/UserService.php b/app/data/service/UserService.php index 622b01f6c..ffabca3d7 100644 --- a/app/data/service/UserService.php +++ b/app/data/service/UserService.php @@ -57,17 +57,13 @@ class UserService extends Service * @param string $type 接口类型 * @param integer $uuid 用户UID * @return array - * @throws \think\Exception - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException */ public function get(string $type, int $uuid): array { $user = $this->app->db->name('DataUser')->where(['id' => $uuid, 'deleted' => 0])->findOrEmpty(); - $data = $this->app->db->name('DataUserToken')->where(['uid' => $uuid, 'type' => $type])->findOrEmpty(); - [$state, $message] = $this->checkUserToken($type, $data['token'] ?? '', $data); - if (empty($state)) throw new \think\Exception($message); + $data = $this->app->db->name('DataUserToken')->where(['uid' => $uuid, 'type' => $type])->where(function ($query) { + $query->where(['tokenv' => ''])->whereOr(['tokenv' => $this->_buildTokenVerify()]); + })->findOrEmpty(); unset($user['deleted'], $user['password']); $user['token'] = ['token' => $data['token'], 'expire' => $data['time']]; return $user; @@ -80,10 +76,7 @@ class UserService extends Service * @param string $type 接口类型 * @param boolean $force 强刷令牌 * @return array - * @throws \think\Exception - * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException */ public function set(array $map, array $data, string $type, bool $force = false): array { @@ -170,7 +163,7 @@ class UserService extends Service return [0, '请重新登录,登录认证无效', 0, 0]; } elseif ($data['time'] < time()) { return [0, '请重新登录,登录认证已失效', 0, 0]; - } elseif ($data['tokenv'] !== $this->_buildTokenVerify()) { + } elseif ($data['tokenv'] !== $this->_buildTokenVerify() && $token !== 'token') { return [0, '请重新登录,客户端已更换', 0, 0]; } else { $this->expireUserToken($type, $token); @@ -191,7 +184,7 @@ class UserService extends Service if (count($list) < 1) return $list; $uids = array_unique(array_column($list, $keys)); $users = $this->app->db->name('DataUser')->whereIn('id', $uids)->column($column, 'id'); - foreach ($list as &$vo) $vo[$bind] = $users[$vo['uid']] ?? []; + foreach ($list as &$vo) $vo[$bind] = $users[$vo[$keys]] ?? []; return $list; } diff --git a/app/data/view/payment/index_search.html b/app/data/view/payment/index_search.html index c4984ce9d..fcdaae482 100644 --- a/app/data/view/payment/index_search.html +++ b/app/data/view/payment/index_search.html @@ -7,6 +7,7 @@ +
@@ -21,11 +22,13 @@
+
+
+
+ - \ No newline at end of file diff --git a/app/data/view/shop_order_send/index_search.html b/app/data/view/shop_order_send/index_search.html index 16790d980..c5efe9b13 100644 --- a/app/data/view/shop_order_send/index_search.html +++ b/app/data/view/shop_order_send/index_search.html @@ -7,29 +7,34 @@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/data/view/shop_truck_company/index_search.html b/app/data/view/shop_truck_company/index_search.html index 94d06545a..b4c696232 100644 --- a/app/data/view/shop_truck_company/index_search.html +++ b/app/data/view/shop_truck_company/index_search.html @@ -7,18 +7,21 @@ +
+
+
diff --git a/app/data/view/shop_truck_template/index_search.html b/app/data/view/shop_truck_template/index_search.html index b4ae831b0..334f0de6a 100644 --- a/app/data/view/shop_truck_template/index_search.html +++ b/app/data/view/shop_truck_template/index_search.html @@ -7,18 +7,21 @@ +
+
+
diff --git a/app/data/view/user/index.html b/app/data/view/user/index.html index 91d66dd87..e1bd19eb9 100644 --- a/app/data/view/user/index.html +++ b/app/data/view/user/index.html @@ -8,12 +8,10 @@ - + - 姓名信息 - 所在区域 + 用户信息 + 推荐人信息 注册时间 @@ -36,7 +34,21 @@
手机:{$vo.phone|default='-'}
- {$vo.region_province|default=''}{$vo.region_city|default=''}{$vo.region_area|default=''} + + {notempty name='vo.fromer'} +
+
+ {notempty name='vo.fromer.username'} +
姓名:{$vo.fromer.username|default='-'}
+ {else} +
昵称:{$vo.fromer.nickname|default='-'}
+ {/notempty} +
手机:{$vo.fromer.phone|default='-'}
+
+ {else} +
没有推荐人
+ {/notempty} + 使用状态:{if $vo.status eq 0}已冻结{elseif $vo.status eq 1}已激活{/if}
注册时间:{$vo.create_at|format_datetime} diff --git a/app/data/view/user/index_search.html b/app/data/view/user/index_search.html index 8a59a0293..d1d18c3fa 100644 --- a/app/data/view/user/index_search.html +++ b/app/data/view/user/index_search.html @@ -7,17 +7,20 @@ +
- +
+
+
+