Commit fb8bdfdb by Joneq

判断分母为零的情况

parent a25bece4
Showing with 8 additions and 1 deletions
......@@ -101,7 +101,14 @@ func (d *dao) DongRate(ctx context.Context,y map[string]string,modelItems []map[
logic.LogWrite("没有订单数据跳过:"+y["erp_company_code"],"dong_error",1)
return
}
ladder_rate = logic.MyFloat64(s1)/logic.MyFloat64(s2)
//如果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)
}
......
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