mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-27 20:05:15 +08:00
用户注册功能实现;用户表添加email字段
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
Target Server Version : 50726
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 03/04/2022 23:36:35
|
||||
Date: 04/04/2022 14:26:48
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -214,6 +214,7 @@ CREATE TABLE `user_info` (
|
||||
`nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`group` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`weixin_third_party_auth_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`qq_third_party_auth_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
@@ -223,7 +224,7 @@ CREATE TABLE `user_info` (
|
||||
-- ----------------------------
|
||||
-- Records of user_info
|
||||
-- ----------------------------
|
||||
INSERT INTO `user_info` VALUES (1, 'admin', '7c4a8d09ca3762af61e59520943dc26494f8941b', '小小墨', 'ADMIN', '/密码/123456/', '', '', '');
|
||||
INSERT INTO `user_info` VALUES (2, 'xiaomo', '7c4a8d09ca3762af61e59520943dc26494f8941b', '小小墨', 'USER', '/密码/123456/', '', '', '');
|
||||
INSERT INTO `user_info` VALUES (1, 'admin', '7c4a8d09ca3762af61e59520943dc26494f8941b', '小小墨', 'ADMIN', '/密码/123456/', '', '', '', '');
|
||||
INSERT INTO `user_info` VALUES (2, 'xiaomo', '7c4a8d09ca3762af61e59520943dc26494f8941b', '小小墨', 'USER', '/密码/123456/', '', '', '', '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
@@ -569,6 +569,79 @@ __可选__|string
|
||||
----
|
||||
|
||||
|
||||
[[_registerusingpost]]
|
||||
==== 用户注册
|
||||
....
|
||||
POST /api/user/register
|
||||
....
|
||||
|
||||
|
||||
===== 说明
|
||||
传入用户名,以及密码明文,后台计算密码SHA1值,进行注册
|
||||
|
||||
|
||||
===== 参数
|
||||
|
||||
[options="header", cols=".^2a,.^3a,.^4a"]
|
||||
|===
|
||||
|类型|名称|类型
|
||||
|**FormData**|**password** +
|
||||
__可选__|string
|
||||
|**FormData**|**username** +
|
||||
__可选__|string
|
||||
|===
|
||||
|
||||
|
||||
===== 响应
|
||||
|
||||
[options="header", cols=".^2a,.^14a,.^4a"]
|
||||
|===
|
||||
|HTTP代码|说明|类型
|
||||
|**200**|OK|<<_commonreturntype,CommonReturnType>>
|
||||
|**201**|Created|无内容
|
||||
|**401**|Unauthorized|无内容
|
||||
|**403**|Forbidden|无内容
|
||||
|**404**|Not Found|无内容
|
||||
|===
|
||||
|
||||
|
||||
===== 消耗
|
||||
|
||||
* `application/x-www-form-urlencoded`
|
||||
|
||||
|
||||
===== 生成
|
||||
|
||||
* `\*/*`
|
||||
|
||||
|
||||
===== HTTP请求示例
|
||||
|
||||
====== 请求 path
|
||||
----
|
||||
/api/user/register
|
||||
----
|
||||
|
||||
|
||||
====== 请求 formData
|
||||
[source,json]
|
||||
----
|
||||
"string"
|
||||
----
|
||||
|
||||
|
||||
===== HTTP响应示例
|
||||
|
||||
====== 响应 200
|
||||
[source,json]
|
||||
----
|
||||
{
|
||||
"data" : "object",
|
||||
"status" : "string"
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
[[_4b02b6687df4f15fab50b8d31c1fc123]]
|
||||
=== 第三方登录
|
||||
Third Party Controller
|
||||
|
@@ -2055,6 +2055,190 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_registerusingpost">2.3.4. 用户注册</h4>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>POST /api/user/register</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_说明_9">说明</h5>
|
||||
<div class="paragraph">
|
||||
<p>传入用户名,以及密码明文,后台计算密码SHA1值,进行注册</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_参数_8">参数</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 22.2222%;">
|
||||
<col style="width: 33.3333%;">
|
||||
<col style="width: 44.4445%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
<th class="tableblock halign-left valign-middle">名称</th>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>FormData</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>password</strong><br>
|
||||
<em>可选</em></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>string</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>FormData</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>username</strong><br>
|
||||
<em>可选</em></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>string</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_响应_9">响应</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 10%;">
|
||||
<col style="width: 70%;">
|
||||
<col style="width: 20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-middle">HTTP代码</th>
|
||||
<th class="tableblock halign-left valign-middle">说明</th>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>200</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>OK</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><a href="#_commonreturntype">CommonReturnType</a></p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>201</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Created</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>401</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Unauthorized</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>403</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Forbidden</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>404</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Not Found</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_消耗_4">消耗</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>application/x-www-form-urlencoded</code></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_生成_9">生成</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>*/*</code></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http请求示例_9">HTTP请求示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_path_9">请求 path</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>/api/user/register</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_formdata_4">请求 formData</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json"><span class="string"><span class="delimiter">"</span><span class="content">string</span><span class="delimiter">"</span></span></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http响应示例_9">HTTP响应示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_响应_200_9">响应 200</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json">{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">data</span><span class="delimiter">"</span></span> : <span class="string"><span class="delimiter">"</span><span class="content">object</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">status</span><span class="delimiter">"</span></span> : <span class="string"><span class="delimiter">"</span><span class="content">string</span><span class="delimiter">"</span></span>
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_4b02b6687df4f15fab50b8d31c1fc123">2.4. 第三方登录</h3>
|
||||
@@ -2069,13 +2253,13 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_说明_9">说明</h5>
|
||||
<h5 id="_说明_10">说明</h5>
|
||||
<div class="paragraph">
|
||||
<p>传入 code 值,进行登录</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_参数_8">参数</h5>
|
||||
<h5 id="_参数_9">参数</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 11.1111%;">
|
||||
@@ -2189,154 +2373,6 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_响应_9">响应</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 10%;">
|
||||
<col style="width: 70%;">
|
||||
<col style="width: 20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-middle">HTTP代码</th>
|
||||
<th class="tableblock halign-left valign-middle">说明</th>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>200</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>OK</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><a href="#_commonreturntype">CommonReturnType</a></p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>401</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Unauthorized</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>403</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Forbidden</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>404</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Not Found</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_生成_9">生成</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>*/*</code></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http请求示例_9">HTTP请求示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_path_9">请求 path</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>/api/third-party/callback/string</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http响应示例_9">HTTP响应示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_响应_200_9">响应 200</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json">{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">data</span><span class="delimiter">"</span></span> : <span class="string"><span class="delimiter">"</span><span class="content">object</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">status</span><span class="delimiter">"</span></span> : <span class="string"><span class="delimiter">"</span><span class="content">string</span><span class="delimiter">"</span></span>
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_loginusingget">2.4.2. 第三方用户登录跳转地址</h4>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>GET /api/third-party/login</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_说明_10">说明</h5>
|
||||
<div class="paragraph">
|
||||
<p>传入需要登录的第三方平台(大小写均可),返回跳转url</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_参数_9">参数</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 11.1111%;">
|
||||
<col style="width: 16.6666%;">
|
||||
<col style="width: 50%;">
|
||||
<col style="width: 22.2223%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
<th class="tableblock halign-left valign-middle">名称</th>
|
||||
<th class="tableblock halign-left valign-middle">说明</th>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>Query</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>platform</strong><br>
|
||||
<em>必填</em></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>platform</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>string</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_响应_10">响应</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
@@ -2415,7 +2451,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
<h6 id="_请求_path_10">请求 path</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>/api/third-party/login?platform=string</pre>
|
||||
<pre>/api/third-party/callback/string</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2435,6 +2471,154 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_loginusingget">2.4.2. 第三方用户登录跳转地址</h4>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>GET /api/third-party/login</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_说明_11">说明</h5>
|
||||
<div class="paragraph">
|
||||
<p>传入需要登录的第三方平台(大小写均可),返回跳转url</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_参数_10">参数</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 11.1111%;">
|
||||
<col style="width: 16.6666%;">
|
||||
<col style="width: 50%;">
|
||||
<col style="width: 22.2223%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
<th class="tableblock halign-left valign-middle">名称</th>
|
||||
<th class="tableblock halign-left valign-middle">说明</th>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>Query</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>platform</strong><br>
|
||||
<em>必填</em></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>platform</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>string</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_响应_11">响应</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 10%;">
|
||||
<col style="width: 70%;">
|
||||
<col style="width: 20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-middle">HTTP代码</th>
|
||||
<th class="tableblock halign-left valign-middle">说明</th>
|
||||
<th class="tableblock halign-left valign-middle">类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>200</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>OK</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><a href="#_commonreturntype">CommonReturnType</a></p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>401</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Unauthorized</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>403</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Forbidden</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p><strong>404</strong></p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>Not Found</p>
|
||||
</div></div></td>
|
||||
<td class="tableblock halign-left valign-middle"><div><div class="paragraph">
|
||||
<p>无内容</p>
|
||||
</div></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_生成_11">生成</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>*/*</code></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http请求示例_11">HTTP请求示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_path_11">请求 path</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>/api/third-party/login?platform=string</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http响应示例_11">HTTP响应示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_响应_200_11">响应 200</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json">{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">data</span><span class="delimiter">"</span></span> : <span class="string"><span class="delimiter">"</span><span class="content">object</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">status</span><span class="delimiter">"</span></span> : <span class="string"><span class="delimiter">"</span><span class="content">string</span><span class="delimiter">"</span></span>
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_aca0f16a4237edba915fe70c9b07871c">2.5. 系统调试接口</h3>
|
||||
@@ -2449,13 +2633,13 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_说明_11">说明</h5>
|
||||
<h5 id="_说明_12">说明</h5>
|
||||
<div class="paragraph">
|
||||
<p>仅限管理员登录状态下可获取</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_参数_10">参数</h5>
|
||||
<h5 id="_参数_11">参数</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 22.2222%;">
|
||||
@@ -2486,7 +2670,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_响应_11">响应</h5>
|
||||
<h5 id="_响应_12">响应</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 10%;">
|
||||
@@ -2560,7 +2744,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_消耗_4">消耗</h5>
|
||||
<h5 id="_消耗_5">消耗</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
@@ -2570,7 +2754,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_生成_11">生成</h5>
|
||||
<h5 id="_生成_12">生成</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
@@ -2580,9 +2764,9 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http请求示例_11">HTTP请求示例</h5>
|
||||
<h5 id="_http请求示例_12">HTTP请求示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_path_11">请求 path</h6>
|
||||
<h6 id="_请求_path_12">请求 path</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>/api/debug/status</pre>
|
||||
@@ -2590,7 +2774,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_formdata_4">请求 formData</h6>
|
||||
<h6 id="_请求_formdata_5">请求 formData</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json"><span class="string"><span class="delimiter">"</span><span class="content">string</span><span class="delimiter">"</span></span></code></pre>
|
||||
@@ -2599,9 +2783,9 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http响应示例_11">HTTP响应示例</h5>
|
||||
<h5 id="_http响应示例_12">HTTP响应示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_响应_200_11">响应 200</h6>
|
||||
<h6 id="_响应_200_12">响应 200</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json">{
|
||||
@@ -2627,13 +2811,13 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_说明_12">说明</h5>
|
||||
<h5 id="_说明_13">说明</h5>
|
||||
<div class="paragraph">
|
||||
<p>获取服务器当前系统负载。SystemLoadAverage返回-1时代表不支持。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_响应_12">响应</h5>
|
||||
<h5 id="_响应_13">响应</h5>
|
||||
<table class="tableblock frame-all grid-all spread">
|
||||
<colgroup>
|
||||
<col style="width: 10%;">
|
||||
@@ -2696,7 +2880,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</table>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_生成_12">生成</h5>
|
||||
<h5 id="_生成_13">生成</h5>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
@@ -2706,9 +2890,9 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http请求示例_12">HTTP请求示例</h5>
|
||||
<h5 id="_http请求示例_13">HTTP请求示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_请求_path_12">请求 path</h6>
|
||||
<h6 id="_请求_path_13">请求 path</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>/api/status/get</pre>
|
||||
@@ -2717,9 +2901,9 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_http响应示例_12">HTTP响应示例</h5>
|
||||
<h5 id="_http响应示例_13">HTTP响应示例</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_响应_200_12">响应 200</h6>
|
||||
<h6 id="_响应_200_13">响应 200</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="CodeRay highlight"><code data-lang="json">{
|
||||
@@ -2785,7 +2969,7 @@ table.CodeRay td.code>pre{padding:0}
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2022-04-04 10:29:49 SGT
|
||||
Last updated 2022-04-04 14:35:07 SGT
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@@ -10,6 +10,7 @@ public enum BusinessErrorCode implements CommonError {
|
||||
USER_LOGIN_FAILED(20002, "用户手机号或密码不正确"),
|
||||
USER_NOT_LOGIN(20003, "用户还未登录"),
|
||||
USER_TOKEN_EXPIRED(20004, "用户令牌过期"),
|
||||
USER_ALREADY_EXIST(20005, "用户已存在"),
|
||||
|
||||
// 30000开头为权限相关错误定义
|
||||
OPERATION_NOT_ALLOWED(30001, "用户没有此操作的权限");
|
||||
|
@@ -3,11 +3,20 @@ package plus.bookshelf.Controller.Controller;
|
||||
import com.aventrix.jnanoid.jnanoid.NanoIdUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import plus.bookshelf.Common.Error.BusinessErrorCode;
|
||||
import plus.bookshelf.Common.Error.BusinessException;
|
||||
import plus.bookshelf.Common.Response.CommonReturnType;
|
||||
import plus.bookshelf.Common.Response.CommonReturnTypeStatus;
|
||||
import plus.bookshelf.Common.SessionManager.RedisSessionManager;
|
||||
import plus.bookshelf.Common.SessionManager.SessionManager;
|
||||
import plus.bookshelf.Service.Model.UserModel;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BaseController {
|
||||
|
||||
@@ -66,23 +75,23 @@ public class BaseController {
|
||||
// return;
|
||||
}
|
||||
|
||||
// // 定义ExceptionHandler解决未被Controller层吸收的Exception
|
||||
// @ExceptionHandler(Exception.class)
|
||||
// @ResponseStatus(HttpStatus.OK)
|
||||
// @ResponseBody
|
||||
// public Object handlerException(HttpServletRequest request, Exception ex) {
|
||||
// HashMap<Object, Object> responseData = new HashMap<>();
|
||||
//
|
||||
// if (ex instanceof BusinessException) {
|
||||
// BusinessException businessException = (BusinessException) ex;
|
||||
// responseData.put("errCode", businessException.getErrCode());
|
||||
// responseData.put("errMsg", businessException.getErrMsg());
|
||||
// } else {
|
||||
// // 生产环境输出格式化信息
|
||||
// responseData.put("errCode", BusinessErrorCode.UNKNOWN_ERROR.getErrCode());
|
||||
// responseData.put("errMsg", BusinessErrorCode.UNKNOWN_ERROR.getErrMsg());
|
||||
// }
|
||||
//
|
||||
// return CommonReturnType.create(responseData, CommonReturnTypeStatus.FAILED);
|
||||
// }
|
||||
// 定义ExceptionHandler解决未被Controller层吸收的Exception
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ResponseBody
|
||||
public Object handlerException(HttpServletRequest request, Exception ex) {
|
||||
HashMap<Object, Object> responseData = new HashMap<>();
|
||||
|
||||
if (ex instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) ex;
|
||||
responseData.put("errCode", businessException.getErrCode());
|
||||
responseData.put("errMsg", businessException.getErrMsg());
|
||||
} else {
|
||||
// 生产环境输出格式化信息
|
||||
responseData.put("errCode", BusinessErrorCode.UNKNOWN_ERROR.getErrCode());
|
||||
responseData.put("errMsg", BusinessErrorCode.UNKNOWN_ERROR.getErrMsg());
|
||||
}
|
||||
|
||||
return CommonReturnType.create(responseData, CommonReturnTypeStatus.FAILED);
|
||||
}
|
||||
}
|
||||
|
@@ -46,20 +46,22 @@ public class UserController extends BaseController {
|
||||
return CommonReturnType.create(userVO);
|
||||
}
|
||||
|
||||
// @ApiOperation(value = "用户注册", notes = "传入用户名,以及密码明文,后台计算密码SHA1值,进行注册")
|
||||
// @RequestMapping(value = "register", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||
// @ResponseBody
|
||||
// public CommonReturnType register(@RequestParam(value = "username") String username,
|
||||
// @RequestParam(value = "password") String password) {
|
||||
// if (username == null || password == null) {
|
||||
// return null;
|
||||
// }
|
||||
// String encryptPwd = DigestUtils.sha1Hex(password);
|
||||
//
|
||||
// UserModel userModel = userService.userRegister(username, encryptPwd);
|
||||
// UserVO userVO = convertFromService(userModel);
|
||||
// return CommonReturnType.create(userVO);
|
||||
// }
|
||||
@ApiOperation(value = "用户注册", notes = "传入用户名,以及密码明文,后台计算密码SHA1值,进行注册")
|
||||
@RequestMapping(value = "register", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||
@ResponseBody
|
||||
public CommonReturnType register(@RequestParam(value = "username") String username,
|
||||
@RequestParam(value = "password") String password) throws BusinessException {
|
||||
if (username == null || password == null) {
|
||||
return null;
|
||||
}
|
||||
String encryptPwd = DigestUtils.sha1Hex(password);
|
||||
|
||||
if(!userService.userRegister(username, encryptPwd)){
|
||||
throw new BusinessException(BusinessErrorCode.UNKNOWN_ERROR, "未知错误,注册失败");
|
||||
}
|
||||
// 注册成功后,进行登录
|
||||
return login(username, password);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户登出", notes = "用户退出登录")
|
||||
// @ApiImplicitParams({
|
||||
|
@@ -55,6 +55,15 @@ public class UserDO {
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column user_info.email
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
@@ -226,6 +235,30 @@ public class UserDO {
|
||||
this.avatar = avatar == null ? null : avatar.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.email
|
||||
*
|
||||
* @return the value of user_info.email
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column user_info.email
|
||||
*
|
||||
* @param email the value for user_info.email
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email == null ? null : email.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column user_info.phone
|
||||
|
@@ -3,7 +3,7 @@ package plus.bookshelf.Dao.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.CategoryDO;
|
||||
|
||||
@Repository
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
public interface CategoryDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
|
@@ -3,7 +3,7 @@ package plus.bookshelf.Dao.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.FileDO;
|
||||
|
||||
@Repository
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
public interface FileDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
|
@@ -3,7 +3,7 @@ package plus.bookshelf.Dao.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.FileObjectDO;
|
||||
|
||||
@Repository
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
public interface FileObjectDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
|
@@ -1,7 +1,9 @@
|
||||
package plus.bookshelf.Dao.Mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.ThirdPartyUserAuthDO;
|
||||
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
public interface ThirdPartyUserAuthDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
|
@@ -1,7 +1,9 @@
|
||||
package plus.bookshelf.Dao.Mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.ThirdPartyUserDO;
|
||||
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
public interface ThirdPartyUserDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
|
@@ -3,7 +3,7 @@ package plus.bookshelf.Dao.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import plus.bookshelf.Dao.DO.UserDO;
|
||||
|
||||
@Repository
|
||||
@Repository // 添加这个注解,Autowired的时候idea就不会报错了
|
||||
public interface UserDOMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@@ -54,4 +54,12 @@ public interface UserDOMapper {
|
||||
int updateByPrimaryKey(UserDO record);
|
||||
|
||||
UserDO selectByUsernameAndEncryptpwd(String username, String encryptPwd);
|
||||
|
||||
/**
|
||||
* 获取是否存在该用户,用于注册时判断
|
||||
* 若用户存在则返回大于0的整数,否则返回0
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountByUsername(String username);
|
||||
}
|
@@ -3,6 +3,7 @@ package plus.bookshelf.Service.Impl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import plus.bookshelf.Common.Error.BusinessErrorCode;
|
||||
import plus.bookshelf.Common.Error.BusinessException;
|
||||
import plus.bookshelf.Common.SessionManager.RedisSessionManager;
|
||||
@@ -55,6 +56,26 @@ public class UserServiceImpl implements UserService {
|
||||
return userModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean userRegister(String username, String encryptPwd) throws BusinessException {
|
||||
if (username == null || "".equals(username)) {
|
||||
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "用户名不能为空");
|
||||
} else if (encryptPwd == null || "".equals(encryptPwd)) {
|
||||
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "密码不能为空");
|
||||
}
|
||||
Integer count = userDOMapper.selectCountByUsername(username);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(BusinessErrorCode.USER_ALREADY_EXIST, "用户已存在");
|
||||
}
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUsername(username);
|
||||
userDO.setEncriptPwd(encryptPwd);
|
||||
userDO.setGroup("USER");
|
||||
userDO.setNickname("该用户尚未设置昵称");
|
||||
return userDOMapper.insertSelective(userDO) > 0;
|
||||
}
|
||||
|
||||
private UserModel convertFromDataObject(UserDO userDO) {
|
||||
if (userDO == null) {
|
||||
return null;
|
||||
|
@@ -8,8 +8,8 @@ public interface UserService {
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param username
|
||||
* @param encryptPwd
|
||||
* @param username 用户名
|
||||
* @param encryptPwd 加密后密码
|
||||
*/
|
||||
UserModel userLogin(String username, String encryptPwd);
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface UserService {
|
||||
* 通过用户Id获取用户
|
||||
*
|
||||
* @param id 用户Id
|
||||
* @return
|
||||
* @return UserModel
|
||||
*/
|
||||
UserModel getUserById(Integer id);
|
||||
|
||||
@@ -25,8 +25,17 @@ public interface UserService {
|
||||
* 检查用户令牌是否有效,并返回令牌对应的用户 UserModel
|
||||
* (令牌无效直接抛出异常)
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
* @param token 用户令牌
|
||||
* @return UserModel
|
||||
*/
|
||||
UserModel getUserByToken(RedisTemplate redisTemplate, String token) throws BusinessException;
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param encryptPwd 加密后密码
|
||||
* @return 注册成功返回true,否则返回false
|
||||
*/
|
||||
Boolean userRegister(String username, String encryptPwd) throws BusinessException;
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
|
||||
<result column="group" jdbcType="VARCHAR" property="group" />
|
||||
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
|
||||
<result column="email" jdbcType="VARCHAR" property="email" />
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||
<result column="weixin_third_party_auth_code" jdbcType="VARCHAR" property="weixinThirdPartyAuthCode" />
|
||||
<result column="qq_third_party_auth_code" jdbcType="VARCHAR" property="qqThirdPartyAuthCode" />
|
||||
@@ -21,7 +22,7 @@
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, username, encript_pwd, nickname, `group`, avatar, phone, weixin_third_party_auth_code,
|
||||
id, username, encript_pwd, nickname, `group`, avatar, email, phone, weixin_third_party_auth_code,
|
||||
qq_third_party_auth_code
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
@@ -49,12 +50,12 @@
|
||||
-->
|
||||
insert into user_info (id, username, encript_pwd,
|
||||
nickname, `group`, avatar,
|
||||
phone, weixin_third_party_auth_code, qq_third_party_auth_code
|
||||
)
|
||||
email, phone, weixin_third_party_auth_code,
|
||||
qq_third_party_auth_code)
|
||||
values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{encriptPwd,jdbcType=VARCHAR},
|
||||
#{nickname,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR},
|
||||
#{phone,jdbcType=VARCHAR}, #{weixinThirdPartyAuthCode,jdbcType=VARCHAR}, #{qqThirdPartyAuthCode,jdbcType=VARCHAR}
|
||||
)
|
||||
#{email,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{weixinThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
#{qqThirdPartyAuthCode,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.UserDO">
|
||||
<!--
|
||||
@@ -81,6 +82,9 @@
|
||||
<if test="avatar != null">
|
||||
avatar,
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email,
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone,
|
||||
</if>
|
||||
@@ -110,6 +114,9 @@
|
||||
<if test="avatar != null">
|
||||
#{avatar,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
#{email,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -143,6 +150,9 @@
|
||||
<if test="avatar != null">
|
||||
avatar = #{avatar,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email = #{email,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -166,6 +176,7 @@
|
||||
nickname = #{nickname,jdbcType=VARCHAR},
|
||||
`group` = #{group,jdbcType=VARCHAR},
|
||||
avatar = #{avatar,jdbcType=VARCHAR},
|
||||
email = #{email,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
weixin_third_party_auth_code = #{weixinThirdPartyAuthCode,jdbcType=VARCHAR},
|
||||
qq_third_party_auth_code = #{qqThirdPartyAuthCode,jdbcType=VARCHAR}
|
||||
@@ -177,4 +188,10 @@
|
||||
from user_info
|
||||
where username = #{username} and encript_pwd = #{encryptPwd}
|
||||
</select>
|
||||
<select id="selectCountByUsername" resultType="java.lang.Integer">
|
||||
select
|
||||
count(*)
|
||||
from user_info
|
||||
where username = #{username}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user