MerchantController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace www\controllers;
  3. use biz\admin\services\AdminService;
  4. use biz\merchant\services\MerchantService;
  5. use common\components\util;
  6. use Yii;
  7. class MerchantController extends BaseController
  8. {
  9. public $withoutLogin = ['add-platform-merchant'];
  10. //商家列表 shish 2019.12.20
  11. public function actionList()
  12. {
  13. $where = [];
  14. $list = MerchantService::getSaasMerchant($where);
  15. util::success($list);
  16. }
  17. //获取当前登陆老板的帐号详情,官网购买套餐时使用 shish 2020.1.11
  18. public function actionLoginAccount()
  19. {
  20. $userId = $this->userId;
  21. $admin = AdminService::getByCondition(['platUserId' => $userId]);
  22. if (empty($admin)) {
  23. util::fail('没有找到注册信息');
  24. }
  25. $merchantId = $admin['merchantId'];
  26. $merchant = MerchantService::getMerchantById($merchantId);
  27. util::success($merchant);
  28. }
  29. //商家信息 shish 2020.1.11
  30. public function actionIntroduceShop()
  31. {
  32. $id = Yii::$app->request->get('id');
  33. $merchant = MerchantService::getMerchantById($id);
  34. if (empty($merchant)) {
  35. util::fail('没有找到介绍人');
  36. }
  37. $merchantName = isset($merchant['merchantName']) ? $merchant['merchantName'] : '';
  38. $smallLogoUrl = isset($merchant['smallLogoUrl']) ? $merchant['smallLogoUrl'] : '';
  39. $logoUrl = isset($merchant['logoUrl']) ? $merchant['logoUrl'] : '';
  40. $data = ['merchantName' => $merchantName, 'smallLogoUrl' => $smallLogoUrl, 'id' => $id, 'logoUrl' => $logoUrl, 'fullAddress' => '暂无'];
  41. util::success($data);
  42. }
  43. //平台帐号激活 shish 2020.2.15
  44. public function actionAddPlatformMerchant()
  45. {
  46. MerchantService::initOpenMerchant();
  47. echo 'ok';
  48. }
  49. }