AdminShopController.php 942 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace shop\controllers;
  3. use biz\admin\services\AdminRoleService;
  4. use biz\admin\services\AdminShopService;
  5. use common\components\jwt;
  6. use common\components\util;
  7. use Yii;
  8. use yii\web\Controller;
  9. class AdminShopController extends BaseController
  10. {
  11. //创建管理员数据准备 shish 2020.4.17
  12. public function actionPrepareBind()
  13. {
  14. $post = Yii::$app->request->post();
  15. $roleId = isset($post['roleId']) ? $post['roleId'] : 0;
  16. $role = AdminRoleService::getById($roleId);
  17. if (empty($role) || isset($role['merchantId']) != $this->merchantId) {
  18. util::fail('请选择角色!');
  19. }
  20. unset($post['userId']);
  21. unset($post['status']);
  22. $post['shopId'] = $this->shopId;
  23. $post['adminId'] = $this->adminId;
  24. $post['merchant'] = $this->merchant;
  25. $respond = AdminShopService::prepareBindAdmin($post);
  26. $miniCode = isset($respond['miniCode']) ? $respond['miniCode'] : '';
  27. util::success(['miniCode' => $miniCode]);
  28. }
  29. }