|
|
@@ -2,93 +2,81 @@
|
|
|
|
|
|
namespace console\controllers;
|
|
|
|
|
|
-use bizHd\user\services\UserService;
|
|
|
-use bizHd\wx\services\WxOpenService;
|
|
|
-use common\services\xhMerchantAssetService;
|
|
|
-use common\services\xhWxMenuService;
|
|
|
+use biz\pt\classes\PtYeChangeClass;
|
|
|
+use biz\recharge\classes\RechargeClass;
|
|
|
+use biz\shop\classes\MainIdClass;
|
|
|
+use biz\shop\classes\ShopAdminClass;
|
|
|
+use biz\shop\classes\ShopCapitalClass;
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
+use biz\shop\classes\ShopYeChangeClass;
|
|
|
+use biz\sj\classes\CashClass;
|
|
|
+use biz\stat\classes\StatOutClass;
|
|
|
+use biz\stat\classes\StatOutMonthClass;
|
|
|
+use biz\stat\classes\StatSaleClass;
|
|
|
+use biz\stat\classes\StatSaleMonthClass;
|
|
|
+use bizGhs\stat\classes\StatYjClass;
|
|
|
+use bizGhs\stat\classes\StatYjMonthClass;
|
|
|
+use bizHd\stat\classes\StatUserClass;
|
|
|
+use bizHd\stat\classes\StatUserMonthClass;
|
|
|
+use bizHd\stat\classes\StatVisitClass;
|
|
|
+use bizHd\stat\classes\StatVisitMonthClass;
|
|
|
use Yii;
|
|
|
use yii\console\Controller;
|
|
|
-use common\services\xhTMessageService;
|
|
|
-use common\services\xhMerchantService;
|
|
|
|
|
|
-/**
|
|
|
- * 脚本
|
|
|
- */
|
|
|
class InitController extends Controller
|
|
|
{
|
|
|
|
|
|
- //微信菜单初始化 shish 20210526
|
|
|
- // yii init/menu-init
|
|
|
- public function actionMenuInit()
|
|
|
+ //执行供货商资产中央化 ./yii init/ghs-center
|
|
|
+ // shish 20220313
|
|
|
+ public function actionGhsCenter()
|
|
|
{
|
|
|
- xhWxMenuService::menuInit();
|
|
|
- }
|
|
|
-
|
|
|
- //接入一个商家需要的操作 ssh 2019.9.7
|
|
|
- // yii init/join-one 12358 更新某个商家公众号
|
|
|
- // yii init/join-one 更新平台公众号
|
|
|
- public function actionJoinOne($id = 0)
|
|
|
- {
|
|
|
- //初始化微信菜单
|
|
|
- if ($id == 0) {
|
|
|
- $isOpen = 1;
|
|
|
- $merchant = WxOpenService::getWxInfo();
|
|
|
- $merchant['id'] = 0;
|
|
|
- } else {
|
|
|
- $isOpen = 0;
|
|
|
- $merchant = xhMerchantService::getById($id);
|
|
|
+ $shopList = ShopClass::getAllByCondition(['ptStyle' => 2], null, '*', null, true);
|
|
|
+ if (empty($shopList)) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- //xhWxMenuService::applyInit($merchant);
|
|
|
- //模板消息
|
|
|
- $r = xhTMessageService::supplement($merchant, $isOpen);
|
|
|
- print_r($r);
|
|
|
- }
|
|
|
+ foreach ($shopList as $shop) {
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ if (empty($mainId)) {
|
|
|
+ $main = MainIdClass::add(['id' => null], true);
|
|
|
+ $mainId = $main->id ?? 0;
|
|
|
+ if (empty($mainId)) {
|
|
|
+ echo "mainId没有生成 \n";
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ $shop->mainId = $mainId;
|
|
|
+ $shop->save();
|
|
|
+ }
|
|
|
|
|
|
+ $shopId = $shop->id ?? 0;
|
|
|
|
|
|
- //yii init/sub
|
|
|
- public function actionSub()
|
|
|
- {
|
|
|
- $name = 'redis_shi';
|
|
|
- $redisPubSub = \Yii::$app->redisPubSub;
|
|
|
- $redisPubSub->setOptReadTimeout(-1);
|
|
|
- $redisPubSub->subscribe($name, function ($instance, $channelName, $message) {
|
|
|
- $a = 123;
|
|
|
- });
|
|
|
- }
|
|
|
+ StatSaleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+ StatSaleMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
|
|
|
- public function actionPub()
|
|
|
- {
|
|
|
- $name = 'redis_shi';
|
|
|
- $time = 'nihao1123';
|
|
|
- $redisPubSub = \Yii::$app->redisPubSub;
|
|
|
- $redisPubSub->publish($name, $time);
|
|
|
- }
|
|
|
+ StatUserClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+ StatUserMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
|
|
|
- public function actionPullUser()
|
|
|
- {
|
|
|
- //拉取用户
|
|
|
- $this->actionPullUser();
|
|
|
- }
|
|
|
+ StatVisitClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+ StatVisitMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
|
|
|
- // 拉取微信用户 ssh 2019.9.9
|
|
|
- public function actionPullUser2()
|
|
|
- {
|
|
|
- $sjId = 12359;
|
|
|
- $return = UserService::syncWxAllUser($sjId);
|
|
|
- $total = isset($return['data']['total']) ? $return['data']['total'] : 0;
|
|
|
- xhMerchantAssetService::updateBySjId($sjId, ['totalFans' => $total]);
|
|
|
- }
|
|
|
+ StatOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+ StatOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
|
|
|
- //更新用户名称
|
|
|
- public function actionUpdateName()
|
|
|
- {
|
|
|
- $sjId = 12362;
|
|
|
- UserService::syncWxAllUser($sjId);
|
|
|
- }
|
|
|
+ PtYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+ ShopYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+
|
|
|
+ CashClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+
|
|
|
+ ShopCapitalClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+
|
|
|
+ RechargeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+
|
|
|
+ StatYjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+ StatYjMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+
|
|
|
+ ShopAdminClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- //消息模板初始化 linqh ./yii init/t-message
|
|
|
- public function actionTMessage()
|
|
|
- {
|
|
|
- xhTMessageService::initTMessage();
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+}
|