MerchantController.php 2.5 KB

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