MerchantController.php 2.4 KB

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