From 4bff97b12981fb4b07c8d2036abe546c339e58c4 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期二, 19 十一月 2019 13:59:58 +0800 Subject: [PATCH] --- --- algorithm/face/face.go | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/algorithm/face/face.go b/algorithm/face/face.go index 33e0d4b..6a90334 100644 --- a/algorithm/face/face.go +++ b/algorithm/face/face.go @@ -8,7 +8,7 @@ "strconv" ) // 浜鸿劯绠楁硶 -func Entrance(rule *protomsg.Rule, am *structure.AreaMap) structure.LittleRuleResult { +func Entrance(rule *protomsg.Rule, am *structure.AreaMap,lable *structure.Others,args *structure.SdkDatas,message *protomsg.SdkMessage) structure.LittleRuleResult { logger.Debug("---------璧颁簡浜鸿劯妫�娴嬬畻娉�",rule.Id,rule.SdkArgAlias,rule.Operator,rule.SdkArgValue,am.AreaId) return filterRule(rule,am) } @@ -64,15 +64,16 @@ //logger.Info("-----------------------浜鸿劯杩囨护鐨刟rgs閲岀殑鏁伴噺锛�", len(args)) for _, arg := range args { var formula string - if rule.SdkArgAlias == "score" { - formula = strconv.FormatFloat(arg.Score, 'f', -1, 64) + " " + rule.Operator + " " + rule.SdkArgValue // 寰楀埌瀛楃涓插叕寮� - logger.Info("褰撳墠鐩镐技搴﹀皬鍏紡锛�", formula) - } else if rule.SdkArgAlias == "proportion" { - formula = strconv.FormatFloat(arg.Proportion, 'f', -1, 64) + " " + rule.Operator + " " + rule.SdkArgValue // 寰楀埌瀛楃涓插叕寮� - logger.Info("褰撳墠鍗犳瘮灏忓叕寮忥細", formula) - } else { - formula = strconv.FormatFloat(arg.Size, 'f', -1, 64) + " " + rule.Operator + " " + rule.SdkArgValue // 寰楀埌瀛楃涓插叕寮� - logger.Info("褰撳墠灏哄灏忓叕寮忥細", formula) + switch rule.SdkArgAlias { + case "score": + formula = strconv.FormatFloat(arg.Score, 'f', -1, 64) + " " + rule.Operator + " " + rule.SdkArgValue + logger.Info("鐩镐技搴﹀皬鍏紡锛�", formula) + case "proportion": + formula = strconv.FormatFloat(arg.Proportion, 'f', -1, 64) + " " + rule.Operator + " " + rule.SdkArgValue + logger.Info("鍗犳瘮鍏紡锛�", formula) + case "size": + formula = strconv.FormatFloat(arg.Size, 'f', -1, 64) + " " + rule.Operator + " " + rule.SdkArgValue + logger.Info("灏哄灏忓叕寮忥細", formula) } expression, _ := govaluate.NewEvaluableExpression(formula) // 寰楀埌鏁板鍏紡 result, _ := expression.Evaluate(nil) // 寰楀埌鏁板鍏紡鐨勭粨鏋� -- Gitblit v1.8.0