作者 王晓刚
1 个管道 的构建 通过 耗费 29 秒

修改问题文档

... ... @@ -287,12 +287,23 @@ class Goods extends Frontend
$insurance = '2';
$store = $storeModel->findData(['id'=>$vo['store_id']]);
$store_user = $userModel->findData(['id'=>$store['user_id']]);
if($store_user['is_svip'] == '1' || in_array($param['province_id'],$store['province_ids'])){
$user_province = Db::name('user_province')->where(['user_id'=>$store['user_id'],'expiration_time'=>['gt',time()]])->select();
$province_ids = [];
foreach($user_province as $key2 => $u_p){
$province_ids[] = $u_p['province_id'];
}
/*if($vo['id'] == 13){
dump($store['is_svip']);
dump($param['province_id2']);
dump($province_ids);
}*/
if($store['is_svip'] == '1' || in_array($param['province_id2'],$province_ids)){
$insurance = '1';
}
// dump($insurance);
$data[$key]['insurance'] = $insurance;
//当前用户若不是会员加密部分信息
if($encrypt == '2'){
if($insurance == '2'){
$text = '';
if(empty($user_id)){
$text = "(请您先登录)";
... ... @@ -338,11 +349,16 @@ class Goods extends Frontend
$store = $storeModel->findData(['id'=>$data['store_id']]);
$userModel = new \app\index\model\User();
$store_user = $userModel->findData(['id'=>$store['user_id']]);
$user_province = Db::name('user_province')->where(['user_id'=>$store['user_id'],'expiration_time'=>['gt',time()]])->select();
$province_ids = [];
foreach($user_province as $key => $u_p){
$province_ids[] = $u_p['province_id'];
}
if(empty($store)){
$this->error('查询为空','',['result'=>2]);
}
$result = 2;
if($store['is_svip'] == '1' || in_array($param['province_id'],$store_user['province_ids'])){
if($store['is_svip'] == '1' || in_array($param['province_id'],$province_ids)){
$result = 1;
}
$this->success('SUCCESS','',['result'=>$result]);
... ...
... ... @@ -47,10 +47,14 @@ class Shop extends Frontend
$user = $userModel->findData(['id'=>$data['user_id']]);
if(!empty($user)){
$province_ids = [];
if($user['province_ids']) {
$province_ids = is_array($user['province_ids']) ? $user['province_ids'] : explode(',',$user['province_ids']);
/*if($data['province_ids']) {
$province_ids = is_array($data['province_ids']) ? $data['province_ids'] : explode(',',$data['province_ids']);
}*/
$user_province = Db::name('user_province')->where(['user_id'=>$data['user_id'],'expiration_time'=>['gt',time()]])->select();
foreach($user_province as $key => $u_p){
$province_ids[] = $u_p['province_id'];
}
if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($province_id,$province_ids))){
if($data['is_svip'] == '1' || in_array($province_id,$province_ids)){
$encrypt = '1';
}
}
... ...
... ... @@ -757,7 +757,7 @@
$.ajax({
url:"{:url('index/goods/get_all')}",
type:"POST",
data:{"province_id":0,"page":page,"pageNum":pageNum,'paginate':1,'sort':sort,'keyword':keyword,'lng':lng,'lat':lat, 'store_id':store_id},
data:{"province_id":0,"province_id2":province_id,"page":page,"pageNum":pageNum,'paginate':1,'sort':sort,'keyword':keyword,'lng':lng,'lat':lat, 'store_id':store_id},
success:function(res){
var goods_html = "";
$(res.data.data).each(function (key1, vo) {
... ... @@ -774,12 +774,12 @@
" <td><img src=\""+vo.thumbnail+"\" alt=\"\" style='width: 100px;height:100px'></td>\n" +
" <td>"+vo.goodsname+"</td>\n" +
" <td>"+vo.inventory+"</td>\n" +
" <td onclick=\"window.event.stopPropagation();window.location.href='{:url('index/shop/detail',array('store_id'=>'STORE_ID'))}'\">"+vo.store_name+property+"\n" +
" <td onclick=\"window.event.stopPropagation();window.location.href='{:url('index/shop/detail',array('store_id'=>'STORE_ID','province_id'=>'PROVINCE_ID'))}'\">"+vo.store_name+property+"\n" +
" <td>"+vo.brand+"</td>\n" +
" <td>单价:¥"+vo.price+"</td>\n" +
" <td>"+vo.store_address+""+distance+"</td>\n" +
" </tr>";
goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id);
goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id).replace("PROVINCE_ID",province_id);
});
$('.goods_dom').html(goods_html);
$('#resultsNum').html(res.data.total+"件");
... ...
... ... @@ -53,13 +53,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
icon: 'fa fa-list',
url: $.fn.bootstrapTable.defaults.extend.user_province_url + "/user_id/{user_id}",
extend: "data-area='[\"90%\",\"90%\"]'",
hidden:function(row){
/*hidden:function(row){
console.log(row.viptype);
if($.inArray(row.viptype,[1]) >= 0){
return false;
}
return true;
},
},*/
},
]
}
... ...