切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
a01c2f2aac8fa3f92ce2195f6cc46c2d059a01e2
1 个父辈
ed003819
优化字符串计算长度
隐藏空白字符变更
内嵌
并排对比
正在显示
10 个修改的文件
包含
37 行增加
和
23 行删除
pkg/application/evaluation_cycle/command/cycle_create.go
pkg/application/evaluation_cycle/command/cycle_update.go
pkg/application/evaluation_project/command/project_create.go
pkg/application/evaluation_project/command/project_update.go
pkg/application/evaluation_rule/command/rule_create.go
pkg/application/evaluation_rule/command/rule_update.go
pkg/application/evaluation_template/command/template_create.go
pkg/application/evaluation_template/command/template_update.go
pkg/application/role/command/role_create.go
pkg/application/role/command/role_update.go
pkg/application/evaluation_cycle/command/cycle_create.go
查看文件 @
a01c2f2
...
...
@@ -2,6 +2,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
CreateCycleCommand
struct
{
...
...
@@ -23,7 +24,7 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) {
validation
.
SetError
(
"creatorId"
,
"创建人ID无效"
)
return
}
if
len
(
in
.
Name
)
>
40
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"名称最大长度40个字符"
)
return
}
...
...
pkg/application/evaluation_cycle/command/cycle_update.go
查看文件 @
a01c2f2
...
...
@@ -2,6 +2,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
UpdateCycleCommand
struct
{
...
...
@@ -15,7 +16,7 @@ type UpdateCycleCommand struct {
}
func
(
in
*
UpdateCycleCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
if
len
(
in
.
Name
)
>
40
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"角色名称最大长度40个字符"
)
return
}
...
...
pkg/application/evaluation_project/command/project_create.go
查看文件 @
a01c2f2
...
...
@@ -2,6 +2,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
CreateProjectCommand
struct
{
...
...
@@ -24,7 +25,7 @@ func (in *CreateProjectCommand) Valid(validation *validation.Validation) {
validation
.
SetError
(
"creatorId"
,
"创建人ID无效"
)
return
}
if
len
(
in
.
Name
)
>
40
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"项目名称最大长度40个字符"
)
return
}
...
...
pkg/application/evaluation_project/command/project_update.go
查看文件 @
a01c2f2
...
...
@@ -2,6 +2,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
UpdateProjectCommand
struct
{
...
...
@@ -36,7 +37,7 @@ type CheckRecipientCommand struct {
}
func
(
in
*
UpdateProjectCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
if
len
(
in
.
Name
)
>
40
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"项目名称最大长度40个字符"
)
return
}
...
...
pkg/application/evaluation_rule/command/rule_create.go
查看文件 @
a01c2f2
...
...
@@ -3,6 +3,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"unicode/utf8"
)
type
CreateRuleCommand
struct
{
...
...
@@ -25,12 +26,12 @@ func (in *CreateRuleCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
Name
)
>
40
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"名称最大长度40个字符"
)
return
}
if
len
(
in
.
Remark
)
>
100
{
if
utf8
.
RuneCountInString
(
in
.
Remark
)
>
100
{
validation
.
SetError
(
"remark"
,
"备注不能超过100个字符"
)
return
}
...
...
pkg/application/evaluation_rule/command/rule_update.go
查看文件 @
a01c2f2
...
...
@@ -3,6 +3,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"unicode/utf8"
)
type
UpdateRuleCommand
struct
{
...
...
@@ -21,12 +22,12 @@ func (in *UpdateRuleCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
Name
)
>
40
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"名称最大长度40个字符"
)
return
}
if
len
(
in
.
Remark
)
>
100
{
if
utf8
.
RuneCountInString
(
in
.
Remark
)
>
100
{
validation
.
SetError
(
"remark"
,
"备注不能超过100个字符"
)
return
}
...
...
pkg/application/evaluation_template/command/template_create.go
查看文件 @
a01c2f2
...
...
@@ -2,6 +2,7 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
CreateTemplateCommand
struct
{
...
...
@@ -21,12 +22,13 @@ func (in *CreateTemplateCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
Name
)
>
40
{
// 这个才是真正计算字符串文字长度的 utf8.RuneCountInString(in.Name)
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"模板名称最大长度40个字符"
)
return
}
if
len
(
in
.
Describe
)
>
100
{
if
utf8
.
RuneCountInString
(
in
.
Describe
)
>
100
{
validation
.
SetError
(
"describe"
,
"备注最大长度100个字符"
)
return
}
...
...
pkg/application/evaluation_template/command/template_update.go
查看文件 @
a01c2f2
...
...
@@ -20,15 +20,15 @@ func (in *UpdateTemplateCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"模板名称最大长度40个字符"
)
return
}
if
len
(
in
.
Describe
)
>
100
{
validation
.
SetError
(
"describe"
,
"备注最大长度100个字符"
)
return
}
//if len(in.Name) > 40 {
// validation.SetError("name", "模板名称最大长度40个字符")
// return
//}
//
//if len(in.Describe) > 100 {
// validation.SetError("describe", "备注最大长度100个字符")
// return
//}
if
len
(
in
.
LinkNodes
)
==
0
{
validation
.
SetError
(
"linkNodes"
,
"评估模板流程不能为空"
)
...
...
pkg/application/role/command/role_create.go
查看文件 @
a01c2f2
package
command
import
"github.com/beego/beego/v2/core/validation"
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
CreateRoleCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
...
...
@@ -14,7 +17,7 @@ func (in *CreateRoleCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
Name
)
>
30
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
30
{
validation
.
SetError
(
"name"
,
"角色名称最大长度30个字符"
)
return
}
...
...
pkg/application/role/command/role_update.go
查看文件 @
a01c2f2
package
command
import
"github.com/beego/beego/v2/core/validation"
import
(
"github.com/beego/beego/v2/core/validation"
"unicode/utf8"
)
type
UpdateRoleCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
...
...
@@ -14,7 +17,7 @@ func (in *UpdateRoleCommand) Valid(validation *validation.Validation) {
validation
.
SetError
(
"companyId"
,
"公司ID无效"
)
}
if
len
(
in
.
Name
)
>
30
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
30
{
validation
.
SetError
(
"name"
,
"角色名称最大长度30个字符"
)
return
}
...
...
请
注册
或
登录
后发表评论