Commit fe8bb9ca by 杨昕

code format

parent 598c1633
...@@ -35,7 +35,7 @@ class UsersController extends Controller ...@@ -35,7 +35,7 @@ class UsersController extends Controller
if (preg_match("['|\"|\/|\\\|\.|:]", $request->uuid)) { if (preg_match("['|\"|\/|\\\|\.|:]", $request->uuid)) {
throw new ControllerException(400, 'uuid含有非法字符'); throw new ControllerException('uuid含有非法字符',400);
} }
$password = strtolower($request->password); $password = strtolower($request->password);
$username = $request->username; $username = $request->username;
......
...@@ -11,6 +11,10 @@ class MediaCategoryModel extends Eloquent ...@@ -11,6 +11,10 @@ class MediaCategoryModel extends Eloquent
{ {
protected $collection = "media_category"; protected $collection = "media_category";
protected $connection = 'mongodb'; //使用mongodb
protected $primaryKey = '_id';
/** /**
* 查询媒资列表 * 查询媒资列表
* @param $request * @param $request
...@@ -21,14 +25,7 @@ class MediaCategoryModel extends Eloquent ...@@ -21,14 +25,7 @@ class MediaCategoryModel extends Eloquent
try{ try{
$catgList = DB::connection("mongodb")->collection(self::$collection)->get()->toArray(); $catgList = MediaCategoryModel::get()->toArray();
foreach ($catgList as &$catg){
$idArr = ($catg['_id'])->jsonSerialize();
$catg['_id'] = $catg['_id'] = $idArr['$oid'];
}
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException("组织不存在"); throw new DatabaseException("组织不存在");
......
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