shish 5 år sedan
förälder
incheckning
cf6a81ca97

+ 9 - 3
app-mall/controllers/BaseController.php

@@ -7,11 +7,13 @@ use biz\sj\classes\SjClass;
 use bizHd\custom\classes\CustomClass;
 use bizMall\merchant\services\MerchantExtendService;
 use bizMall\merchant\services\MerchantService;
+use bizMall\user\classes\UserClass;
 use bizMall\user\services\UserService;
 use common\components\dict;
 use common\components\httpUtil;
 use common\components\jwt;
 use common\components\util;
+use function GuzzleHttp\Promise\iter_for;
 use Yii;
 
 class BaseController extends PublicController
@@ -26,14 +28,17 @@ class BaseController extends PublicController
     public function beforeAction($action)
     {
         //定义平台类型 1花店 2供货商 3商城
-        Yii::$app->params['ptStyle']  = dict::getDict('ptStyle', 'mall');
+        Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'mall');
         $userId = jwt::getLoginId();
         if (empty($userId)) {
             util::fail('您还没有登陆');
         }
         $this->userId = $userId;
-        $userInfo = UserService::getUserInfo($userId);
-        $this->user = $userInfo;
+        $user = UserClass::getById($userId, true);
+        if (empty($user)) {
+            util::fail('没有找到客户信息');
+        }
+        $this->user = $user;
         $this->isWx = util::isWx();
 
         $header = httpUtil::getHeader();
@@ -56,6 +61,7 @@ class BaseController extends PublicController
             $this->sj = $sj;
             $this->shop = $shop;
             $this->sjExtend = MerchantExtendService::getBySjId($sjId);
+            $userInfo = isset($user->attributes) ? $user->attributes : [];
             $custom = CustomClass::replaceCustom($sjId, $userInfo, $shopId);
             if (!empty($custom)) {
                 $this->custom = $custom;

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

@@ -50,7 +50,7 @@ class OrderController extends BaseController
         try {
             $post['customId'] = $this->customId;
             $post['customName'] = $this->custom['name'] ?? '';
-            $user = $this->user;
+            $user = isset($this->user->attributes) ? $this->user->attributes : [];
             $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
             $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
             $bookMobile = empty($bookMobile) && isset($user['mobile']) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
@@ -255,7 +255,7 @@ class OrderController extends BaseController
         $post['store'] = 0;
         $fromType = dict::getDict('fromType', 'shop');
         $post['customId'] = $this->customId;
-        $user = $this->user;
+        $user = isset($this->user->attributes) ? $this->user->attributes : [];
         $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
         $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
         $bookMobile = empty($bookMobile) && isset($user['mobile']) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;

+ 4 - 78
app-mall/controllers/RechargeController.php

@@ -11,85 +11,11 @@ use Yii;
 
 class RechargeController extends BaseController
 {
-	
-	//发起充值 ssh 2019.12.19
-	public function actionLaunch()
-	{
-		$rechargeAmount = Yii::$app->request->get('amount', 1);
-		$account = $this->sjId;
-		$sj = $this->sj->attributes;
-		$extend = $this->sjExtend->attributes;
-		$user = $this->user;
-		ini_set('date.timezone', 'Asia/Shanghai');
-		if ($rechargeAmount <= 0) {
-			util::fail('请填写充值金额');
-		}
-		$rechargeAmount = round($rechargeAmount, 2);//四舍五入,保留二位小数
-		$userId = $user['id'];
-		$rechargeData['userId'] = $userId;
-		$rechargeData['actPrice'] = $rechargeAmount;
-		$rechargeData['payStyle'] = 0;
-		$rechargeData['sjId'] = $sj['id'];
-		$now = time();
-		$expireTime = $now + 300;//订单5分钟后过期
-		$rechargeData['createTime'] = date("Y-m-d H:i:s", $now);
-		$rechargeData['addTime'] = time();
-		$rechargeData['deadline'] = $expireTime;
-		$rechargeData['id'] = stringUtil::generateOrderNo($account, $userId);
-		$rechargeData['sourceType'] = 1;//订单来源:0商城订单 1付款订单
-		$payment = xhRechargeService::add($rechargeData);
-		$orderId = $payment['id'];
-		$orderSn = $payment['orderSn'];
-		
-		UserService::updateVisitTime($sjId, $userId);
 
-		$totalFee = $rechargeAmount;
-		$name = '充值' . $totalFee . '元';
+    //发起充值 ssh 2019.12.19
+    public function actionLaunch()
+    {
 
-		//小程序使用miniOpenId
-		if (httpUtil::isMiniProgram()) {
-			$openId = $user['miniOpenId'];
-		} else {
-			$openId = $user['openId'];
-		}
-		if (empty($openId)) {
-			util::fail('没有找到用户信息 wx');
-		}
+    }
 
-        $capitalType = dict::getDict('capitalType','xhRecharge','id');
-		$attach = 'capitalType=' . $capitalType;//将流水类型、代金劵传过去
-		$wx = Yii::getAlias("@vendor/weixin");
-		require_once($wx . '/lib/WxPay.Api.php');
-		require_once($wx . '/example/WxPay.JsApiPay.php');
-		$input = new \WxPayUnifiedOrder();
-		$input->SetBody($name);
-		$input->SetOut_trade_no($orderSn);
-		$input->SetTotal_fee($totalFee * 100);
-		$input->SetTime_start(date("YmdHis", $now));
-		$input->SetAttach($attach);
-		$input->SetTime_expire(date("YmdHis", $expireTime));//设置订单有效期5分钟
-		$input->SetNotify_url(Yii::$app->params['miniUrl'] . '/notice/weixin-recharge-callback/');
-		$input->SetTrade_type("JSAPI");
-		
-		//服务商 代设置微信支付,要添加的参数设置
-		if ($extend['wxPayApply'] == 1) {
-			//$input->SetOpenid($openId);
-			$input->SetSub_openid($openId);
-			//自设置 微信支付
-		} else {
-			$input->SetOpenid($openId);
-		}
-		//小程序使用miniAppId
-		if(httpUtil::isMiniProgram()){
-			$sjExtend['wxAppId'] = $sjExtend['miniAppId'];
-		}
-
-		$wxOrder = \WxPayApi::unifiedOrder($input, 6, $extend);
-		$tools = new \JsApiPay();
-		$jsApiParameters = $tools->GetJsApiParameters($wxOrder, $extend);
-		$newParams = json_decode($jsApiParameters, true);
-		$newParams['orderSn'] = $orderSn;
-		util::success($newParams);
-	}
-	
 }

+ 4 - 3
app-mall/controllers/UserController.php

@@ -81,7 +81,7 @@ class UserController extends BaseController
         $encryptedData = $post['encryptedData'];
         $sjWx = $this->sjWx;
         $appId = $sjWx['miniAppId'];
-        $user = $this->user;
+        $user = isset($this->user->attributes) ? $this->user->attributes : [];
         $miniOpenId = $user['miniOpenId'];
         $customId = $this->customId;
         $info = CustomClass::getCustomInfo($customId);
@@ -169,14 +169,15 @@ class UserController extends BaseController
             util::fail('手机号已经注册过了');
         }
         $update['mobile'] = $mobile;
-        UserService::becomeMember($this->user, $this->sj->attributes, $update);
+        $userInfo = isset($this->user->attributes) ? $this->user->attributes : [];
+        UserService::becomeMember($userInfo, $this->sj->attributes, $update);
         util::complete('注册成功');
     }
 
     //登陆客户的信息 ssh 2020.3.12
     public function actionLoginDetail()
     {
-        $user = $this->user;
+        $user = isset($this->user->attributes) ? $this->user->attributes : [];
         util::success($user);
     }
 

