修改此文件 这部分代码,增加为以下内容
上面的 地址videofreeadmin.youyacao.com 是自己的后台域名地址
/** 添加视频
* Notes: <br>
* User:bigniu <br>
* Date:2019-12-07 <br>
* Time:17:38:52 <br>
* @return Json <br>
* @throws hinkdbexceptionDataNotFoundException
* @throws hinkdbexceptionModelNotFoundException
* @throws hinkexceptionDbException
*/
public function addVideo()
{
$uid = input("uid/i",1);
$title = input("title");//标题
$url = input("url");//视频链接
$type = input("type");//视频类型
$img = input('img');//通过视频存储路径获取视略缩图"1.png";//
$user = Db("user")->where(['id'=>$uid])->find();
if(!$user){
return error("该用户不存在,请重新选择");
}
$typeInfo = Db("type")->where(['id' => $type, "level" => 2])->find();
if (!$typeInfo) {
u_log("用户" . $user['name'] . "(" . $user['id'] . ")发布视频失败('类型选择错误')", "error");
return error("类型选择错误");
}
$data = [
"title" => $title,
"uid" => $user['id'],
"type" => $type,//视频分类
"img" => $img,
"url" => $url,
"state" => 1,
"create_time" => TIME
];
$id = Db("video")->insertGetId($data);
$data['id'] = $id;
u_log("用户" . $user['name'] . "(" . $user['id'] . ")发布视频成功");
return success("成功", $data);
}
最终效果是