Commit 3bc106b4 by 孙龙

up

parent e3d5c6eb
Showing with 11 additions and 0 deletions
......@@ -377,16 +377,27 @@ Class AjaxController extends Controller
}
/*
* 判断是否是管理员
*/
protected function isAdmin($request){
$role_id = (new \App\Http\Controllers\PermController)->getUserRole($request);
return in_array($role_id,[1]) ? true : false;
}
/**
* 编辑模板 获取模板详情
*/
public function getTemplateDetail($request){
$id = $request->input("t_id",0);
$isAdmin = $this->isAdmin($request);
if(!$isAdmin){
$count = TemplateListModel::where("id",intval($id))->where("create_userid",$request->user->userId)->count("id");
if($count <= 0){
return $this->ajaxReturn(-1,"没找到属于您的模板信息");
}
}
$templateInfo = TemplateListModel::where("id",intval($id))->select("id","template_name","status")->first();
if($templateInfo->status <= 0){
return $this->ajaxReturn(-1,"该模板已经被主人禁用了");
......
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 sign in to comment