mirror of
https://github.com/eiblog/eiblog.git
synced 2025-12-19 17:32:24 +08:00
chore: optimize variable naming
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,3 +19,4 @@ backend
|
||||
# vendor/
|
||||
bin
|
||||
assets/*.*
|
||||
db.sqlite
|
||||
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -2,20 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [2.1.18](https://github.com/eiblog/eiblog/compare/v2.1.17...v2.1.18) (2023-01-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 1. template read panic ([f6d8656](https://github.com/eiblog/eiblog/commit/f6d8656c83591584581383643d109611d7ed2caa))
|
||||
|
||||
### [2.1.17](https://github.com/eiblog/eiblog/compare/v2.1.16...v2.1.17) (2023-01-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **disqus:** failed to commit disqus comments ([a9e8e39](https://github.com/eiblog/eiblog/commit/a9e8e39d342488ec46175997f3df9ab109f2fecf))
|
||||
|
||||
### [2.1.16](https://github.com/eiblog/eiblog/compare/v2.1.15...v2.1.16) (2022-11-20)
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ func handleAdminProfile(c *gin.Context) {
|
||||
renderHTMLAdminLayout(c, "admin-profile", params)
|
||||
}
|
||||
|
||||
// T tag struct
|
||||
type T struct {
|
||||
ID string `json:"id"`
|
||||
Tags string `json:"tags"`
|
||||
|
||||
@@ -222,7 +222,7 @@ func handleDisqusList(c *gin.Context) {
|
||||
ID: v.ID,
|
||||
Name: v.Author.Name,
|
||||
Parent: v.Parent,
|
||||
Url: v.Author.ProfileUrl,
|
||||
URL: v.Author.ProfileURL,
|
||||
Avatar: v.Author.Avatar.Cache,
|
||||
CreatedAtStr: tools.ConvertStr(v.CreatedAt),
|
||||
Message: v.Message,
|
||||
@@ -261,7 +261,7 @@ type commentsDetail struct {
|
||||
ID string `json:"id"`
|
||||
Parent int `json:"parent"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
URL string `json:"url"`
|
||||
Avatar string `json:"avatar"`
|
||||
CreatedAtStr string `json:"createdAtStr"`
|
||||
Message string `json:"message"`
|
||||
@@ -292,7 +292,7 @@ func handleDisqusCreate(c *gin.Context) {
|
||||
AuthorEmail: email,
|
||||
AuthorName: name,
|
||||
Identifier: identifier,
|
||||
IpAddress: c.ClientIP(),
|
||||
IPAddress: c.ClientIP(),
|
||||
}
|
||||
postDetail, err := internal.PostCreate(&comment)
|
||||
if err != nil {
|
||||
@@ -312,7 +312,7 @@ func handleDisqusCreate(c *gin.Context) {
|
||||
ID: postDetail.Response.ID,
|
||||
Name: name,
|
||||
Parent: postDetail.Response.Parent,
|
||||
Url: postDetail.Response.Author.ProfileUrl,
|
||||
URL: postDetail.Response.Author.ProfileURL,
|
||||
Avatar: postDetail.Response.Author.Avatar.Cache,
|
||||
CreatedAtStr: tools.ConvertStr(postDetail.Response.CreatedAt),
|
||||
Message: postDetail.Response.Message,
|
||||
|
||||
@@ -95,8 +95,8 @@ func PostsCount(articles map[string]*model.Article) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// postsListResp 获取评论列表
|
||||
type postsListResp struct {
|
||||
// PostsListResp 获取评论列表
|
||||
type PostsListResp struct {
|
||||
Cursor struct {
|
||||
HasNext bool
|
||||
Next string
|
||||
@@ -113,7 +113,7 @@ type postDetail struct {
|
||||
IsDeleted bool
|
||||
Author struct {
|
||||
Name string
|
||||
ProfileUrl string
|
||||
ProfileURL string
|
||||
Avatar struct {
|
||||
Cache string
|
||||
}
|
||||
@@ -122,7 +122,7 @@ type postDetail struct {
|
||||
}
|
||||
|
||||
// PostsList 评论列表
|
||||
func PostsList(slug, cursor string) (*postsListResp, error) {
|
||||
func PostsList(slug, cursor string) (*PostsListResp, error) {
|
||||
if err := checkDisqusConfig(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func PostsList(slug, cursor string) (*postsListResp, error) {
|
||||
return nil, errors.New(string(b))
|
||||
}
|
||||
|
||||
result := &postsListResp{}
|
||||
result := &PostsListResp{}
|
||||
err = json.Unmarshal(b, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -163,18 +163,19 @@ type PostComment struct {
|
||||
Thread string
|
||||
AuthorEmail string
|
||||
AuthorName string
|
||||
IpAddress string
|
||||
IPAddress string
|
||||
Identifier string
|
||||
UserAgent string
|
||||
}
|
||||
|
||||
type postCreateResp struct {
|
||||
// PostCreateResp create comments resp
|
||||
type PostCreateResp struct {
|
||||
Code int
|
||||
Response postDetail
|
||||
}
|
||||
|
||||
// PostCreate 评论文章
|
||||
func PostCreate(pc *PostComment) (*postCreateResp, error) {
|
||||
func PostCreate(pc *PostComment) (*PostCreateResp, error) {
|
||||
if err := checkDisqusConfig(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -201,7 +202,7 @@ func PostCreate(pc *PostComment) (*postCreateResp, error) {
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.New(string(b))
|
||||
}
|
||||
result := &postCreateResp{}
|
||||
result := &PostCreateResp{}
|
||||
err = json.Unmarshal(b, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user