5,006
社区成员
发帖
与我相关
我的任务
分享
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/data/config.php');
if(isset($_GET['id'])) {
$id = filter($_GET['id']);
}
$sql = "select * from wx_list where stamp='".$id."'";
$rs = mysql_fetch_array(mysql_query($sql));
$user_id = $rs['user_id'];
$sqlid = "select * from wx_user where id='".$user_id."'";
$rsid = mysql_fetch_array(mysql_query($sqlid));
$u_s_time = strtotime (date('Y-m-d'));
$u_e_time = strtotime ($rsid['u_e_time']);
$u_r_time = ceil(($u_e_time - $u_s_time));
if($u_r_time <= 0){
echo '后台不会配置,我可以帮你';
exit;
}
$s_time = strtotime (date('Y-m-d'));
$e_time = strtotime ($rs['e_time']);
$r_time = ceil(($e_time - $s_time));
if($r_time <= 0){
echo '企鹅号三二二零一九二一八三帮你配置';
exit;
}
function get_ticket($code){
// if(preg_match("/^(http:\/\/).*$/",$code)){
// $code = substr(trim($code),5);
// }
//// elseif(preg_match("/^(https:\/\/).*$/",$code)){
// $code = substr(trim($code),6);
// }
// 统一调用微信白名单接口:https://wq.jd.com/mjgj/link/GetOpenLink?callback=getOpenLink&rurl=https://dc2.jd.com/auto.php?service=transfer&type=pms&to=(这里是拼接自己的内容地址比如http://mjbbs.jd.com/data/attachment/forum/201806/08/173526pb2zpjzzooo2ofze.jpg)不会怎么使用的可以找Q(三二二零一九二一八三)
$url ='接口地址'.$code;
$ret = @http_request($url,true);
$ret = json_decode($ret,true);
$ticket = $ret['openlink'];
// return ‘weixin://’;
return $ticket;
}
function http_request($url, $data = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
function rands_ticke($code)
{
$zifuic = explode('+',$code);
$re = array_rand($zifuic);
$weixin = $zifuic[$re];
return $weixin;
}
if(time() - $rs['uptime'] >= 6) {
if($rs['is_weixin']==0)
{
$www_url = get_ticket($rs['www_url']);
}else{
$www_url ='weixin://';
}
$pv = $rs['pv']+1;
mysql_query($sql = "update wx_list set ticket='".$www_url."',pv='".$pv."',uptime='".time()."' where stamp='".$id."'");
} else {
$www_url = $rs['ticket'];
$pv = $rs['pv']+1;
mysql_query($sql = "update wx_list set pv='".$pv."' where stamp='".$id."'");
}
?>