diff --git a/app/Controller/PunchCard/User/UserController.php b/app/Controller/PunchCard/User/UserController.php new file mode 100644 index 0000000..9c41627 --- /dev/null +++ b/app/Controller/PunchCard/User/UserController.php @@ -0,0 +1,71 @@ +request->input('openid', ''); + return $this->getServiceResult($this->userExternalService->getUserInfo($openid, [ + 'user_name', + 'user_phone', + ])); + } + + /** + * 保存个人资料 + * + * @return void + */ + #[PostMapping(path: "user/save_information")] + public function saveInformation() : void + { + $phone = $this->request->input('phone', ''); + // TODO 逻辑完善 + } + + /** + * 保存问题反馈 + * + * @return array + */ + #[PostMapping(path: "user/save_feedback")] + public function saveFeedback() : array + { + return $this->getServiceResult($this->punchCardSystemExternalService->saveFeedback($this->request)); + } +} diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 021cd3d..674b454 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -74,14 +74,4 @@ class TestController extends BaseController return new Paginator($users, $perPage, $currentPage); } - - /** - * RPC调用示例 - * - * @return array - */ - public function user_info() - { - return $this->getServiceResult($this->userService->getUserInfo()); - } } \ No newline at end of file diff --git a/app/JsonRpc/PunchCardSystemExternalServiceConsumer.php b/app/JsonRpc/PunchCardSystemExternalServiceConsumer.php new file mode 100644 index 0000000..913e4b1 --- /dev/null +++ b/app/JsonRpc/PunchCardSystemExternalServiceConsumer.php @@ -0,0 +1,26 @@ +__request(__FUNCTION__, $request->all()); + } +} \ No newline at end of file diff --git a/app/JsonRpc/PunchCardSystemExternalServiceInterface.php b/app/JsonRpc/PunchCardSystemExternalServiceInterface.php new file mode 100644 index 0000000..ce993cc --- /dev/null +++ b/app/JsonRpc/PunchCardSystemExternalServiceInterface.php @@ -0,0 +1,16 @@ + JsonRpcPoolTransporter::class, + App\JsonRpc\PunchCardSystemExternalServiceInterface::class => App\JsonRpc\PunchCardSystemExternalServiceConsumer::class, ]; diff --git a/config/autoload/services.php b/config/autoload/services.php index a7df251..39c28f4 100644 --- a/config/autoload/services.php +++ b/config/autoload/services.php @@ -19,6 +19,7 @@ return [ // 这里示例自动创建代理消费者类的配置形式,顾存在 name 和 service 两个配置项,这里的做法不是唯一的,仅说明可以通过 PHP 代码来生成配置 $services = [ 'UserExternalService' => App\JsonRpc\UserExternalServiceInterface::class, + 'PunchCardSystemExternalService' => '' ]; foreach ($services as $name => $interface) { $consumers[] = [