InitController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace console\controllers;
  3. use biz\shop\classes\ShopClass;
  4. use biz\wx\classes\WxMessageClass;
  5. use bizHd\custom\classes\CustomClass;
  6. use bizHd\custom\classes\HdClass;
  7. use common\components\stringUtil;
  8. use yii\console\Controller;
  9. class InitController extends Controller
  10. {
  11. public function actionCustom()
  12. {
  13. $customList = CustomClass::getAllByCondition(['id>0'], null, '*', null, true);
  14. if (!empty($customList)) {
  15. foreach ($customList as $custom) {
  16. $userId = $custom->userId ?? 0;
  17. $shopId = $custom->shopId ?? 0;
  18. $customId = $custom->id ?? 0;
  19. $hd = HdClass::getByCondition(['userId' => $userId, 'shopId' => $shopId], true);
  20. if (!empty($hd)) {
  21. $hdId = $hd->id ?? 0;
  22. $hd->customId = $customId;
  23. $hd->save();
  24. $custom->hdId = $hdId;
  25. $custom->save();
  26. echo "hdId:{$hdId} customId:{$customId} \n";
  27. }
  28. }
  29. }
  30. }
  31. }