OpenShopInitController.php 887 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace console\controllers;
  3. use biz\sj\services\MerchantService;
  4. use bizHd\wx\services\WxOpenService;
  5. use common\components\sms;
  6. use common\components\util;
  7. use Yii;
  8. use yii\console\Controller;
  9. /**
  10. * 脚本
  11. */
  12. class OpenShopInitController extends Controller
  13. {
  14. //开店初始化 ./yii open-shop-init/init ssh 2020.6.10
  15. public function actionInit($id = 0)
  16. {
  17. if (empty($id)) {
  18. util::stop();
  19. }
  20. $return = MerchantService::openShopInit(['sjId' => $id]);
  21. if ($return == false) {
  22. //没有初始化成功短信通知管理员
  23. $merchant = MerchantService::getMerchantById($id);
  24. $name = $merchant['name'];
  25. $adminMobile = WxOpenService::getAdminMobile();
  26. sms::freeSend($adminMobile, "花店:{$name}({$id})初始化没有成功。", $merchant);
  27. }
  28. }
  29. }