Kirin hace 2 meses
padre
commit
6317cffadf

+ 3 - 3
app/controller/admin/user/User.php

@@ -114,7 +114,7 @@ class User extends AdminBaseController
             ['area', 0],
             ['street', 0],
         ]);
-        $this->validate(['pwd' => $data['pwd'], 'phone' => $data['phone']], app()->make(UserValidate::class));
+        $this->validate(['pwd' => $data['pwd'], 'phone' => $data['phone']], new UserValidate());
         if ($this->service->be(['phone' => $data['phone']])) {
             return $this->error('手机号已经存在不能添加相同的手机号用户');
         }
@@ -343,7 +343,7 @@ class User extends AdminBaseController
         if (!$userInfo) {
             return $this->error('用户不存在');
         }
-        if ($data['spread_uid'] != -1) {
+        if ($data['spread_uid'] > 0 && $data['spread_uid'] != $userInfo['spread_uid']) {
             $spreadUid = $data['spread_uid'];
             if ($id == $spreadUid) {
                 return $this->error('上级推广人不能为自己');
@@ -396,7 +396,7 @@ class User extends AdminBaseController
      */
     public function delete($id)
     {
-        if (!$id) return app('json')->fail('用户不存在');
+        if (!$id) return $this->error('用户不存在');
         event('user.cancelUser', [$id]);
         return $this->success('注销成功');
     }

+ 6 - 1
app/model/user/UserLevel.php

@@ -92,7 +92,12 @@ class UserLevel extends BaseModel
      */
     public function searchValidAttr($query, $value)
     {
-        if ($value) $query->where('valid_time', '>', time())->whereOr('is_forever', 1)->where('status', 1);
+        if ($value)
+            $query->where(function ($q) {
+                $q->where(function ($qq) {
+                    $qq->where('valid_time', '>=', time())->whereOr('is_forever', 1);
+                })->where('status', 1);
+            });
     }
 
     /**

+ 3 - 2
app/services/user/UserServices.php

@@ -14,6 +14,7 @@ namespace app\services\user;
 
 use app\model\user\User;
 use app\services\system\config\SystemUserLevelServices;
+use app\services\wechat\WechatUserServices;
 use qiniu\basic\BaseServices;
 use qiniu\exceptions\AdminException;
 use think\db\exception\DataNotFoundException;
@@ -201,7 +202,7 @@ class UserServices extends BaseServices
     {
         /** @var UserWechatuserServices $userWechatUser */
         $userWechatUser = app()->make(UserWechatuserServices::class);
-        $fields = 'u.*,w.country,w.province,w.city,w.sex,w.unionid,w.openid,w.user_type as w_user_type,w.groupid,w.tagid_list,w.subscribe,w.subscribe_time';
+        $fields = 'u.*,w.country,w.province,w.city,u.sex,w.unionid,w.openid,w.user_type as w_user_type,w.groupid,w.tagid_list,w.subscribe,w.subscribe_time';
         [$list, $count] = $userWechatUser->getWhereUserList($where, $fields);
         if ($list) {
             /** @var UserGroupServices $userGroup */
@@ -288,7 +289,7 @@ class UserServices extends BaseServices
         $edit['mark'] = $data['mark'];
         $edit['is_promoter'] = (isset($data['is_promoter']) && $data['is_promoter'] >= 0) ? $data['is_promoter'] : $user['is_promoter'];
         $edit['group_id'] = $data['group_id'];
-        if ($data['spread_uid'] != -1) {
+        if ($data['spread_uid'] >= 0 && $data['spread_uid'] != $user['spread_uid']) {
             /** @var UserSpreadServices $spreadService */
             $spreadService = app()->make(UserSpreadServices::class);
             $spreadService->adminSetSpread($user['uid'], $data['spread_uid']);

+ 9 - 1
app/services/user/UserSpreadServices.php

@@ -128,9 +128,17 @@ class UserSpreadServices extends BaseServices
      */
     public function adminSetSpread(int $uid, int $spread_uid, int $spread_time = 0)
     {
-        if (!$uid || !$spread_uid) return false;
+        if (!$uid) return false;
         /** @var UserServices $userServices */
         $userServices = app()->make(UserServices::class);
+        if (!$spread_uid) {
+            $this->search(['uid' => $uid])->delete();
+            $user = $userServices->getUserInfo($uid);
+            $old_spread = $user['spread_uid'];
+            $user['spread_uid'] = 0;
+            $user->save();
+            if ($old_spread > 0) $userServices->setUserSpreadCount($old_spread);
+        }
 
         $sp = $spread_uid;
         $userList = $userServices->getColumn([], 'uid,spread_uid', 'uid');

+ 32 - 0
eb_store_product_description.sql

@@ -0,0 +1,32 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : 幸福家【新】
+ Source Server Type    : MySQL
+ Source Server Version : 50744
+ Source Host           : localhost:3306
+ Source Schema         : nanjinglongzhu_c
+
+ Target Server Type    : MySQL
+ Target Server Version : 50744
+ File Encoding         : 65001
+
+ Date: 03/01/2025 14:55:10
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for eb_store_product_description
+-- ----------------------------
+DROP TABLE IF EXISTS `eb_store_product_description`;
+CREATE TABLE `eb_store_product_description`  (
+  `product_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品ID',
+  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品详情',
+  `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '商品类型',
+  INDEX `product_id`(`product_id`, `type`) USING BTREE,
+  INDEX `type`(`type`, `product_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品详情表' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 5 - 2
qiniu/command/stubs/search/id.stub

@@ -8,6 +8,9 @@
     {
         if (is_array($value))
             $query->whereIn('{%field%}', $value);
-        else
-            $query->where('{%field%}', $value);
+        else {
+            if ($value != '') {
+                $query->where('{%field%}', $value);
+            }
+        }
     }