Commit 1d1719db by 冷斌

add

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