MerchantController.php 1.6 KB

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