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

问题文档修复

@@ -82,6 +82,19 @@ class Goods extends Frontend @@ -82,6 +82,19 @@ class Goods extends Frontend
82 if(!empty($collect)){ 82 if(!empty($collect)){
83 $is_collect = "1"; 83 $is_collect = "1";
84 } 84 }
  85 + $userModel = new \app\index\model\User();
  86 + $encrypt = '2';
  87 + $user = $userModel->findData(['id'=>$user_id]);
  88 + if(!empty($user)){
  89 + if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){
  90 + $encrypt = '1';
  91 + }
  92 + }
  93 + //当前用户若不是会员加密部分信息
  94 + if($encrypt == '2'){
  95 + $data['store_phone'] = "***********";
  96 + $data['store_address'] = "***********";
  97 + }
85 } 98 }
86 $data['is_collect'] = $is_collect; 99 $data['is_collect'] = $is_collect;
87 //获取评论 100 //获取评论
@@ -250,6 +263,15 @@ class Goods extends Frontend @@ -250,6 +263,15 @@ class Goods extends Frontend
250 }else{ 263 }else{
251 $data = $data->select(); 264 $data = $data->select();
252 } 265 }
  266 + $user_id = $this->auth->id;
  267 + $userModel = new \app\index\model\User();
  268 + $encrypt = '2';
  269 + $user = $userModel->findData(['id'=>$user_id]);
  270 + if(!empty($user)){
  271 + if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){
  272 + $encrypt = '1';
  273 + }
  274 + }
253 $storeModel = new Store(); 275 $storeModel = new Store();
254 $evaluateModel = new Evaluate(); 276 $evaluateModel = new Evaluate();
255 foreach($data as $key => $vo){ 277 foreach($data as $key => $vo){
@@ -260,8 +282,8 @@ class Goods extends Frontend @@ -260,8 +282,8 @@ class Goods extends Frontend
260 $insurance = '1'; 282 $insurance = '1';
261 } 283 }
262 $data[$key]['insurance'] = $insurance; 284 $data[$key]['insurance'] = $insurance;
263 - //若不是会员加密部分信息  
264 - if($insurance == '2'){ 285 + //当前用户若不是会员加密部分信息
  286 + if($encrypt == '2'){
265 $data[$key]['store_phone'] = "***********"; 287 $data[$key]['store_phone'] = "***********";
266 $data[$key]['store_address'] = "***********"; 288 $data[$key]['store_address'] = "***********";
267 } 289 }
@@ -34,16 +34,29 @@ class Shop extends Frontend @@ -34,16 +34,29 @@ class Shop extends Frontend
34 } 34 }
35 $storeModel = new Store(); 35 $storeModel = new Store();
36 $data = $storeModel->findData(['id'=>$store_id]); 36 $data = $storeModel->findData(['id'=>$store_id]);
37 - $is_collect = "2";  
38 - if(!empty($user_id)){  
39 - $storecollect = Db::name('storecollect')->where(['user_id'=>$user_id,'stores_id'=>$data['id']])->find();  
40 - if(!empty($storecollect)){  
41 - $is_collect = "1"; 37 + //收藏
  38 + $is_collect = "2";
  39 + $encrypt = '2';
  40 + if(!empty($user_id)){
  41 + $storecollect = Db::name('storecollect')->where(['user_id'=>$user_id,'stores_id'=>$data['id']])->find();
  42 + if(!empty($storecollect)){
  43 + $is_collect = "1";
  44 + }
  45 + $userModel = new \app\index\model\User();
  46 + $user = $userModel->findData(['id'=>$user_id]);
  47 + if(!empty($user)){
  48 + if($user['is_svip'] == '1' || ($user['is_vip'] == '1' && in_array($user['province_id'],$user['province_ids']))){
  49 + $encrypt = '1';
42 } 50 }
43 } 51 }
44 - $data['is_collect'] = $is_collect; 52 + }
  53 + $data['is_collect'] = $is_collect;
  54 + //当前用户若不是会员加密部分信息
  55 + if($encrypt == '2'){
  56 + $data['store_phone'] = "***********";
  57 + $data['store_address'] = "***********";
  58 + }
45 $this->assign('data',$data); 59 $this->assign('data',$data);
46 -// dump($data);  
47 return $this->fetch(); 60 return $this->fetch();
48 } 61 }
49 62