shish 6 роки тому
батько
коміт
848189ab29

+ 5 - 3
app/business/controllers/BaseController.php

@@ -16,7 +16,7 @@ class BaseController extends PublicController
 	public $merchantId = 0, $merchantName, $merchant, $merchantExtend, $merchantAsset, $merchantLogo, $signPackage;
 	public $openMerchant, $openMerchantId;
 	public $appId;
-	public $isWeixin = false;
+	public $isWx = false;
 	public $isLogin = false;
 	public $withoutLogin = [];//不需要登陆的方法名
 	public $validate = true;
@@ -46,9 +46,11 @@ class BaseController extends PublicController
 		if ($this->validate == false) {
 			util::notLogin();
 		}
-		$admin = AdminService::getById($adminId);
+		//$admin = AdminService::getById($adminId);
+		//授权方式获取客户信息 xhAdmin userId存的是每个公众号店长的微信userId
+		$admin = AdminService::getByCondition(['userId' => $adminId]);
 		if (empty($admin)) {
-			util::fail('没有找到管理员'.$adminId);
+			util::fail('没有找到管理员' . $adminId);
 		}
 		$merchantId = $admin['merchantId'];
 		if (empty($merchantId)) {

+ 2 - 2
app/client/controllers/BaseController.php

@@ -23,7 +23,7 @@ class BaseController extends PublicController
 	public $withoutLogin = [];//不需要登陆可以访问的方法
 	public $userId, $user;
 	public $merchantId, $merchant, $merchantExtend;
-	public $isWeixin;
+	public $isWx;
 	
 	public function beforeAction($action)
 	{
@@ -44,7 +44,7 @@ class BaseController extends PublicController
 		$this->merchantId = $account;
 		$this->merchant = $merchant;
 		$this->merchantExtend = MerchantExtendService::getByMerchantId($account);
-		$this->isWeixin = util::isWeixin();
+		$this->isWx = util::isWx();
 
 		if (empty($userId)) {
 			$this->validate = false;

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

@@ -43,7 +43,7 @@ class OrderController extends BaseController
 		$needSend = isset($goodsInfo['needSend']) && $goodsInfo['needSend'] == 1 ? 1 : 0;
 		
 		$post['userId'] = $this->userId;
-		$post['payWay'] = $this->isWeixin == true ? 0 : 1;
+		$post['payWay'] = $this->isWx == true ? 0 : 1;
 		$defaultShopId = MerchantService::getDefaultShopId($this->merchant);
 		if (empty($defaultShopId)) {
 			util::fail('没有找到门店');
@@ -256,7 +256,7 @@ class OrderController extends BaseController
 			util::fail('请填写正确的金额');
 		}
 		//微信支付订单提交不能修改价格
-		$post['modPrice'] = $this->isWeixin ? 0 : 1;
+		$post['modPrice'] = $this->isWx ? 0 : 1;
 		$post['sourceType'] = $sourceType;
 		$order = OrderService::addOrder($post);
 		$orderId = $order['id'];

+ 3 - 3
app/client/controllers/PayController.php

@@ -40,7 +40,7 @@ class PayController extends BaseController
 		//dump($post);die;
 		$userId = $this->userId;
 		$post['userId'] = $userId;
-		$post['payWay'] = $this->isWeixin == true ? 0 : 1;
+		$post['payWay'] = $this->isWx == true ? 0 : 1;
 		$lat2 = $post['receiveLat'];//收货人纬度
 		$lng2 = $post['receiveLong'];//收货人经度
 		$lat1 = $this->merchant['shopLat'];//花店纬度
@@ -225,7 +225,7 @@ class PayController extends BaseController
 		if ($post['actPrice'] <= 0) {
 			util::fail('消费金额太低');
 		}
-		if ($this->isWeixin) {
+		if ($this->isWx) {
 			$post['modPriceStatus'] = 1;//微信已经提交不能再修改价格
 		}
 		$post['sourceType'] = $sourceType;
@@ -238,7 +238,7 @@ class PayController extends BaseController
 		}
 		$name = '购买商品';
 		$totalFee = $post['actPrice'];
-		if ($this->isWeixin) {
+		if ($this->isWx) {
 			$userId = $post['userId'];
 			$user = xhUserService::getById($userId);
 			if ($user['merchantId'] != $this->merchantId) {

+ 4 - 4
app/www/controllers/OpenendController.php

@@ -19,11 +19,11 @@ class OpenendController extends PublicController{
 
 	public $isLogin				= false;
 	public $withoutLogin		= [];//不需要登陆的方法名
-	public $userId,$user,$isWeixin,$signPackage,$merchant,$merchantId,$merchantExtend;
+	public $userId,$user,$isWx,$signPackage,$merchant,$merchantId,$merchantExtend;
 	public $wxOpen;
 
 	public function beforeAction($action){
-		$this->isWeixin			= util::isWeixin();
+		$this->isWx			= util::isWx();
 		$get					= Yii::$app->request->get();
 		$account				= isset($get['account']) ? $get['account'] : '';
 		$one					= xhMerchantService::getOne();
@@ -41,7 +41,7 @@ class OpenendController extends PublicController{
 			$merchantId				= $merchant['id'];
 			$this->merchantId		= $merchantId;
 			$this->merchantExtend	= xhMerchantExtendService::getByMerchantId($merchantId);
-			if($this->isWeixin){
+			if($this->isWx){
 				$jssdk						= new jsSDK();//微信分享
 				$this->signPackage			= $jssdk->GetSignPackage($merchant);
 			}
@@ -63,7 +63,7 @@ class OpenendController extends PublicController{
 			$this->user		= $user;
 			$noNeedLogin	= true;
 		}
-		if ($this->isWeixin) {//如果是微信,走微信授权取用户信息
+		if ($this->isWx) {//如果是微信,走微信授权取用户信息
 			if($noNeedLogin == false){
 				//snsapi_userinfo 需要用户授权获取用户信息,snsapi_base表示自动静默方式
 				$authScope			= isset($get['authScope']) ? $get['authScope'] : 'snsapi_userinfo';

+ 1 - 1
app/www/controllers/PayController.php

@@ -68,7 +68,7 @@ class PayController extends OpenendController
     			util::stop('您的邀请码已失效');
     		}
     	}
-    	if($this->isWeixin == false){
+    	if($this->isWx == false){
     		util::failInfo('请使用微信访问');
     	}
     	$userId			= $this->userId;

+ 2 - 2
app/www/controllers/WxOpenController.php

@@ -443,8 +443,8 @@ class WxOpenController extends PublicController
 	
 	public function actionSelect()
 	{
-		$isWeixin = util::isWeixin();
-		if ($isWeixin == false) {
+		$isWx = util::isWx();
+		if ($isWx == false) {
 			return $this->renderPartial('notWeixin');
 		}
 		return $this->renderPartial('select');

+ 1 - 1
common/components/httpUtil.php

@@ -97,7 +97,7 @@ class httpUtil
 	}
 	
 	//判断是否微信浏览器
-	public static function isWeixin()
+	public static function isWx()
 	{
 		if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
 			return true;

+ 1 - 1
common/components/util.php

@@ -9,7 +9,7 @@ class util
 {
 
 	//判断是否微信浏览器
-	public static function isWeixin()
+	public static function isWx()
 	{
 		if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
 			return true;