MerchantController.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace pt\controllers;
  3. use biz\sj\classes\MerchantClass;
  4. use biz\sj\classes\SjClass;
  5. use biz\sj\services\MerchantExtendService;
  6. use Yii;
  7. use bizHd\admin\services\AdminService;
  8. use biz\sj\services\MerchantService;
  9. use common\components\util;
  10. class MerchantController extends BaseController
  11. {
  12. //商家列表 ssh 2019.12.20
  13. public function actionList()
  14. {
  15. $where = ['delStatus' => 0];
  16. $list = MerchantService::getMerchantList($where);
  17. util::success($list);
  18. }
  19. //获取当前登陆老板的帐号详情,官网购买套餐时使用 ssh 2020.1.11
  20. public function actionLoginAccount()
  21. {
  22. $userId = $this->userId;
  23. $admin = AdminService::getByCondition(['platUserId' => $userId]);
  24. if (empty($admin)) {
  25. util::fail('没有找到注册信息');
  26. }
  27. $merchantId = $admin['merchantId'];
  28. $merchant = MerchantService::getMerchantById($merchantId);
  29. util::success($merchant);
  30. }
  31. //商家信息 ssh 2020.1.11
  32. public function actionDetail()
  33. {
  34. $merchant = MerchantService::getMerchantById(12358);
  35. util::success($merchant);
  36. }
  37. //平台帐号激活 ssh 2020.2.15
  38. public function actionAddPlatformMerchant()
  39. {
  40. MerchantService::initOpenMerchant();
  41. echo 'ok';
  42. }
  43. //注释商家 ssh 2020.3.4
  44. public function actionCancel()
  45. {
  46. if (getenv('YII_ENV') != 'test') {
  47. util::fail('只有测试环境才能操作');
  48. }
  49. $id = Yii::$app->request->get('id', 0);
  50. $merchant = MerchantService::getById($id, true);
  51. if (isset($merchant->wxAppId) && empty($merchant->wxAppId)) {
  52. util::fail('已注销/未授权');
  53. }
  54. $merchant->wxAppId = '';
  55. $merchant->miniAppId = '';
  56. $merchant->save();
  57. $extend = MerchantExtendService::getByMerchantId($id, true);
  58. $extend->miniAppId = '';
  59. $extend->wxAppId = '';
  60. $extend->save();
  61. util::complete();
  62. }
  63. //商家h5商城二维码 ssh 2020.4.30
  64. public function actionGetH5MallQrCode()
  65. {
  66. $id = Yii::$app->request->get('id', 0);
  67. $imgUrl = MerchantService::getH5MallQrCode($id);
  68. util::success(['imgUrl' => $imgUrl]);
  69. }
  70. }