style: style all project

pull/351/head
textworld 1 year ago
parent 9ba3842513
commit ad38517fd7

@ -2,6 +2,7 @@ package admin
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/go-sonic/sonic/handler/trans"

@ -116,11 +116,10 @@ func parsePostParam(ctx *gin.Context) (*param.Post, error) {
log.CtxInfo(ctx, "wpPost: "+string(bytes))
return convertToPostParam(&wpPost)
}
func convertToPostParam(wpPost *param.WpPost) (*param.Post, error) {
var paramPostStatus = sonicconst.PostStatusPublished
paramPostStatus := sonicconst.PostStatusPublished
if strings.ToLower(wpPost.Status) == "draft" {
paramPostStatus = sonicconst.PostStatusDraft
}
@ -168,9 +167,9 @@ func convertToPostParam(wpPost *param.WpPost) (*param.Post, error) {
func convertToWpPost(postEntity *entity.Post) *wp.PostDTO {
timeFormat := time.RFC3339
var wpStatus = "publish"
var wpCommentStatus = "open"
var wpContent = make(map[string]interface{})
wpStatus := "publish"
wpCommentStatus := "open"
wpContent := make(map[string]interface{})
if postEntity.Status == sonicconst.PostStatusDraft {
wpStatus = "draft"
@ -183,7 +182,7 @@ func convertToWpPost(postEntity *entity.Post) *wp.PostDTO {
wpContent["rendered"] = postEntity.OriginalContent
wpContent["protected"] = false
var postDTO = &wp.PostDTO{
postDTO := &wp.PostDTO{
Date: postEntity.CreateTime.Format(timeFormat),
DateGmt: postEntity.CreateTime.UTC().Format(timeFormat),
GUID: nil,

@ -1,13 +1,14 @@
package wp
import (
"strings"
"github.com/gin-gonic/gin"
"github.com/go-sonic/sonic/model/dto/wp"
"github.com/go-sonic/sonic/model/entity"
"github.com/go-sonic/sonic/model/param"
"github.com/go-sonic/sonic/service"
"github.com/go-sonic/sonic/util/xerr"
"strings"
)
type TagHandler struct {

@ -14,9 +14,7 @@ import (
"github.com/go-sonic/sonic/service"
)
var (
basicAuthRegexp = regexp.MustCompile(`^Basic [a-z\\d/+]*={0,2}`)
)
var basicAuthRegexp = regexp.MustCompile(`^Basic [a-z\\d/+]*={0,2}`)
type ApplicationPasswordMiddleware struct {
PasswordService service.ApplicationPasswordService

@ -2,6 +2,7 @@ package service
import (
"context"
"github.com/go-sonic/sonic/model/dto"
"github.com/go-sonic/sonic/model/entity"
"github.com/go-sonic/sonic/model/param"

@ -149,7 +149,6 @@ func (a *applicationPasswordServiceImpl) Update(ctx context.Context, entityID in
LastActivateIP: ip,
LastActivateTime: &now,
})
if err != nil {
return WrapDBErr(err)
}

Loading…
Cancel
Save