mirror of https://gitee.com/answerdev/answer.git
update Annotation document
This commit is contained in:
parent
5cb3c8c055
commit
ec950da888
|
@ -4092,7 +4092,7 @@ const docTemplate = `{
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"html": {
|
"html": {
|
||||||
"description": "解析后的html",
|
"description": "html",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"question_id": {
|
"question_id": {
|
||||||
|
@ -4146,7 +4146,7 @@ const docTemplate = `{
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"html": {
|
"html": {
|
||||||
"description": "解析后的html",
|
"description": "html",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -4080,7 +4080,7 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"html": {
|
"html": {
|
||||||
"description": "解析后的html",
|
"description": "html",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"question_id": {
|
"question_id": {
|
||||||
|
@ -4134,7 +4134,7 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"html": {
|
"html": {
|
||||||
"description": "解析后的html",
|
"description": "html",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -129,7 +129,7 @@ definitions:
|
||||||
description: content
|
description: content
|
||||||
type: string
|
type: string
|
||||||
html:
|
html:
|
||||||
description: 解析后的html
|
description: html
|
||||||
type: string
|
type: string
|
||||||
question_id:
|
question_id:
|
||||||
description: question_id
|
description: question_id
|
||||||
|
@ -167,7 +167,7 @@ definitions:
|
||||||
description: edit_summary
|
description: edit_summary
|
||||||
type: string
|
type: string
|
||||||
html:
|
html:
|
||||||
description: 解析后的html
|
description: html
|
||||||
type: string
|
type: string
|
||||||
id:
|
id:
|
||||||
description: id
|
description: id
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package entity
|
package entity
|
||||||
|
|
||||||
// UserCacheInfo 用户缓存信息
|
// UserCacheInfo User Cache Information
|
||||||
type UserCacheInfo struct {
|
type UserCacheInfo struct {
|
||||||
UserID string `json:"user_id"`
|
UserID string `json:"user_id"`
|
||||||
UserStatus int `json:"user_status"`
|
UserStatus int `json:"user_status"`
|
||||||
|
|
|
@ -16,7 +16,7 @@ const (
|
||||||
type AnswerAddReq struct {
|
type AnswerAddReq struct {
|
||||||
QuestionId string `json:"question_id" ` // question_id
|
QuestionId string `json:"question_id" ` // question_id
|
||||||
Content string `json:"content" ` // content
|
Content string `json:"content" ` // content
|
||||||
Html string `json:"html" ` // 解析后的html
|
Html string `json:"html" ` // html
|
||||||
UserID string `json:"-" ` // user_id
|
UserID string `json:"-" ` // user_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ type AnswerUpdateReq struct {
|
||||||
UserID string `json:"-" ` // user_id
|
UserID string `json:"-" ` // user_id
|
||||||
Title string `json:"title" ` // title
|
Title string `json:"title" ` // title
|
||||||
Content string `json:"content"` // content
|
Content string `json:"content"` // content
|
||||||
Html string `json:"html" ` // 解析后的html
|
Html string `json:"html" ` // html
|
||||||
EditSummary string `validate:"omitempty" json:"edit_summary"` //edit_summary
|
EditSummary string `validate:"omitempty" json:"edit_summary"` //edit_summary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,27 +52,27 @@ type QuestionUpdate struct {
|
||||||
|
|
||||||
type QuestionBaseInfo struct {
|
type QuestionBaseInfo struct {
|
||||||
ID string `json:"id" `
|
ID string `json:"id" `
|
||||||
Title string `json:"title" xorm:"title"` // 标题
|
Title string `json:"title" xorm:"title"` // title
|
||||||
ViewCount int `json:"view_count" xorm:"view_count"` // view_count
|
ViewCount int `json:"view_count" xorm:"view_count"` // view count
|
||||||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // 回复总数
|
AnswerCount int `json:"answer_count" xorm:"answer_count"` // answer count
|
||||||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // 收藏总数
|
CollectionCount int `json:"collection_count" xorm:"collection_count"` // collection count
|
||||||
FollowCount int `json:"follow_count" xorm:"follow_count"` // 关注数
|
FollowCount int `json:"follow_count" xorm:"follow_count"` // follow count
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
AcceptedAnswer bool `json:"accepted_answer"`
|
AcceptedAnswer bool `json:"accepted_answer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QuestionInfo struct {
|
type QuestionInfo struct {
|
||||||
ID string `json:"id" `
|
ID string `json:"id" `
|
||||||
Title string `json:"title" xorm:"title"` // 标题
|
Title string `json:"title" xorm:"title"` // title
|
||||||
Content string `json:"content" xorm:"content"` // 内容
|
Content string `json:"content" xorm:"content"` // content
|
||||||
Html string `json:"html" xorm:"html"` // 解析后的html
|
Html string `json:"html" xorm:"html"` // html
|
||||||
Tags []*TagResp `json:"tags" ` // tags
|
Tags []*TagResp `json:"tags" ` // tags
|
||||||
ViewCount int `json:"view_count" xorm:"view_count"` // view_count
|
ViewCount int `json:"view_count" xorm:"view_count"` // view_count
|
||||||
UniqueViewCount int `json:"unique_view_count" xorm:"unique_view_count"` // unique_view_count
|
UniqueViewCount int `json:"unique_view_count" xorm:"unique_view_count"` // unique_view_count
|
||||||
VoteCount int `json:"vote_count" xorm:"vote_count"` // vote_count
|
VoteCount int `json:"vote_count" xorm:"vote_count"` // vote_count
|
||||||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // 回复总数
|
AnswerCount int `json:"answer_count" xorm:"answer_count"` // answer count
|
||||||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // 收藏总数
|
CollectionCount int `json:"collection_count" xorm:"collection_count"` // collection count
|
||||||
FollowCount int `json:"follow_count" xorm:"follow_count"` // 关注数
|
FollowCount int `json:"follow_count" xorm:"follow_count"` // follow count
|
||||||
AcceptedAnswerId string `json:"accepted_answer_id" ` // accepted_answer_id
|
AcceptedAnswerId string `json:"accepted_answer_id" ` // accepted_answer_id
|
||||||
LastAnswerId string `json:"last_answer_id" ` // last_answer_id
|
LastAnswerId string `json:"last_answer_id" ` // last_answer_id
|
||||||
CreateTime int64 `json:"create_time" ` // create_time
|
CreateTime int64 `json:"create_time" ` // create_time
|
||||||
|
|
|
@ -365,7 +365,6 @@ func (as *AnswerService) SearchList(ctx context.Context, search *schema.AnswerLi
|
||||||
|
|
||||||
func (as *AnswerService) SearchFormatInfo(ctx context.Context, dblist []*entity.Answer, loginUserId string) ([]*schema.AnswerInfo, error) {
|
func (as *AnswerService) SearchFormatInfo(ctx context.Context, dblist []*entity.Answer, loginUserId string) ([]*schema.AnswerInfo, error) {
|
||||||
list := make([]*schema.AnswerInfo, 0)
|
list := make([]*schema.AnswerInfo, 0)
|
||||||
//todo 依赖其他接口
|
|
||||||
objectIds := make([]string, 0)
|
objectIds := make([]string, 0)
|
||||||
userIds := make([]string, 0)
|
userIds := make([]string, 0)
|
||||||
for _, dbitem := range dblist {
|
for _, dbitem := range dblist {
|
||||||
|
|
|
@ -14,13 +14,13 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* minLength: 指定密码的最小长度
|
* minLength: Specifies the minimum length of a password
|
||||||
* maxLength:指定密码的最大长度
|
* maxLength:Specifies the maximum length of a password
|
||||||
* minLevel:指定密码最低要求的强度等级
|
* minLevel:Specifies the minimum strength level required for passwords
|
||||||
* pwd:明文密码
|
* pwd:Text passwords
|
||||||
*/
|
*/
|
||||||
func PassWordCheck(minLength, maxLength, minLevel int, pwd string) error {
|
func PassWordCheck(minLength, maxLength, minLevel int, pwd string) error {
|
||||||
// 首先校验密码长度是否在范围内
|
// First check whether the password length is within the range
|
||||||
if len(pwd) < minLength {
|
if len(pwd) < minLength {
|
||||||
return fmt.Errorf("BAD PASSWORD: The password is shorter than %d characters", minLength)
|
return fmt.Errorf("BAD PASSWORD: The password is shorter than %d characters", minLength)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,9 @@ func PassWordCheck(minLength, maxLength, minLevel int, pwd string) error {
|
||||||
return fmt.Errorf("BAD PASSWORD: The password is logner than %d characters", maxLength)
|
return fmt.Errorf("BAD PASSWORD: The password is logner than %d characters", maxLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化密码强度等级为D,利用正则校验密码强度,若匹配成功则强度自增1
|
// The password strength level is initialized to D.
|
||||||
|
// The regular is used to verify the password strength.
|
||||||
|
// If the matching is successful, the password strength increases by 1
|
||||||
var level int = levelD
|
var level int = levelD
|
||||||
patternList := []string{`[0-9]+`, `[a-z]+`, `[A-Z]+`, `[~!@#$%^&*?_-]+`}
|
patternList := []string{`[0-9]+`, `[a-z]+`, `[A-Z]+`, `[~!@#$%^&*?_-]+`}
|
||||||
for _, pattern := range patternList {
|
for _, pattern := range patternList {
|
||||||
|
@ -38,7 +40,7 @@ func PassWordCheck(minLength, maxLength, minLevel int, pwd string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果最终密码强度低于要求的最低强度,返回并报错
|
// If the final password strength falls below the required minimum strength, return with an error
|
||||||
if level < minLevel {
|
if level < minLevel {
|
||||||
return fmt.Errorf("The password does not satisfy the current policy requirements. ")
|
return fmt.Errorf("The password does not satisfy the current policy requirements. ")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue