| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace console\controllers;
- use biz\ghs\classes\GhsClass;
- use biz\shop\classes\ShopClass;
- use bizGhs\custom\classes\CustomClass;
- use yii\console\Controller;
- use Yii;
- class ShopController extends Controller
- {
- public function actionCustom()
- {
- $custom = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
- if (empty($custom)) {
- echo '空';
- return false;
- }
- foreach ($custom as $item) {
- $shopId = $item->shopId ?? 0;
- $shop = ShopClass::getById($shopId, true);
- if ($shop->mainId != $item->mainId) {
- echo "客户id:{$item->id} {$shop->mainId} {$item->mainId}\n";
- if (!empty($shop->mainId)) {
- $item->mainId = $shop->mainId;
- $item->save();
- }
- }
- $ownShopId = $item->ownShopId ?? 0;
- $ownShop = ShopClass::getById($ownShopId, true);
- if ($ownShop->mainId != $item->ownMainId) {
- echo "客户own {$item->id} {$item->ownMainId} {$ownShop->mainId}\n";
- if (!empty($ownShop->mainId)) {
- $item->ownMainId = $ownShop->mainId;
- $item->save();
- }
- }
- }
- }
- public function actionGhs()
- {
- $ghs = GhsClass::getAllByCondition(['id>' => 0], null, '*', null, true);
- if (empty($ghs)) {
- echo '空';
- return false;
- }
- foreach ($ghs as $item) {
- $shopId = $item->shopId ?? 0;
- $mainId = $item->mainId ?? 0;
- $shop = ShopClass::getById($shopId, true);
- if ($shop->mainId != $mainId) {
- echo "ghs {$item->id} {$mainId} {$shop->mainId} \n";
- }
- $ownShopId = $item->ownShopId ?? 0;
- $ownMainId = $item->ownMainId ?? 0;
- $ownShop = ShopClass::getById($ownShopId, true);
- if ($ownShop->mainId != $ownMainId) {
- echo "ghs own {$item->id} {$ownMainId} {$ownShop->mainId} \n";
- if (!empty($ownShop->mainId)) {
- $item->ownMainId = $ownShop->mainId;
- $item->save();
- }
- }
- }
- }
- }
|