+ 0 - 13
biz-hd/custom/classes/CustomClass.php

@@ -2,7 +2,6 @@
 
 namespace bizHd\custom\classes;
 
-use bizHd\admin\classes\AdminClass;
 use bizMall\user\classes\UserClass;
 use common\components\imgUtil;
 use common\components\stringUtil;
@@ -26,16 +25,6 @@ class CustomClass extends BaseClass
         $userId = $user['id'];
         $name = $user['name'] ?? '';
         $mobile = $user['mobile'] ?? '';
-//        $key = self::getCustomCacheKey($sjId, $shopId, $userId);
-//        $currentId = Yii::$app->redis->executeCommand('GET', [$key]);
-//        if (!empty($currentId)) {
-//            $info = self::getById($currentId);
-//            if (!empty($info)) {
-//                $info['avatar'] = imgUtil::groupImg($info['avatar']);
-//                return $info;
-//            }
-//        }
-
         $info = self::getByCondition(['shopId' => $shopId, 'userId' => $userId]);
         if (empty($info)) {
             $py = stringUtil::py($name);
@@ -54,8 +43,6 @@ class CustomClass extends BaseClass
         if (empty($info)) {
             return $info;
         }
-//        $id = $info['id'];
-//        Yii::$app->redis->executeCommand('SET', [$key, $id]);
         $info['avatar'] = imgUtil::groupImg($info['avatar']);
         return $info;
     }

+ 0 - 11
biz/ghs/classes/GhsClass.php

@@ -5,7 +5,6 @@ namespace biz\ghs\classes;
 use biz\shop\classes\ShopClass;
 use biz\shop\services\ShopService;
 use biz\sj\classes\MerchantAssetClass;
-use biz\sj\classes\SjClass;
 use bizGhs\custom\classes\CustomClass;
 use common\components\imgUtil;
 use common\components\stringUtil;
@@ -168,14 +167,4 @@ class GhsClass extends BaseClass
         util::fail('您没有权限访问的供应商');
     }
 
-    //冗余到其它表的供货商信息,表结构变化,这里不会变化 shish 2021.5.11
-    public static function formatGhsInfo($ghs)
-    {
-        return [
-
-        ];
-    }
-
-    
-
 }