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
ae036501
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
0aa203fe
608e8d11
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
2 deletions
app/Http/Controllers/AjaxController.php
app/Http/Controllers/WebController.php
app/Model/TemplateExtendModel.php
resources/views/web/labelList.blade.php
app/Http/Controllers/AjaxController.php
View file @
ae036501
...
...
@@ -8,6 +8,7 @@ use DB;
use
App\Model\TemplateListModel
;
use
App\Model\SaleOrderListsModel
;
use
App\Model\TmplRelationsModel
;
use
App\Model\TemplateExtendModel
;
Class
AjaxController
extends
Controller
{
...
...
@@ -159,4 +160,64 @@ Class AjaxController extends Controller
}
}
/*
* 添加模板
*/
public
function
add_template
(
$request
){
$template_name
=
$request
->
input
(
"designName"
,
''
);
$html
=
$request
->
input
(
"html"
,
''
);
$lableBg
=
$request
->
input
(
"lableBg"
,
''
);
$lableBorder
=
$request
->
input
(
"lableBorder"
,
''
);
$lableSize
=
$request
->
input
(
"lableSize"
,
''
);
if
(
!
$template_name
){
return
$this
->
ajaxReturn
(
-
1
,
"请填写模板名称!"
);
}
if
(
!
$html
){
return
$this
->
ajaxReturn
(
-
1
,
"模板标签是空!"
);
}
$attribute
[
"lableBg"
]
=
$lableBg
;
$attribute
[
"lableBorder"
]
=
$lableBorder
;
$attribute
[
"lableSize"
]
=
$lableSize
;
$data
[
'template_name'
]
=
$template_name
;
$data
[
'html'
]
=
$html
;
$data
[
'attribute'
]
=
$attribute
;
try
{
DB
::
Connection
(
"label"
)
->
transaction
(
function
()
use
(
$data
,
$request
)
{
//创建模板
$templateList
=
TemplateListModel
::
create
([
"template_name"
=>
$data
[
'$template_name'
],
"create_userid"
=>
$request
->
user
->
userId
,
"create_username"
=>
$request
->
user
->
name
,
"create_time"
=>
time
(),
"update_time"
=>
time
(),
]);
if
(
!
$templateList
){
throw
new
\Exception
(
"添加模板失败"
,
-
1
);
}
//创建模板扩展信息 属性
$templateExtend
=
TemplateExtendModel
::
create
([
"template_id"
=>
$templateList
->
id
,
"html"
=>
$data
[
'html'
],
"attribute"
=>
json_encode
(
$data
[
'attribute'
]),
]);
if
(
!
$templateExtend
){
throw
new
\Exception
(
"添加模板失败"
,
-
1
);
}
});
}
catch
(
\Exception
$e
){
return
$this
->
ajaxReturn
(
-
1
,
"添加模板失败"
);
}
}
}
\ No newline at end of file
app/Http/Controllers/WebController.php
View file @
ae036501
...
...
@@ -84,7 +84,6 @@ class WebController extends Controller
public
function
design
(
$request
,
$info
){
$info
[
'title'
]
=
'标签设计'
;
return
view
(
'web'
,
$info
);
}
...
...
app/Model/TemplateExtendModel.php
0 → 100644
View file @
ae036501
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Http\Request
;
class
TemplateExtendModel
extends
Model
{
protected
$connection
=
'label'
;
//库名
protected
$table
=
'template_extend'
;
protected
$primaryKey
=
'id'
;
//设置id
protected
$guarded
=
[
'id'
];
//设置字段黑名单
public
$timestamps
=
false
;
protected
$dateFormat
=
'Y-m-d H:i:s'
;
}
\ No newline at end of file
resources/views/web/labelList.blade.php
View file @
ae036501
...
...
@@ -50,7 +50,7 @@
<script
type=
"text/html"
id=
"action"
>
<
a
class
=
"btn btn-xs btn-outline btn-info"
lay
-
event
=
"offline"
>
离线使用
<
/a>
<
a
class
=
"btn btn-xs btn-outline btn-success"
lay
-
event
=
"show"
>
预览
<
/a>
<
a
class
=
"btn btn-xs btn-outline btn-success"
href
=
"/web/
editLabel
?t_id=@{{ d.id }}"
target
=
"_blank"
>
编辑
<
/a>
<
a
class
=
"btn btn-xs btn-outline btn-success"
href
=
"/web/
design
?t_id=@{{ d.id }}"
target
=
"_blank"
>
编辑
<
/a>
@{{
#
if
(
d
.
status
==
-
1
)
{
}}
<
a
class
=
"btn btn-xs btn-outline layui-btn-primary"
lay
-
event
=
"enable"
>
启用
<
/a>
@{{
#
}
else
{
}}
...
...
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