Index.php
3.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace app\index\controller;
use app\api\controller\Message;
use app\common\controller\Frontend;
use think\Db;
class Index extends Frontend
{
protected $noNeedLogin = '*';
protected $noNeedRight = '*';
protected $layout = '';
public function index()
{
return $this->view->fetch();
}
//会有到期提醒 添加信息记录
public function mess()
{
$data = Db::name('user')
->field('id,identity,audit,expirationtime')
->where('identity','neq',1)
->where('audit',1)
->select();
foreach ($data as &$v){
if(time() > $v['expirationtime']){
$message = new Message();
$message->add($v['id'],'会员到期');
}else{
if(time()+86400 >= $v['expirationtime']){
$message = new Message();
$message->add($v['id'],'会员1天后到期');
}else{
if(time()+2*86400 >= $v['expirationtime']){
$message = new Message();
$message->add($v['id'],'会员2天后到期');
}else{
if (time()+3*86400 >= $v['expirationtime']){
$message = new Message();
$message->add($v['id'],'会员3天后到期');
}
}
}
}
}
}
//文件详情
public function detail()
{
$qiniu = get_addon_config('qiniu')['cdnurl'];
$user_id = $this->request->param('user_id');
$file_id = $this->request->param('file_id');
$data = Db::name('savemes')
->where('id',$file_id)
->find();
if($data['type'] == 2){
$data['video'] = '';
$data['video_image'] = '';
$data['content'] = '';
$data['images'] = $qiniu.$data['images'];
}elseif ($data['type'] == 3){
$data['images'] = '';
$data['content'] = '';
$data['video'] = $qiniu.$data['video'];
// 获取视频第一帧图片
$video_info = json_decode(file_get_contents($data['video'] . '?avinfo'), true);
$data['video_image'] = $this->get_video_first_image($data['video'], $video_info);
}elseif ($data['type'] == 1){
$data['images'] = '';
$data['video'] = '';
$data['video_image'] = '';
}
$text = Db::name('official')->where('id',1)->find();
$data['introduce'] = $text['introduce'];
$this->assign('data',$data);
return $this->fetch();
}
public function get_video_first_image($video_url,$video_info){
if(empty($video_info['streams'][0]['width'])) {
$width = $video_info['streams'][1]['width'];
$height = $video_info['streams'][1]['height'];
} else {
$width = $video_info['streams'][0]['width'];
$height = $video_info['streams'][0]['height'];
}
return $video_url.'?vframe/jpg/offset/1/w/'.$width.'/h/'.$height;
}
}