HfController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace console\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use biz\shop\classes\ShopClass;
  5. use biz\shop\services\ShopAdminService;
  6. use biz\sj\classes\SjClass;
  7. use bizGhs\admin\classes\AdminClass;
  8. use bizGhs\custom\classes\CustomClass;
  9. use bizGhs\custom\models\Custom;
  10. use bizGhs\order\classes\OrderClass;
  11. use bizHd\purchase\classes\PurchaseClass;
  12. use bizHd\saas\classes\ApplyClass;
  13. use bizHd\saas\services\ApplyService;
  14. use common\components\dict;
  15. use common\components\noticeUtil;
  16. use common\components\stringUtil;
  17. use common\components\util;
  18. use yii\console\Controller;
  19. use Yii;
  20. class HfController extends Controller
  21. {
  22. public function actionCopy()
  23. {
  24. ini_set('memory_limit', '2045M');
  25. set_time_limit(0);
  26. //指定当前环境为批发商
  27. Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'ghs');
  28. if (getenv('YII_ENV') == 'production') {
  29. $toShopId = 33904;
  30. $fromShopId = 12526;
  31. } else {
  32. $toShopId = 36677;
  33. $fromShopId = 36523;
  34. }
  35. $fromCustomList = CustomClass::getAllByCondition(['ownShopId' => $fromShopId], null, '*');
  36. foreach ($fromCustomList as $fromCustomer) {
  37. $exist = CustomClass::exists(['ownShopId' => $toShopId, 'shopId' => $fromCustomer['shopId']]);
  38. if (!$exist) {
  39. CustomClass::build($toShopId, $fromCustomer['shopId'], $fromCustomer['name']);
  40. }
  41. }
  42. }
  43. }