添加网站文件
This commit is contained in:
100
application/admin/logic/TrainingLogic.php
Normal file
100
application/admin/logic/TrainingLogic.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\server\UrlServer;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
|
||||
class TrainingLogic{
|
||||
|
||||
public static function lists($get){
|
||||
$count = Db::name('video_type')
|
||||
->count();
|
||||
$lists = Db::name('video_type')
|
||||
->page($get['page'],$get['limit'])
|
||||
->order('id desc')
|
||||
->select();
|
||||
foreach ($lists as &$item){
|
||||
$item['create_time']=date('Y-m-d H:i:s',$item['create_time']);
|
||||
}
|
||||
|
||||
return ['count'=>$count , 'lists'=>$lists];
|
||||
}
|
||||
|
||||
public static function setlistadd($post){
|
||||
$data=[
|
||||
'title'=>$post['name'],
|
||||
'create_time'=>time()
|
||||
];
|
||||
return Db::name('video_type')->data($data)->insert();
|
||||
}
|
||||
|
||||
public static function seteidt($post){
|
||||
return Db::name('video_type')->where('id',$post['id'])->update(['title'=>$post['title'],'create_time'=>time()]);
|
||||
}
|
||||
|
||||
public static function setlistinfo($id){
|
||||
return Db::name('video_type')->where('id',$id)->find();
|
||||
}
|
||||
|
||||
public static function setlist(){
|
||||
return Db::name('video_type')->select();
|
||||
}
|
||||
|
||||
public static function add($post){
|
||||
$post['create_time']=time();
|
||||
return Db::name('video')->data($post)->insert();
|
||||
}
|
||||
|
||||
public static function video_lists($get){
|
||||
$where = [];
|
||||
// 查询
|
||||
if(isset($get['name']) && $get['name'] != ''){
|
||||
$where[] = ['name', 'like', '%' . $get['name'] . '%'];
|
||||
}
|
||||
//视频类型
|
||||
if(isset($get['type_id']) && $get['type_id']){
|
||||
$where[] = ['type_id','=',$get['type_id']];
|
||||
}
|
||||
//上传时间
|
||||
if(isset($get['start_times']) && $get['start_times']!=''){
|
||||
$where[] = ['login_time','>=',strtotime($get['start_times'])];
|
||||
}
|
||||
if(isset($get['end_times']) && $get['end_times']!=''){
|
||||
$where[] = ['login_time','<=',strtotime($get['end_times'])];
|
||||
}
|
||||
|
||||
$count = Db::name('video')
|
||||
->where($where)
|
||||
->count();
|
||||
$lists = Db::name('video')
|
||||
->where($where)
|
||||
->page($get['page'],$get['limit'])
|
||||
->order('id desc')
|
||||
->select();
|
||||
foreach ($lists as &$item){
|
||||
$item['create_time']=date('Y-m-d H:i:s',$item['create_time']);
|
||||
$item['image']= UrlServer::getFileUrl($item['image']);
|
||||
}
|
||||
|
||||
return ['count'=>$count , 'lists'=>$lists];
|
||||
|
||||
}
|
||||
|
||||
public static function videoinfo($id){
|
||||
$data=Db::name('video')->where('id',$id)->find();
|
||||
$data['image']= UrlServer::getFileUrl($data['image']);
|
||||
return $data;
|
||||
// return Db::name('video')->where('id',$id)->find();
|
||||
}
|
||||
|
||||
public static function edits($post){
|
||||
$post['create_time']=time();
|
||||
return Db::name('video')->where('id',$post['id'])->update($post);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user