| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace pt\controllers;
- use biz\sj\services\MerchantExtendService;
- use Yii;
- use bizHd\admin\services\AdminService;
- use biz\sj\services\MerchantService;
- use common\components\util;
- class MerchantController extends BaseController
- {
- //商家列表 ssh 2019.12.20
- public function actionList()
- {
- $style = Yii::$app->request->get('style', 0);
- $where = ['delStatus' => 0];
- if (!empty($style)) {
- $where['style'] = $style;
- }
- $name = Yii::$app->request->get('name', '');
- if (!empty($name)) {
- $where['name'] = ['like', $name];
- }
- $list = MerchantService::getMerchantList($where);
- util::success($list);
- }
- //获取当前登陆老板的帐号详情,官网购买套餐时使用 ssh 2020.1.11
- public function actionLoginAccount()
- {
- $staffId = $this->staffId;
- $admin = AdminService::getByCondition(['platUserId' => $staffId]);
- if (empty($admin)) {
- util::fail('没有找到注册信息');
- }
- $sjId = $admin['sjId'];
- $merchant = MerchantService::getMerchantById($sjId);
- util::success($merchant);
- }
- //商家信息 ssh 2020.1.11
- public function actionDetail()
- {
- $merchant = MerchantService::getMerchantById(12358);
- util::success($merchant);
- }
- //平台帐号激活 ssh 2020.2.15
- public function actionAddPlatformMerchant()
- {
- MerchantService::initOpenMerchant();
- echo 'ok';
- }
- //注释商家 ssh 2020.3.4
- public function actionCancel()
- {
- if (getenv('YII_ENV') != 'test') {
- util::fail('只有测试环境才能操作');
- }
- $id = Yii::$app->request->get('id', 0);
- $merchant = MerchantService::getById($id, true);
- if (isset($merchant->wxAppId) && empty($merchant->wxAppId)) {
- util::fail('已注销/未授权');
- }
- $merchant->wxAppId = '';
- $merchant->miniAppId = '';
- $merchant->save();
- $extend = MerchantExtendService::getBySjId($id, true);
- $extend->miniAppId = '';
- $extend->wxAppId = '';
- $extend->save();
- util::complete();
- }
- //商家h5商城二维码 ssh 2020.4.30
- public function actionGetH5MallQrCode()
- {
- $id = Yii::$app->request->get('id', 0);
- $imgUrl = MerchantService::getH5MallQrCode($id);
- util::success(['imgUrl' => $imgUrl]);
- }
- }
|