Title: 几个建议(我可以协助完成) · Issue #89 · phalapi/phalapi · GitHub
Open Graph Title: 几个建议(我可以协助完成) · Issue #89 · phalapi/phalapi
X Title: 几个建议(我可以协助完成) · Issue #89 · phalapi/phalapi
Description: 首先第一步, 注释规范化. . 建议使用apidocjs的方案. 比如下面是我的代码: /** * @api {post} /auth/register/email 邮箱注册 * @apiDescription 注册时, 请求体将不可避免地用明文传参.所以建议开启SSL. * @apiVersion 2.0.0 * @apiPermission none * @apiName registerByEmail * @apiGroup Auth * * @apiParam ...
Open Graph Description: 首先第一步, 注释规范化. . 建议使用apidocjs的方案. 比如下面是我的代码: /** * @api {post} /auth/register/email 邮箱注册 * @apiDescription 注册时, 请求体将不可避免地用明文传参.所以建议开启SSL. * @apiVersion 2.0.0 * @apiPermission none * @apiName registe...
X Description: 首先第一步, 注释规范化. . 建议使用apidocjs的方案. 比如下面是我的代码: /** * @api {post} /auth/register/email 邮箱注册 * @apiDescription 注册时, 请求体将不可避免地用明文传参.所以建议开启SSL. * @apiVersion 2.0.0 * @apiPermission none * @apiName registe...
Opengraph URL: https://github.com/phalapi/phalapi/issues/89
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"几个建议(我可以协助完成)","articleBody":"首先第一步, 注释规范化. . 建议使用[apidocjs](http://apidocjs.com/)的方案. 比如下面是我的代码:\r\n```php\r\n /**\r\n * @api {post} /auth/register/email 邮箱注册\r\n * @apiDescription 注册时, 请求体将不可避免地用明文传参.所以建议开启SSL.\r\n * @apiVersion 2.0.0\r\n * @apiPermission none\r\n * @apiName registerByEmail\r\n * @apiGroup Auth\r\n *\r\n * @apiParam {String{3..16}} username 用户名.\r\n * @apiParam {String{..32}} email 用户邮箱.\r\n * @apiParam {String{6}} captch 验证码.\r\n * @apiParam {String} password 密码.\r\n *\r\n * @apiSuccessExample 成功响应:\r\n {\r\n \"ret\": 200,\r\n \"data\": {},\r\n \"msg\": \"\"\r\n }\r\n */\r\n public function registerByEmail()\r\n {\r\n $domain = new Domain();\r\n /** ============== 格式检查 ============== */\r\n /** ------- 用户名检查 ------- */\r\n $this->username = trim($this->username);\r\n if (!\\App\\Helper\\Validator::checkUsernameFormat($this->username)) {\r\n throw new BadRequestException('用户名格式错误, 请检查用户名格式是否正确. 只可以含有?.@_所有中英文和emoji.');\r\n }\r\n /** ------- 邮箱检查 ------- */\r\n $this->email = trim($this->email);\r\n if (!\\App\\Helper\\Validator::checkEmailFormat($this->email)) {\r\n throw new BadRequestException('邮箱格式错误, 必须形如 username@website.domain 的格式');\r\n }\r\n /** ============== 正式检查 ============== */\r\n // 检查可用性(重复)\r\n if (!$domain->isEmailAvailable($this->email)) {\r\n throw new BadRequestException('邮箱已被使用');\r\n }\r\n /** ------- captch validating ------- */\r\n $this->captch = trim($this->captch);\r\n $correctCaptch = $domain->getLastCaptch($this->email);\r\n if ($correctCaptch == null) {\r\n throw new BadRequestException('未发送验证码');\r\n }\r\n if ($this->captch != $correctCaptch) {\r\n throw new BadRequestException('验证码错误或过期');\r\n }\r\n /** ------- password validating ------- */\r\n // 密码不进行 trim()\r\n /** ------- 完成注册 ------- */\r\n $domain->registerUserByEmail($this->username, $this->email, $this->password, 1);\r\n\r\n // 目前规定, 失败才返回消息\r\n //\\PhalApi\\DI()->response->setMsg(\"注册成功\");\r\n\r\n return array();\r\n }\r\n```\r\n\r\n1. 在目前的设计中, getRules 和 API 实现距离太远, 无论是查找和修改都麻烦, 降低了开发效率. 建议直接从注释中读取规则.\r\n2. 建议能够从注释直接生成fastroute的配置. 比如上面这个就是post方式, 地址为/auth/register/email\r\n3. 建议直接从注释中判断执行权限, 比如这里 @apiPermission none, 就表示任何人都有权限.\r\n\r\napidoc 已经能够直接生成json, 读取json再生成相应所需php文件, 并不困难.","author":{"url":"https://github.com/pluveto","@type":"Person","name":"pluveto"},"datePublished":"2019-05-23T07:41:44Z","url":"https://github.com/phalapi/phalapi/issues/89"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f117a871-6cde-8de6-3c60-5d2c21960be1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDBA:39E772:F858C:152D7A:6B006340 |
| html-safe-nonce | f73b420bc05f50b6b8bf9f849e2f6bc1dded463401e5d95f30ef967a2c1d343d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREJBOjM5RTc3MjpGODU4QzoxNTJEN0E6NkIwMDYzNDAiLCJ2aXNpdG9yX2lkIjoiMTk3MTUwMzg4ODg5NjkxMDE0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b6887f32a526f96fda94d72f658719f68c31ae41a7a1c7a4d9bd775e0346378a |
| hovercard-subject-tag | issue:447497606 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/phalapi/phalapi/89/issue_layout |
| twitter:image | https://opengraph.githubassets.com/381c1548dbb9f1c351a48da67682895fb44ce76f79bd1dbe54bb117f6beb0f08/phalapi/phalapi/issues/89 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/381c1548dbb9f1c351a48da67682895fb44ce76f79bd1dbe54bb117f6beb0f08/phalapi/phalapi/issues/89 |
| og:image:alt | 首先第一步, 注释规范化. . 建议使用apidocjs的方案. 比如下面是我的代码: /** * @api {post} /auth/register/email 邮箱注册 * @apiDescription 注册时, 请求体将不可避免地用明文传参.所以建议开启SSL. * @apiVersion 2.0.0 * @apiPermission none * @apiName registe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pluveto |
| hostname | github.com |
| expected-hostname | github.com |
| None | 25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e |
| turbo-cache-control | no-preview |
| go-import | github.com/phalapi/phalapi git https://github.com/phalapi/phalapi.git |
| octolytics-dimension-user_id | 12585518 |
| octolytics-dimension-user_login | phalapi |
| octolytics-dimension-repository_id | 36178323 |
| octolytics-dimension-repository_nwo | phalapi/phalapi |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36178323 |
| octolytics-dimension-repository_network_root_nwo | phalapi/phalapi |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4f5c239e31f1f680e6bbc419ff92d774da616ec |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width