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

问题文档修复

... ... @@ -82,6 +82,19 @@ class Goods extends Frontend
if(!empty($collect)){
$is_collect = "1";
}
$userModel = new \app\index\model\User();
$encrypt = '2';
$user = $userModel->findData(['id'=>$user_id]);
if(!empty($user)){
if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){
$encrypt = '1';
}
}
//当前用户若不是会员加密部分信息
if($encrypt == '2'){
$data['store_phone'] = "***********";
$data['store_address'] = "***********";
}
}
$data['is_collect'] = $is_collect;
//获取评论
... ... @@ -250,6 +263,15 @@ class Goods extends Frontend
}else{
$data = $data->select();
}
$user_id = $this->auth->id;
$userModel = new \app\index\model\User();
$encrypt = '2';
$user = $userModel->findData(['id'=>$user_id]);
if(!empty($user)){
if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){
$encrypt = '1';
}
}
$storeModel = new Store();
$evaluateModel = new Evaluate();
foreach($data as $key => $vo){
... ... @@ -260,8 +282,8 @@ class Goods extends Frontend
$insurance = '1';
}
$data[$key]['insurance'] = $insurance;
//若不是会员加密部分信息
if($insurance == '2'){
//当前用户若不是会员加密部分信息
if($encrypt == '2'){
$data[$key]['store_phone'] = "***********";
$data[$key]['store_address'] = "***********";
}
... ...
... ... @@ -34,16 +34,29 @@ class Shop extends Frontend
}
$storeModel = new Store();
$data = $storeModel->findData(['id'=>$store_id]);
$is_collect = "2";
if(!empty($user_id)){
$storecollect = Db::name('storecollect')->where(['user_id'=>$user_id,'stores_id'=>$data['id']])->find();
if(!empty($storecollect)){
$is_collect = "1";
//收藏
$is_collect = "2";
$encrypt = '2';
if(!empty($user_id)){
$storecollect = Db::name('storecollect')->where(['user_id'=>$user_id,'stores_id'=>$data['id']])->find();
if(!empty($storecollect)){
$is_collect = "1";
}
$userModel = new \app\index\model\User();
$user = $userModel->findData(['id'=>$user_id]);
if(!empty($user)){
if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){
$encrypt = '1';
}
}
$data['is_collect'] = $is_collect;
}
$data['is_collect'] = $is_collect;
//当前用户若不是会员加密部分信息
if($encrypt == '2'){
$data['store_phone'] = "***********";
$data['store_address'] = "***********";
}
$this->assign('data',$data);
// dump($data);
return $this->fetch();
}
... ...