shish 6 年 前
コミット
12d942242c

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

@@ -150,7 +150,7 @@ class OrderController extends BaseController
 		$out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $this->merchant];
 		util::success($out);
 	}
-	
+
 	//配送单 shish 2020.2.29
 	public function actionDeliver()
 	{
@@ -174,5 +174,5 @@ class OrderController extends BaseController
 		];
 		util::success($data);
 	}
-	
+
 }

+ 28 - 10
console/controllers/UpgradeController.php

@@ -7,6 +7,7 @@ use biz\goods\services\GoodsService;
 use biz\goods\services\GoodsStyleService;
 use biz\merchant\services\MerchantCapitalService;
 use biz\merchant\services\MerchantExtendService;
+use biz\message\services\TMessageService;
 use biz\order\services\OrderGoodsService;
 use biz\order\services\OrderService;
 use biz\stat\services\StatIncomeMonthService;
@@ -17,6 +18,7 @@ use biz\user\services\UserAssetService;
 use biz\user\services\UserCapitalService;
 use biz\user\services\UserGrowthService;
 use biz\user\services\UserService;
+use biz\weixin\services\WxMenuService;
 use common\components\dirUtil;
 use common\components\util;
 use common\services\xhMerchantService;
@@ -968,10 +970,10 @@ UPDATE `xhAdmin` SET id=18528,merchantId=12358,roleId=683 WHERE id=1;";
 		$time = time();
 		$sql = "insert into xhCouponAsset value(null,12358,1,30,280,7,0,0,0,0,{$time}),(null,12359,1,30,280,7,0,0,0,0,{$time}),(null,12360,1,30,280,7,0,0,0,0,{$time}),(null,12361,1,30,280,7,0,0,0,0,{$time})";
 		Yii::$app->db->createCommand($sql)->execute();
-
+		
 		$sql = "update xhMerchant set adminId=18528 where id=12358;update xhMerchant set adminId=18529 where id=12359;update xhMerchant set adminId=18530 where id=12360;update xhMerchant set adminId=18531 where id=12361;";
 		Yii::$app->db->createCommand($sql)->execute();
-
+		
 		$password = password_hash('123456', PASSWORD_BCRYPT);
 		$confirmPassword = password_hash('123456', PASSWORD_BCRYPT);
 		$sql = "update `xhAdmin` set password='{$password}',confirmPassword='{$confirmPassword}' where id=18528";
@@ -1093,22 +1095,22 @@ update xhMerchant set merchantName='中花卉' where id=12358;update xhShop set
 update xhMerchant set merchantName='花店宝' where id=12358;update xhShop set shopName='花店宝',merchantName='花店宝' where merchantId=12358;";
 			Yii::$app->db->createCommand($sql)->execute();
 		}
-
+		
 		//清除没有用网站标题
 		$sql = "update xhMerchantExtend set webTitle='',webKeyword='',webDescription='';";
 		Yii::$app->db->createCommand($sql)->execute();
-
+		
 		$sql = "update xhAdmin set addTime=1583375880;update xhAdminRole set addTime=1583375880;";
 		Yii::$app->db->createCommand($sql)->execute();
-
+		
 		$sql = "update xhShop set openTime='08:00-22:00',telephone='15280215347',lat='30.03974',`long`='120.88564',province='浙江省',city='绍兴市',address='浙江省绍兴市上虞区华维路68号' where id in(15682,15683);";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		$sql = "update xhShop set openTime='08:00-22:00',telephone='18030142050',lat='24.46886',`long`='118.10708',province='福建省',city='厦门市',address='福建省厦门市思明区后埭溪路128-5号' where id in(15681,15680);update xhShop set telephone='15280215347' where id=15681;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
-
+		
 		$sql = "UPDATE xhMerchant SET wxAppId='',openAppId='' WHERE id IN(12359,12358);UPDATE xhMerchantExtend SET wxAppId='',openAppId='',wxAuth=0,miniAuth=0,init=0 WHERE merchantId IN(12359,12358);";
 		Yii::$app->db->createCommand($sql)->execute($sql);
-
+		
 		//更换开发环境小程序的miniAppId、miniAppSecret
 		if ($env == 'dev') {
 			$sql = "UPDATE xhMerchant SET miniAppId='wxe41bd5816affd0ba',miniAppSecret='ad634457979bc6eb1fb0bc7f4f58d885' WHERE id=12358;UPDATE xhMerchantExtend SET miniAppId='wxe41bd5816affd0ba',wxPayInit=0,wxPayMerchantId='',wxPayKey='' WHERE merchantId=12358;";
@@ -1123,18 +1125,34 @@ update xhMerchant set merchantName='花店宝' where id=12358;update xhShop set
 			$sql = "UPDATE xhMerchant SET miniAppId='wx21b7c3ef12082099',miniAppSecret='fd21ef3ebbc70e89d5c3a5a3c013edb6' WHERE id=12359;UPDATE xhMerchantExtend SET miniAppId='wx21b7c3ef12082099',wxPayInit=0,wxPayMerchantId='',wxPayKey='' WHERE merchantId=12359;";
 			Yii::$app->db->createCommand($sql)->execute($sql);
 		}
-
+		
 		//设置过期时间
 		$sql = "update xhMerchant set setDeadline=1583648639";
 		Yii::$app->db->createCommand($sql)->execute($sql);
-
+		
+		//如果是开发环境,将用户、订单、微信菜单全部清除
+		if ($env == 'dev') {
+			TMessageService::deleteByCondition(['merchantId' => 12358]);
+			UserService::deleteByCondition(['merchantId' => 12358]);
+			WxMenuService::deleteByCondition(['merchantId' => 12358]);
+			TMessageService::deleteByCondition(['merchantId' => 12359]);
+			UserService::deleteByCondition(['merchantId' => 12359]);
+			WxMenuService::deleteByCondition(['merchantId' => 12359]);
+		}
+		if ($env == 'test') {
+			TMessageService::deleteByCondition(['merchantId' => 12358]);
+			UserService::deleteByCondition(['merchantId' => 12358]);
+			WxMenuService::deleteByCondition(['merchantId' => 12358]);
+			TMessageService::deleteByCondition(['merchantId' => 12359]);
+			UserService::deleteByCondition(['merchantId' => 12359]);
+			WxMenuService::deleteByCondition(['merchantId' => 12359]);
+		}
 	}
 
 	//数据迁移 shish 2020.1.12
 	//./yii upgrade/sync
 	public function actionSync()
 	{
-		
 		//国兰老客户导入
 		$oldUserList = Yii::$app->db2->createCommand('select * from xhUserOldData where `status`=0')->queryAll();
 		if (!empty($oldUserList)) {