dever 4 years ago
parent
commit
0a4475ab87

+ 9 - 9
app/collection/lib/Content.php

@@ -19,7 +19,7 @@ class Content
     }
 
 	# 获取某一个合集的内容列表
-	public function getList($info_id, $page_id)
+	public function getList($user, $info_id, $page_id)
 	{
 		$where['info_id'] = $info_id;
         $where['page_id'] = $page_id;
@@ -38,8 +38,8 @@ class Content
                 $info = Dever::db('collection/info')->one($info_id);
                 if ($info && $info['uid'] > 0) {
                     $page['author_name'] = $info['author_name'] . ':';
-                    $user = Dever::load('user/lib/info')->get($info['uid'], $info_id);
-                    $page['username'] = $user['username'];
+                    $userinfo = Dever::load('user/lib/info')->get($info['uid'], $info_id);
+                    $page['username'] = $userinfo['username'];
 
                     $page['copyright'] = '如不慎侵害您的权益,请告知,我们将第一时间修改';
                 } else {
@@ -61,7 +61,7 @@ class Content
                 $i = 1;
             }
 			foreach ($data as $k => $v) {
-				$data[$k] = $this->getOne($v);
+				$data[$k] = $this->getOne($v, $user);
                 if ($data[$k]['data']) {
                     $result[$i] = $data[$k];
                     $i++;
@@ -77,7 +77,7 @@ class Content
 		return $result;
 	}
 
-	public function getOne($data)
+	public function getOne($data, $user = array())
 	{
 		$type = Dever::db('collection/cate')->config['gettype'];
 		$table = $type[$data['type']]['table'];
@@ -96,10 +96,10 @@ class Content
 
         if ($data['data']) {
             if (isset($data['data']['id'])) {
-                $data['data'] = $this->getData($data['data']);
+                $data['data'] = $this->getData($data['data'], $user);
             } else {
                 foreach ($data['data'] as $k => $v) {
-                    $data['data'][$k] = $this->getData($v);
+                    $data['data'][$k] = $this->getData($v, $user);
                 }
             }
         }
@@ -107,7 +107,7 @@ class Content
 		return $data;
 	}
 
-    public function getData($data)
+    public function getData($data, $user = array())
     {
         $data['num_view'] = 1;
 
@@ -149,7 +149,7 @@ class Content
         }
 
         if (isset($data['goods_id']) && $data['goods_id'] > 0) {
-            $data['goods'] = Dever::load('goods/lib/info')->getInfo($data['goods_id']);
+            $data['goods'] = Dever::load('goods/lib/info')->getInfo($data['goods_id'], true, 'view_reorder', $user);
             $data['goods'] = $this->getContent($data['goods']);
         }
 

+ 1 - 1
app/collection/lib/Core.php

@@ -39,10 +39,10 @@ class Core
     	# 获取当前的用户信息
         $this->token = Dever::input('token');
         $this->uid = 2;
+        $this->checkCode();
         $this->user = $this->getUser($this->uid, $this->id);
         $this->user['id'] = $this->uid;
         $this->system_source = Dever::input('system_source', 1);
-        $this->checkCode();
     }
 
     # 获取用户信息

+ 1 - 1
app/collection/src/Api.php

@@ -264,7 +264,7 @@ class Api extends Core
         $data['show'] = $this->checkView();
 
         # 获取每个模块
-        $data['items'] = Dever::load('collection/lib/content')->getList($this->id, $this->page_id);
+        $data['items'] = Dever::load('collection/lib/content')->getList($this->user, $this->id, $this->page_id);
         # 滑动到多少时,加载下一页
         $data['total'] = count($data['items']) - 2;
 

+ 13 - 0
app/user/database/info.php

@@ -121,6 +121,19 @@ return array
 			'list'		=> true,
 		),
 
+		'area_id'		=> array
+		(
+			'type' 		=> 'varchar-500',
+			'name' 		=> '所在地区',
+			'default' 	=> '',
+			'desc' 		=> '所在地区',
+			'match' 	=> 'is_string',
+			'search'	=> 'linkage',
+			'update'	=> 'linkage',
+			'option'	=> Dever::url('api.get', 'area'),
+			'list'		=> 'Dever::load("area/api.string", "{area_id}")',
+		),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 2 - 0
app/user/lib/Info.php

@@ -73,11 +73,13 @@ class Info
 		            $result['info'] = $user['info'];
 		            $result['sex'] = $user['sex'];
 		            $result['title'] = '';
+		            $result['area_id'] = $user['area_id'];
 		        } else {
 		        	!$result['username'] && $result['username'] = $user['username'];
 		        	!$result['avatar'] && $result['avatar'] = $user['avatar'];
 		        	!$result['info'] && $result['info'] = $user['info'];
 		        	!$result['sex'] && $result['sex'] = $user['sex'];
+		        	!$result['area_id'] && $result['area_id'] = $user['area_id'];
 		        }
 			} else {
 				$result = $user;

+ 1 - 1
app/user/src/Pay.php

@@ -26,7 +26,7 @@ class Pay extends Core
             Dever::alert('请传入正确的产品ID');
         }
 
-        $pay = Dever::load('goods/lib/pay')->action($this->share_uid, $uid, $goods_id, $sku, $num, $address_id, $this->system_source, 'collection/info', $this->id);
+        $pay = Dever::load('goods/lib/pay')->action($this->share_uid, $this->user, $goods_id, $sku, $num, $address_id, $this->system_source, 'collection/info', $this->id);
 
         return $pay;
     }