dever 4 years ago
parent
commit
16a2f97820

+ 17 - 4
app/collection/lib/Content.php

@@ -19,7 +19,7 @@ class Content
     }
 
 	# 获取某一个合集的内容列表
-	public function getList($user, $info_id, $page_id)
+	public function getList($user, $info_id, $page_id, $show = true, $index = 0)
 	{
 		$where['info_id'] = $info_id;
         $where['page_id'] = $page_id;
@@ -61,11 +61,24 @@ class Content
                 $i = 1;
             }
 			foreach ($data as $k => $v) {
-				$data[$k] = $this->getOne($v, $user);
-                if ($data[$k]['data']) {
-                    $result[$i] = $data[$k];
+                if (!$show) {
+                    if ($i != $index) {
+                        $result[$i] = array();
+                    } else {
+                        $data[$k] = $this->getOne($v, $user);
+                        if ($data[$k]['data']) {
+                            $result[$i] = $data[$k];
+                        }
+                    }
                     $i++;
+                } else {
+                    $data[$k] = $this->getOne($v, $user);
+                    if ($data[$k]['data']) {
+                        $result[$i] = $data[$k];
+                        $i++;
+                    }
                 }
+				
 			}
 
             if ($page && $page['desc_end']) {

+ 5 - 2
app/collection/src/Api.php

@@ -90,6 +90,8 @@ class Api extends Core
             '#ffaa00',
             '#bababa'
         );
+        # 佣金
+        $data['info']['reward'] = 0;
         if ($type == -1) {
             $page = Dever::db('collection/page')->one($content_id);
             $data['info']['name'] = $page['name'];
@@ -122,8 +124,9 @@ class Api extends Core
                 $content['data'] = Dever::db('content/product')->one(array('content_id' => $content['id'], 'info_id' => $content['info_id']));
 
                 if (isset($content['data']['goods_id']) && $content['data']['goods_id'] > 0) {
-                    $goods = Dever::load('goods/lib/info')->getInfo($content['data']['goods_id']);
+                    $goods = Dever::load('goods/lib/info')->getInfo($content['data']['goods_id'], true, 'view_reorder', false, true);
                     if ($goods && isset($goods['price']['min']['price'])) {
+                        $data['info']['reward'] = $goods['reward'];
                         $data['info']['price'] = '¥' . $goods['price']['min']['price'];
                         $data['info']['s_price'] = '¥' . $goods['price']['min']['s_price'];
                     }
@@ -264,7 +267,7 @@ class Api extends Core
         $data['show'] = $this->checkView();
 
         # 获取每个模块
-        $data['items'] = Dever::load('collection/lib/content')->getList($this->user, $this->id, $this->page_id);
+        $data['items'] = Dever::load('collection/lib/content')->getList($this->user, $this->id, $this->page_id, $data['show'], $this->index);
         # 滑动到多少时,加载下一页
         $data['total'] = count($data['items']) - 2;
 

+ 8 - 0
app/community/src/Api.php

@@ -89,6 +89,14 @@ class Api extends Core
         if (!$type) {
             Dever::alert('错误的信息');
         }
+
+        if ($type == 'content/product') {
+            # 对这种评论需要验证是否有权限
+            $buy = Dever::load('goods/lib/order')->checkBuy($this->uid, $type_id);
+            if (!$buy) {
+                Dever::alert('未购买,您没有权限评价');
+            }
+        }
         
         Dever::load('community/lib/comment')->submit($this->uid, $type_id, $type, $pic, $content, $playtime, 'collection/info', $this->id);
 

+ 8 - 2
app/user/src/Api.php

@@ -167,7 +167,10 @@ class Api extends Core
             $this->user['area_name'] = Dever::load('area/api')->string($this->user['area_id'], ' ');
         }
         $data['area_id'] = $this->user['area_id'];
-        $data['area_name'] = $this->user['area_name'] . ' ';
+        if ($this->user['area_name']) {
+            $this->user['area_name'] .= ' ';
+        }
+        $data['area_name'] = $this->user['area_name'];
         $data['address'] = $this->user['address'];
         $data['address_contact'] = $this->user['address_contact'];
         $data['address_mobile'] = $this->user['address_mobile'];
@@ -193,6 +196,9 @@ class Api extends Core
         $goods_id = Dever::input('goods_id');
         $num = Dever::input('num');
         $goods_id = Dever::input('goods_id');
-        return Dever::load('goods/lib/info')->getFreight($goods_id, $price, $this->user, $num);
+        $data['freight'] = Dever::load('goods/lib/info')->getFreight($goods_id, $price, $this->user, $num);
+        # 获取自提点
+        $data['store'] = Dever::load('goods/lib/info')->storeInfo($goods_id, $this->user['area_id']);
+        return $data;
     }
 }

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

@@ -14,6 +14,10 @@ class Pay extends Core
             Dever::alert('用户信息错误');
         }
 
+        if (!$this->id) {
+            Dever::alert('用户信息错误');
+        }
+
         $uid = $this->uid;
 
         $content_id = Dever::input('content_id');
@@ -22,12 +26,13 @@ class Pay extends Core
         $store_id = Dever::input('store_id');
         $num = Dever::input('num');
         $sku = Dever::input('sku');
+        $refer = Dever::input('refer');
 
         if (!$goods_id) {
             Dever::alert('请传入正确的产品ID');
         }
 
-        $pay = Dever::load('goods/lib/pay')->action($this->share_uid, $this->user, $goods_id, $sku, $num, $mode, $store_id, $this->system_source, 'collection/info', $this->id);
+        $pay = Dever::load('goods/lib/pay')->action($this->share_uid, $this->user, $goods_id, $sku, $num, $mode, $store_id, $this->system_source, 'collection/info', $this->id, $refer);
 
         return $pay;
     }