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
466e8323
authored
May 15, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
9fa4d548
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
27 deletions
app/Http/Controllers/AjaxController.php
resources/views/web/labelList.blade.php
app/Http/Controllers/AjaxController.php
View file @
466e8323
...
...
@@ -38,10 +38,10 @@ Class AjaxController extends Controller
$query
=
TemplateListModel
::
select
(
'*'
)
->
CreateUserId
(
$admin_id
,
$role
,
$create_username
,
$userType
)
->
TemplateName
(
$template_name
)
->
Status
(
$status
)
->
SearchTime
(
$begin_time
,
$end_time
)
->
OrderBy
(
"status"
,
"desc"
)
->
OrderBy
(
"id"
,
"desc"
);
$query
=
$query
->
paginate
(
$limit
,[],
'page'
,
$page
);
$list
=
$query
->
toArray
();
// dump($list);
return
[
'code'
=>
0
,
'count'
=>
$list
[
'total'
],
'data'
=>
$list
[
"data"
]];
}
...
...
@@ -96,9 +96,7 @@ Class AjaxController extends Controller
$tmpl
->
status
=
(
$tmpl
->
status
==
-
1
)
?
1
:-
1
;
$tmpl
->
save
();
//此处推送到erp
if
(
!
$this
->
pushTemplateErp
(
intval
(
$id
))){
return
$this
->
ajaxReturn
(
-
1
,
"模板信息推送至erp失败"
);
}
$this
->
pushTemplateErp
(
intval
(
$id
));
return
$this
->
ajaxReturn
(
0
,
"修改成功"
);
}
else
{
return
$this
->
ajaxReturn
(
-
1
,
"没找到与自己对应的模板"
);
...
...
@@ -106,7 +104,7 @@ Class AjaxController extends Controller
}
/*
* 模板列表修改
状态
* 模板列表修改
名称
*/
public
function
edit_template_info
(
$request
){
$id
=
$request
->
input
(
"id"
,
0
);
...
...
@@ -121,7 +119,7 @@ Class AjaxController extends Controller
$count
=
TemplateListModel
::
where
([
"create_userid"
=>
$request
->
user
->
userId
,
"template_name"
=>
$template_name
])
->
count
();
if
(
$count
>
0
){
return
$this
->
ajaxReturn
(
-
1
,
"
模板名称不能重复哟
!"
);
return
$this
->
ajaxReturn
(
-
1
,
"
已经存在该名称的模板了
!"
);
}
$tmpl
->
template_name
=
$template_name
;
...
...
@@ -131,9 +129,7 @@ Class AjaxController extends Controller
}
//此处推送到erp
if
(
!
$this
->
pushTemplateErp
(
intval
(
$id
))){
return
$this
->
ajaxReturn
(
-
1
,
"模板信息推送至erp失败"
);
}
$this
->
pushTemplateErp
(
intval
(
$id
));
return
$this
->
ajaxReturn
(
0
,
"修改成功"
);
...
...
@@ -157,7 +153,6 @@ Class AjaxController extends Controller
// return true;
try
{
$template
=
TemplateListModel
::
find
(
$t_id
);
//dump($template);
//登录
$soap
=
new
\SoapClient
(
env
(
"ERP_DOMAIN"
)
.
'/ormrpc/services/EASLogin?wsdl'
);
$res
=
$soap
->
login
(
'TC'
,
'unicom'
,
'eas'
,
env
(
'ERP_DB_NAME'
),
'L2'
,
1
,
'BaseDB'
);
...
...
@@ -169,16 +164,28 @@ Class AjaxController extends Controller
"createUser"
=>
$template
->
create_username
,
"status"
=>
intval
(
$template
->
status
),
]));
$template
->
is_push
=
0
;
$arr
=
[];
if
(
$res
){
$res
=
\GuzzleHttp\json_decode
(
$res
,
true
);
Log
::
info
(
print_r
(
$res
,
true
));
if
(
isset
(
$res
[
"0000"
])){
return
true
;
$template
->
is_push
=
1
;
$arr
=
[
'err_code'
=>
0
,
'err_msg'
=>
"模板推送成功"
];
}
elseif
(
isset
(
$res
[
"4444"
])){
$arr
=
[
'err_code'
=>-
1
,
'err_msg'
=>
sprintf
(
"模板推送erp失败 %s"
,
$res
[
"4444"
])];
}
}
else
{
$arr
=
[
'err_code'
=>-
1
,
'err_msg'
=>
sprintf
(
"模板信息推送到erp失败"
)];
}
return
false
;
$template
->
save
();
return
$arr
;
}
catch
(
\Exception
$e
){
Log
::
info
(
sprintf
(
"模板更新信息推送到erp失败:%s"
,
$e
->
getMessage
()));
return
false
;
$template
->
is_push
=
0
;
//0未推送至erp 1已推送
$template
->
save
();
Log
::
info
(
sprintf
(
"模板:%s 信息推送到erp失败:%s"
,
$t_id
,
$e
->
getMessage
()));
return
[
'err_code'
=>-
1
,
'err_msg'
=>
sprintf
(
"模板信息推送到erp异常,原因:%s"
,
$e
->
getMessage
())];
}
}
...
...
@@ -249,9 +256,7 @@ Class AjaxController extends Controller
}
//此处推送到erp
if
(
!
$this
->
pushTemplateErp
(
$data
[
't_id'
])){
throw
new
\Exception
(
"模板信息推送至erp失败"
,
-
1
);
}
$this
->
pushTemplateErp
(
$data
[
't_id'
]);
});
return
$this
->
ajaxReturn
(
0
,
"修改模板成功"
);
}
catch
(
\Exception
$e
){
...
...
@@ -293,9 +298,7 @@ Class AjaxController extends Controller
throw
new
\Exception
(
"添加模板失败"
,
-
1
);
}
//此处推送到erp
if
(
!
$this
->
pushTemplateErp
(
$templateList
->
id
)){
throw
new
\Exception
(
"模板信息推送至erp失败"
,
-
1
);
}
$this
->
pushTemplateErp
(
$templateList
->
id
);
});
return
$this
->
ajaxReturn
(
0
,
"添加模板成功"
);
}
catch
(
\Exception
$e
){
...
...
@@ -315,8 +318,13 @@ Class AjaxController extends Controller
return
$this
->
ajaxReturn
(
-
1
,
"没找到属于您的模板相关信息"
);
}
//此处推送到erp
if
(
!
$this
->
pushTemplateErp
(
$template
->
id
)){
return
$this
->
ajaxReturn
(
-
1
,
"模板信息推送至erp失败"
);
$res
=
$this
->
pushTemplateErp
(
$template
->
id
);
if
(
!
empty
(
$res
)
&&
$res
[
'err_code'
]
<
0
){
return
$this
->
ajaxReturn
(
-
1
,
$res
[
'err_msg'
]);
}
$template
->
is_push
=
1
;
if
(
$template
->
save
()
===
false
){
return
$this
->
ajaxReturn
(
-
1
,
推送失败
);
}
return
$this
->
ajaxReturn
(
0
,
"推送模板成功"
);
}
...
...
@@ -354,9 +362,7 @@ Class AjaxController extends Controller
throw
new
\Exception
(
"复制模板失败"
,
-
1
);
}
//此处推送到erp
if
(
!
$this
->
pushTemplateErp
(
$templateList
->
id
)){
throw
new
\Exception
(
"模板信息推送至erp失败"
,
-
1
);
}
$this
->
pushTemplateErp
(
$templateList
->
id
);
});
$data
=
[];
...
...
resources/views/web/labelList.blade.php
View file @
466e8323
...
...
@@ -55,18 +55,25 @@
<input type="
hidden
" name="
labelListSystem
" value="
{{
isset
(
$labelListSystem
)
?
$labelListSystem
:
0
}}
" />
<table id="
list
" lay-filter="
list
"></table>
<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
" href="
/
web
/
showTemplate
?
t_id
=@
{{
d
.
id
}}
" target="
_blank
" lay-event="
show
">预览</a>
<a title="
复制一份该模板
" class="
btn
btn
-
xs
btn
-
outline
btn
-
info
" lay-event="
copy
">复制</a>
@if(!isset(
$labelListSystem
))
<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{ }}
<a class="
btn
btn
-
xs
btn
-
outline
btn
-
info
" lay-event="
forbid
">禁用</a>
@{{# } }}
<a title="
复制一份该模板
" class="
btn
btn
-
xs
btn
-
outline
btn
-
info
" lay-event="
copy
">复制</a>
<a title="
推送模板信息到erp
" class="
btn
btn
-
xs
btn
-
outline
btn
-
info
" lay-event="
push
">推送</a>
@{{# if (d.is_push == 0) { }}
<a title="
推送模板信息到erp
" style="
color
:
#ffffff" class="btn btn-xs btn-outline layui-btn-warm" lay-event="push">推送</a>
@
{{
# } }}
@
endif
</
script
>
<
script
type
=
"text/html"
id
=
"status"
>
...
...
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