补充接口

This commit is contained in:
yumaojun03 2024-12-01 11:06:09 +08:00
parent 6db92ad4ec
commit 7f7fb35f77
11 changed files with 258 additions and 5 deletions

View File

@ -18,4 +18,9 @@ https://gitee.com/infraboard/go-course/blob/master/new.md#%E6%9E%B6%E6%9E%84%E8%
![](./docs/page.png) ![](./docs/page.png)
### 架构 ### 架构(BS)和概要设计
![](./docs/arch.png)
### 业务的详细设计

2
vblog/apps/README.md Normal file
View File

@ -0,0 +1,2 @@
# 业务域/模块

12
vblog/apps/blog/README.md Normal file
View File

@ -0,0 +1,12 @@
# 博客管理
## 业务功能
+ 创建博客
+ 博客列表查询
+ 博客详情查询
+ 博客编辑
+ 发布
+ 删除
使用接口的方式来定义上述业务功能

View File

@ -0,0 +1,16 @@
package blog
type Service interface {
// 创建博客
CreateBlog()
// 博客列表查询
QueryBlog()
// 博客详情查询
DescribeBlog()
// 博客编辑
UpdateBlog()
// 发布
PublishBlog()
// 删除
DeleteBlog()
}

View File

@ -0,0 +1,11 @@
# 令牌管理
1. 外部
+ 登录
+ 退出
2. 内部
+ 令牌校验

View File

@ -0,0 +1,21 @@
package token
// 业务域
type Service interface {
Outer
Innter
}
// 1. 外部
type Outer interface {
// 颁发令牌 登录
IssueToken()
// 撤销令牌 退出
RevolkToken()
}
// 内部
type Innter interface {
// 令牌校验
ValidateToken()
}

View File

@ -0,0 +1,6 @@
# 用户管理
+ 注册
+ 注销

View File

@ -0,0 +1,8 @@
package user
type Service interface {
// 注册
Registry()
// 注销
UnRegistry()
}

145
vblog/docs/arch.drawio Normal file
View File

@ -0,0 +1,145 @@
<mxfile host="65bd71144e">
<diagram id="G4rBrXM05HFn1dIN60R_" name="第 1 页">
<mxGraphModel dx="893" dy="570" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="7" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.625;entryY=0.2;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="2" target="6">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="80" width="640" height="80" as="geometry"/>
</mxCell>
<mxCell id="3" value="Web:浏览器" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="100" y="50" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="4" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="270" y="375" width="520" height="395" as="geometry"/>
</mxCell>
<mxCell id="5" value="vblog api server" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="310" y="345" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="11" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.8;exitY=0.8;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="6" target="4">
<mxGeometry relative="1" as="geometry">
<mxPoint x="461.20000000000005" y="321" as="sourcePoint"/>
<Array as="points">
<mxPoint x="442" y="320"/>
<mxPoint x="660" y="320"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="36" value="http: 每个请求是独立,需要带上 用户身份标识符(访问令牌 Token)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="11">
<mxGeometry x="0.2492" y="-2" relative="1" as="geometry">
<mxPoint x="21" y="-22" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="16" value="加载Web UI" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.25;exitY=0.25;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="6" target="2">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="376" y="210"/>
<mxPoint x="260" y="210"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="6" value="网络" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="346" y="220" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="12" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="375" width="120" height="285" as="geometry"/>
</mxCell>
<mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.31;entryY=0.8;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="13" target="6">
<mxGeometry relative="1" as="geometry">
<mxPoint x="354.4000000000001" y="297" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="13" value="Web 静态服务" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="100" y="345" width="100" height="30" as="geometry"/>
</mxCell>
<mxCell id="17" value="BS 网络架构" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="10" y="10" width="90" height="30" as="geometry"/>
</mxCell>
<mxCell id="46" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="18" target="43">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="18" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="310" y="420" width="120" height="330" as="geometry"/>
</mxCell>
<mxCell id="20" value="用户管理" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="310" y="390" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="23" value="注册" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="324" y="440" width="90" height="30" as="geometry"/>
</mxCell>
<mxCell id="41" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="24" target="32">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="48" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="24" target="45">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="24" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="630" y="420" width="144" height="330" as="geometry"/>
</mxCell>
<mxCell id="25" value="文章管理(作者 需要登录)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="630" y="390" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="26" value="文章列表" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="644" y="440" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="27" value="文章编辑" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="644" y="490" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="28" value="文章创建" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="644" y="540" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="29" value="文章发布" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="647" y="585" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="30" value="文章详情" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="647" y="630" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="31" value="文章删除" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="647" y="680" width="110" height="30" as="geometry"/>
</mxCell>
<mxCell id="47" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="32" target="44">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="32" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="466" y="420" width="120" height="330" as="geometry"/>
</mxCell>
<mxCell id="38" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="35" target="37">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="35" value="用户/密码" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="620" y="30" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="37" value="身份令牌" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="460" y="27.5" width="120" height="35" as="geometry"/>
</mxCell>
<mxCell id="39" value="令牌管理" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="466" y="390" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="21" value="登录" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="481" y="440" width="90" height="30" as="geometry"/>
</mxCell>
<mxCell id="22" value="退出" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="481" y="490" width="90" height="30" as="geometry"/>
</mxCell>
<mxCell id="40" value="注销" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="325" y="490" width="90" height="30" as="geometry"/>
</mxCell>
<mxCell id="42" value="令牌校验" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="481" y="600" width="90" height="30" as="geometry"/>
</mxCell>
<mxCell id="43" value="表" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="1">
<mxGeometry x="340" y="830" width="60" height="60" as="geometry"/>
</mxCell>
<mxCell id="44" value="表" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="1">
<mxGeometry x="496" y="830" width="60" height="60" as="geometry"/>
</mxCell>
<mxCell id="45" value="表" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="1">
<mxGeometry x="672" y="830" width="60" height="60" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

