Commit 1d1719db by 冷斌

add

parent 66dd301c
......@@ -10,7 +10,7 @@
<form class="well form-search" method="post" action="{:U('Welfare/savePrice')}">
价格:
<input type="text" name="price" style="width: 200px;" value="" placeholder="">
<input type="submit" class="btn btn-primary js-ajax-dialog-btn" data-msg="您确定要删除吗?" value="保存">
<input type="submit" class="btn btn-primary js-ajax-dialog-btn" data-msg="您确定要修改价格吗?" value="保存">
</form>
<form method="post" class="js-ajax-form">
<table class="table table-hover table-bordered">
......
......@@ -28,25 +28,23 @@ class WelfareController extends AdminbaseController
function savePrice()
{
if(IS_POST){
$price=I('price');
if ($price > 0) {
$jackpot=M("welfare_rate");
$check = $jackpot->where("id=1")->find();
if (empty($check)) {
$p = [
'id' => 1,
'giftid' => 0,
'nums' => 0,
'rate' => $price
];
M("welfare_rate")->add($p);
} else {
M("welfare_rate")->where('id=1')->save(['rate' => $price]);
}
$price=I('price');
if ($price > 0) {
$jackpot=M("welfare_rate");
$check = $jackpot->where("id=1")->find();
if (empty($check)) {
$p = [
'id' => 1,
'giftid' => 0,
'nums' => 0,
'rate' => $price
];
M("welfare_rate")->add($p);
} else {
M("welfare_rate")->where('id=1')->save(['rate' => $price]);
}
}
return $this->index();
$this->success('修改成功');
}
function index(){
......
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