Commit 2dd63bf4 by Joneq

判断分母为零的情况

parent 61e8b7bf
Showing with 10 additions and 1 deletions
......@@ -215,12 +215,19 @@ func (d *dao) BankDongRate(ctx context.Context,y map[string]string,modelItems []
remark = c3["period_use_times_six"]
}
}
if project_id != 48 && project_id != 44{
if s1 == "" || s2 == "" {
logic.LogWrite("没有订单数据跳过:"+y["erp_company_code"],"dong_error",1)
return
}
//如果0是被除则跳过,否则会出错
if(logic.MyFloat64(s2) != 0){
ladder_rate = logic.MyFloat64(s1)/logic.MyFloat64(s2)
}else{
ladder_rate = 0
}
remark = s1+"/"+s2+"="+logic.MyFloat64ToStr(ladder_rate)
}
......@@ -244,7 +251,7 @@ func (d *dao) BankDongAddScore(ctx context.Context,com_credits_id int64,month_si
sum_dong_score float64 //动态模型总分
)
c1,_ := d.QueryOne(ctx,3,fmt.Sprintf(bank_sql5,com_credits_id,month_six_zi))
c1,_ := d.QueryOne(ctx,1,fmt.Sprintf(bank_sql5,com_credits_id,month_six_zi))
if c1["sum_dong_score"] == "0" || c1["sum_dong_score"] == "" { //没有结果
sum_dong_score = 0
}else{
......
......@@ -28,3 +28,5 @@
[2019/11/21 17:19:34.063] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/main.go:24] caipu-server start
[2019/12/19 16:18:26.263] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] kaopuserver start%!(EXTRA int=0)
[2020/01/02 18:27:52.584] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] kaopuserver-static start%!(EXTRA int=0)
[2020/01/06 09:17:46.842] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] kaopuserver-static start%!(EXTRA int=0)
[2020/01/06 09:18:13.207] [INFO] [/usr/local/var/www/ichunt/kaopu-server/cmd/static/main.go:56] kaopuserver-static start%!(EXTRA int=0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment