From 8e6393d72f399d5792ee46f517b6cf798e8317ad Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期二, 19 十一月 2019 13:45:24 +0800
Subject: [PATCH] ---
---
algorithm/face/face.go | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/algorithm/face/face.go b/algorithm/face/face.go
index 2a46afc..6a90334 100644
--- a/algorithm/face/face.go
+++ b/algorithm/face/face.go
@@ -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