作者 刘朕
1 个管道 的构建 通过 耗费 22 秒

合并分支 'liuzhen' 到 'master'

Liuzhen



查看合并请求 !144
... ... @@ -81,6 +81,27 @@ class ShopcartController extends WeChatBaseController{
}
/**
* 商品数量修改
*/
public function shop_cart_numchange(){
$id = $this->request->param('id',0,'intval');
$num = $this->request->param('num',0,'intval');
$data = Db::name('shopping_cart') -> where('id',$id) -> find();
if($data['book_num'] != $num){
if($num > 999){
$this->error('商品数量不能大于999');
}
$res = Db::name('shopping_cart') -> where('id',$id) -> update(['book_num'=>$num]);
if(!$res) {
$this->error('购物车更新失败');
}
}
$this->success('修改成功');
}
/**
* 商品数量加一
*/
public function shop_cart_numadd(){
... ...
... ... @@ -40,7 +40,7 @@
<p class="de_topTxt1_1"><span>{$vo.price0}.{$vo.price1}</span></p>
<div class="order_newsNum">
<div class="order_newsJian" onclick="jian({$vo.carid})">-</div>
<input class="order_newsnum" type="text" readonly="readonly" value="{$vo.book_num}" />
<input class="order_newsnum" type="text" value="{$vo.book_num}" data-id="{$vo.carid}" oninput="var v=this.value||'';v=v.replace(/[^\d]/g,'');if(v.length==1 && v==0){v=''};this.value=v.substr(0,3);"/>
<div class="order_newsJia" onclick="jia({$vo.carid})">+</div>
</div>
</div>
... ... @@ -222,6 +222,21 @@
$(".zoji span").html(totalPrice.toFixed(2));
}
$(function() {
// 输入框修改数量
$('.order_newsnum').change(function () {
var id = $(this).data('id');
var num = $(this).val();
if(num > 999) {
alert('商品数量不能大于999');
}
$.post("{:url('Shopcart/shop_cart_numchange')}",{id:id,num:num},function(data){
if(data.code == 1) {
calcTotal();
} else {
alert(data.msg);
}
});
});
$(".order_newsNum div").on("click", function(evt) {
if ($(this).text() == "-") {
var count = parseInt($(this).next().val());
... ...
... ... @@ -208,10 +208,10 @@ class WeChatBaseController extends BaseController
$user = Db::name('user')->where('id',6)->find();
cmf_update_current_user($user);
}
else if(cmf_get_current_user_id()==484){
$user = Db::name('user')->where('id',49)->find();
cmf_update_current_user($user);
}
// else if(cmf_get_current_user_id()==484){
// $user = Db::name('user')->where('id',49)->find();
// cmf_update_current_user($user);
// }
// if(cmf_get_current_user_id()==484){
// $user = Db::name('user')->where('id',6)->find();
// cmf_update_current_user($user);
... ...
... ... @@ -506,7 +506,13 @@ class Request
} elseif (!$this->method) {
if (isset($_POST[Config::get('var_method')])) {
$this->method = strtoupper($_POST[Config::get('var_method')]);
$this->{$this->method}($_POST);
if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
$this->method = $method;
$this->{$this->method}($_POST);
} else {
$this->method = 'POST';
}
unset($_POST[Config::get('var_method')]);
} elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
$this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
} else {
... ...