Skip to content

Commit 827d4c5

Browse files
committed
update
1 parent ac4b691 commit 827d4c5

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

controller.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"tool-gin/utils"
1414
)
1515

16-
// 首页
16+
// WebRoot 首页
1717
func WebRoot(c *gin.Context) {
1818
// 301重定向
1919
//c.Redirect(http.StatusMovedPermanently, "/static")
@@ -22,7 +22,7 @@ func WebRoot(c *gin.Context) {
2222
c.HTML(http.StatusOK, "index.html", gin.H{})
2323
}
2424

25-
// 获取系统信息
25+
// SystemInfo 获取系统信息
2626
func SystemInfo(c *gin.Context) {
2727
data := make(map[string]interface{}, 0)
2828
data["Version"] = utils.ToUpper(runtime.Version())
@@ -44,7 +44,7 @@ func SystemInfo(c *gin.Context) {
4444
SuccessJSON(c, "获取系统信息成功", data)
4545
}
4646

47-
// 获取key
47+
// GetKey 获取key
4848
func GetKey(c *gin.Context) {
4949
// GET 获取参数内容,没有则返回空字符串
5050
//company := c.Query("company")
@@ -121,7 +121,7 @@ func GetKey(c *gin.Context) {
121121

122122
}
123123

124-
// 脚本执行错误处理
124+
// ExecuteScriptError 脚本执行错误处理
125125
func ExecuteScriptError(err error) {
126126
// 如果命令执行错误
127127
if err != nil && strings.Contains(err.Error(), "exit status 1") {
@@ -130,7 +130,7 @@ func ExecuteScriptError(err error) {
130130
}
131131
}
132132

133-
// 文件上传请求
133+
// Upload 文件上传请求
134134
func Upload(c *gin.Context) {
135135
// 拿到上传的文件的信息
136136
file, header, err := c.Request.FormFile("upload")
@@ -148,7 +148,7 @@ func Upload(c *gin.Context) {
148148
}
149149
}
150150

151-
// 文件下载请求
151+
// Download 文件下载请求
152152
func Download(c *gin.Context) {
153153
response, err := http.Get(c.Request.Host + "/static/public/favicon.ico")
154154
if err != nil || response.StatusCode != http.StatusOK {
@@ -163,7 +163,7 @@ func Download(c *gin.Context) {
163163
c.DataFromReader(http.StatusOK, response.ContentLength, response.Header.Get("Content-Type"), response.Body, extraHeaders)
164164
}
165165

166-
// 获取NetSarang下载url
166+
// GetNetSarangDownloadUrl 获取NetSarang下载url
167167
func GetNetSarangDownloadUrl(c *gin.Context) {
168168
// POST 获取的所有参数内容的类型都是 string
169169
app := c.PostForm("app")
@@ -184,7 +184,7 @@ func GetNetSarangDownloadUrl(c *gin.Context) {
184184
SuccessJSON(c, "获取"+app+"成功", map[string]string{"url": url})
185185
}
186186

187-
// NGINX格式化代码页面
187+
// NginxFormatIndex NGINX格式化代码页面
188188
func NginxFormatIndex(c *gin.Context) {
189189
// 301重定向
190190
//c.Redirect(http.StatusMovedPermanently, "/static")
@@ -193,7 +193,7 @@ func NginxFormatIndex(c *gin.Context) {
193193
c.HTML(http.StatusOK, "nginx-format.html", gin.H{})
194194
}
195195

196-
// 格式化nginx配置代码
196+
// NginxFormatPython 格式化nginx配置代码
197197
func NginxFormatPython(c *gin.Context) {
198198
// GET 获取参数内容,没有则返回空字符串
199199
//code := c.Query("code")
@@ -216,7 +216,7 @@ func NginxFormatPython(c *gin.Context) {
216216

217217
}
218218

219-
// 获取navicat下载地址
219+
// GetNavicatDownloadUrl 获取navicat下载地址
220220
func GetNavicatDownloadUrl(c *gin.Context) {
221221
location, isExist := c.GetQuery("location")
222222
if location == "" || !isExist {

reptile/Netsarang.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package reptile
2+
13
/**
24
*
35
* @Description:
@@ -9,7 +11,6 @@
911
* @Package:
1012
* @Software: GoLand
1113
*/
12-
package reptile
1314

1415
import (
1516
"bytes"
@@ -44,7 +45,7 @@ func init() {
4445
NetsarangMap = make(map[string]NetsarangInfo)
4546
}
4647

47-
// 获取单个产品信息
48+
// GetInfoUrl 获取单个产品信息
4849
func GetInfoUrl(product string) (string, error) {
4950
info := NetsarangMap[product]
5051
if NetsarangMap == nil || info.Url == "" || len(info.Url) == 0 || !utils.DateEqual(time.Now(), info.Time) {
@@ -61,7 +62,7 @@ func GetInfoUrl(product string) (string, error) {
6162
return info.Url, nil
6263
}
6364

64-
// 获取可用mail
65+
// NetsarangGetMail 获取可用mail
6566
func NetsarangGetMail() (string, error) {
6667
prefix := utils.RandomLowercaseAlphanumeric(9)
6768
suffix, err := LinShiYouXiangSuffix()
@@ -77,7 +78,7 @@ func NetsarangGetMail() (string, error) {
7778
return mail, nil
7879
}
7980

80-
// 获取所有链接信息
81+
// NetsarangDownloadAll 获取所有链接信息
8182
func NetsarangDownloadAll() {
8283
mail, err := NetsarangGetMail()
8384
if err != nil {
@@ -93,7 +94,7 @@ func NetsarangDownloadAll() {
9394
log.Println(NetsarangMap)
9495
}
9596

96-
// 获取链接信息
97+
// NetsarangGetInfo 获取链接信息
9798
func NetsarangGetInfo(mail, product string) (string, error) {
9899
if mail == "" || len(mail) == 0 {
99100
return "", errors.New("mail不能为空")
@@ -174,7 +175,7 @@ func NetsarangGetInfo(mail, product string) (string, error) {
174175
return ur, nil
175176
}
176177

177-
// 发送邮件
178+
// NetsarangSendMail 发送邮件
178179
func NetsarangSendMail(mail, product string) error {
179180
if mail == "" || len(mail) == 0 {
180181
return errors.New("邮箱号不能为空!")
@@ -261,7 +262,7 @@ func NetsarangSendMail(mail, product string) error {
261262
return nil
262263
}
263264

264-
// 获取下载产品信息
265+
// NetsarangGetUrl 获取下载产品信息
265266
func NetsarangGetUrl(lang, token string) (map[string]interface{}, error) {
266267
if lang == "" || len(lang) == 0 {
267268
return nil, errors.New("lang不能为空")
@@ -292,7 +293,7 @@ func NetsarangGetUrl(lang, token string) (map[string]interface{}, error) {
292293
return utils.HttpReadBodyJsonMap(http.MethodPost, NetsarangJsonUrl, utils.ContentTypeMFD, params, nil)
293294
}
294295

295-
// 通过ChromeDP获取所有链接信息
296+
// NetsarangDownloadAllDP 通过ChromeDP获取所有链接信息
296297
func NetsarangDownloadAllDP() {
297298
ctx, cancel, mail, err := NetsarangGetMailDP()
298299
defer cancel()
@@ -319,7 +320,7 @@ func NetsarangDownloadAllDP() {
319320
log.Println(NetsarangMap)
320321
}
321322

322-
// 获取单个产品信息
323+
// GetInfoUrlDP 获取单个产品信息
323324
func GetInfoUrlDP(product string) (string, error) {
324325
info := NetsarangMap[product]
325326
if NetsarangMap == nil || info.Url == "" || len(info.Url) == 0 || !utils.DateEqual(time.Now(), info.Time) {
@@ -337,7 +338,7 @@ func GetInfoUrlDP(product string) (string, error) {
337338
return info.Url, nil
338339
}
339340

340-
// 通过ChromeDP获取可用mail
341+
// NetsarangGetMailDP 通过ChromeDP获取可用mail
341342
func NetsarangGetMailDP() (context.Context, context.CancelFunc, string, error) {
342343
var mail string
343344
ctx, cancel := Apply(false)
@@ -349,7 +350,7 @@ func NetsarangGetMailDP() (context.Context, context.CancelFunc, string, error) {
349350
return ctx, cancel, mail, nil
350351
}
351352

352-
// 通过ChromeDP通过ChromeDP获取链接信息
353+
// NetsarangGetInfoDP 通过ChromeDP通过ChromeDP获取链接信息
353354
func NetsarangGetInfoDP(ctx context.Context, mail, product string) (string, error) {
354355
if ctx == nil {
355356
return "", errors.New("context不能为空")
@@ -402,7 +403,7 @@ func NetsarangGetInfoDP(ctx context.Context, mail, product string) (string, erro
402403
return url, nil
403404
}
404405

405-
// 通过ChromeDP发送邮件
406+
// NetsarangSendMailDP 通过ChromeDP发送邮件
406407
func NetsarangSendMailDP(ctx context.Context, mail, product string) error {
407408
if ctx == nil {
408409
return errors.New("context不能为空")
@@ -464,7 +465,7 @@ func NetsarangSendMailDP(ctx context.Context, mail, product string) error {
464465
return nil
465466
}
466467

467-
// 通过ChromeDP获取下载产品信息
468+
// NetsarangGetUrlDP 通过ChromeDP获取下载产品信息
468469
func NetsarangGetUrlDP(ctx context.Context, url string) (string, error) {
469470
if ctx == nil {
470471
return "", errors.New("context不能为空")

0 commit comments

Comments
 (0)