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"
|
||||
},
|
||||
"html": {
|
||||
"description": "解析后的html",
|
||||
"description": "html",
|
||||
"type": "string"
|
||||
},
|
||||
"question_id": {
|
||||
|
@ -4146,7 +4146,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"html": {
|
||||
"description": "解析后的html",
|
||||
"description": "html",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
|
|
|
@ -4080,7 +4080,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"html": {
|
||||
"description": "解析后的html",
|
||||
"description": "html",
|
||||
"type": "string"
|
||||
},
|
||||
"question_id": {
|
||||
|
@ -4134,7 +4134,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"html": {
|
||||
"description": "解析后的html",
|
||||
"description": "html",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
|
|
|
@ -129,7 +129,7 @@ definitions:
|
|||
description: content
|
||||
type: string
|
||||
html:
|
||||
description: 解析后的html
|
||||
description: html
|
||||
type: string
|
||||
question_id:
|
||||
description: question_id
|
||||
|
@ -167,7 +167,7 @@ definitions:
|
|||
description: edit_summary
|
||||
type: string
|
||||
html:
|
||||
description: 解析后的html
|
||||
description: html
|
||||
type: string
|
||||
id:
|
||||
description: id
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package entity
|
||||
|
||||
// UserCacheInfo 用户缓存信息
|
||||
// UserCacheInfo User Cache Information
|
||||
type UserCacheInfo struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserStatus int `json:"user_status"`
|
||||
|
|
|
@ -16,7 +16,7 @@ const (
|
|||
type AnswerAddReq struct {
|
||||
QuestionId string `json:"question_id" ` // question_id
|
||||
Content string `json:"content" ` // content
|
||||
Html string `json:"html" ` // 解析后的html
|
||||
Html string `json:"html" ` // html
|
||||
UserID string `json:"-" ` // user_id
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ type AnswerUpdateReq struct {
|
|||
UserID string `json:"-" ` // user_id
|
||||
Title string `json:"title" ` // title
|
||||
Content string `json:"content"` // content
|
||||
Html string `json:"html" ` // 解析后的html
|
||||
Html string `json:"html" ` // html
|
||||
EditSummary string `validate:"omitempty" json:"edit_summary"` //edit_summary
|
||||
}
|
||||
|
||||
|
|
|
@ -52,27 +52,27 @@ type QuestionUpdate struct {
|
|||
|
||||
type QuestionBaseInfo struct {
|
||||
ID string `json:"id" `
|
||||
Title string `json:"title" xorm:"title"` // 标题
|
||||
ViewCount int `json:"view_count" xorm:"view_count"` // view_count
|
||||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // 回复总数
|
||||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // 收藏总数
|
||||
FollowCount int `json:"follow_count" xorm:"follow_count"` // 关注数
|
||||
Title string `json:"title" xorm:"title"` // title
|
||||
ViewCount int `json:"view_count" xorm:"view_count"` // view count
|
||||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // answer count
|
||||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // collection count
|
||||
FollowCount int `json:"follow_count" xorm:"follow_count"` // follow count
|
||||
Status string `json:"status"`
|
||||
AcceptedAnswer bool `json:"accepted_answer"`
|
||||
}
|
||||
|
||||
type QuestionInfo struct {
|
||||
ID string `json:"id" `
|
||||
Title string `json:"title" xorm:"title"` // 标题
|
||||
Content string `json:"content" xorm:"content"` // 内容
|
||||
Html string `json:"html" xorm:"html"` // 解析后的html
|
||||
Title string `json:"title" xorm:"title"` // title
|
||||
Content string `json:"content" xorm:"content"` // content
|
||||
Html string `json:"html" xorm:"html"` // html
|
||||
Tags []*TagResp `json:"tags" ` // tags
|
||||
ViewCount int `json:"view_count" xorm:"view_count"` // 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
|
||||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // 回复总数
|
||||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // 收藏总数
|
||||
FollowCount int `json:"follow_count" xorm:"follow_count"` // 关注数
|
||||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // answer count
|
||||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // collection count
|
||||
FollowCount int `json:"follow_count" xorm:"follow_count"` // follow count
|
||||
AcceptedAnswerId string `json:"accepted_answer_id" ` // accepted_answer_id
|
||||
LastAnswerId string `json:"last_answer_id" ` // last_answer_id
|
||||
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) {
|
||||
list := make([]*schema.AnswerInfo, 0)
|
||||
//todo 依赖其他接口
|
||||
objectIds := make([]string, 0)
|
||||
userIds := make([]string, 0)
|
||||
for _, dbitem := range dblist {
|
||||
|
|
|
@ -14,13 +14,13 @@ const (
|
|||
)
|
||||
|
||||
/*
|
||||
* minLength: 指定密码的最小长度
|
||||
* maxLength:指定密码的最大长度
|
||||
* minLevel:指定密码最低要求的强度等级
|
||||
* pwd:明文密码
|
||||
* minLength: Specifies the minimum length of a password
|
||||
* maxLength:Specifies the maximum length of a password
|
||||
* minLevel:Specifies the minimum strength level required for passwords
|
||||
* pwd:Text passwords
|
||||
*/
|
||||
func PassWordCheck(minLength, maxLength, minLevel int, pwd string) error {
|
||||
// 首先校验密码长度是否在范围内
|
||||
// First check whether the password length is within the range
|
||||
if len(pwd) < 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)
|
||||
}
|
||||
|
||||
// 初始化密码强度等级为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
|
||||
patternList := []string{`[0-9]+`, `[a-z]+`, `[A-Z]+`, `[~!@#$%^&*?_-]+`}
|
||||
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 {
|
||||
return fmt.Errorf("The password does not satisfy the current policy requirements. ")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue