Commit a62b4e8c by 冷斌

update

parent ca088f9e
......@@ -73,13 +73,16 @@ class LuckrateController extends AdminbaseController {
$this->error('中奖倍数不能小于0');
}
$check = $jackpot->where("giftid='{$giftid}' and nums='{$nums}' and times = '{$times}'")->find();
if($check){
$this->error('相同数量、倍数的配置已存在');
}
// $check = $jackpot->where("giftid='{$giftid}' and nums='{$nums}' and times = '{$times}'")->find();
$check = $jackpot->where("giftid='{$giftid}'")->sum('rate');
var_dump($check + I('rate'));
die;
if($check){
if(($check + I('rate')) > 100){
// $this->error('相同数量、倍数的配置已存在');
$this->error('配置已存在');
$this->error('中奖概率大于100%');
}
$jackpot->addtime=time();
......@@ -124,6 +127,11 @@ class LuckrateController extends AdminbaseController {
if($check){
$this->error('相同数量、倍数的配置已存在');
}
$check = $jackpot->where("giftid='{$giftid}' and id!={$id}")->sum('rate');
if(($check + I('rate')) > 100){
// $this->error('相同数量、倍数的配置已存在');
$this->error('中奖概率大于100%');
}
$result=$jackpot->save();
if($result!==false){
......
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 to comment