diff --git a/app/chat/controller/GroupController.php b/app/chat/controller/GroupController.php index affc932..be8ca0b 100644 --- a/app/chat/controller/GroupController.php +++ b/app/chat/controller/GroupController.php @@ -24,7 +24,7 @@ class GroupController extends ApiController if (empty($shop_id)) { return $this->error('参数不存在'); } - return $this->success(Db::name('chat_group')->where(['shop_id' => $shop_id])->find()); + return $this->success(Db::name('chat_group')->where(['shop_id' => $shop_id, 'owner_id' => $this->uid])->find()); } diff --git a/app/common/controller/ApiController.php b/app/common/controller/ApiController.php index 0776038..1a45a06 100644 --- a/app/common/controller/ApiController.php +++ b/app/common/controller/ApiController.php @@ -2,6 +2,7 @@ namespace app\common\controller; use app\exception\MyBusinessException; +use extend\chat\model\Base; use support\exception\BusinessException; class ApiController { @@ -10,8 +11,9 @@ class ApiController public function __construct() { - $this->uid = input('uid'); - $this->user_type = input('user_type'); + $user_info = Base::getUser(request()->header('token')); + $this->uid = $user_info['uid']; + $this->user_type = $user_info['user_type']; } public function success($data = []) diff --git a/app/middleware/JwtAuthMiddleware.php b/app/middleware/JwtAuthMiddleware.php index 090e810..06b26c7 100644 --- a/app/middleware/JwtAuthMiddleware.php +++ b/app/middleware/JwtAuthMiddleware.php @@ -15,11 +15,11 @@ class JwtAuthMiddleware implements MiddlewareInterface { public function process(Request $request, callable $handler) : Response { - $user_info = Base::getUser($request->header('token')); - $a = $request->setPost('uid', $user_info['uid']); - Log::info('uid注入结果' . json_encode($request->post())); - $b = $request->setPost('user_type', $user_info['user_type']); - Log::info('user_type注入结果' . json_encode($request->post())); +// $user_info = Base::getUser($request->header('token')); +// $a = $request->setPost('uid', $user_info['uid']); +// Log::info('uid注入结果' . json_encode($request->post())); +// $b = $request->setPost('user_type', $user_info['user_type']); +// Log::info('user_type注入结果' . json_encode($request->post())); return $handler($request); } }