Przeglądaj źródła

平台微信相关字段变更

shish 5 lat temu
rodzic
commit
01b289d63a

+ 1 - 1
app/saas/controllers/WxController.php

@@ -53,7 +53,7 @@ class WxController extends PublicController
 		//取开放平台信息
 		$openId = configDict::getConfig('openId');
 		$open = xhWxOpenService::getById($openId);
-		$wxBaseId = isset($open['wx_base_id']) ? $open['wx_base_id'] : 0;
+		$wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
 		if (empty($wxBaseId)) {
 			Yii::warning('平台还没有绑定公众号');
 			Yii::$app->end();

+ 4 - 4
app/saas/controllers/WxOpenController.php

@@ -312,7 +312,7 @@ class WxOpenController extends PublicController
 			];
 			
 			//开放平台没有小程序先绑定开放平台要用的小程序
-			if (isset($open['wx_mini_base_id']) == false || empty($open['wx_mini_base_id'])) {
+			if (isset($open['wxMiniBaseId']) == false || empty($open['wxMiniBaseId'])) {
 				$miniData['addTime'] = $time;
 				
 				//花卉宝
@@ -330,7 +330,7 @@ class WxOpenController extends PublicController
 				
 				$wxMiniBaseRespond = WxMiniBaseService::add($miniData);
 				$wxMiniBaseId = $wxMiniBaseRespond['id'];
-				WxOpenService::updateOpen(['wx_mini_base_id' => $wxMiniBaseId]);
+				WxOpenService::updateOpen(['wxMiniBaseId' => $wxMiniBaseId]);
 				util::stop('开放平台成功绑定小程序');
 			}
 			
@@ -368,11 +368,11 @@ class WxOpenController extends PublicController
 		$wxData['wxAccessTokenTime'] = $accessTokenTime;
 		$wxData['wxRefreshToken'] = $authorize_refresh_token;
 		//开放平台还没有公众号先绑定开放平台的公众号
-		if (isset($open['wx_base_id']) == false || empty($open['wx_base_id'])) {
+		if (isset($open['wxBaseId']) == false || empty($open['wxBaseId'])) {
 			$wxData['addTime'] = $time;
 			$wxBaseRespond = WxBaseService::add($wxData);
 			$wxBaseId = $wxBaseRespond['id'];
-			WxOpenService::updateOpen(['wx_base_id' => $wxBaseId]);
+			WxOpenService::updateOpen(['wxBaseId' => $wxBaseId]);
 			util::stop('开放平台成功绑定公众号');
 		}
 		$wxData['status'] = 1;//审核通过

+ 1 - 1
biz-ghs/merchant/services/MerchantService.php

@@ -193,7 +193,7 @@ class MerchantService extends BaseService
     public static function initOpenMerchant()
     {
         $open = WxOpenClass::getOpen();
-        if (isset($open['wx_base_id']) && !empty($open['wx_base_id']) && isset($open['wx_mini_base_id']) && !empty($open['wx_mini_base_id'])) {
+        if (isset($open['wxBaseId']) && !empty($open['wxBaseId']) && isset($open['wxMiniBaseId']) && !empty($open['wxMiniBaseId'])) {
             util::stop('已初始化,无需重复操作');
         }
         $env = getenv('YII_ENV');

+ 1 - 1
biz/merchant/services/MerchantService.php

@@ -193,7 +193,7 @@ class MerchantService extends BaseService
     public static function initOpenMerchant()
     {
         $open = WxOpenClass::getOpen();
-        if (isset($open['wx_base_id']) && !empty($open['wx_base_id']) && isset($open['wx_mini_base_id']) && !empty($open['wx_mini_base_id'])) {
+        if (isset($open['wxBaseId']) && !empty($open['wxBaseId']) && isset($open['wxMiniBaseId']) && !empty($open['wxMiniBaseId'])) {
             util::stop('已初始化,无需重复操作');
         }
         $env = getenv('YII_ENV');

+ 110 - 89
biz/wx/classes/WxOpenClass.php

@@ -9,93 +9,114 @@ use biz\base\classes\BaseClass;
 
 class WxOpenClass extends BaseClass
 {
-
-    public static $baseFile = '\biz\wx\models\WxOpen';
-
-    //平台管理员的手机号
-    const ADMIN_MOBILE = 15280215347;
-    const PLATFORM_ACCOUNT = 12359;
-    const ID = 1;
-
-    //取平台的帐号
-    public static function getPlatformAccount()
-    {
-        return self::PLATFORM_ACCOUNT;
-    }
-
-    //获取平台基础信息 shish 2020.2.11
-    public static function getOpen()
-    {
-        return self::getById(self::ID);
-    }
-
-    //获取平台管理员的手机号 shish 2020.3.4
-    public static function getAdminMobile()
-    {
-        return self::ADMIN_MOBILE;
-    }
-
-    //获取平台微信信息
-    public static function getOpenInfo()
-    {
-        $open = self::getById(self::ID);
-        if (isset($open['merchantId']) && !empty($open['merchantId'])) {
-            $merchantId = $open['merchantId'];
-            return MerchantClass::getMerchantById($merchantId);
-        }
-        util::fail('没有找到平台信息');
-    }
-
-    //更新开放平台信息 shish 2020.4.13
-    public static function updateOpen($data)
-    {
-        self::updateById(self::ID, $data);
-    }
-
-    //平台小程序信息 shish 2020.4.13
-    public static function getWxMiniBase()
-    {
-        $open = self::getOpen();
-        $wx_mini_base_id = isset($open['wx_mini_base_id']) ? $open['wx_mini_base_id'] : 0;
-        $base = WxMiniBaseClass::getById($wx_mini_base_id);
-        if (empty($base)) {
-            util::fail('没有找到平台小程序信息');
-        }
-        return $base;
-    }
-
-    //平台小程序信息 shish 2020.4.13
-    public static function getGhsWxMiniBase()
-    {
-        $open = self::getOpen();
-        $wxGhsMiniBaseId = isset($open['wxGhsMiniBaseId']) ? $open['wxGhsMiniBaseId'] : 0;
-        $base = WxMiniBaseClass::getById($wxGhsMiniBaseId);
-        if (empty($base)) {
-            util::fail('没有找到平台小程序信息');
-        }
-        return $base;
-    }
-
-    //公众号信息 shish 2020.4.14
-    public static function getWxBase()
-    {
-        $open = self::getOpen();
-        $wx_base_id = isset($open['wx_base_id']) ? $open['wx_base_id'] : 0;
-        $base = WxBaseClass::getById($wx_base_id);
-        if (empty($base)) {
-            util::fail('没有找到平台公众号信息');
-        }
-        return $base;
-    }
-
-    //获取微信和小程序信息 shish 2020.4.14
-    public static function getWxInfo()
-    {
-        $open = self::getOpen();
-        $openAppId = isset($open['appIdCreated']) ? $open['appIdCreated'] : '';
-        $mini = self::getWxMiniBase();
-        $wx = self::getWxBase();
-        return array_merge($wx, $mini, ['openAppId' => $openAppId]);
-    }
-
+	
+	public static $baseFile = '\biz\wx\models\WxOpen';
+	
+	//平台管理员的手机号
+	const ADMIN_MOBILE = 15280215347;
+	const PLATFORM_ACCOUNT = 12359;
+	const ID = 1;
+	
+	//取平台的帐号
+	public static function getPlatformAccount()
+	{
+		return self::PLATFORM_ACCOUNT;
+	}
+	
+	//获取平台基础信息 shish 2020.2.11
+	public static function getOpen()
+	{
+		return self::getById(self::ID);
+	}
+	
+	//获取平台管理员的手机号 shish 2020.3.4
+	public static function getAdminMobile()
+	{
+		return self::ADMIN_MOBILE;
+	}
+	
+	//获取平台微信信息
+	public static function getOpenInfo()
+	{
+		$open = self::getById(self::ID);
+		if (isset($open['merchantId']) && !empty($open['merchantId'])) {
+			$merchantId = $open['merchantId'];
+			return MerchantClass::getMerchantById($merchantId);
+		}
+		util::fail('没有找到平台信息');
+	}
+	
+	//更新开放平台信息 shish 2020.4.13
+	public static function updateOpen($data)
+	{
+		self::updateById(self::ID, $data);
+	}
+	
+	//平台小程序信息 shish 2020.4.13
+	public static function getWxMiniBase()
+	{
+		$open = self::getOpen();
+		$wxMiniBaseId = isset($open['wxMiniBaseId']) ? $open['wxMiniBaseId'] : 0;
+		$base = WxMiniBaseClass::getById($wxMiniBaseId);
+		if (empty($base)) {
+			util::fail('没有找到平台小程序信息');
+		}
+		return $base;
+	}
+	
+	//公众号信息 shish 2020.4.14
+	public static function getWxBase()
+	{
+		$open = self::getOpen();
+		$wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
+		$base = WxBaseClass::getById($wxBaseId);
+		if (empty($base)) {
+			util::fail('没有找到平台公众号信息');
+		}
+		return $base;
+	}
+	
+	//获取微信和小程序信息 shish 2020.4.14
+	public static function getWxInfo()
+	{
+		$open = self::getOpen();
+		$openAppId = isset($open['appIdCreated']) ? $open['appIdCreated'] : '';
+		$mini = self::getWxMiniBase();
+		$wx = self::getWxBase();
+		return array_merge($wx, $mini, ['openAppId' => $openAppId]);
+	}
+	
+	//公众号信息 shish 2020.4.14
+	public static function getGhsWxBase()
+	{
+		$open = self::getOpen();
+		$wxGhsBaseId = isset($open['wxGhsBaseId']) ? $open['wxGhsBaseId'] : 0;
+		$base = WxBaseClass::getById($wxGhsBaseId);
+		if (empty($base)) {
+			util::fail('没有找到平台公众号信息');
+		}
+		return $base;
+	}
+	
+	//平台小程序信息 shish 2020.4.13
+	public static function getGhsWxMiniBase()
+	{
+		$open = self::getOpen();
+		$wxGhsMiniBaseId = isset($open['wxGhsMiniBaseId']) ? $open['wxGhsMiniBaseId'] : 0;
+		$base = WxMiniBaseClass::getById($wxGhsMiniBaseId);
+		if (empty($base)) {
+			util::fail('没有找到平台小程序信息');
+		}
+		return $base;
+	}
+	
+	public static function getGhsWxInfo()
+	{
+		$open = self::getOpen();
+		$openAppId = isset($open['appIdCreated']) ? $open['appIdCreated'] : '';
+		$mini = self::getGhsWxMiniBase();
+		$wx = self::getGhsWxBase();
+		return array_merge($wx, $mini, ['openAppId' => $openAppId]);
+	}
+	
 }

+ 49 - 44
biz/wx/services/WxOpenService.php

@@ -8,48 +8,53 @@ use Yii;
 
 class WxOpenService extends BaseService
 {
-
-    public static $baseFile = '\biz\wx\classes\WxOpenClass';
-
-    //获取平台基础信息 shish 2020.2.11
-    public static function getOpen()
-    {
-        return WxOpenClass::getOpen();
-    }
-
-    public static function updateOpen($data)
-    {
-        return WxOpenClass::updateOpen($data);
-    }
-
-    //获取平台管理员手机号 shish 2020.3.4
-    public static function getAdminMobile()
-    {
-        return WxOpenClass::getAdminMobile();
-    }
-
-    //取平台帐号 shish 2020.3.7
-    public static function getPlatformAccount()
-    {
-        return WxOpenClass::getPlatformAccount();
-    }
-
-    //获取平台微信信息
-    public static function getOpenInfo()
-    {
-        return WxOpenClass::getOpenInfo();
-    }
-
-    //获取小程序信息 shish 2020.4.13
-    public static function getWxMiniBase()
-    {
-        return WxOpenClass::getWxMiniBase();
-    }
-
-    //获取微信和小程序信息 shish 2020.4.14
-    public static function getWxInfo()
-    {
-        return WxOpenClass::getWxInfo();
-    }
-
+	
+	public static $baseFile = '\biz\wx\classes\WxOpenClass';
+	
+	//获取平台基础信息 shish 2020.2.11
+	public static function getOpen()
+	{
+		return WxOpenClass::getOpen();
+	}
+	
+	public static function updateOpen($data)
+	{
+		return WxOpenClass::updateOpen($data);
+	}
+	
+	//获取平台管理员手机号 shish 2020.3.4
+	public static function getAdminMobile()
+	{
+		return WxOpenClass::getAdminMobile();
+	}
+	
+	//取平台帐号 shish 2020.3.7
+	public static function getPlatformAccount()
+	{
+		return WxOpenClass::getPlatformAccount();
+	}
+	
+	//获取平台微信信息
+	public static function getOpenInfo()
+	{
+		return WxOpenClass::getOpenInfo();
+	}
+	
+	//获取小程序信息 shish 2020.4.13
+	public static function getWxMiniBase()
+	{
+		return WxOpenClass::getWxMiniBase();
+	}
+	
+	//获取微信和小程序信息 shish 2020.4.14
+	public static function getWxInfo()
+	{
+		return WxOpenClass::getWxInfo();
+	}
+	
+	public static function getGhsWxInfo()
+	{
+		return WxOpenClass::getGhsWxInfo();
+	}
+	
 }

+ 6 - 6
common/components/miniUtil.php

@@ -605,9 +605,9 @@ class miniUtil
 				$uData['wxAccessTokenTime'] = date("Y-m-d H:i:s", (time() + $expires_in - 100));
 				if ($isOpen == 1) {
 					$open = WxOpenService::getOpen();
-					$wx_base_id = isset($open['wx_base_id']) ? $open['wx_base_id'] : 0;
-					if (!empty($wx_base_id)) {
-						WxBaseService::updateById($wx_base_id, $uData);
+					$wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
+					if (!empty($wxBaseId)) {
+						WxBaseService::updateById($wxBaseId, $uData);
 					}
 				} else {
 					xhMerchantService::updateById($merchantId, $uData);
@@ -657,9 +657,9 @@ class miniUtil
 				$uData['miniAccessTokenTime'] = date("Y-m-d H:i:s", (time() + $expires_in - 100));
 				if ($isOpen == 1) {
 					$open = WxOpenService::getOpen();
-					$wx_mini_base_id = isset($open['wx_mini_base_id']) ? $open['wx_mini_base_id'] : 0;
-					if (!empty($wx_mini_base_id)) {
-						WxMiniBaseService::updateById($wx_mini_base_id, $uData);
+					$wxMiniBaseId = isset($open['wxMiniBaseId']) ? $open['wxMiniBaseId'] : 0;
+					if (!empty($wxMiniBaseId)) {
+						WxMiniBaseService::updateById($wxMiniBaseId, $uData);
 					}
 				} else {
 					xhMerchantExtendService::updateByMerchantId($merchantId, $uData);

+ 6 - 6
common/components/wxUtil.php

@@ -606,9 +606,9 @@ class wxUtil
 				$uData['wxAccessTokenTime'] = date("Y-m-d H:i:s", (time() + $expires_in - 100));
 				if ($isOpen == 1) {
 					$open = WxOpenService::getOpen();
-					$wx_base_id = isset($open['wx_base_id']) ? $open['wx_base_id'] : 0;
-					if (!empty($wx_base_id)) {
-						WxBaseService::updateById($wx_base_id, $uData);
+					$wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
+					if (!empty($wxBaseId)) {
+						WxBaseService::updateById($wxBaseId, $uData);
 					}
 				} else {
 					xhMerchantService::updateById($merchantId, $uData);
@@ -658,9 +658,9 @@ class wxUtil
 				$uData['miniAccessTokenTime'] = date("Y-m-d H:i:s", (time() + $expires_in - 100));
 				if ($isOpen == 1) {
 					$open = WxOpenService::getOpen();
-					$wx_mini_base_id = isset($open['wx_mini_base_id']) ? $open['wx_mini_base_id'] : 0;
-					if (!empty($wx_mini_base_id)) {
-						WxMiniBaseService::updateById($wx_mini_base_id, $uData);
+					$wxMiniBaseId = isset($open['wxMiniBaseId']) ? $open['wxMiniBaseId'] : 0;
+					if (!empty($wxMiniBaseId)) {
+						WxMiniBaseService::updateById($wxMiniBaseId, $uData);
 					}
 				} else {
 					xhMerchantExtendService::updateByMerchantId($merchantId, $uData);

+ 1 - 1
console/controllers/UpgradeController.php

@@ -1337,7 +1337,7 @@ CREATE TABLE IF NOT EXISTS `xhWxMiniBase`(
   `miniVersion` INT(11) NOT NULL DEFAULT '0' COMMENT '当前版本',
   `addTime` INT(11) NOT NULL DEFAULT '0' COMMENT '添加时间'
 )COMMENT='小程序基础信息';
-ALTER TABLE `xhWxOpen` ADD wx_mini_base_id INT NOT NULL DEFAULT 0 COMMENT '平台对应的小程序' AFTER `merchantId`;
+ALTER TABLE `xhWxOpen` ADD wxMiniBaseId INT NOT NULL DEFAULT 0 COMMENT '平台对应的小程序' AFTER `merchantId`;
 ALTER TABLE `xhWxOpen` CHANGE `openName` `name` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '名称' AFTER `appSecret`;
 ALTER TABLE `xhWxOpen` ADD appIdCreated VARCHAR(200) NOT NULL DEFAULT '' COMMENT '创建的平台帐号appId' AFTER `appId`;
 ALTER TABLE `xhWxOpen` MODIFY `appId` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '后台拿到的appId';";

+ 3 - 1
sql.sql

@@ -113,7 +113,7 @@ ALTER TABLE xhMerchant ADD `style` TINYINT NOT NULL DEFAULT 0 COMMENT '商家类
 
 ==shish 20201.1.6
 
-ALTER TABLE xhWxOpen MODIFY wx_mini_base_id INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商小程序';
+ALTER TABLE xhWxOpen MODIFY wxMiniBaseId INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商小程序';
 ALTER TABLE xhWxOpen MODIFY wx_base_id INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商公众号';
 ALTER TABLE xhWxOpen ADD wxGhsMiniBaseId INT(11) NOT NULL DEFAULT '0' COMMENT '平台供货商小程序' AFTER wx_base_id;
 ALTER TABLE xhWxOpen ADD wxGhsBaseId INT(11) NOT NULL DEFAULT '0' COMMENT '平台供货商公众号' AFTER wxGhsMiniBaseId;
@@ -432,3 +432,5 @@ CREATE TABLE `xhGhsAdminRoleAuth` (
   `addTime` INT(11) NOT NULL DEFAULT '0' COMMENT '添加时间',
   PRIMARY KEY (`id`)
 ) COMMENT='员工角色权限';
+ALTER TABLE `xhWxOpen` CHANGE `wx_mini_base_id` `wxMiniBaseId` INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商小程序';
+ALTER TABLE `xhWxOpen` CHANGE `wx_base_id` `wxBaseId` INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商公众号'