Skip to content

Commit 412226c

Browse files
committed
Update readme & prepare for release
1 parent e60a42c commit 412226c

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ func PasswordBase58Hash(password string) (string, error) {
8383

8484
管理端 HTTP API 支持请参阅 [ohUrlShortener HTTP API](API.md)
8585

86-
---
86+
```golang
87+
api := router.Group("/api", controller.APIAuthHandler())
88+
api.POST("/account", controller.APINewAdmin)
89+
api.PUT("/account/:account/update", controller.APIAdminUpdate)
90+
api.POST("/url", controller.APIGenShortUrl)
91+
api.GET("/url/:url", controller.APIUrlInfo)
92+
api.DELETE("/url/:url", controller.APIDeleteUrl)
93+
api.PUT("/url/:url/change_state", controller.APIUpdateUrl)
94+
```
8795

8896
## 短链接在应用启动时会存入 Redis 中
8997

@@ -125,10 +133,10 @@ func GenerateShortLink(initialLink string) (string, error) {
125133

126134
```golang
127135
//清理 Redis 中的访问日志的时间间隔
128-
const ACCESS_LOG_CLEAN_INTERVAL = 1 * time.Minute
136+
const AccessLogCleanInterval = 1 * time.Minute
129137

130138
func startTicker() error {
131-
ticker := time.NewTicker(ACCESS_LOG_CLEAN_INTERVAL)
139+
ticker := time.NewTicker(AccessLogCleanInterval)
132140
for range ticker.C {
133141
log.Println("[StoreAccessLog] Start.")
134142
if err := service.StoreAccessLogs(); err != nil {
@@ -145,10 +153,10 @@ func startTicker() error {
145153

146154
```golang
147155
// Top25 榜单计算间隔
148-
TOP25_CALC_INTERVAL = 5 * time.Minute
156+
Top25CalcInterval = 5 * time.Minute
149157

150158
func startTicker2() error {
151-
top25Ticker := time.NewTicker(TOP25_CALC_INTERVAL)
159+
top25Ticker := time.NewTicker(Top25CalcInterval)
152160
for range top25Ticker.C {
153161
log.Println("[Top25Urls Ticker] Start.")
154162
if err := storage.CallProcedureStatsTop25(); err != nil {
@@ -165,10 +173,10 @@ func startTicker2() error {
165173

166174
```golang
167175
// 仪表盘页面中其他几个统计数据计算间隔
168-
STATS_SUM_CALC_INTERVAL = 5 * time.Minute
176+
StatsSumCalcInterval = 5 * time.Minute
169177

170178
func startTicker4() error {
171-
statsSumTicker := time.NewTicker(STATS_SUM_CALC_INTERVAL)
179+
statsSumTicker := time.NewTicker(StatsSumCalcInterval)
172180
for range statsSumTicker.C {
173181
log.Println("[StatsSum Ticker] Start.")
174182
if err := storage.CallProcedureStatsSum(); err != nil {
@@ -185,10 +193,10 @@ func startTicker4() error {
185193

186194
```golang
187195
//全部访问日志分析统计的间隔
188-
STATS_IP_SUM_CALC_INTERVAL = 30 * time.Minute
196+
StatsIpSumCalcInterval = 30 * time.Minute
189197

190198
func startTicker3() error {
191-
statsIpSumTicker := time.NewTicker(STATS_IP_SUM_CALC_INTERVAL)
199+
statsIpSumTicker := time.NewTicker(StatsIpSumCalcInterval)
192200
for range statsIpSumTicker.C {
193201
log.Println("[StatsIpSum Ticker] Start.")
194202
if err := storage.CallProcedureStatsIPSum(); err != nil {
@@ -200,6 +208,22 @@ func startTicker3() error {
200208
}
201209
```
202210

211+
## License
212+
213+
ohUrlShortener 以《木兰宽松许可证》 第2版 为开源协议发布
214+
215+
```
216+
Copyright (c) [2023] [巴拉迪维]
217+
[ohUrlShortener] is licensed under Mulan PSL v2.
218+
You can use this software according to the terms and conditions of the Mulan PSL v2.
219+
You may obtain a copy of Mulan PSL v2 at:
220+
http://license.coscl.org.cn/MulanPSL2
221+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
222+
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
223+
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
224+
See the Mulan PSL v2 for more details.
225+
```
226+
203227
## Contributor License Agreement
204228

205229
**第一次提交 Pull Request 时** ,请您在 Pull Request 内容中明确写明「本人自愿接受并签署 [《ohUrlShortener Contributor License Agreement》](CLA.md)」,并在 Pull Request 信息中附带该协议链接信息。

0 commit comments

Comments
 (0)