BIN
vblog/docs/arch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -1,6 +1,6 @@
<mxfile host="65bd71144e"> <mxfile host="65bd71144e">
<diagram id="q5X4NpZnwlXZwvvlOuBN" name="第 1 页"> <diagram id="q5X4NpZnwlXZwvvlOuBN" name="第 1 页">
<mxGraphModel dx="893" dy="560" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <mxGraphModel dx="893" dy="1679" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root> <root>
<mxCell id="0"/> <mxCell id="0"/>
<mxCell id="1" parent="0"/> <mxCell id="1" parent="0"/>
@ -38,13 +38,13 @@
<mxGeometry relative="1" as="geometry"/> <mxGeometry relative="1" as="geometry"/>
</mxCell> </mxCell>
<mxCell id="11" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="11" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="520" y="120" width="300" height="260" as="geometry"/> <mxGeometry x="520" y="80" width="300" height="300" as="geometry"/>
</mxCell> </mxCell>
<mxCell id="12" value="作者的工作台(后台)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="12" value="作者的工作台(后台)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="520" y="60" width="130" height="30" as="geometry"/> <mxGeometry x="520" y="20" width="130" height="30" as="geometry"/>
</mxCell> </mxCell>
<mxCell id="13" value="文章列表" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="13" value="文章列表" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="520" y="90" width="60" height="30" as="geometry"/> <mxGeometry x="520" y="50" width="60" height="30" as="geometry"/>
</mxCell> </mxCell>
<mxCell id="14" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="14" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="530" y="140" width="30" height="220" as="geometry"/> <mxGeometry x="530" y="140" width="30" height="220" as="geometry"/>
@ -155,6 +155,33 @@
<mxCell id="53" value="登录页面" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"> <mxCell id="53" value="登录页面" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="210" y="80" width="60" height="30" as="geometry"/> <mxGeometry x="210" y="80" width="60" height="30" as="geometry"/>
</mxCell> </mxCell>
<mxCell id="54" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="220" y="-200" width="230" height="180" as="geometry"/>
</mxCell>
<mxCell id="57" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.75;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="56" target="54">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="56" value="注册" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="360" y="130" width="65" height="20" as="geometry"/>
</mxCell>
<mxCell id="58" value="用户名" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="270" y="-180" width="120" height="20" as="geometry"/>
</mxCell>
<mxCell id="59" value="密码" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="270" y="-140" width="120" height="20" as="geometry"/>
</mxCell>
<mxCell id="60" value="提交" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="270" y="-70" width="120" height="20" as="geometry"/>
</mxCell>
<mxCell id="61" value="密码" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="270" y="-110" width="120" height="20" as="geometry"/>
</mxCell>
<mxCell id="62" value="注册页面" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="220" y="-240" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="63" value="退出" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="745" y="90" width="65" height="20" as="geometry"/>
</mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>