Operational.php
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace app\admin\controller;
use think\Db;
use think\facade\Request;
class Operational extends Common
{
/********************************可发送消息列表*******************************/
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) {
$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'],'count'=>intval($total),'rel'=>1];
}
$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();
}
}