Commit 5a32c541 by 杨昕

Merge branch 'test' into 'master'

Test

See merge request !16
parents 1ac0eb13 9f72245b
Pipeline #10251 passed with stages
in 42 seconds
...@@ -56,9 +56,9 @@ class Handler extends ExceptionHandler ...@@ -56,9 +56,9 @@ class Handler extends ExceptionHandler
$path = $request->path(); $path = $request->path();
var_dump($exception->getMessage()); // var_dump($exception->getMessage());
var_dump($exception->getFile()); // var_dump($exception->getFile());
var_dump($exception->getLine());die; // var_dump($exception->getLine());die;
#检测当前请求是否是api路由 #检测当前请求是否是api路由
......
...@@ -43,6 +43,9 @@ class MediaModel extends Eloquent ...@@ -43,6 +43,9 @@ class MediaModel extends Eloquent
$limit = (isset($request->page_size) ? (int)($request->page_size) : Constant::PAGE_NUMBER) ; $limit = (isset($request->page_size) ? (int)($request->page_size) : Constant::PAGE_NUMBER) ;
if ($limit >500){
$limit = 500;
}
$page = $request->page??1; $page = $request->page??1;
...@@ -79,9 +82,17 @@ class MediaModel extends Eloquent ...@@ -79,9 +82,17 @@ class MediaModel extends Eloquent
} }
$aggregate[]['$sort'] = ['start_time' => $sort]; $aggregate[]['$sort'] = ['start_time' => $sort];
$count = sizeof($collection->aggregate($aggregate)->toArray());
$aggregate1=$aggregate;
$aggregate1[]['$group'] = [
'_id' => array(),//更具性别进行分组
'count'=>array('$sum'=>1)
];
$count = $collection->aggregate($aggregate1)->toArray()[0]['count'];
$skip = ((empty($request->page) ? 1 : $request->page)-1) * $limit; $skip = ((empty($request->page) ? 1 : $request->page)-1) * $limit;
$aggregate[]['$skip'] = $skip; $aggregate[]['$skip'] = $skip;
...@@ -99,6 +110,7 @@ class MediaModel extends Eloquent ...@@ -99,6 +110,7 @@ class MediaModel extends Eloquent
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException($exception->getMessage()); throw new DatabaseException($exception->getMessage());
} }
return $medias; return $medias;
} }
...@@ -186,6 +198,8 @@ class MediaModel extends Eloquent ...@@ -186,6 +198,8 @@ class MediaModel extends Eloquent
} }
$id = MediaModel::insertGetId($data); $id = MediaModel::insertGetId($data);
LogModel::addlog(["添加媒资信息"=> $data,['媒资ID为:=> '.$id]]);
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException($exception->getMessage()); throw new DatabaseException($exception->getMessage());
} }
...@@ -263,6 +277,8 @@ class MediaModel extends Eloquent ...@@ -263,6 +277,8 @@ class MediaModel extends Eloquent
throw new \Exception("更新失败"); throw new \Exception("更新失败");
} }
LogModel::addlog(["更新媒资信息=>".$id,$data]);
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException($exception->getMessage()); throw new DatabaseException($exception->getMessage());
} }
......
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