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
086e8785
authored
May 12, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
a360d2be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
app/Http/Controllers/AjaxController.php
app/Http/Controllers/AjaxController.php
View file @
086e8785
...
...
@@ -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
()
);
}
...
...
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