浏览代码

小bug,0不可以做除数

lizhen_gitee 1 年之前
父节点
当前提交
991e4d53b8
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      application/admin/controller/Eggjackpotchanchu.php

+ 5 - 1
application/admin/controller/Eggjackpotchanchu.php

@@ -99,7 +99,11 @@ class Eggjackpotchanchu extends Backend
                     'do_giftprice' => Db::name('egg_do')->where('Jackpot_id',$jackpot_id)->where('starttime',$jackpot['starttime'])->sum('price'),//抽奖总礼物价值
                 ];
                 //产出比
-                $jackpot_chanchu['chanchubi'] = bcdiv($jackpot_chanchu['do_giftprice'],$jackpot_chanchu['jp_giftprice'],2);
+                if($jackpot_chanchu['jp_giftprice'] == 0){
+                    $jackpot_chanchu['chanchubi'] = 0;
+                }else{
+                    $jackpot_chanchu['chanchubi'] = bcdiv($jackpot_chanchu['do_giftprice'],$jackpot_chanchu['jp_giftprice'],2);
+                }
 
                 $jackpot = array_merge($jackpot,$jackpot_chanchu);
             }