Commit 94f75ac8 by 杨昕

更新登录接口

parent fe8c7698
Pipeline #9867 passed with stages
in 33 seconds
......@@ -10,6 +10,11 @@ use Illuminate\Support\Facades\DB;
class UsersController extends Controller
{
protected $domain = [
'dev' => 'dev-offcncloud.s3-cn-north-1.qiniucs.com',
'test' => 'test-offcncloud.s3-cn-north-1.qiniucs.com',
'master'=> 'offcncloud.s3-cn-north-1.qiniucs.com',
];
/**
* 第三方验权
* @param Request $request
......@@ -126,7 +131,8 @@ class UsersController extends Controller
throw new DatabaseException('用户名信息更新失败');
}
return $newtoken;
$branch = empty(getenv('branch')) ? 'test' : getenv('branch');
return ['access_token'=>$newtoken,'domain'=> $this->domain[$branch]];
}else{
throw new DatabaseException('用户名称或者密码错误');
......
......@@ -120,7 +120,7 @@ class MediaController extends Controller
$id = handler_drive(function () use($request,$id){
return MediaModel::deleteMediaById($id);
return MediaModel::deleteMediaById($request,$id);
});
......
......@@ -332,13 +332,19 @@ class MediaModel extends Eloquent
* @return int
* @throws \Exception
*/
public static function deleteMediaById($id){
public static function deleteMediaById($request,$id){
try{
$media = MediaModel::where('_id',$id)->first();
if (empty($media)){
throw new \Exception('媒资不存在!');
}
if ($request->token_username != 'offcn'){
}
$flag = MediaModel::destroy($id);
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