| | |
| | | } |
| | | |
| | | // 保留四位小数 |
| | | func Retain(f float32)(float32) { |
| | | func Retain(f float32)(float64) { |
| | | s:= strconv.FormatFloat(float64(f), 'f', 4, 64) |
| | | v, err := strconv.ParseFloat(s, 32) |
| | | v, err := strconv.ParseFloat(s, 64) |
| | | if err != nil { |
| | | logger.Error("保留四位小数转换错误") |
| | | } |
| | | return float32(v) |
| | | // float32与float64互转会有位数保留不准的问题 |
| | | return v |
| | | } |
| | | |
| | | // 取出某个时间规则的第几天的规则段集合 |
| | |
| | | if err != nil || len(table) == 0{ |
| | | logger.Error("根据id查询底库信息出错!",err,"--返回值长度为:",len(table)) |
| | | } |
| | | base := BaseInfo{TableId:baseinfo.TableId,TableName:table[0].TableName,BwType:table[0].BwType,CompareScore:float64(m[baseinfo.Id]),PersonId:baseinfo.Id,PersonName:baseinfo.PersonName,PersonPicUrl:baseinfo.PersonPicUrl,PhoneNum:baseinfo.PhoneNum,Sex:baseinfo.Sex,MonitorLevel:baseinfo.MonitorLevel,Content:""} |
| | | base := BaseInfo{TableId:baseinfo.TableId,TableName:table[0].TableName,BwType:table[0].BwType,CompareScore:Retain(m[baseinfo.Id]),PersonId:baseinfo.Id,PersonName:baseinfo.PersonName,PersonPicUrl:baseinfo.PersonPicUrl,PhoneNum:baseinfo.PhoneNum,Sex:baseinfo.Sex,MonitorLevel:baseinfo.MonitorLevel,Content:""} |
| | | //logger.Debug("看看这个base的对比值是多少:",base) |
| | | //os.Exit(1) |
| | | arg.Liker = append(arg.Liker, &base) |
| | | } |
| | | } |