ShopController.php 811 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace console\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use biz\shop\classes\ShopClass;
  5. use bizGhs\custom\classes\CustomClass;
  6. use yii\console\Controller;
  7. use Yii;
  8. class ShopController extends Controller
  9. {
  10. public function actionMain()
  11. {
  12. $custom = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  13. if (empty($custom)) {
  14. echo '空';
  15. return false;
  16. }
  17. foreach ($custom as $item) {
  18. $shopId = $item->shopId ?? 0;
  19. $shop = ShopClass::getById($shopId, true);
  20. if ($shop->mainId != $item->mainId) {
  21. echo "客户id:{$item->id} {$shop->mainId} {$item->mainId}\n";
  22. $item->mainId = $shop->mainId;
  23. $item->save();
  24. }
  25. }
  26. }
  27. }