StoreInform.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace app\api\model;
class StoreInform extends Base
{
protected $append = [
'image_arr',
'video_image'
];
public function getImageArrAttr($value,$data)
{
$image_arr = [];
if($data['images']) {
$image_arr = explode(',',$data['images']);
foreach ($image_arr as &$v) {
$v = cdnurl($v);
}
}
return $image_arr;
}
public function getVideoAttr($value)
{
$video = '';
if($value) {
// 获取视频第一帧图片
$video = cdnurl($value, true);
}
return $video;
}
public function getVideoImageAttr($value,$data)
{
$img = '';
if($data['video']) {
// 获取视频第一帧图片
$video_info = json_decode(file_get_contents(cdnurl($data['video'], true) . '?avinfo'), true);
$img = get_video_first_image(cdnurl($data['video'],true), $video_info);
}
return $img;
}
// public function getCreatetimeAttr($value)
// {
// return date('Y-m-d H:i:s',$value);
// }
}