Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
note-library
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ae5885e6
authored
May 12, 2020
by
肖康
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/sunlong_v5/note-library
parents
c649a8f6
809dcce0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
app/Http/Controllers/AjaxController.php
app/Http/Controllers/AjaxController.php
View file @
ae5885e6
...
...
@@ -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
(),
...
...
@@ -210,8 +217,9 @@ Class AjaxController extends Controller
throw
new
\Exception
(
"添加模板失败"
,
-
1
);
}
});
return
$this
->
ajaxReturn
(
0
,
"添加模板成功"
);
}
catch
(
\Exception
$e
){
return
$this
->
ajaxReturn
(
-
1
,
"添加模板失败"
);
return
$this
->
ajaxReturn
(
-
1
,
$e
->
getMessage
()
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment