Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
xiaozhan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
xiaozhan
Commits
138e0a4b
Commit
138e0a4b
authored
Mar 16, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
01b7599a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
41 deletions
+43
-41
application/Admin/Controller/PushController.class.php
+43
-41
No files found.
application/Admin/Controller/PushController.class.php
View file @
138e0a4b
...
...
@@ -12,12 +12,12 @@ class PushController extends AdminbaseController {
$map
[
'addtime'
]
=
array
(
"gt"
,
strtotime
(
$_REQUEST
[
'start_time'
]));
$_GET
[
'start_time'
]
=
$_REQUEST
[
'start_time'
];
}
if
(
$_REQUEST
[
'end_time'
]
!=
''
){
$map
[
'addtime'
]
=
array
(
"lt"
,
strtotime
(
$_REQUEST
[
'end_time'
]));
$_GET
[
'end_time'
]
=
$_REQUEST
[
'end_time'
];
}
if
(
$_REQUEST
[
'start_time'
]
!=
''
&&
$_REQUEST
[
'end_time'
]
!=
''
){
$map
[
'addtime'
]
=
array
(
"between"
,
array
(
strtotime
(
$_REQUEST
[
'start_time'
]),
strtotime
(
$_REQUEST
[
'end_time'
])));
$_GET
[
'start_time'
]
=
$_REQUEST
[
'start_time'
];
...
...
@@ -25,10 +25,10 @@ class PushController extends AdminbaseController {
}
if
(
$_REQUEST
[
'keyword'
]
!=
''
){
$map
[
'touid|adminid'
]
=
array
(
"like"
,
"%"
.
$_REQUEST
[
'keyword'
]
.
"%"
);
$map
[
'touid|adminid'
]
=
array
(
"like"
,
"%"
.
$_REQUEST
[
'keyword'
]
.
"%"
);
$_GET
[
'keyword'
]
=
$_REQUEST
[
'keyword'
];
}
}
$Pushrecord
=
M
(
"pushrecord"
);
$count
=
$Pushrecord
->
where
(
$map
)
->
count
();
$page
=
$this
->
page
(
$count
,
20
);
...
...
@@ -42,39 +42,41 @@ class PushController extends AdminbaseController {
$this
->
assign
(
'lists'
,
$lists
);
$this
->
assign
(
'formget'
,
$_GET
);
$this
->
assign
(
"page"
,
$page
->
show
(
'Admin'
));
$this
->
display
();
}
function
del
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
){
$result
=
M
(
"pushrecord"
)
->
delete
(
$id
);
$result
=
M
(
"pushrecord"
)
->
delete
(
$id
);
if
(
$result
){
$action
=
"删除推送信息:
{
$id
}
"
;
setAdminLog
(
$action
);
$this
->
success
(
'删除成功'
);
}
else
{
$this
->
error
(
'删除失败'
);
}
}
else
{
}
}
else
{
$this
->
error
(
'数据传入失败!'
);
}
}
}
}
function
add
(){
$this
->
display
();
}
$this
->
display
();
}
function
add_post
(){
if
(
IS_POST
){
if
(
IS_POST
){
$content
=
str_replace
(
"
\r
"
,
""
,
$_POST
[
'content'
]);
$content
=
str_replace
(
"
\n
"
,
""
,
$content
);
$touid
=
str_replace
(
"
\r
"
,
""
,
$_POST
[
'touid'
]);
$touid
=
str_replace
(
"
\n
"
,
""
,
$touid
);
$touid
=
preg_replace
(
"/,|,/"
,
","
,
$touid
);
var_dump
(
$touid
);
die
;
$Pushrecord
=
M
(
"pushrecord"
);
$Pushrecord
->
create
();
...
...
@@ -83,20 +85,20 @@ class PushController extends AdminbaseController {
if
(
$content
==
''
){
$this
->
error
(
'推送内容不能为空'
);
}
$configpri
=
getConfigPri
();
/* 极光推送 */
$app_key
=
$configpri
[
'jpush_key'
];
$master_secret
=
$configpri
[
'jpush_secret'
];
if
(
!
$app_key
||
!
$master_secret
){
$this
->
error
(
'请先设置推送配置'
);
$this
->
error
(
'请先设置推送配置'
);
}
$issuccess
=
0
;
$error
=
'推送失败'
;
if
(
$app_key
&&
$master_secret
){
require_once
SITE_PATH
.
'api/public/JPush/autoload.php'
;
// 初始化
...
...
@@ -104,7 +106,7 @@ class PushController extends AdminbaseController {
//file_put_contents('./jpush.txt',date('y-m-d h:i:s').'提交参数信息 设备名client2:'.json_encode($client)."\r\n",FILE_APPEND);
//file_put_contents('./jpush.txt',date('y-m-d h:i:s').'提交参数信息 设备名client:'.$client."\r\n",FILE_APPEND);
$anthorinfo
=
array
();
$map
=
array
();
if
(
$touid
!=
''
){
...
...
@@ -116,12 +118,12 @@ class PushController extends AdminbaseController {
->
field
(
"pushid"
)
->
where
(
$map
)
->
select
();
$pushids
=
array_column
(
$pushids
,
'pushid'
);
$pushids
=
array_filter
(
$pushids
);
$nums
=
count
(
$pushids
);
$apns_production
=
false
;
if
(
$configpri
[
'jpush_sandbox'
]){
$apns_production
=
true
;
...
...
@@ -130,7 +132,7 @@ class PushController extends AdminbaseController {
for
(
$i
=
0
;
$i
<
$nums
;){
$alias
=
array_slice
(
$pushids
,
$i
,
900
);
$i
+=
900
;
try
{
try
{
$result
=
$client
->
push
()
->
setPlatform
(
'all'
)
->
addRegistrationId
(
$alias
)
...
...
@@ -161,11 +163,11 @@ class PushController extends AdminbaseController {
}
else
{
$error
=
$result
[
'msg'
];
}
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
file_put_contents
(
'./jpush.txt'
,
date
(
'y-m-d h:i:s'
)
.
'提交参数信息 设备名:'
.
json_encode
(
$alias
)
.
"
\r\n
"
,
FILE_APPEND
);
file_put_contents
(
'./jpush.txt'
,
date
(
'y-m-d h:i:s'
)
.
'提交参数信息:'
.
$e
.
"
\r\n
"
,
FILE_APPEND
);
}
}
}
}
}
/* 极光推送 */
if
(
$issuccess
==
0
){
...
...
@@ -175,7 +177,7 @@ class PushController extends AdminbaseController {
$Pushrecord
->
admin
=
$_SESSION
[
'name'
];
$Pushrecord
->
addtime
=
time
();
$Pushrecord
->
ip
=
ip2long
(
$_SERVER
[
'REMOTE_ADDR'
]);
$result
=
$Pushrecord
->
add
();
$result
=
$Pushrecord
->
add
();
if
(
$result
!==
false
){
$action
=
"推送信息ID:
{
$result
}
"
;
setAdminLog
(
$action
);
...
...
@@ -183,22 +185,22 @@ class PushController extends AdminbaseController {
}
else
{
$this
->
error
(
'推送失败'
);
}
}
}
}
}
function
export
()
{
if
(
$_REQUEST
[
'start_time'
]
!=
''
){
$map
[
'addtime'
]
=
array
(
"gt"
,
strtotime
(
$_REQUEST
[
'start_time'
]));
}
if
(
$_REQUEST
[
'end_time'
]
!=
''
){
}
if
(
$_REQUEST
[
'end_time'
]
!=
''
){
$map
[
'addtime'
]
=
array
(
"lt"
,
strtotime
(
$_REQUEST
[
'end_time'
]));
}
if
(
$_REQUEST
[
'start_time'
]
!=
''
&&
$_REQUEST
[
'end_time'
]
!=
''
){
if
(
$_REQUEST
[
'start_time'
]
!=
''
&&
$_REQUEST
[
'end_time'
]
!=
''
){
$map
[
'addtime'
]
=
array
(
"between"
,
array
(
strtotime
(
$_REQUEST
[
'start_time'
]),
strtotime
(
$_REQUEST
[
'end_time'
])));
}
if
(
$_REQUEST
[
'keyword'
]
!=
''
){
$map
[
'touid|adminid'
]
=
array
(
"like"
,
"%"
.
$_REQUEST
[
'keyword'
]
.
"%"
);
$map
[
'touid|adminid'
]
=
array
(
"like"
,
"%"
.
$_REQUEST
[
'keyword'
]
.
"%"
);
}
$xlsName
=
"Excel"
;
$Pushrecord
=
M
(
"pushrecord"
);
...
...
@@ -208,9 +210,9 @@ class PushController extends AdminbaseController {
if
(
!
$v
[
'touid'
]){
$xlsData
[
$k
][
'touid'
]
=
'所有会员'
;
$xlsData
[
$k
][
'addtime'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'addtime'
]);
}
}
}
$action
=
"导出推送信息:"
.
M
(
"pushrecord"
)
->
getLastSql
();
setAdminLog
(
$action
);
$cellName
=
array
(
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
);
...
...
@@ -224,5 +226,5 @@ class PushController extends AdminbaseController {
);
exportExcel
(
$xlsName
,
$xlsCell
,
$xlsData
,
$cellName
);
}
}
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