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
3678e212
authored
Dec 05, 2017
by
李洋
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update code
parent
90eb7c01
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
29 deletions
app/Http/Controllers/MessageController.php
public/js/Message/AddTemplate.js
resources/views/message/AddTemplate.blade.php
resources/views/message/TemplateList.blade.php
app/Http/Controllers/MessageController.php
View file @
3678e212
...
...
@@ -267,18 +267,63 @@ class MessageController extends Controller
private
function
addTemplate
(
Request
$request
,
$id
,
$viewid
)
{
Csrf
(
$request
);
$map
=
$request
->
input
();
$db
=
DB
::
connection
(
'message'
)
->
table
(
'lie_msg_tpl'
);
$info
=
$db
->
get
();
if
(
!
empty
(
$map
[
'tpl_id'
]))
$rq_tpl_id
=
$request
->
input
(
'tpl_id'
);
$db
=
DB
::
connection
(
'message'
);
$isContainInner
=
''
;
$isContainSMS
=
''
;
$isContainEmail
=
''
;
$isContainWechatNotify
=
''
;
if
(
!
empty
(
$rq_tpl_id
))
{
//通过tpl_id找到模板的渠道们 和 描述等
$info
=
$db
->
table
(
'lie_msg_tpl'
)
->
select
(
'tpl_id'
,
'description'
,
'channels'
,
'msg_type'
)
->
where
(
'tpl_id'
,
$rq_tpl_id
)
->
first
();
//通过找到的 channels 去渠道模板表里 把每个channel找出来
$tpl_channels_arr
=
explode
(
','
,
$info
->
channels
);
$channel_tpls
=
[];
foreach
(
$tpl_channels_arr
as
$channel_type
)
{
$channel_tpl_obj
=
$db
->
table
(
'lie_msg_channel_tpl'
)
->
where
(
'tpl_id'
,
$info
->
tpl_id
)
->
where
(
'channel_type'
,
$channel_type
)
->
first
();
$channel_tpls
[
$channel_type
]
=
$channel_tpl_obj
;
}
$info
->
channel_tpls
=
$channel_tpls
;
//判断包含的消息渠道(用于展示消息渠道)(利用之前分割字符串得到的数组)
$isContainInner
=
in_array
(
'1'
,
$tpl_channels_arr
);
$isContainSMS
=
in_array
(
'2'
,
$tpl_channels_arr
);
$isContainEmail
=
in_array
(
'3'
,
$tpl_channels_arr
);
$isContainWechatNotify
=
in_array
(
'4'
,
$tpl_channels_arr
);
}
$info
=
[];
if
(
empty
(
$info
))
{
$info
=
(
object
)
null
;
$info
->
tpl_id
=
''
;
$info
->
description
=
''
;
$info
->
channels
=
''
;
$info
->
channel_tpls
=
[];
$info
->
msg_type
=
''
;
}
//消息类型枚举
$msg_type
=
[
'请选择'
,
'公告'
,
'活动'
,
'新闻'
,
'其他'
];
$data
=
[
'title'
=>
'asd'
,
'id'
=>
$id
,
'info'
=>
$info
'info'
=>
$info
,
'msg_type'
=>
$msg_type
,
'isContainInner'
=>
$isContainInner
,
'isContainSMS'
=>
$isContainSMS
,
'isContainEmail'
=>
$isContainEmail
,
'isContainWechatNotify'
=>
$isContainWechatNotify
,
];
return
view
(
$viewid
,
$data
);
...
...
public/js/Message/AddTemplate.js
View file @
3678e212
...
...
@@ -38,6 +38,11 @@ $('#msg_tpl_submit').click(function()
Prompt
(
'请填写消息内容'
,
5
);
return
false
;
}
if
(
!
$
(
"input[id='inner-tpl-op-url']"
).
is
(
':checked'
)
&&
!
$
(
"input[id='inner-tpl-op-open']"
).
is
(
':checked'
))
{
Prompt
(
'请选择点击消息操作'
,
5
);
return
false
;
}
if
(
$
(
"input[id='inner-tpl-op-url']"
).
is
(
':checked'
)
&&
!
$
(
"#inner-tpl-op-url-text"
).
val
())
{
Prompt
(
'请填写要打开的url'
,
5
);
...
...
resources/views/message/AddTemplate.blade.php
View file @
3678e212
...
...
@@ -107,17 +107,17 @@
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 20px"
>
<label
class=
"col-sm-2 control-label"
id=
"msg-tpl-channels"
><span
style=
"color: red"
>
*
</span>
消息渠道:
</label>
<div
class=
"col-sm-4"
>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-inner"
value=
"1"
/><label>
站内信
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-sms"
value=
"2"
/><label>
短息
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-email"
value=
"3"
/><label>
邮箱
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-wechat-notify"
value=
"4"
/><label>
微信通知
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-inner"
value=
"1"
@
if
(!
empty
($
isContainInner
))
checked
@
endif
/><label>
站内信
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-sms"
value=
"2"
@
if
(!
empty
($
isContainSMS
))
checked
@
endif
/><label>
短息
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-email"
value=
"3"
@
if
(!
empty
($
isContainEmail
))
checked
@
endif
/><label>
邮箱
</label>
<input
type=
"checkbox"
name=
"chk-channels"
id=
"chk-channels-wechat-notify"
value=
"4"
@
if
(!
empty
($
isContainWechatNotify
))
checked
@
endif
/><label>
微信通知
</label>
</div>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 20px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
模板描述:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"msg-tpl-desc"
class=
"form-control"
placeholder=
"请输入描述"
value=
""
/>
<input
type=
"text"
id=
"msg-tpl-desc"
class=
"form-control"
placeholder=
"请输入描述"
value=
"
{{ $info->description }}
"
/>
</div>
</div>
</div>
...
...
@@ -163,37 +163,35 @@
<div
role=
"tabpanel"
class=
"tab-pane fade in active"
id=
"innner"
>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
消息
类型:
</label>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
站内信
类型:
</label>
<div
class=
"col-sm-3"
>
<select
class=
"form-control"
name=
"inner-tpl-type"
id=
"inner-tpl-type"
>
<option
value=
"0"
>
请选择
</option>
<option
value=
"1"
>
公告
</option>
<option
value=
"2"
>
活动
</option>
<option
value=
"3"
>
新闻
</option>
<option
value=
"4"
>
其他
</option>
@for($i=0;$i
<5
;$
i
++)
<
option
value=
"{{ $i }}"
@
if
($
i=
=$info-
>
msg_type) selected @endif>{{ $msg_type[$i] }}
</option>
@endfor
</select>
</div>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 20px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
消息
标题:
</label>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
站内信
标题:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"inner-tpl-title"
class=
"form-control"
placeholder=
"请输入标题"
value=
""
/
>
<input
type=
"text"
id=
"inner-tpl-title"
class=
"form-control"
placeholder=
"请输入标题"
value=
@if(!empty($info-
>
channel_tpls['1'])) "{{ $info->channel_tpls['1']->title }}" @endif
>
</div>
</div>
<div
class=
"col-sm-10"
style=
"margin-top: 20px"
>
<label><span
style=
"color: red"
>
*
</span>
消息
内容:
</label>
<script
type=
"text/plain"
id=
"inner-tpl-content"
name=
"inner-tpl-content"
></script>
<label><span
style=
"color: red"
>
*
</span>
站内信
内容:
</label>
<script
type=
"text/plain"
id=
"inner-tpl-content"
name=
"inner-tpl-content"
>
@
if
(
!
empty
(
$info
->
channel_tpls
[
'1'
]
->
content
))
{{
$info
->
channel_tpls
[
'1'
]
->
content
}}
@
endif
</script>
<script
type=
"text/javascript"
>
UE
.
getEditor
(
'inner-tpl-content'
);
</script>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 20px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
点击消息操作:
</label>
<div
class=
"col-sm-5"
>
<input
type=
"radio"
id=
"inner-tpl-op-open"
name=
"inner-tpl-op"
checked
/><label
for=
"inner-tpl-op-open"
>
打开消息
</label>
<input
type=
"radio"
id=
"inner-tpl-op-url"
name=
"inner-tpl-op"
/><label
for=
"inner-tpl-op-url"
>
打开URL
</label>
<input
type=
"text"
id=
"inner-tpl-op-url-text"
name=
"inner-tpl-url-text"
placeholder=
"请输入URL"
>
<input
type=
"radio"
id=
"inner-tpl-op-open"
name=
"inner-tpl-op"
value=
"1"
@
if
(!
empty
($
info-
>
channel_tpls['1'])
&&
1==$info->channel_tpls['1']->op_type) checked @endif
/>
<label
for=
"inner-tpl-op-open"
>
打开消息
</label>
<input
type=
"radio"
id=
"inner-tpl-op-url"
name=
"inner-tpl-op"
value=
"2"
@
if
(!
empty
($
info-
>
channel_tpls['1'])
&&
2==$info->channel_tpls['1']->op_type) checked @endif
/>
<label
for=
"inner-tpl-op-url"
>
打开URL
</label>
<input
type=
"text"
id=
"inner-tpl-op-url-text"
name=
"inner-tpl-url-text"
placeholder=
"请输入URL"
value=
@if(!empty($info-
>
channel_tpls['1'])
&&
2==$info->channel_tpls['1']->op_type) "{{ $info->channel_tpls['1']->url }}" @endif
>
</div>
</div>
...
...
@@ -204,7 +202,7 @@
<div
class=
"col-sm-10"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
短信内容:
</label>
<div
class=
"col-sm-10"
>
<textarea
rows=
"2"
cols=
"10"
id=
"sms-tpl-content"
class=
"form-control"
placeholder=
"请输入短信内容"
></textarea>
<textarea
rows=
"2"
cols=
"10"
id=
"sms-tpl-content"
class=
"form-control"
placeholder=
"请输入短信内容"
>
@if(!empty($info->channel_tpls['2'])) {{ $info->channel_tpls['2']->content }} @endif
</textarea>
<label
id=
"sms-content-length"
>
预计1条短信
</label>
</div>
</div>
...
...
@@ -215,13 +213,13 @@
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
邮件标题:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"email-tpl-title"
class=
"form-control"
placeholder=
"请输入邮件标题"
value=
""
/
>
<input
type=
"text"
id=
"email-tpl-title"
class=
"form-control"
placeholder=
"请输入邮件标题"
value=
@if(!empty($info-
>
channel_tpls['3'])) "{{ $info->channel_tpls['3']->title }}" @endif
>
</div>
</div>
<div
class=
"col-sm-10"
style=
"margin-top: 20px"
>
<label><span
style=
"color: red"
>
*
</span>
邮件内容:
</label>
<script
type=
"text/plain"
id=
"email-tpl-content"
name=
"email-tpl-content"
></script>
<script
type=
"text/plain"
id=
"email-tpl-content"
name=
"email-tpl-content"
>
@
if
(
!
empty
(
$info
->
channel_tpls
[
'3'
]
->
content
))
{{
$info
->
channel_tpls
[
'3'
]
->
content
}}
@
endif
</script>
<script
type=
"text/javascript"
>
UE
.
getEditor
(
'email-tpl-content'
);
</script>
</div>
</div>
...
...
@@ -231,7 +229,7 @@
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
><span
style=
"color: red"
>
*
</span>
微信模板:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify_tpl_title"
class=
"form-control"
placeholder=
"请输入微信模板编号"
value=
""
/
>
<input
type=
"text"
id=
"wechat-notify_tpl_title"
class=
"form-control"
placeholder=
"请输入微信模板编号"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->title }}" @endif
>
</div>
</div>
</div>
...
...
resources/views/message/TemplateList.blade.php
View file @
3678e212
...
...
@@ -37,7 +37,7 @@
<td>
{{ $info[$i]->title }}
</td>
<td>
{{ $info[$i]->description }}
</td>
<td>
{{ $info[$i]->show_channels_str }}
</td>
<td><a
href=
"
"
class=
"btn btn-xs btn-outline btn-warning
"
>
编辑
</a></td>
<td><a
href=
"
{{url('message/addTemplate')}}?tpl_id={{$info[$i]->tpl_id}}"
class=
"btn btn-xs btn-outline btn-primary
"
>
编辑
</a></td>
</tr>
@endfor
</tbody>
...
...
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