MerchantController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. $style = Yii::$app->request->get('style', 0);
  16. $where = ['delStatus' => 0];
  17. if (!empty($style)) {
  18. $where['style'] = $style;
  19. }
  20. $list = MerchantService::getMerchantList($where);
  21. util::success($list);
  22. }
  23. //获取当前登陆老板的帐号详情,官网购买套餐时使用 ssh 2020.1.11
  24. public function actionLoginAccount()
  25. {
  26. $userId = $this->userId;
  27. $admin = AdminService::getByCondition(['platUserId' => $userId]);
  28. if (empty($admin)) {
  29. util::fail('没有找到注册信息');
  30. }
  31. $merchantId = $admin['merchantId'];
  32. $merchant = MerchantService::getMerchantById($merchantId);
  33. util::success($merchant);
  34. }
  35. //商家信息 ssh 2020.1.11
  36. public function actionDetail()
  37. {
  38. $merchant = MerchantService::getMerchantById(12358);
  39. util::success($merchant);
  40. }
  41. //平台帐号激活 ssh 2020.2.15
  42. public function actionAddPlatformMerchant()
  43. {
  44. MerchantService::initOpenMerchant();
  45. echo 'ok';
  46. }
  47. //注释商家 ssh 2020.3.4
  48. public function actionCancel()
  49. {
  50. if (getenv('YII_ENV') != 'test') {
  51. util::fail('只有测试环境才能操作');
  52. }
  53. $id = Yii::$app->request->get('id', 0);
  54. $merchant = MerchantService::getById($id, true);
  55. if (isset($merchant->wxAppId) && empty($merchant->wxAppId)) {
  56. util::fail('已注销/未授权');
  57. }
  58. $merchant->wxAppId = '';
  59. $merchant->miniAppId = '';
  60. $merchant->save();
  61. $extend = MerchantExtendService::getByMerchantId($id, true);
  62. $extend->miniAppId = '';
  63. $extend->wxAppId = '';
  64. $extend->save();
  65. util::complete();
  66. }
  67. //商家h5商城二维码 ssh 2020.4.30
  68. public function actionGetH5MallQrCode()
  69. {
  70. $id = Yii::$app->request->get('id', 0);
  71. $imgUrl = MerchantService::getH5MallQrCode($id);
  72. util::success(['imgUrl' => $imgUrl]);
  73. }
  74. }