当前位置:首页 » 文件管理 » 怎样不重复推送同样内容
扩展阅读
可以驯化动物原始人游戏 2025-05-18 04:06:20
qq里可以打字的图片 2025-05-18 03:53:44

怎样不重复推送同样内容

发布时间: 2023-02-10 07:10:12

A. 不推送重复的数据

做一个标记,可以在那张表中设置一个字段,值为是否推送。或者新建一张表然后记录下推送过的数据。这样在查询的时候就可以使用
select *from table_name t where t.name like '%张%' and t.ispushtoserver='false'等

B. 苹果手机微信来重复消息怎样不重复显示消息

苹果手机微信来重复消息,就是因为别人给你发送了消息你才会有显示,不想接收可以把这个发送人拉黑。

C. 华为浏览器推送短视频是重复

华为浏览器推送短视频是重复这样设置:
1、打开手机,点击进入“设置”。
2、在设置中选择“存储”,点击进入。
3、在存储中点击打开“清理加速”。
4、在清理加速里面点击“重复文件”后面的“去清理”。
5、保留重复文件其中的一个,其余的全部勾选,最后点击最下方的“删除”即可完成。

D. php 怎么让极光推送消息不重复

<?php

/**

* 极光推送

*/

class jpush {

private $_masterSecret = '';

private $_appkeys = '';

/**

* 构造函数

* @param string $username

* @param string $password

* @param string $appkeys

*/

function __construct($masterSecret = '',$appkeys = '') {

$this->_masterSecret = $masterSecret;

$this->_appkeys = $appkeys;

}

/**

* 模拟post进行url请求

* @param string $url

* @param string $param

*/

function request_post($url="",$param="",$header="") {

if (empty($url) || empty($param)) {

return false;

}

$postUrl = $url;

$curlPost = $param;

$ch = curl_init();//初始化curl

curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页

curl_setopt($ch, CURLOPT_HEADER, 0);//设置header

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上

curl_setopt($ch, CURLOPT_POST, 1);//post提交方式

curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);

curl_setopt($ch, CURLOPT_HTTPHEADER,$header);

// 增加 HTTP Header(头)里的字段

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

// 终止从服务端进行验证

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

$data = curl_exec($ch);//运行curl

curl_close($ch);

return $data;

}

/* $receiver 接收者的信息

all 字符串 该产品下面的所有用户. 对app_key下的所有用户推送消息

tag(20个)Array标签组(并集): tag=>array('昆明','北京','曲靖','上海');

tag_and(20个)Array标签组(交集): tag_and=>array('广州','女');

alias(1000)Array别名(并集): alias=>array('93d78b73611d886a74*****88497f501','606d05090896228f66ae10d1*****310');

registration_id(1000)注册ID设备标识(并集): registration_id=>array('20effc071de0b45c1a**********');

*/

//$content 推送的内容。

//$extras 附加字段

//$m_time 保存离线时间的秒数默认为一天(可不传)单位为秒

//$message_type消息类型,0消息,1通知

public function pushMessage($title='',$message='',$receiver='all',$message_type=0,$extras=array(),$m_time='86400',$platform='all'){

$url = 'https://api.jpush.cn/v3/push';

$base64=base64_encode("$this->_appkeys:$this->_masterSecret");

$header=array("Authorization:Basic $base64","Content-Type:application/json");

$data = array();

$data['platform'] = $platform; //目标用户终端手机的平台类型android,ios,winphone

$data['audience'] = $receiver; //目标用户

if($message_type == 1){

$data['notification'] = array(

//统一的模式--标准模式

"alert"=>$message,

//安卓自定义

"android"=>array(

"alert"=>$message,

"title"=>$title,

"builder_id"=>1,

"extras"=> $extras

),

//ios的自定义

"ios"=>array(

// "alert"=>$content,

"badge"=>"1",

"sound"=>"default",

// "extras"=>array("type"=>$m_type, "txt"=>$m_txt)

),

);

}else{

//苹果自定义---为了弹出值方便调测

$data['message'] = array(

"title"=> $title,

"msg_content" =>$message,

"extras"=>$extras

);

}

//附加选项

$data['options'] = array(

"sendno"=>time(),

"time_to_live"=>$m_time, //保存离线时间的秒数默认为一天

"apns_proction"=>1, //指定 APNS 通知发送环境:0开发环境,1生产环境。

);

$param = json_encode($data);

$res = $this->request_post($url, $param,$header);

if ($res === false) {

return false;

}

$res_arr = json_decode($res, true);

return $res_arr;

}

}

/**

* 使用方法

*/

$appkeys='';

$masterSecret='';

$jpush = new jpush($masterSecret,$appkeys);

$title = '标题';

$message = '消息内容';

$message_type = 0;

$receiver = 'all';//接收者

$extras = array();

$jpush->pushMessage($title,$message,$receiver,$message_type,$extras);