Răsfoiți Sursa

游客问题

shish 5 ani în urmă
părinte
comite
367504d618

+ 1 - 0
app-ghs/controllers/ApplyController.php

@@ -41,6 +41,7 @@ class ApplyController extends BaseController
         $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
         $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
         $post['from'] = ApplyClass::FROM_GHS;
+        dd($post);
         $name = $post['name'] ?? '';
         if (empty($name)) {
             util::fail('名称不能为空');

+ 1 - 1
app-hd/controllers/CustomController.php

@@ -314,7 +314,7 @@ class CustomController extends BaseController
             util::fail('二次密码不一致');
         }
         $userId = $this->adminId;
-        $user = UserService::getUserInfo($userId, false);
+        $user = UserService::getUserInfo($userId);
         if (isset($user['hasPayPwd']) && $user['hasPayPwd'] == 1) {
             if (empty($old)) {
                 util::fail('请填写旧密码');

+ 2 - 2
app-hd/controllers/OrderController.php

@@ -216,7 +216,7 @@ class OrderController extends BaseController
 
         $order = OrderService::getByOrderSn($orderSn);
         $userId = $this->adminId;
-        $user = UserService::getUserInfo($userId, false);
+        $user = UserService::getUserInfo($userId);
         //验证支付密码是否正确
         UserService::validPayPassword($payPassword, $user);
         //支付前验证订单有效性
@@ -475,7 +475,7 @@ class OrderController extends BaseController
         } elseif ($payWay == 2) {
             //余额支付,验证支付密码是否正确
             $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
-            $user = UserService::getUserInfo($this->adminId, false);
+            $user = UserService::getUserInfo($this->adminId);
             UserService::validPayPassword($payPassword, $user);
             $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
             $callbackParams = [];

+ 1 - 1
app-hd/controllers/UserController.php

@@ -376,7 +376,7 @@ class UserController extends BaseController
             util::fail('二次密码不一致');
         }
         $userId = $this->adminId;
-        $user = UserService::getUserInfo($userId, false);
+        $user = UserService::getUserInfo($userId);
         if (isset($user['hasPayPwd']) && $user['hasPayPwd'] == 1) {
             if (empty($old)) {
                 util::fail('请填写旧密码');

+ 1 - 1
app-mall/controllers/BaseController.php

@@ -61,7 +61,7 @@ class BaseController extends PublicController
                 $this->customId = $customId;
             } else {
                 if (in_array($action->id, $this->guestAccess) == false) {
-                    util::fail('没有找到客户信息,无权限访问');
+                    util::fail('没有找到客户信息');
                 }
             }
         }

+ 1 - 1
app-mall/controllers/CustomController.php

@@ -3,7 +3,6 @@
 namespace mall\controllers;
 
 use bizHd\custom\classes\CustomClass;
-use Yii;
 use common\components\util;
 
 class CustomController extends BaseController
@@ -14,6 +13,7 @@ class CustomController extends BaseController
     //生成客户信息 shish 2021.5.1
     public function actionInitCustom()
     {
+        dd($this->user);
         $custom = [];
         if(!empty($this->shopId)){
             $custom = CustomClass::replaceCustom($this->sjId, $this->user, $this->shopId);

+ 2 - 2
app-mall/controllers/OrderController.php

@@ -159,7 +159,7 @@ class OrderController extends BaseController
 
         $order = OrderService::getByOrderSn($orderSn);
         $userId = $this->userId;
-        $user = UserService::getUserInfo($userId, false);
+        $user = UserService::getUserInfo($userId);
         //验证支付密码是否正确
         UserService::validPayPassword($payPassword, $user);
         //支付前验证订单有效性
@@ -395,7 +395,7 @@ class OrderController extends BaseController
         } elseif ($payWay == 2) {
             //余额支付,验证支付密码是否正确
             $payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
-            $user = UserService::getUserInfo($this->userId, false);
+            $user = UserService::getUserInfo($this->userId);
             UserService::validPayPassword($payPassword, $user);
             $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
             $callbackParams = [];

+ 1 - 1
app-mall/controllers/UserController.php

@@ -123,7 +123,7 @@ class UserController extends BaseController
             util::fail('二次密码不一致');
         }
         $userId = $this->userId;
-        $user = UserService::getUserInfo($userId, false);
+        $user = UserService::getUserInfo($userId);
         if (isset($user['hasPayPwd']) && $user['hasPayPwd'] == 1) {
             if (empty($old)) {
                 util::fail('请填写旧密码');

+ 6 - 8
biz-ghs/admin/classes/AdminClass.php

@@ -112,20 +112,18 @@ class AdminClass extends BaseClass
     }
 
     //组合员工基本信息 ssh 2019.12.9
-    public static function groupAdminBaseInfo($list, $sensitive = true)
+    public static function groupAdminBaseInfo($list)
     {
         foreach ($list as $key => $val) {
             $list[$key]['roleName'] = '';
             $list[$key]['avatar'] = imgUtil::groupImg($val['avatar']);
             $list[$key]['addDate'] = date("Y-m-d H:i", $val['addTime']);
             $list[$key]['lastLoginTime'] = date("Y-m-d H:i", $val['loginTime']);
-            //敏感信息
-            if ($sensitive) {
-                //这里需要输出值secret,否则修改密码那边会有问题
-                $list[$key]['openId'] = isset($val['openId']) && !empty($val['openId']) ? 'secret' : '';
-                $list[$key]['password'] = isset($val['password']) && !empty($val['password']) ? 'secret' : '';
-                $list[$key]['payPassword'] = isset($val['payPassword']) && !empty($val['payPassword']) ? 'secret' : '';
-            }
+
+            $list[$key]['openId'] = isset($val['openId']) && !empty($val['openId']) ? 'secret' : '';
+            $list[$key]['password'] = isset($val['password']) && !empty($val['password']) ? 'secret' : '';
+            $list[$key]['payPassword'] = isset($val['payPassword']) && !empty($val['payPassword']) ? 'secret' : '';
+
         }
         return $list;
     }

+ 2 - 12
biz-ghs/merchant/services/MerchantService.php

@@ -56,19 +56,9 @@ class MerchantService extends BaseService
         return MerchantClass::getDefaultShopId($merchant);
     }
 
-    //商家基本信息,$sensitive true 除敏感信息 ssh 2019.12.8
-    public static function getInfo($merchant, $extend, $sensitive = true)
+    //商家基本信息 ssh 2019.12.8
+    public static function getInfo($merchant, $extend)
     {
-        if ($sensitive) {
-            $delete = ['miniAppId', 'miniAppSecret', 'wxAppId', 'wxAppSecret', 'openAppId', 'wxToken', 'wxJsApiTicket', 'wxAccessToken', 'wxRefreshToken'];
-            foreach ($delete as $del) {
-                unset($merchant[$del]);
-            }
-            $deleteExtend = ['miniAppId', 'miniAccessToken', 'miniRefreshToken', 'wxPayKey', 'wxPayMerchantId', 'wxAppId'];
-            foreach ($deleteExtend as $delExtend) {
-                unset($extend[$delExtend]);
-            }
-        }
         $merchant['extend'] = $extend;
         return $merchant;
     }

+ 1 - 1
biz-ghs/shop/services/ShopAdminService.php

@@ -110,7 +110,7 @@ class ShopAdminService extends BaseService
     }
 
     //获取管理员 ssh 2020.4.21
-    public static function getAdminList($where, $sensitive = true)
+    public static function getAdminList($where)
     {
         $data = ShopAdminClass::getList('*', $where, 'addTime DESC');
         $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];

+ 1 - 2
biz-hd/admin/classes/AdminClass.php

@@ -70,7 +70,7 @@ class AdminClass extends BaseClass
         }
     }
 
-    //组合员工基本信息 $sensitive = true 表示敏感的,不要输出密码信息 ssh 2019.12.9
+    //组合员工基本信息 ssh 2019.12.9
     public static function groupAdminBaseInfo($list)
     {
         foreach ($list as $key => $val) {
@@ -94,7 +94,6 @@ class AdminClass extends BaseClass
     }
 
     //获取员工详情 ssh 2019.12.9
-    // $sensitive = true 表示敏感的,不要输出密码等信息
     public static function getAdminById($id)
     {
         $detail = AdminClass::getById($id);

+ 1 - 1
biz-hd/admin/services/ShopAdminService.php

@@ -109,7 +109,7 @@ class ShopAdminService extends BaseService
     }
 
     //获取管理员 ssh 2020.4.21
-    public static function getAdminList($where, $sensitive = true)
+    public static function getAdminList($where)
     {
         $data = ShopAdminClass::getList('*', $where, 'addTime DESC');
         $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];

+ 3 - 8
biz-hd/user/classes/UserClass.php

@@ -53,7 +53,7 @@ class UserClass extends BaseClass
     ];
 
     //组合客户基本和资产信息
-    public static function groupUserBaseInfo($list, $sensitive = true)
+    public static function groupUserBaseInfo($list)
     {
         //取客户资产
         $ids = array_column($list, 'id');
@@ -78,20 +78,15 @@ class UserClass extends BaseClass
             $list[$key] = business::formatUserAvatar($list[$key]);
             $merchantId = $val['merchantId'];
             $list[$key]['name'] = isset($merchantList[$merchantId]['name']) ? $merchantList[$merchantId]['name'] : '';
-            //敏感信息不要输出
-            if ($sensitive) {
-                unset($list[$key]['password']);
-                unset($list[$key]['payPassword']);
-            }
         }
         return $list;
     }
 
     //获取客户基本和资产信息 ssh 2019.11.30
-    public static function getUserInfo($id, $sensitive = true)
+    public static function getUserInfo($id)
     {
         $list = self::getByIds([$id]);
-        $data = self::groupUserBaseInfo($list, $sensitive);
+        $data = self::groupUserBaseInfo($list);
         return current($data);
     }
 

+ 2 - 2
biz-hd/user/services/UserService.php

@@ -40,9 +40,9 @@ class UserService extends BaseService
     }
 
     //获取客户基本和资产信息 ssh 2019.11.30
-    public static function getUserInfo($id, $sensitive = true)
+    public static function getUserInfo($id)
     {
-        return UserClass::getUserInfo($id, $sensitive);
+        return UserClass::getUserInfo($id);
     }
 
     //获取客户基本、资产和订单信息 ssh 2019.11.30

+ 5 - 8
biz-mall/admin/classes/AdminClass.php

@@ -23,7 +23,7 @@ class AdminClass extends BaseClass
     ];
 
     //组合员工基本信息 ssh 2019.12.9
-    public static function groupAdminBaseInfo($list, $sensitive = true)
+    public static function groupAdminBaseInfo($list)
     {
         $prefix = imgUtil::getPrefix();
         foreach ($list as $key => $val) {
@@ -31,13 +31,10 @@ class AdminClass extends BaseClass
             $list[$key]['avatarUrl'] = $prefix . '/retail/default-avatar.png';
             $list[$key]['addDate'] = date("Y-m-d H:i", $val['addTime']);
             $list[$key]['lastLoginTime'] = date("Y-m-d H:i", $val['loginTime']);
-            //敏感信息
-            if ($sensitive) {
-                //这里需要输出值secret,否则修改密码那边会有问题
-                $list[$key]['openId'] = isset($val['openId']) && !empty($val['openId']) ? 'secret' : '';
-                $list[$key]['password'] = isset($val['password']) && !empty($val['password']) ? 'secret' : '';
-                $list[$key]['payPassword'] = isset($val['payPassword']) && !empty($val['payPassword']) ? 'secret' : '';
-            }
+            $list[$key]['openId'] = isset($val['openId']) && !empty($val['openId']) ? 'secret' : '';
+            $list[$key]['password'] = isset($val['password']) && !empty($val['password']) ? 'secret' : '';
+            $list[$key]['payPassword'] = isset($val['payPassword']) && !empty($val['payPassword']) ? 'secret' : '';
+
         }
         return $list;
     }

+ 2 - 3
biz-mall/admin/services/ShopAdminService.php

@@ -88,8 +88,7 @@ class ShopAdminService extends BaseService
     }
 
     //获取管理员 ssh 2020.4.21
-    // $sensitive true 密码等敏感信息不显示
-    public static function getAdminList($where, $sensitive = true)
+    public static function getAdminList($where)
     {
         $data = ShopAdminClass::getList('*', $where, 'addTime DESC');
         $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
@@ -100,7 +99,7 @@ class ShopAdminService extends BaseService
         //管理员基础信息
         $ids = array_column($list, 'adminId');
         $adminInfo = AdminClass::getByIds($ids, null, 'id');
-        $adminBaseInfo = AdminClass::groupAdminBaseInfo($adminInfo, $sensitive);
+        $adminBaseInfo = AdminClass::groupAdminBaseInfo($adminInfo);
 
         $roleIds = array_column($list, 'roleId');
         $roleIds = array_filter(array_unique($roleIds));

+ 2 - 12
biz-mall/merchant/services/MerchantService.php

@@ -56,19 +56,9 @@ class MerchantService extends BaseService
         return MerchantClass::getDefaultShopId($merchant);
     }
 
-    //商家基本信息,$sensitive true 除敏感信息 ssh 2019.12.8
-    public static function getInfo($merchant, $extend, $sensitive = true)
+    //商家基本信息 ssh 2019.12.8
+    public static function getInfo($merchant, $extend)
     {
-        if ($sensitive) {
-            $delete = ['miniAppId', 'miniAppSecret', 'wxAppId', 'wxAppSecret', 'openAppId', 'wxToken', 'wxJsApiTicket', 'wxAccessToken', 'wxRefreshToken'];
-            foreach ($delete as $del) {
-                unset($merchant[$del]);
-            }
-            $deleteExtend = ['miniAppId', 'miniAccessToken', 'miniRefreshToken', 'wxPayKey', 'wxPayMerchantId', 'wxAppId'];
-            foreach ($deleteExtend as $delExtend) {
-                unset($extend[$delExtend]);
-            }
-        }
         $merchant['extend'] = $extend;
         return $merchant;
     }

+ 18 - 17
biz-mall/user/classes/UserClass.php

@@ -62,6 +62,11 @@ class UserClass extends BaseClass
         if (!empty($recent)) {
             $ids = json_decode($recent, true);
             $list = ShopClass::getShopByIds($ids);
+            foreach ($list as $key => $val) {
+                $shopName = $val['shopName'] ?? '';
+                $sjName = $val['merchantName'] ?? '';
+                $list[$key]['showName'] = $sjName . ' ' . $shopName;
+            }
         }
         return $list;
     }
@@ -84,7 +89,7 @@ class UserClass extends BaseClass
     }
 
     //组合客户基本和资产信息
-    public static function groupUserBaseInfo($list, $sensitive = true)
+    public static function groupUserBaseInfo($list)
     {
         //取客户资产
         $ids = array_column($list, 'id');
@@ -99,24 +104,15 @@ class UserClass extends BaseClass
             }
             $list[$key]['visitTimeFormat'] = $visitTime;
             $list[$key]['userAsset'] = isset($asset[$userId]) ? $asset[$userId] : [];
-            //客户发来新消息数
-            $list[$key]['unReadNum'] = ChatClass::getUnreadNum($userId);
-            $list[$key] = business::formatUserAvatar($list[$key]);
-            $list[$key]['name'] = '';
-            //敏感信息不要输出
-            if ($sensitive) {
-                unset($list[$key]['password']);
-                unset($list[$key]['payPassword']);
-            }
         }
         return $list;
     }
 
     //获取客户基本和资产信息 ssh 2019.11.30
-    public static function getUserInfo($id, $sensitive = true)
+    public static function getUserInfo($id)
     {
         $list = self::getByIds([$id]);
-        $data = self::groupUserBaseInfo($list, $sensitive);
+        $data = self::groupUserBaseInfo($list);
         return current($data);
     }
 
@@ -151,8 +147,12 @@ class UserClass extends BaseClass
         $getUserInfo['source'] = isset($getUserInfo['source']) ? $getUserInfo['source'] : 0;
         $getUserInfo['hasSubscribe'] = 0;
         //生成用户基础信息
-        $user = self::add($getUserInfo);
-        $userId = $user['id'];
+        $user = self::add($getUserInfo, true);
+        $userId = $user->id;
+        if (empty($userName)) {
+            $user->name = '游客' . $userId;
+            $user->save();
+        }
 
         //保存头像
         if (isset($getUserInfo['headImgUrl']) && !empty($getUserInfo['headImgUrl'])) {
@@ -160,12 +160,13 @@ class UserClass extends BaseClass
                 $imgUrl = $getUserInfo['headImgUrl'];
                 $currentImg = ImageService::generateAvatar(0, $imgUrl);
                 if (!empty($currentImg)) {
-                    self::updateById($userId, ['avatar' => $currentImg]);
+                    $user->avatar = $currentImg;
+                    $user->save();
                 }
             }
         }
 
-        return $user;
+        return $user->attributes;
     }
 
     public static function updateUser($originalUser, $getUserInfo)
