Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李洋
/
消息系统
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
1fe18552
authored
Dec 18, 2017
by
李洋
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加权限控制
parent
3333d136
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
13 deletions
app/Http/Controllers/MessageController.php
resources/views/message/addtemplate.blade.php
resources/views/message/allhistorylist.blade.php
resources/views/message/manualhistorylist.blade.php
resources/views/message/sendmanualmessage.blade.php
resources/views/message/templatelist.blade.php
app/Http/Controllers/MessageController.php
View file @
1fe18552
...
...
@@ -168,14 +168,20 @@ class MessageController extends Controller
}
//-------------------------------模块-------------------------------
// 消息模板列表
private
function
templatelist
(
Request
$request
,
$id
,
$viewid
)
{
Csrf
(
$request
);
//获取权限
$perms_arr
=
[
'template_check'
,
'template_create'
,
'template_edit'
];
$res_perm
=
$this
->
getUserPerms
(
$request
,
$perms_arr
);
$template_check
=
$res_perm
[
'template_check'
];
$template_create
=
$res_perm
[
'template_create'
];
$template_edit
=
$res_perm
[
'template_edit'
];
//搜索
$search_desc
=
$request
->
input
(
'search_desc'
);
$search_channel
=
$request
->
input
(
'search_channel'
);
...
...
@@ -233,6 +239,10 @@ class MessageController extends Controller
'msg_channels'
=>
$msg_channels
,
'search_desc'
=>
$search_desc
,
'search_channel'
=>
$search_channel
,
'template_check'
=>
$template_check
,
'template_create'
=>
$template_create
,
'template_edit'
=>
$template_edit
];
return
view
(
$viewid
,
$data
);
}
...
...
@@ -241,6 +251,13 @@ class MessageController extends Controller
private
function
manualhistorylist
(
Request
$request
,
$id
,
$viewid
)
{
Csrf
(
$request
);
//获取权限
$perms_arr
=
[
'manualhistorylist_check'
,
'manualmessage_edit'
,
'manualmessage_send'
];
$res_perm
=
$this
->
getUserPerms
(
$request
,
$perms_arr
);
$manualhistorylist_check
=
$res_perm
[
'manualhistorylist_check'
];
$manualmessage_edit
=
$res_perm
[
'manualmessage_edit'
];
$manualmessage_send
=
$res_perm
[
'manualmessage_send'
];
//搜索条件
$search_desc
=
$request
->
input
(
'search_desc'
);
$search_channel
=
$request
->
input
(
'search_channel'
);
...
...
@@ -260,14 +277,14 @@ class MessageController extends Controller
if
(
0
==
$search_channel
)
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
groupBy
(
'lie_msg_log.tpl_id'
)
->
having
(
'lie_msg_log.source_type'
,
'='
,
2
)
->
where
(
'lie_msg_log.expect_send_time'
,
$search_sendtime
)
//
->where('lie_msg_log.expect_send_time',$search_sendtime)
->
join
(
'lie_msg_tpl'
,
'lie_msg_log.tpl_id'
,
'='
,
'lie_msg_tpl.tpl_id'
)
->
where
(
'lie_msg_tpl.description'
,
'like'
,
"%
$search_desc
%"
)
->
get
();
}
else
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
groupBy
(
'lie_msg_log.tpl_id'
)
->
having
(
'lie_msg_log.source_type'
,
'='
,
2
)
->
join
(
'lie_msg_tpl'
,
'lie_msg_log.tpl_id'
,
'='
,
'lie_msg_tpl.tpl_id'
)
->
where
(
'lie_msg_log.expect_send_time'
,
$search_sendtime
)
//
->where('lie_msg_log.expect_send_time',$search_sendtime)
->
where
(
'lie_msg_tpl.channels'
,
'like'
,
"%
$search_channel
%"
)
->
where
(
'lie_msg_tpl.description'
,
'like'
,
"%
$search_desc
%"
)
->
get
();
}
...
...
@@ -312,6 +329,10 @@ class MessageController extends Controller
'search_desc'
=>
$search_desc
,
'search_channel'
=>
$search_channel
,
'search_sendtime'
=>
$search_sendtime
,
'manualhistorylist_check'
=>
$manualhistorylist_check
,
'manualmessage_edit'
=>
$manualmessage_edit
,
'manualmessage_send'
=>
$manualmessage_send
];
return
view
(
$viewid
,
$data
);
...
...
@@ -321,6 +342,10 @@ class MessageController extends Controller
private
function
allhistorylist
(
Request
$request
,
$id
,
$viewid
)
{
Csrf
(
$request
);
$perms_arr
=
[
'allhistorylist_check'
];
$res_perm
=
$this
->
getUserPerms
(
$request
,
$perms_arr
);
$allhistorylist_check
=
$res_perm
[
'allhistorylist_check'
];
//搜索条件
$search_id
=
$request
->
input
(
'search_id'
);
$search_user
=
$request
->
input
(
'search_user'
);
...
...
@@ -384,6 +409,8 @@ class MessageController extends Controller
'search_sendtime'
=>
$search_sendtime
,
'search_channel'
=>
$search_channel
,
'search_status'
=>
$search_status
,
'allhistorylist_check'
=>
$allhistorylist_check
];
return
view
(
$viewid
,
$data
);
...
...
@@ -393,6 +420,11 @@ class MessageController extends Controller
private
function
addtemplate
(
Request
$request
,
$id
,
$viewid
)
{
Csrf
(
$request
);
$perms_arr
=
[
'template_create'
];
$res_perm
=
$this
->
getUserPerms
(
$request
,
$perms_arr
);
$template_create
=
$res_perm
[
'template_create'
];
$rq_tpl_id
=
$request
->
input
(
'tpl_id'
);
$db
=
DB
::
connection
(
'message'
);
//是否包含某一渠道
...
...
@@ -475,6 +507,7 @@ class MessageController extends Controller
'sms_chn_tpl_id'
=>
$sms_chn_tpl_id
,
'email_chn_tpl_id'
=>
$email_chn_tpl_id
,
'wechatNotify_chn_tpl_id'
=>
$wechatNotify_chn_tpl_id
,
'template_create'
=>
$template_create
];
return
view
(
$viewid
,
$data
);
...
...
@@ -484,6 +517,11 @@ class MessageController extends Controller
private
function
sendmanualmessage
(
Request
$request
,
$id
,
$viewid
)
{
Csrf
(
$request
);
$perms_arr
=
[
'manualmessage_send'
];
$res_perm
=
$this
->
getUserPerms
(
$request
,
$perms_arr
);
$manualmessage_send
=
$res_perm
[
'manualmessage_send'
];
$rq_log_id
=
$request
->
input
(
'log_id'
);
//发送人工消息改变了模板的选择时会传过来tpl_id
$rq_tpl_id
=
$request
->
input
(
'tpl_id'
);
...
...
@@ -569,6 +607,8 @@ class MessageController extends Controller
'isContainSMS'
=>
$isContainSMS
,
'isContainEmail'
=>
$isContainEmail
,
'isContainWechatNotify'
=>
$isContainWechatNotify
,
'manualmessage_send'
=>
$manualmessage_send
];
return
view
(
$viewid
,
$data
);
...
...
@@ -604,4 +644,17 @@ class MessageController extends Controller
}
return
$chineseStr
;
}
private
function
getUserPerms
(
Request
$request
,
$perms_arr
)
{
$perms_str
=
implode
(
','
,
$perms_arr
);
$uid
=
$request
->
user
->
userId
;
$bid
=
8
;
$url
=
"http://perm.liexin.net/api/check/
$uid
/
$bid
/?perms=
$perms_str
"
;
$res
=
json_decode
(
curl
(
$url
),
true
);
if
(
!
$res
[
'retcode'
])
{
return
$res
[
'data'
][
'perms'
];
}
}
}
\ No newline at end of file
resources/views/message/addtemplate.blade.php
View file @
1fe18552
...
...
@@ -98,6 +98,7 @@
}
</style>
@if($template_create)
<div
class=
"wrapper wrapper-content"
>
<div
class=
"col-lg-11"
>
<div
class=
"ibox float-e-margins"
>
...
...
@@ -259,4 +260,13 @@
</div>
</div>
</div>
\ No newline at end of file
</div>
@else
<div
style=
"text-align: center"
>
<label
style=
"margin-top: 30px"
>
对不起,您没有权限查看此页面
</label>
<div>
<a
href=
"http://perm.liexin.net/page/business/8/request/template_create"
target=
"_blank"
class=
"btn btn-primary"
>
申请权限
</a>
</div>
</div>
@endif
\ No newline at end of file
resources/views/message/allhistorylist.blade.php
View file @
1fe18552
...
...
@@ -13,6 +13,7 @@
}
</style>
@if($allhistorylist_check)
<div
class=
"gray-bg"
>
<div
class=
"wrapper wrapper-content"
>
<div
class=
"row"
>
...
...
@@ -152,4 +153,13 @@
</div>
</div>
@else
<div
style=
"text-align: center"
>
<label
style=
"margin-top: 30px"
>
对不起,您没有权限查看此页面
</label>
<div>
<a
href=
"http://perm.liexin.net/page/business/8/request/allhistorylist_check"
target=
"_blank"
class=
"btn btn-primary"
>
申请权限
</a>
</div>
</div>
@endif
resources/views/message/manualhistorylist.blade.php
View file @
1fe18552
...
...
@@ -13,6 +13,7 @@
}
</style>
@if($manualhistorylist_check)
<div
class=
"gray-bg"
>
<div
class=
"wrapper wrapper-content"
>
<div
class=
"row"
>
...
...
@@ -22,7 +23,9 @@
<div
class=
"form-inline p-l"
>
<form
method=
"get"
action=
"/message/templatelist"
>
<div
style=
"text-align: center"
class=
"div-b"
>
<a
class=
"btn btn-primary btn-sm"
href=
"/message/sendmanualmessage"
style=
"float: left;margin-left: 30px"
>
发送消息
</a>
@if($manualmessage_send)
<a
class=
"btn btn-primary btn-sm"
href=
"/message/sendmanualmessage"
style=
"float: left;margin-left: 30px"
>
发送消息
</a>
@endif
<label>
消息描述:
</label>
<input
type=
"text"
class=
"form-control"
id=
"search-desc"
placeholder=
"请输入消息描述"
value=
"{{ $search_desc }}"
>
<label>
消息渠道:
</label>
...
...
@@ -70,7 +73,9 @@
<td>
{{ $info[$i]->obj_user }}
</td>
@endif
<td>
{{ $info[$i]->actual_send_time }}
</td>
<td><a
href=
"{{url('message/sendmanualmessage')}}?log_id={{$info[$i]->log_id}}"
class=
"btn btn-xs btn-outline btn-primary"
>
编辑
</a></td>
@if($manualmessage_edit)
<td><a
href=
"{{url('message/sendmanualmessage')}}?log_id={{$info[$i]->log_id}}"
class=
"btn btn-xs btn-outline btn-primary"
>
编辑
</a></td>
@endif
</tr>
@endfor
</tbody>
...
...
@@ -93,4 +98,11 @@
</div>
</div>
@else
<div
style=
"text-align: center"
>
<label
style=
"margin-top: 30px"
>
对不起,您没有权限查看此页面
</label>
<div>
<a
href=
"http://perm.liexin.net/page/business/8/request/manualhistorylist_check"
target=
"_blank"
class=
"btn btn-primary"
>
申请权限
</a>
</div>
</div>
@endif
resources/views/message/sendmanualmessage.blade.php
View file @
1fe18552
...
...
@@ -98,6 +98,8 @@
}
</style>
@if($manualmessage_send)
<div
class=
"wrapper wrapper-content"
>
<div
class=
"col-lg-11"
>
<div
class=
"ibox float-e-margins"
>
...
...
@@ -292,4 +294,12 @@
</div>
</div>
</div>
\ No newline at end of file
</div>
@else
<div
style=
"text-align: center"
>
<label
style=
"margin-top: 30px"
>
对不起,您没有权限查看此页面
</label>
<div>
<a
href=
"http://perm.liexin.net/page/business/8/request/manualmessage_send"
target=
"_blank"
class=
"btn btn-primary"
>
申请权限
</a>
</div>
</div>
@endif
\ No newline at end of file
resources/views/message/templatelist.blade.php
View file @
1fe18552
...
...
@@ -12,6 +12,7 @@
}
</style>
@if($template_check)
<div
class=
"gray-bg"
>
<div
class=
"wrapper wrapper-content"
>
<div
class=
"row"
>
...
...
@@ -21,7 +22,11 @@
<div
class=
"form-inline p-l"
>
<form
method=
"get"
action=
"/message/templatelist"
>
<div
style=
"text-align: center"
class=
"div-b"
>
<a
class=
"btn btn-primary btn-sm"
href=
"/message/addtemplate"
style=
"float: left; margin-left: 30px"
>
新增消息模板
</a>
@if($template_create)
<a
class=
"btn btn-primary btn-sm"
href=
"/message/addtemplate"
style=
"float: left; margin-left: 30px"
>
新增消息模板
</a>
@endif
<label>
消息描述:
</label>
<input
type=
"text"
class=
"form-control"
id=
"search-desc"
placeholder=
"请输入消息描述"
value=
"{{ $search_desc }}"
>
<label>
消息渠道:
</label>
...
...
@@ -59,7 +64,9 @@
<td>
{{ $info[$i]->title }}
</td>
<td>
{{ $info[$i]->description }}
</td>
<td>
{{ $info[$i]->show_channels_str }}
</td>
<td><a
href=
"{{url('message/addtemplate')}}?tpl_id={{$info[$i]->tpl_id}}"
class=
"btn btn-xs btn-outline btn-primary"
>
编辑
</a></td>
@if($template_edit)
<td><a
href=
"{{url('message/addtemplate')}}?tpl_id={{$info[$i]->tpl_id}}"
class=
"btn btn-xs btn-outline btn-primary"
>
编辑
</a></td>
@endif
</tr>
@endfor
</tbody>
...
...
@@ -80,5 +87,13 @@
</div>
</div>
</div>
@else
<div
style=
"text-align: center"
>
<label
style=
"margin-top: 30px"
>
对不起,您没有权限查看此页面
</label>
<div>
<a
href=
"http://perm.liexin.net/page/business/8/request/template_check"
target=
"_blank"
class=
"btn btn-primary"
>
申请权限
</a>
</div>
</div>
@endif
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