From 5d9cab58355591b018ca3525c7471a8c6fbefbe5 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 12 Sep 2024 17:26:52 +0800 Subject: [PATCH] 1 --- app/db/db_store.go | 2 +- app/svc/svc_store.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/db/db_store.go b/app/db/db_store.go index 2de782d..e748a2c 100644 --- a/app/db/db_store.go +++ b/app/db/db_store.go @@ -22,7 +22,7 @@ func GetStore(eg *xorm.Engine, arg map[string]string) []map[string]string { where += " and store_type=" + arg["store_type"] } if arg["city"] != "" { - where += " and city='" + arg["city"] + "'" + where += " and address like '%" + arg["city"] + "%'" } if arg["name"] != "" { where += " and name like '%" + arg["name"] + "'" diff --git a/app/svc/svc_store.go b/app/svc/svc_store.go index a836f68..aa9a095 100644 --- a/app/svc/svc_store.go +++ b/app/svc/svc_store.go @@ -25,12 +25,14 @@ func BankStore(c *gin.Context) { } storeList := make([]map[string]interface{}, 0) for _, v := range store { + km := v["km"] if utils.StrToFloat64(v["km"]) < 1 { v["km"] = utils.IntToStr(int(utils.StrToFloat64(v["km"])*1000)) + "m" } else { + v["km"] = GetCommissionPrec(c, v["km"], "2", "1") v["km"] += "km" } - if utils.StrToFloat64(v["km"]) <= 0 { + if utils.StrToFloat64(km) <= 0 { v["km"] = "-" } tmp := map[string]interface{}{ @@ -73,6 +75,7 @@ func Store(c *gin.Context) { if utils.StrToFloat64(v["km"]) < 1 { v["km"] = utils.IntToStr(int(utils.StrToFloat64(v["km"])*1000)) + "m" } else { + v["km"] = GetCommissionPrec(c, v["km"], "2", "1") v["km"] += "km" } label := make([]string, 0)