12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package main
- import (
- "fmt"
- qu "qfw/util"
- "unicode/utf8"
- )
- func projectnameFieldScore(tmp map[string]interface{},score int64) (map[string]interface{}) {
- projectname := qu.ObjToString(tmp["projectname"])
- reason,desc:=fmt.Sprintf("%d初始分",score),""
- /*错误项*/
- if utf8.RuneCountInString(projectname) <= 6 {
- return map[string]interface{}{
- "score":int64(0),
- "reason":"错误:长度",
- }
- }
- if !isHan(projectname) {
- return map[string]interface{}{
- "score":int64(0),
- "reason":"错误:无中文",
- }
- }
- /*减分项
- "长度过长":1,
- "中文比例": 2
- */
- if utf8.RuneCountInString(projectname) >= 40 {
- desc = "长度过长"
- reason+="~"+desc
- score -= qu.Int64All(projectname_score[desc])
- }
- if !isHanLenToLittle(projectname) {
- desc = "中文比例"
- reason+="~"+desc
- score -= qu.Int64All(projectname_score[desc])
- }
- return map[string]interface{}{
- "score":score,
- "reason":reason,
- }
- }
|