wangchuanjin 4 tygodni temu
rodzic
commit
ac7275f1e8
3 zmienionych plików z 18 dodań i 36 usunięć
  1. 4 16
      service/model.go
  2. 6 11
      service/rule.go
  3. 8 9
      service/service.go

+ 4 - 16
service/model.go

@@ -11,26 +11,20 @@ import (
 type Model struct {
 }
 
-func (ml *Model) Execute(b *BidInfo) (bool, string, int, map[string]interface{}) {
+func (ml *Model) Execute(b *BidInfo) (bool, string, int) {
 	return ml.Do(b, 2)
 }
-func (ml *Model) Do(b *BidInfo, t int) (bool, string, int, map[string]interface{}) {
+func (ml *Model) Do(b *BidInfo, t int) (bool, string, int) {
 	result := ml.post(b.Id, b.Detail, t)
 	if result == nil {
-		return false, "", 0, nil
+		return false, "", 0
 	}
 	for k, v := range result {
 		if v == nil {
 			delete(result, k)
 		}
 	}
-	set := map[string]interface{}{}
-	flag := false
 	quoteMode, _ := result["报价模式"].(string)
-	if !allQuoteMode[quoteMode] {
-		quoteMode = ""
-		flag = true
-	}
 	bidCommonwealth := 0
 	if result["中标联合体"] != nil {
 		if result["中标联合体"] == "是" {
@@ -38,14 +32,8 @@ func (ml *Model) Do(b *BidInfo, t int) (bool, string, int, map[string]interface{
 		} else {
 			bidCommonwealth = -1
 		}
-		if result["中标联合体"] != "是" && result["中标联合体"] != "否" {
-			flag = true
-		}
-	}
-	if flag && result != nil {
-		set["model_dataidentify"] = result
 	}
-	return true, quoteMode, bidCommonwealth, set
+	return true, quoteMode, bidCommonwealth
 }
 func (ml *Model) post(_id, detail string, t int) map[string]interface{} {
 	ctx := gctx.New()

+ 6 - 11
service/rule.go

@@ -18,7 +18,6 @@ var (
 	bidCommonwealth_firstWinnerOrder  = g.Config().MustGet(gctx.New(), "bidCommonwealth.firstWinnerOrder").String()
 	quoteModeRules                    = g.Config().MustGet(gctx.New(), "quoteMode.rules").Maps()
 	quoteMode_modelPatterns           = g.Config().MustGet(gctx.New(), "quoteMode.modelPatterns").Strings()
-	allQuoteMode                      = map[string]bool{}
 	showOnlyOnce                      = [][]string{}
 )
 
@@ -26,30 +25,26 @@ func init() {
 	for _, v := range g.Config().MustGet(gctx.New(), "bidCommonwealth.showOnlyOnce").Array() {
 		showOnlyOnce = append(showOnlyOnce, gconv.Strings(v))
 	}
-	for _, v := range quoteModeRules {
-		vv := gvar.New(v).MapStrVar()
-		allQuoteMode[vv["mode"].String()] = true
-	}
 }
 
 type Rule struct{}
 
 // 判断是否是联合体中标
-func (r *Rule) Execute(b *BidInfo) (bool, string, int, map[string]interface{}) {
+func (r *Rule) Execute(b *BidInfo) (bool, string, int) {
 	bc := r.bidCommonwealth(b)
 	quoteMode := r.quoteMode(b)
 	if bc == -2 && quoteMode == "大模型识别" {
-		_, quoteMode, bc, _ = (&Model{}).Do(b, 2)
+		_, quoteMode, bc = (&Model{}).Do(b, 2)
 	} else if bc == -2 {
-		_, _, bc, _ = (&Model{}).Do(b, 3)
+		_, _, bc = (&Model{}).Do(b, 3)
 	} else if quoteMode == "大模型识别" {
-		_, quoteMode, _, _ = (&Model{}).Do(b, 1)
+		_, quoteMode, _ = (&Model{}).Do(b, 1)
 	}
-	if (quoteMode == "" || quoteMode == "无法识别") && b.Bidamount > 0 {
+	if (quoteMode == "" || quoteMode == "无法识别") && b.Bidamount > 10000 {
 		quoteMode = "整体报价模式"
 	}
 	log.Println(b.Id, "规则", "报价模式", quoteMode, "中标联合体", bc)
-	return true, quoteMode, bc, nil
+	return true, quoteMode, bc
 }
 
 // 识别中标联合体

+ 8 - 9
service/service.go

@@ -26,11 +26,8 @@ type DataIdentify struct {
 
 func (d *DataIdentify) Execute(_id *string, reply *map[string]string) error {
 	log.Println("rpc接收到要识别的_id", _id)
-	_, a, b, _ := Start(*_id)
+	_, a, b := Start(*_id)
 	*reply = map[string]string{}
-	if !allQuoteMode[a] {
-		a = "其他"
-	}
 	if a == "费率模式" {
 		a = "费率"
 	} else if a == "单价模式" {
@@ -39,6 +36,8 @@ func (d *DataIdentify) Execute(_id *string, reply *map[string]string) error {
 		a = "折扣率"
 	} else if a == "整体报价模式" {
 		a = "正常报价"
+	} else {
+		a = "其他"
 	}
 	(*reply)["报价模式"] = a
 	if b == 1 {
@@ -50,7 +49,7 @@ func (d *DataIdentify) Execute(_id *string, reply *map[string]string) error {
 }
 
 type Service interface {
-	Execute(b *BidInfo) (bool, string, int, map[string]interface{})
+	Execute(b *BidInfo) (bool, string, int)
 }
 type BidInfo struct {
 	Id, Detail, Subtype string
@@ -59,19 +58,19 @@ type BidInfo struct {
 	Bidamount           float64
 }
 
-func Start(_id string) (bool, string, int, map[string]interface{}) {
+func Start(_id string) (bool, string, int) {
 	data, ok := Mgo_Main.FindById(g.Config().MustGet(gctx.New(), "mongodb.main.collection").String(), _id, SelectField)
 	if !ok || data == nil || len(*data) == 0 {
 		log.Println(_id, "没有找到标讯")
-		return false, "", 0, nil
+		return false, "", 0
 	}
 	return Pretreatment(_id, *data)
 }
 
-func Pretreatment(_id string, m map[string]interface{}) (bool, string, int, map[string]interface{}) {
+func Pretreatment(_id string, m map[string]interface{}) (bool, string, int) {
 	if m == nil || len(m) == 0 {
 		log.Println(_id, "没有找到标讯")
-		return false, "", 0, nil
+		return false, "", 0
 	}
 	detail, _ := m["detail"].(string)
 	subtype, _ := m["subtype"].(string)