diff --git a/app/Controller/v3/HomeController.php b/app/Controller/v3/HomeController.php index 8811f33..dd95bd9 100644 --- a/app/Controller/v3/HomeController.php +++ b/app/Controller/v3/HomeController.php @@ -122,7 +122,17 @@ class HomeController extends BaseController { $params = $request->validated(); $data['user'] = $this->userInfoService->detail($params['user_id']); - $data['user']['role'] = '商家'; + $data['user']['store_info'] = $this->userInfoService->getStoreByUID($params['user_id']); + $data['user']['role'] = [ + [ + 'title'=>'商家', + 'color'=>'#0091FF' + ], + [ + 'title'=>'骑手', + 'color'=>'#009100' + ], + ]; $data['user']['collection_count'] = $this->collectStoreService->countByUser($params['user_id']); $data['user']['coupon_count'] = $this->couponService->countAvailableByUser($params['user_id']); diff --git a/app/Service/v3/Implementations/UserInfoService.php b/app/Service/v3/Implementations/UserInfoService.php index c612aa9..5a11ad2 100644 --- a/app/Service/v3/Implementations/UserInfoService.php +++ b/app/Service/v3/Implementations/UserInfoService.php @@ -6,6 +6,7 @@ use App\Constants\v3\ErrorCode; use App\Constants\v3\SsdbKeys; use App\Exception\ErrorCodeException; use App\Model\v3\User; +use App\Model\v3\Store; use App\Service\v3\Interfaces\UserInfoServiceInterface; use App\TaskWorker\SSDBTask; use EasyWeChat\Factory; @@ -74,4 +75,12 @@ class UserInfoService implements UserInfoServiceInterface ->where(['status' => 1, 'id' => $userId]) ->first()->toArray(); } + + public function getStoreByUID($userId) + { + $store = Store::where('user_id',$userId)->select(['id','name'])->first(); + return $store; + } + + } \ No newline at end of file diff --git a/app/Service/v3/Interfaces/UserInfoServiceInterface.php b/app/Service/v3/Interfaces/UserInfoServiceInterface.php index 29834c5..e591d03 100644 --- a/app/Service/v3/Interfaces/UserInfoServiceInterface.php +++ b/app/Service/v3/Interfaces/UserInfoServiceInterface.php @@ -8,4 +8,5 @@ interface UserInfoServiceInterface public function check($userId); public function undo($userId); public function detail($userId); + public function getStoreByUID($userId); } \ No newline at end of file