@@ -534,7 +535,7 @@ class UserClass extends BaseClass
             $user = self::updateUser($user, $userInfo);
         }
         $custom = [];
-        if (!empty($sjId)) {
+        if (!empty($shopId)) {
             //创建客户信息
             $custom = CustomClass::replaceCustom($sjId, $user, $shopId);
         }

+ 2 - 2
biz-mall/user/services/UserService.php

@@ -38,9 +38,9 @@ class UserService extends BaseService
 	}
 	
 	//获取客户基本和资产信息 ssh 2019.11.30
-	public static function getUserInfo($id, $sensitive = true)
+	public static function getUserInfo($id)
 	{
-		return UserClass::getUserInfo($id, $sensitive);
+		return UserClass::getUserInfo($id);
 	}
 	
 	//获取客户基本、资产和订单信息 ssh 2019.11.30

+ 2 - 3
biz/shop/services/ShopAdminService.php

@@ -88,8 +88,7 @@ class ShopAdminService extends BaseService
     }
 
     //获取管理员 ssh 2020.4.21
-    // $sensitive true 密码等敏感信息不显示
-    public static function getAdminList($where, $sensitive = true)
+    public static function getAdminList($where)
     {
         $data = ShopAdminClass::getList('*', $where, 'addTime DESC');
         $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
@@ -100,7 +99,7 @@ class ShopAdminService extends BaseService
         //管理员基础信息
         $ids = array_column($list, 'adminId');
         $adminInfo = AdminClass::getByIds($ids, null, 'id');
-        $adminBaseInfo = AdminClass::groupAdminBaseInfo($adminInfo, $sensitive);
+        $adminBaseInfo = AdminClass::groupAdminBaseInfo($adminInfo);
 
         $roleIds = array_column($list, 'roleId');
         $roleIds = array_filter(array_unique($roleIds));

+ 2 - 12
biz/sj/services/MerchantService.php

@@ -216,19 +216,9 @@ class MerchantService extends BaseService
         return MerchantClass::getDefaultShopId($merchant);
     }
 
-    //商家基本信息,$sensitive true 除敏感信息 ssh 2019.12.8
-    public static function getInfo($merchant, $extend, $sensitive = true)
+    //商家基本信息 ssh 2019.12.8
+    public static function getInfo($merchant, $extend)
     {
-        if ($sensitive) {
-            $delete = ['miniAppId', 'miniAppSecret', 'wxAppId', 'wxAppSecret', 'openAppId', 'wxToken', 'wxJsApiTicket', 'wxAccessToken', 'wxRefreshToken'];
-            foreach ($delete as $del) {
-                unset($merchant[$del]);
-            }
-            $deleteExtend = ['miniAppId', 'miniAccessToken', 'miniRefreshToken', 'wxPayKey', 'wxPayMerchantId', 'wxAppId'];
-            foreach ($deleteExtend as $delExtend) {
-                unset($extend[$delExtend]);
-            }
-        }
         $merchant['extend'] = $extend;
         return $merchant;
     }

+ 8 - 1
sql.sql

@@ -2433,4 +2433,11 @@ ALTER TABLE xhGhs ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地
 ALTER TABLE xhPurchase ADD ghsInfo VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '供货商信息' AFTER `ghsId`;
 ALTER TABLE xhPurchase DROP COLUMN `ghsInfo`;
 ALTER TABLE xhPurchase ADD ghsMobile CHAR(15) NOT NULL DEFAULT '' COMMENT '供货商手机号' AFTER `ghsAvatar`;
-ALTER TABLE xhPurchase ADD ghsFullAddress VARCHAR(800) NOT NULL DEFAULT '' COMMENT '供货商地址' AFTER `ghsMobile`;
+ALTER TABLE xhPurchase ADD ghsFullAddress VARCHAR(800) NOT NULL DEFAULT '' COMMENT '供货商地址' AFTER `ghsMobile`;
+ALTER TABLE xhApply ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地图接口显示的完整地址' AFTER `fullAddress`;
+ALTER TABLE xhUser MODIFY id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id';
+ALTER TABLE xhCustom MODIFY id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id';
+TRUNCATE xhUser;
+TRUNCATE xhCustom;
+ALTER TABLE xhUser AUTO_INCREMENT=958260;
+ALTER TABLE xhCustom AUTO_INCREMENT=980361;