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
86ebc545
authored
Jan 03, 2018
by
李洋
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
微信
parent
e91bb604
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
28 deletions
app/Http/Controllers/MessageApiController.php
app/Http/Controllers/MessageController.php
public/js/Message/addtemplate.js
public/js/Message/sendmanualmessage.js
resources/views/message/addtemplate.blade.php
resources/views/message/sendmanualmessage.blade.php
app/Http/Controllers/MessageApiController.php
View file @
86ebc545
...
...
@@ -193,6 +193,11 @@ class MessageApiController extends Controller
$chn_tpl_model_wechatnotify
[
'channel_type'
]
=
$data
[
'wechat_notify_channel_type'
];
$chn_tpl_model_wechatnotify
[
'title'
]
=
$data
[
'wechat_notify_title'
];
$chn_tpl_model_wechatnotify
[
'tpl_id'
]
=
$insert_tpl_id
;
$chn_tpl_model_wechatnotify
[
'url'
]
=
$data
[
'wechat_notify_url'
];
$wechat_head
=
$data
[
'wechat_notify_head'
];
$wechat_tail
=
$data
[
'wechat_notify_tail'
];
$wechat_content
=
json_encode
(
array
(
'wechat_tpl_head'
=>
$wechat_head
,
'wechat_tpl_tail'
=>
$wechat_tail
));
$chn_tpl_model_wechatnotify
[
'content'
]
=
$wechat_content
;
if
(
empty
(
$chn_tpl_model_wechatnotify
[
'channel_tpl_id'
]))
{
$chn_tpl_model_wechatnotify
[
'create_time'
]
=
time
();
$chn_tpl_model_wechatnotify
[
'update_time'
]
=
time
();
...
...
@@ -251,9 +256,15 @@ class MessageApiController extends Controller
$params
[
'content_2'
]
=
$data
[
'content_2'
];
$params
[
'content_3'
]
=
$data
[
'content_3'
];
$params
[
'op_type'
]
=
$data
[
'op_type'
];
$params
[
'url
'
]
=
$data
[
'url
'
];
$params
[
'url
_1'
]
=
$data
[
'url_1
'
];
$params
[
'obj_user'
]
=
$data
[
'obj_user'
];
$params
[
'wechat_tpl_id'
]
=
$data
[
'wechat_tpl_id'
];
$params
[
'title_4'
]
=
$data
[
'title_4'
];
$params
[
'url_4'
]
=
$data
[
'url_4'
];
$wechat_head
=
$data
[
'wechat_notify_head'
];
$wechat_tail
=
$data
[
'wechat_notify_tail'
];
$wechat_content
=
json_encode
(
array
(
'wechat_tpl_head'
=>
$wechat_head
,
'wechat_tpl_tail'
=>
$wechat_tail
));
$params
[
'content_4'
]
=
$wechat_content
;
$params
[
'expect_send_time'
]
=
$data
[
'expect_send_time'
];
//csrf
$check
[
'k1'
]
=
time
();
...
...
app/Http/Controllers/MessageController.php
View file @
86ebc545
...
...
@@ -191,7 +191,7 @@ class MessageController extends Controller
//1.首次进页面无搜索条件
if
(
$search_desc
==
null
&&
$search_channel
==
null
)
{
$info
=
$cnt
->
table
(
'lie_msg_tpl'
)
->
where
(
'source_type'
,
'1'
)
->
paginate
(
20
);
$info
=
$cnt
->
table
(
'lie_msg_tpl'
)
->
where
(
'source_type'
,
'1'
)
->
orderBy
(
'tpl_id'
,
'desc'
)
->
paginate
(
20
);
$search_channel
=
0
;
$search_desc
=
''
;
}
else
//2.有搜索条件
...
...
@@ -199,10 +199,10 @@ class MessageController extends Controller
//渠道里没有0,所以如果没选,将此条件剔除掉
if
(
0
==
$search_channel
)
{
$info
=
$cnt
->
table
(
'lie_msg_tpl'
)
->
where
(
'source_type'
,
'1'
)
->
where
(
'description'
,
'like'
,
"%
$search_desc
%"
)
->
paginate
(
20
);
$info
=
$cnt
->
table
(
'lie_msg_tpl'
)
->
where
(
'source_type'
,
'1'
)
->
where
(
'description'
,
'like'
,
"%
$search_desc
%"
)
->
orderBy
(
'tpl_id'
,
'desc'
)
->
paginate
(
20
);
}
else
{
$info
=
$cnt
->
table
(
'lie_msg_tpl'
)
->
where
(
'source_type'
,
'1'
)
->
where
(
'channels'
,
'like'
,
"%
$search_channel
%"
)
->
where
(
'description'
,
'like'
,
"%
$search_desc
%"
)
->
paginate
(
20
);
$info
=
$cnt
->
table
(
'lie_msg_tpl'
)
->
where
(
'source_type'
,
'1'
)
->
where
(
'channels'
,
'like'
,
"%
$search_channel
%"
)
->
where
(
'description'
,
'like'
,
"%
$search_desc
%"
)
->
orderBy
(
'tpl_id'
,
'desc'
)
->
paginate
(
20
);
}
}
...
...
@@ -269,7 +269,7 @@ class MessageController extends Controller
//1.首次进页面无搜索条件
if
(
null
==
$search_desc
&&
null
==
$search_channel
&&
null
==
$search_sendtime_start
&&
null
==
$search_sendtime_end
)
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
groupBy
(
'tpl_id'
)
->
having
(
'source_type'
,
'='
,
2
)
->
get
();
$info
=
$db
->
table
(
'lie_msg_log'
)
->
groupBy
(
'tpl_id'
)
->
having
(
'source_type'
,
'='
,
2
)
->
orderBy
(
'log_id'
,
'desc'
)
->
get
();
$search_channel
=
0
;
$search_desc
=
''
;
$search_sendtime_start
=
''
;
...
...
@@ -293,14 +293,14 @@ class MessageController extends Controller
$info
=
$db
->
table
(
'lie_msg_log'
)
->
groupBy
(
'lie_msg_log.tpl_id'
)
->
having
(
'lie_msg_log.source_type'
,
'='
,
2
)
->
whereBetween
(
'lie_msg_log.actual_send_time'
,[
$start_time
,
$end_time
])
->
join
(
'lie_msg_tpl'
,
'lie_msg_log.tpl_id'
,
'='
,
'lie_msg_tpl.tpl_id'
)
->
where
(
'lie_msg_tpl.description'
,
'like'
,
"%
$search_desc
%"
)
->
get
();
->
where
(
'lie_msg_tpl.description'
,
'like'
,
"%
$search_desc
%"
)
->
orderBy
(
'log_id'
,
'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'
)
->
whereBetween
(
'lie_msg_log.actual_send_time'
,[
$start_time
,
$end_time
])
->
where
(
'lie_msg_tpl.channels'
,
'like'
,
"%
$search_channel
%"
)
->
where
(
'lie_msg_tpl.description'
,
'like'
,
"%
$search_desc
%"
)
->
get
();
->
where
(
'lie_msg_tpl.description'
,
'like'
,
"%
$search_desc
%"
)
->
orderBy
(
'log_id'
,
'desc'
)
->
get
();
}
}
...
...
@@ -372,7 +372,7 @@ class MessageController extends Controller
$db
=
DB
::
connection
(
'message'
);
if
(
$search_id
==
null
&&
$search_user
==
null
&&
$search_sendtime_start
==
null
&&
$search_sendtime_end
==
null
&&
$search_channel
==
null
&&
$search_status
==
null
)
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
paginate
(
20
);
$info
=
$db
->
table
(
'lie_msg_log'
)
->
orderBy
(
'log_id'
,
'desc'
)
->
paginate
(
20
);
$search_id
=
''
;
$search_user
=
''
;
$search_sendtime_start
=
''
;
...
...
@@ -398,24 +398,24 @@ class MessageController extends Controller
$info
=
$db
->
table
(
'lie_msg_log'
)
->
where
(
'log_id'
,
'like'
,
"%
$search_id
%"
)
->
where
(
'obj_user'
,
'like'
,
"%
$search_user
%"
)
->
whereBetween
(
'actual_send_time'
,[
$start_time
,
$end_time
])
->
where
(
'status'
,
$search_status
)
->
paginate
(
20
);
->
where
(
'status'
,
$search_status
)
->
orderBy
(
'log_id'
,
'desc'
)
->
paginate
(
20
);
}
elseif
(
$search_channel
!=
0
&&
$search_status
==
0
)
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
where
(
'log_id'
,
'like'
,
"%
$search_id
%"
)
->
where
(
'obj_user'
,
'like'
,
"%
$search_user
%"
)
->
whereBetween
(
'actual_send_time'
,[
$start_time
,
$end_time
])
->
where
(
'channel_type'
,
$search_channel
)
->
paginate
(
20
);
->
orderBy
(
'log_id'
,
'desc'
)
->
paginate
(
20
);
}
elseif
(
$search_channel
==
0
&&
$search_status
==
0
)
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
where
(
'log_id'
,
'like'
,
"%
$search_id
%"
)
->
where
(
'obj_user'
,
'like'
,
"%
$search_user
%"
)
->
whereBetween
(
'actual_send_time'
,[
$start_time
,
$end_time
])
->
paginate
(
20
);
->
whereBetween
(
'actual_send_time'
,[
$start_time
,
$end_time
])
->
orderBy
(
'log_id'
,
'desc'
)
->
paginate
(
20
);
}
else
{
$info
=
$db
->
table
(
'lie_msg_log'
)
->
where
(
'log_id'
,
'like'
,
"%
$search_id
%"
)
->
where
(
'obj_user'
,
'like'
,
"%
$search_user
%"
)
->
whereBetween
(
'actual_send_time'
,[
$start_time
,
$end_time
])
->
where
(
'channel_type'
,
$search_channel
)
->
where
(
'status'
,
$search_status
)
->
paginate
(
20
);
->
where
(
'status'
,
$search_status
)
->
orderBy
(
'log_id'
,
'desc'
)
->
paginate
(
20
);
}
}
...
...
@@ -478,7 +478,7 @@ class MessageController extends Controller
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
;
//将channel_tpl_id赋给正确的变量中
if
(
$channel_type
==
1
)
{
...
...
@@ -492,7 +492,10 @@ class MessageController extends Controller
}
elseif
(
$channel_type
==
4
)
{
$wechatNotify_chn_tpl_id
=
$channel_tpl_obj
->
channel_tpl_id
;
//将head 和 tail从content中解析出来
$channel_tpl_obj
->
content
=
json_decode
(
$channel_tpl_obj
->
content
,
true
);
}
$channel_tpls
[
$channel_type
]
=
$channel_tpl_obj
;
}
$info
->
channel_tpls
=
$channel_tpls
;
...
...
@@ -598,6 +601,11 @@ class MessageController extends Controller
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
();
if
(
$channel_type
==
4
)
{
//将head 和 tail从content中解析出来
$channel_tpl_obj
->
content
=
json_decode
(
$channel_tpl_obj
->
content
,
true
);
}
$channel_tpls
[
$channel_type
]
=
$channel_tpl_obj
;
}
$info
->
channel_tpls
=
$channel_tpls
;
...
...
public/js/Message/addtemplate.js
View file @
86ebc545
$
(
'#msg
_tpl_
submit'
).
click
(
function
()
$
(
'#msg
-tpl-
submit'
).
click
(
function
()
{
//前端校验
...
...
@@ -76,7 +76,7 @@ $('#msg_tpl_submit').click(function()
//微信通知
if
(
$
(
"input[id='chk-channels-wechat-notify']"
).
is
(
':checked'
))
{
if
(
!
$
(
"#wechat-notify
_tpl_
title"
).
val
())
if
(
!
$
(
"#wechat-notify
-tpl-
title"
).
val
())
{
Prompt
(
'请填写微信模板编号'
,
5
);
return
false
;
...
...
@@ -120,8 +120,10 @@ function addTemplate()
wechat_notify_tpl_id
:
$
(
'#wechatnotify-chn-tpl-id'
).
val
(),
wechat_notify_channel_type
:
4
,
wechat_notify_title
:
$
(
'#wechat-notify_tpl_title'
).
val
(),
//存放的是微信模板的id
wechat_notify_title
:
$
(
'#wechat-notify-tpl-title'
).
val
(),
//存放的是微信模板的id
wechat_notify_head
:
$
(
'#wechat-notify-tpl-head'
).
val
(),
wechat_notify_tail
:
$
(
'#wechat-notify-tpl-tail'
).
val
(),
wechat_notify_url
:
$
(
'#wechat-notify-tpl-url'
).
val
(),
},
dataType
:
'json'
,
...
...
public/js/Message/sendmanualmessage.js
View file @
86ebc545
...
...
@@ -13,7 +13,7 @@ layui.use('laydate', function(){
});
var
sendTime
=
''
;
$
(
'#msg
_tpl_
submit'
).
click
(
function
()
$
(
'#msg
-tpl-
submit'
).
click
(
function
()
{
//前端校验
...
...
@@ -88,7 +88,7 @@ $('#msg_tpl_submit').click(function()
//微信通知
if
(
$
(
"input[id='chk-channels-wechat-notify']"
).
is
(
':checked'
))
{
if
(
!
$
(
"#wechat-notify
_tpl_
title"
).
val
())
if
(
!
$
(
"#wechat-notify
-tpl-
title"
).
val
())
{
Prompt
(
'请填写微信模板编号'
,
5
);
return
false
;
...
...
@@ -140,14 +140,17 @@ function sendManualMessage()
title_1
:
$
(
'#inner-tpl-title'
).
val
()?
$
(
'#inner-tpl-title'
).
val
():
''
,
content_1
:
ue_inner
.
getContent
()?
ue_inner
.
getContent
():
''
,
op_type
:
$
(
"input[name='inner-tpl-op']:checked"
).
val
()?
$
(
"input[name='inner-tpl-op']:checked"
).
val
():
''
,
url
:
$
(
'#inner-tpl-op-url-text'
).
val
()?
$
(
'#inner-tpl-op-url-text'
).
val
():
''
,
url
_1
:
$
(
'#inner-tpl-op-url-text'
).
val
()?
$
(
'#inner-tpl-op-url-text'
).
val
():
''
,
content_2
:
$
(
'#sms-tpl-content'
).
val
()?
$
(
'#sms-tpl-content'
).
val
():
''
,
title_3
:
$
(
'#email-tpl-title'
).
val
()?
$
(
'#email-tpl-title'
).
val
():
''
,
content_3
:
ue_email
.
getContent
()?
ue_email
.
getContent
():
''
,
wechat_tpl_id
:
$
(
'#wechat-notify_tpl_title'
).
val
()?
$
(
'#wechat-notify_tpl_title'
).
val
():
''
,
//存放的是微信模板的id
title_4
:
$
(
'#wechat-notify-tpl-title'
).
val
()?
$
(
'#wechat-notify-tpl-title'
).
val
():
''
,
//存放的是微信模板的id
wechat_notify_head
:
$
(
'#wechat-notify-tpl-head'
).
val
(),
wechat_notify_tail
:
$
(
'#wechat-notify-tpl-tail'
).
val
(),
url_4
:
$
(
'#wechat-notify-tpl-url'
).
val
(),
obj_user
:
$
(
'#msg-specified-users-text'
).
val
()?
$
(
'#msg-specified-users-text'
).
val
():
'is_to_all'
,
expect_send_time
:
sendTime
?
sendTime
:
''
,
...
...
resources/views/message/addtemplate.blade.php
View file @
86ebc545
...
...
@@ -239,9 +239,30 @@
<div
role=
"tabpanel"
class=
"tab-pane fade"
id=
"wechat-notify"
>
<input
type=
"hidden"
id=
"wechatnotify-chn-tpl-id"
value=
"{{ $wechatNotify_chn_tpl_id }}"
>
<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>
微信模板
ID
:
</label>
<div
class=
"col-sm-3"
>
<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>
<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
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
>
微信模板头:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify-tpl-head"
class=
"form-control"
placeholder=
"请输入微信模板头"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_head'] }}" @endif>
</div>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
>
微信模板尾:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify-tpl-tail"
class=
"form-control"
placeholder=
"请输入微信模板尾"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_tail'] }}" @endif>
</div>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
>
跳转URL:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify-tpl-url"
class=
"form-control"
placeholder=
"请输入跳转URL"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->url }}" @endif>
</div>
</div>
</div>
...
...
@@ -254,7 +275,7 @@
{{--外部统一提交按钮--}}
<div
class=
"col-sm-10"
style=
"margin-top: 40px"
>
<div
align=
"center"
>
<button
class=
"btn btn-primary"
id=
"msg
_tpl_
submit"
>
提交
</button>
<button
class=
"btn btn-primary"
id=
"msg
-tpl-
submit"
>
提交
</button>
</div>
</div>
...
...
resources/views/message/sendmanualmessage.blade.php
View file @
86ebc545
...
...
@@ -248,9 +248,30 @@
{{--微信通知--}}
<div
role=
"tabpanel"
class=
"tab-pane fade"
id=
"wechat-notify"
>
<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>
微信模板
ID
:
</label>
<div
class=
"col-sm-3"
>
<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 >
<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
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
>
微信模板头:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify-tpl-head"
class=
"form-control"
placeholder=
"请输入微信模板头"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_head'] }}" @endif>
</div>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
>
微信模板尾:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify-tpl-tail"
class=
"form-control"
placeholder=
"请输入微信模板尾"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_tail'] }}" @endif>
</div>
</div>
<div
class=
"col-sm-10 form-inline"
style=
"margin-top: 40px"
>
<label
class=
"col-sm-2 control-label"
>
跳转URL:
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
id=
"wechat-notify-tpl-url"
class=
"form-control"
placeholder=
"请输入跳转URL"
value=
@if(!empty($info-
>
channel_tpls['4'])) "{{ $info->channel_tpls['4']->url }}" @endif>
</div>
</div>
</div>
...
...
@@ -289,7 +310,7 @@
{{--外部统一提交按钮--}}
<div
class=
"col-sm-10"
style=
"margin-top: 40px"
>
<div
align=
"center"
>
<button
class=
"btn btn-primary"
id=
"msg
_tpl_
submit"
>
提交发送
</button>
<button
class=
"btn btn-primary"
id=
"msg
-tpl-
submit"
>
提交发送
</button>
</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