Commit 086e8785 by 孙龙

up

parent a360d2be
Showing with 9 additions and 2 deletions
......@@ -187,11 +187,18 @@ Class AjaxController extends Controller
$data['attribute'] = $attribute;
$count = TemplateListModel::where("template_name",trim($data['template_name']))
->where(function($q) use($request){
$q->where(["create_userid"=>$request->user->userId])->orWhere(["create_userid"=>1000]);
})->count("id");
if($count){
return $this->ajaxReturn(-1,"模板名称已经存在,请修改模板名称再提交!");
}
try{
DB::Connection("label")->transaction(function () use($data,$request) {
//创建模板
$templateList = TemplateListModel::create([
"template_name"=>$data['$template_name'],
"template_name"=>trim($data['template_name']),
"create_userid"=>$request->user->userId,
"create_username"=>$request->user->name,
"create_time"=>time(),
......@@ -211,7 +218,7 @@ Class AjaxController extends Controller
}
});
}catch(\Exception $e){
return $this->ajaxReturn(-1,"添加模板失败");
return $this->ajaxReturn(-1,$e->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 sign in to comment