Commit f4907640 by 杨昕

code format

parent 3c4cf1d5
Pipeline #9807 passed with stages
in 33 seconds
......@@ -133,10 +133,39 @@ class MediaModel extends Eloquent
* @return mixed
* @throws DatabaseException
*/
public static function updateMedia($reqeust,$id){
public static function updateMedia($request,$id){
try{
$flag = MediaModel::where('_id',$id)->update($reqeust->all());
//hb15011&河北公务员考试试题
/**
* 媒资名称是由课程编号与课程名称组成
*/
$media_info = explode("&",$request->media_name);
if (count($media_info)!=2){
throw new \Exception('视频名称格式不对');
}
$mediaCatg = MediaCategoryModel::where('_id',$request->media_type)->first();
if (empty($mediaCatg)){
throw new \Exception("媒资类别不存在");
}
$data = [
'_id' => $id,
'media_name' => $request->media_name,
'media_type' => $mediaCatg->_id,
'media_category'=> $mediaCatg['name'],
'class_id' => $media_info[0],
'class_name' => $media_info[1],
'media_url' => $request->media_url,
'access_key' => $request->access_key,
'secret_key' => $request->secret_key,
'create_time' => date('Y-m-d H:i:s',time())
];
$flag = MediaModel::where('_id',$id)->update($data);
if (!$flag){
throw new \Exception("更新失败");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment