Browse Source

收货地址bug

master
ZLW-PC\Administrator 7 years ago
parent
commit
d2c4510902
  1. 8
      app/Http/Controllers/Api/UserAddressController.php
  2. 28
      app/Http/Controllers/Weixin/GoodsController.php
  3. 2
      app/Http/Model/UserAddress.php
  4. 6
      resources/views/weixin/address/userAddressUpdate.blade.php
  5. 0
      resources/views/weixin/goods/goodsDetail.blade.php
  6. 2
      resources/views/weixin/user/userinfo.blade.php
  7. 4
      routes/web.php

8
app/Http/Controllers/Api/UserAddressController.php

@ -101,18 +101,14 @@ class UserAddressController extends CommonController
$data['id'] = $request->input('id',null);
$data['name'] = $request->input('name',null);
$data['mobile'] = $request->input('mobile',null);
$data['country'] = $request->input('country',null);
$data['province'] = $request->input('province',null);
$data['city'] = $request->input('city',null);
$data['district'] = $request->input('district',null);
$data['address'] = $request->input('address',null);
if($request->input('telphone',null)!==null){$data['telphone'] = $request->input('telphone');}
if($request->input('zipcode',null)!==null){$data['zipcode'] = $request->input('zipcode');}
if($request->input('email',null)!==null){$data['email'] = $request->input('email');}
if($request->input('best_time',null)!==null){$data['best_time'] = $request->input('best_time');}
if($request->input('country',null)!==null){$data['country'] = $request->input('country');}
if($request->input('is_default',null)!==null){$data['is_default'] = $request->input('is_default');}
if($data['id']===null || $data['name']===null || $data['mobile']===null || $data['address']===null || $data['country']===null || $data['province']===null || $data['city']===null || $data['district']===null)
if($data['id']===null || $data['name']===null || $data['mobile']===null || $data['address']===null || $data['province']===null || $data['city']===null || $data['district']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}

28
app/Http/Controllers/Weixin/GoodsController.php

@ -11,8 +11,32 @@ class GoodsController extends CommonController
parent::__construct();
}
//商品详情
public function goodsDetail(Request $request)
{
if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');}
if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');}
if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');}
if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;}
if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;}
//商品列表
$postdata = array(
'limit' => 10,
'offset' => 0
);
$url = env('APP_API_URL')."/goods_list";
$goods_list = curl_request($url,$postdata,'GET');
$data['goods_list'] = $goods_list['data']['list'];
return view('weixin.goods.goodsDetail', $data);
}
//商品列表
public function goodslist(Request $request)
public function goodsList(Request $request)
{
if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
@ -32,6 +56,6 @@ class GoodsController extends CommonController
$goods_list = curl_request($url,$postdata,'GET');
$data['goods_list'] = $goods_list['data']['list'];
return view('weixin.goods.goodslist', $data);
return view('weixin.goods.goodsList', $data);
}
}

2
app/Http/Model/UserAddress.php

@ -134,7 +134,7 @@ class UserAddress extends BaseModel
$model->user_id = $user_id;
$model->is_default = isset($is_default) ? $is_default : 0;
if(isset($name)){$model->name = $country;}
if(isset($name)){$model->name = $name;}
if(isset($country)){$model->country = $country;}
if(isset($province)){$model->province = $province;}
if(isset($city)){$model->city = $city;}

6
resources/views/weixin/address/userAddressUpdate.blade.php

@ -26,6 +26,7 @@
.adr-form-group select{padding:5px;margin-right:10px;}
.bottoma{display:block;font-size:18px;padding:10px;color:white;background-color: #f23030;text-align:center;}
</style>
<input name="id" type="hidden" class="" id="id" value="<?php echo $post['id']; ?>">
<div class="adr_add">
<div class="adr-form-group">
<label for="doc-ipt-email-1">收货人</label>
@ -178,7 +179,8 @@ function adr_dosubmit()
{
var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
var url = '<?php echo env('APP_API_URL').'/user_address_add'; ?>';
var url = '<?php echo env('APP_API_URL').'/user_address_update'; ?>';
var id = $("#id").val();
var name = $("#name").val();
var mobile = $("#mobile").val();
var address = $("#address").val();
@ -238,7 +240,7 @@ function adr_dosubmit()
return false;
}
$.post(url,{access_token:access_token,name:name,mobile:mobile,address:address,province:province,city:city,district:district,is_default:is_default},function(res)
$.post(url,{access_token:access_token,id:id,name:name,mobile:mobile,address:address,province:province,city:city,district:district,is_default:is_default},function(res)
{
if(res.code==0)
{

0
resources/views/weixin/goods/goods.blade.php → resources/views/weixin/goods/goodsDetail.blade.php

2
resources/views/weixin/user/userinfo.blade.php

@ -47,8 +47,6 @@ function update_avator()
}
$(function(){
$("#fileupload").change(function(){
$("#head_img").ajaxSubmit({
dataType: 'json',

4
routes/web.php

@ -61,8 +61,8 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin'], function () {
Route::get('/cat{cat}', 'ArticleController@category')->name('weixin_article_category'); //分类页
Route::get('/tag{tag}', 'IndexController@tag')->name('weixin_tag'); //标签页
Route::get('/page/{id}', 'IndexController@page')->name('weixin_singlepage'); //单页
Route::get('/goods/{id}', 'GoodsController@goods')->name('weixin_goods_detail'); //商品详情页
Route::get('/goodslist', 'GoodsController@goodslist')->name('weixin_goods_list'); //产品分类页
Route::get('/goods/{id}', 'GoodsController@goodsDetail')->name('weixin_goods_detail'); //商品详情页
Route::get('/goodslist', 'GoodsController@goodsList')->name('weixin_goods_list'); //产品分类页
Route::any('/login', 'UserController@login')->name('weixin_login');
Route::any('/register', 'UserController@register')->name('weixin_register');

Loading…
Cancel
Save