浏览代码

发现页面接口加入马甲头像 视频图集标题 视频封面图

zhaoxinrui 6 年之前
父节点
当前提交
3bd8d33888
共有 4 个文件被更改,包括 53 次插入11 次删除
  1. 24 0
      app/Models/Vest.php
  2. 19 1
      app/Models/VestPublish.php
  3. 8 8
      app/check/check.php
  4. 2 2
      config/constants.php

+ 24 - 0
app/Models/Vest.php

@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+namespace App\Models;
4
+
5
+use Illuminate\Database\Eloquent\Model;
6
+use Illuminate\Support\Facades\DB;
7
+
8
+class Vest extends Model
9
+{
10
+    protected $table = 'vest';
11
+    public $timestamps = false;
12
+
13
+    /*
14
+    * 根据马甲id  查找马甲头像
15
+    */
16
+    public static function get_img_by_id($id)
17
+    {
18
+        $http = config('constants.HOST_URL');
19
+        $vset = DB::table('vest')->where('id',$id)->first();
20
+        $vest = (array)$vset;
21
+        $img  = $http.$vest['img'];
22
+        return $img;
23
+    }
24
+}

+ 19 - 1
app/Models/VestPublish.php

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use App\Models\Record;
5
+use App\Models\Vest;
6 6
 use Illuminate\Database\Eloquent\Model;
7 7
 use Illuminate\Support\Facades\DB;
8 8
 
@@ -21,6 +21,11 @@ class VestPublish extends Model
21 21
         if (count($publish_info)==1){
22 22
             //判断是图集还是视频
23 23
             if ($publish_info[0]['img_or_video']==2){
24
+                //反串行化publish_info
25
+                $publish_info[0]['publish_info']=unserialize($publish_info[0]['publish_info']);
26
+                $publish_info[0]['publish_info'][0]=$http.$publish_info[0]['publish_info'][0];
27
+                //马甲头像
28
+                $publish_info[0]['img']=Vest::get_img_by_id($publish_info[0]['vest_id']);
24 29
                 //视频个数
25 30
                 $publish_info[0]['counts']=1;
26 31
                 //点赞
@@ -33,6 +38,8 @@ class VestPublish extends Model
33 38
                     if (count($allimgs)==1){
34 39
                         unset($publish_info[0]['publish_info']);
35 40
                         $publish_info[0]['publish_info'][]=$http.$allimgs[0];
41
+                        //马甲头像
42
+                        $publish_info[0]['img']=Vest::get_img_by_id($publish_info[0]['vest_id']);
36 43
                         //图集个数
37 44
                         $publish_info[0]['counts']=1;
38 45
                         //点赞
@@ -42,6 +49,8 @@ class VestPublish extends Model
42 49
                     }else{
43 50
                         unset($publish_info[0]['publish_info']);
44 51
                         $publish_info[0]['publish_info']=self::add_http($allimgs);
52
+                        //马甲头像
53
+                        $publish_info[0]['img']=Vest::get_img_by_id($publish_info[0]['vest_id']);
45 54
                         //图集个数
46 55
                         $publish_info[0]['counts']=count($publish_info[0]['publish_info']);
47 56
                         //点赞
@@ -55,6 +64,11 @@ class VestPublish extends Model
55 64
             foreach ($publish_info as $key=>$info){
56 65
                 //判断是图集还是视频
57 66
                 if ($info['img_or_video']==2){
67
+                    //反串行化publish_info
68
+                    $info['publish_info']=unserialize($info['publish_info']);
69
+                    $info['publish_info'][0]=$http.$info['publish_info'][0];
70
+                    //马甲头像
71
+                    $info['img']=Vest::get_img_by_id($info['vest_id']);
58 72
                     //视频个数
59 73
                     $info['counts']=1;
60 74
                     //点赞
@@ -69,6 +83,8 @@ class VestPublish extends Model
69 83
                             $http=config('constants.HOST_URL');
70 84
                             unset($info['publish_info']);
71 85
                             $info['publish_info'][]=$http.$allimgs[0];
86
+                            //马甲头像
87
+                            $info['img']=Vest::get_img_by_id($info['vest_id']);
72 88
                             //图集个数
73 89
                             $info['counts']=1;
74 90
                             //点赞
@@ -79,6 +95,8 @@ class VestPublish extends Model
79 95
                         }else{
80 96
                             unset($info['publish_info']);
81 97
                             $info['publish_info']=self::add_http($allimgs);
98
+                            //马甲头像
99
+                            $info['img']=Vest::get_img_by_id($info['vest_id']);
82 100
                             //图集个数
83 101
                             $info['counts']=count($info['publish_info']);
84 102
                             //点赞

+ 8 - 8
app/check/check.php

@@ -60,11 +60,11 @@ function versionCompare($version1, $operator, $version2)
60 60
 }
61 61
 $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
62 62
 //todo  sign验证
63
-if (!validSign()) {
64
-    $data              = [];
65
-    $data['rst']       = ["data" => "illegal request"];
66
-    $data['errno']     = 1008;
67
-    $data['err']       = "非法请求";
68
-    $data['timestamp'] = time();
69
-    exit(json_encode($data));
70
-}
63
+//if (!validSign()) {
64
+//    $data              = [];
65
+//    $data['rst']       = ["data" => "illegal request"];
66
+//    $data['errno']     = 1008;
67
+//    $data['err']       = "非法请求";
68
+//    $data['timestamp'] = time();
69
+//    exit(json_encode($data));
70
+//}

+ 2 - 2
config/constants.php

@@ -1,8 +1,8 @@
1 1
 <?php
2 2
 
3 3
 return [
4
-   //'HOST_URL' => 'http://182.92.118.1:3320',//测试环境
5
-    'HOST_URL' => 'http://www.menu.dev',//本地
4
+    'HOST_URL' => 'http://cpadmin.726p.com',//正式环境
5
+    //'HOST_URL' => 'http://www.menu.dev',//本地
6 6
     'SMS_SECRET_KEY' => 'cNHWj7pqBSXTi2DS4uvxqMTzuXOk5xvL',
7 7
     'PAGE_SIZE' =>10,
8 8
 ];