Toggle navigation
This project
Loading...
Sign in
najixian
/
xt_dc_admin
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Download as
Email Patches
Plain Diff
Browse Files
Commit
769d849d36a1d56b56c230ec433392682b5d589d
Authored by
teemitop
2019-03-12 11:40:35 +0800
1 parent
90bc3030
build: skipped
运营消息推送
Changes
2
Builds
0
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
67 deletions
application/admin/controller/Operational.php
application/admin/view/operational/messagelist.html
application/admin/controller/Operational.php
View file @
769d849
...
...
@@ -5,21 +5,43 @@ use think\facade\Request;
class
Operational
extends
Common
{
/********************************可发送消息列表*******************************/
//打印机型号列表
public
function
messagelist
(
$sys_id
=
1
){
if
(
Request
::
isAjax
())
{
$list
=
file_get_contents
(
ON_LINE
.
'App.Prints.QueryPrintsList'
);
public
function
messagelist
(){
if
(
Request
::
isAjax
()){
$data
=
Request
::
except
(
'file'
);
$key
=
input
(
'post.key'
)
?
input
(
'post.key'
)
:
""
;
$channel
=
@
$key
[
'channel'
]
?
@
$key
[
'channel'
]
:
1
;
$role
=
@
$key
[
'role'
]
?
@
$key
[
'role'
]
:
''
;
$limit
=
'&offset='
.
$data
[
"page"
]
.
'&size='
.
$data
[
"limit"
]
.
'&keywords='
.@
$key
[
'id'
]
.
'&channel='
.
$channel
.
'&role='
.
$role
;
$list
=
file_get_contents
(
ON_LINE
.
'App.Message.GetFormidList'
.
$limit
);
$array
=
json_decode
(
$list
,
TRUE
);
$total
=
$array
[
'data'
][
'total'
];
unset
(
$array
[
'data'
][
'total'
]);
foreach
(
$array
[
'data'
]
as
$key
=>
$value
)
{
if
(
$value
[
'type'
]
==
1
)
$array
[
'data'
][
$key
][
'type'
]
=
'50'
;
elseif
(
$value
[
'type'
]
==
2
)
$array
[
'data'
][
$key
][
'type'
]
=
'80'
;
$array
[
'data'
][
$key
][
'cdate'
]
=
date
(
'Y-m-d H:i:s'
,
$value
[
'cdate'
]);
$array
[
'data'
][
$key
][
'sellerinfo'
]
=
$value
[
'id'
]
.
'-'
.
$value
[
'sellername'
];
$array
[
'data'
][
$key
][
'expire_in'
]
=
$value
[
'expire_in'
]
?
date
(
'Y-m-d H:i:s'
,
$value
[
'expire_in'
])
:
''
;
$array
[
'data'
][
$key
][
'wx/app'
]
=
$value
[
'wx'
]
.
' / '
.
$value
[
'app'
];
}
return
$result
=
[
'code'
=>
0
,
'msg'
=>
'获取成功!'
,
'data'
=>
$array
[
'data'
],
'rel'
=>
1
];
return
$result
=
[
'code'
=>
0
,
'msg'
=>
'获取成功!'
,
'data'
=>
$array
[
'data'
],
'
count'
=>
intval
(
$total
),
'
rel'
=>
1
];
}
$this
->
assign
(
'title'
,
'打印机型号列表
'
);
$this
->
assign
(
'title'
,
'运营消息推广
'
);
return
$this
->
fetch
();
}
/********************************消息推送*******************************/
public
function
sendmessagelist
(){
if
(
Request
::
isAjax
()){
$data
=
Request
::
except
(
'file'
);
$list
=
file_get_contents
(
ON_LINE
.
'App.Message.SendMessage&openid='
.
json_encode
(
$data
[
'openid'
]));
$array
=
json_decode
(
$list
,
TRUE
);
if
(
$array
[
'ret'
]
==
200
){
$result
[
'code'
]
=
1
;
$result
[
'msg'
]
=
'SUCCESS!'
;
}
else
{
$result
[
'code'
]
=
0
;
$result
[
'msg'
]
=
'请求错误!'
;
}
return
$result
;
}
return
view
();
}
}
...
...
application/admin/view/operational/messagelist.html
View file @
769d849
{include file="common/head"/}
<form
class=
"layui-form layui-form-pane"
>
<div
class=
"admin-main layui-anim layui-anim-upbit"
>
<fieldset
class=
"layui-elem-field layui-field-title"
>
<legend>
{:$title}
</legend>
</fieldset>
<div
class=
"demoTable"
>
商家:
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
name=
"key"
id=
"key"
placeholder=
"{:lang('pleaseEnter')}店铺名称"
autocomplete=
"off"
>
</div>
给谁发:
<div
class=
"layui-input-inline"
>
<input
type=
"checkbox"
name=
"role[write]"
lay-skin=
"primary"
title=
"客户经理"
>
<input
type=
"checkbox"
name=
"role[read]"
lay-skin=
"primary"
title=
"老板"
>
<input
type=
"checkbox"
name=
"role[game]"
lay-skin=
"primary"
title=
"前台"
>
<div
class=
"layui-form"
>
搜索商家:
<div
class=
"layui-inline"
>
<input
class=
"layui-input"
name=
"key"
id=
"key"
placeholder=
"{:lang('pleaseEnter')}店铺名称"
autocomplete=
"off"
>
</div>
角色选择:
<div
class=
"layui-inline"
>
<input
type=
"checkbox"
name=
"role[1]"
value=
'管理员'
title=
"管理员"
>
<input
type=
"checkbox"
name=
"role[2]"
value=
"店长"
title=
"店长"
>
<input
type=
"checkbox"
name=
"role[3]"
value=
"收银员"
title=
"收银员"
>
<input
type=
"checkbox"
name=
"role[4]"
value=
"服务员"
title=
"服务员"
>
<input
type=
"checkbox"
name=
"role[5]"
value=
"客户经理"
title=
"客户经理"
>
</div>
商家来源:
商家来源:
<div
class=
"layui-input-inline layui-form"
>
<div
class=
"layui-input-8"
>
<select
name=
"class"
id=
"channel"
lay-filter=
"myselect"
>
...
...
@@ -25,75 +27,112 @@
</select>
</div>
</div>
<button
class=
"layui-btn"
id=
"search"
data-type=
"reload"
>
查询统计
</button>
<button
class=
"layui-btn"
id=
"search"
data-type=
"reload"
>
搜索
</button>
</div>
</div>
<table
class=
"layui-table"
id=
"list"
lay-filter=
"list"
>
</table>
<table
class=
"layui-table"
id=
"list"
lay-filter=
"list"
></table>
</div>
</form>
<script
type=
"text/html"
id=
"toolbarDemo"
>
<
div
class
=
"layui-btn-container"
>
<
button
class
=
"layui-btn layui-btn-sm"
lay
-
event
=
"getCheckData"
>
推送消息
<
/button
>
<
/div
>
</script>
{include file="common/foot"/}
<script>
layui
.
use
([
'table'
,
'form'
,
'laydate'
],
function
()
{
var
table
=
layui
.
table
,
laydate
=
layui
.
laydate
,
$
=
layui
.
jquery
;
console
.
log
(
layui
);
layui
.
use
([
'table'
,
'form'
],
function
()
{
var
table
=
layui
.
table
,
$
=
layui
.
jquery
;
var
tableIn
=
table
.
render
({
elem
:
'#list'
,
url
:
'{:url("messagelist")}'
,
toolbar
:
'#toolbarDemo'
,
method
:
'post'
,
title
:
'预定订单统计'
,
page
:
true
,
cols
:
[[
{
checkbox
:
true
,
fixed
:
true
},
{
field
:
'sellername'
,
title
:
'FORMID'
},
{
field
:
'reserve_count_sort'
,
title
:
'OPENID'
},
{
field
:
'reserve_count'
,
title
:
'失效时间'
},
{
field
:
'sms_send_count_sort'
,
title
:
'可发送总数'
},
{
field
:
'sms_send_count'
,
title
:
'ID-商家'
},
{
field
:
'inviting'
,
title
:
'角色'
},
{
field
:
'inviting'
,
title
:
'昵称'
},
{
field
:
'inviting'
,
title
:
'最后预定时间(小程序/电话机)'
},
]],
done
:
function
(
res
,
curr
,
count
){
}
{
field
:
'formid'
,
title
:
'FORMID'
},
{
field
:
'seat_openid'
,
title
:
'OPENID'
},
{
field
:
'expire_in'
,
title
:
'失效时间'
},
{
field
:
'count'
,
align
:
'center'
,
title
:
'可发送总数'
},
{
field
:
'sellerinfo'
,
align
:
'center'
,
title
:
'ID-商家名称'
},
{
field
:
'role_name'
,
align
:
'center'
,
title
:
'角色'
},
{
field
:
'nick_name'
,
align
:
'center'
,
title
:
'昵称'
},
{
field
:
'wx/app'
,
align
:
'center'
,
width
:
300
,
title
:
'最后预定时间(小程序/电话机)'
}
]]
,
id
:
'testReload'
,
page
:
true
,
limit
:
20
,
limit
:
15
});
//日期时间范围
laydate
.
render
({
elem
:
'#time'
,
type
:
'datetime'
,
range
:
true
//头工具栏事件
table
.
on
(
'toolbar(list)'
,
function
(
obj
){
var
checkStatus
=
table
.
checkStatus
(
obj
.
config
.
id
);
switch
(
obj
.
event
){
case
'getCheckData'
:
var
arr
=
[];
var
lists
=
[];
var
data
=
checkStatus
.
data
;
//data = JSON.stringify(data);
console
.
log
(
data
);
console
.
log
(
data
.
length
);
//判断是否选中发送目标
if
(
data
.
length
==
0
){
layer
.
msg
(
'请选择发送目标!'
);
return
;
}
//数据填充
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
){
arr
.
push
(
data
[
i
].
count
);
lists
.
push
(
data
[
i
].
seat_openid
);
}
//判断用户是否可发送
if
(
arr
.
indexOf
(
'0'
)
!=-
1
){
layer
.
msg
(
'该用户可发送记条数为0'
);
return
;
}
//请求后台
layer
.
confirm
(
'确定要推送消息吗?'
,
{
btn
:
[
'确定'
,
'取消'
]
//按钮
},
function
(
index
){
$
.
post
(
"{:url('sendmessagelist')}"
,{
openid
:
lists
},
function
(
res
){
if
(
res
.
code
==
1
){
layer
.
msg
(
res
.
msg
,{
time
:
1000
,
icon
:
1
});
}
else
{
layer
.
msg
(
res
.
msg
,{
time
:
1000
,
icon
:
2
});
}
});
layer
.
close
(
index
);
},
function
(){
layer
.
msg
(
'操作已取消'
,
{});
});
break
;
};
});
//搜索
$
(
'#search'
).
on
(
'click'
,
function
()
{
//关键字
var
key
=
$
(
'#key'
).
val
();
//选中的商家ID
var
checkStatus
=
table
.
checkStatus
(
'testReload'
);
//test即为参数id设定的值
var
a
=
[];
$
(
checkStatus
.
data
).
each
(
function
(
i
,
o
){
a
.
push
(
o
.
id
);
/*if($.trim(key)==='') {
layer.msg('{:lang("pleaseEnter")}店铺名称!',{icon:0});
return;
}*/
var
arr
=
new
Array
();
$
.
each
(
$
(
'input:checkbox:checked'
),
function
(
i
){
arr
[
i
]
=
$
(
this
).
val
();
});
console
.
log
(
a
);
var
time
=
$
(
'#time'
).
val
();
console
.
log
(
time
);
//商家来源
var
channel
=
$
(
'#channel'
).
val
();
console
.
log
(
channel
);
//筛选条件
var
time_type
=
$
(
'#time_type'
).
val
();
console
.
log
(
time_type
);
//传参
tableIn
.
reload
({
page
:
{
page
:
1
},
where
:
{
key
:
key
,
sid
:
a
,
time_type
:
time_type
,
time
:
time
,
channel
:
channel
}});
role
=
arr
.
join
(
","
);
//将数组合并成字符串
tableIn
.
reload
({
page
:
{
page
:
1
},
where
:
{
key
:
key
,
channel
:
$
(
'#channel'
).
val
(),
role
:
role
}});
});
var
$
=
layui
.
$
,
active
=
{
reload
:
function
(){
var
key
=
$
(
'#key'
);
var
key
=
$
(
'#key'
);
var
channel
=
$
(
'#channel'
);
var
arr
=
new
Array
();
$
.
each
(
$
(
'input:checkbox:checked'
),
function
(
i
){
arr
[
i
]
=
$
(
this
).
val
();
});
role
=
arr
.
join
(
","
);
//将数组合并成字符串
//执行重载
table
.
reload
(
'testReload'
,
{
page
:
{
...
...
@@ -101,11 +140,18 @@
}
,
where
:
{
key
:
{
id
:
key
.
val
()
id
:
key
.
val
(),
channel
:
channel
.
val
(),
role
:
role
,
}
}
});
}
};
$
(
'.demoTable .layui-btn'
).
on
(
'click'
,
function
(){
var
type
=
$
(
this
).
data
(
'type'
);
active
[
type
]
?
active
[
type
].
call
(
this
)
:
''
;
});
})
</script>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment