From cb75856a9440cf7a207e5c8cf05006d49b6d3f15 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期六, 30 十一月 2019 13:47:33 +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 2a46afc..30ed387 100644 --- a/algorithm/face/face.go +++ b/algorithm/face/face.go @@ -2,7 +2,7 @@ import ( "basic.com/pubsub/protomsg.git" - "basic.com/valib/logger.git" + logger "github.com/alecthomas/log4go" "github.com/knetic/govaluate" "ruleprocess/structure" "strconv" @@ -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