添加后台代理代码

This commit is contained in:
2026-03-15 01:27:05 +08:00
parent 11f9ac4dc1
commit ea08c9366a
5254 changed files with 721042 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,46 @@
在做微信开发时有时需要判断用户是否已关注公众号,以便于做出不同的回应,如提醒用户关注公众号等。
判断用户是否已关注公众号可能通过获取用户信息来操作。
如果已关注公众号那么微信返回的JSON数据包会包含”subscribe”: 1这样的信息。
如果未关注公众号那么微信返回的JSON数据包会包含”subscribe”: 0这样的信息。
开发者可通过OpenID到http GET请求方式调用接口来获取用户基本信息。
请求示例:
https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
参数:
参数 是否必须 说明
access_token 是 调用接口凭证
openid 是 普通用户的标识,对当前公众号唯一
lang 否 返回国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
以下是PHP来判断用户是否已关注公众号的示例
function verification($openid,$accestoken){
$url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$accestoken.'&openid='.$openid.'&lang=zh_CN';
$json_Wxuser=json_decode(curlGet($url),true);
//获取用户信息后判断subcribe == 0 那么就是未关注
if(isset($json_Wxuser['subscribe']) && $json_Wxuser['subscribe'] == 0){
//跳转到提示用户关注页面中
$this->redirect('Guanzhu/index', array('id' => $id), 0, '页面跳转中...');
}
}
function curlGet($url){
$ch = curl_init();
$header = "Accept-Charset: utf-8";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$temp = curl_exec($ch);
return $temp;
}

View File

@@ -0,0 +1,18 @@
红包接口:
请求地址https://api.tscce.cn/api/newpay/sendredpack
请求类型post
请求参数:
appid: appid
devkey: 开发者key
sid: 登录sid
scode: scode
orderid: 订单号
fee: 红包金额单位分1元起步
wishing: 红包祝福语
act_name: 活动名称
remark: 备注
send_type: 红包类型1微信2支付宝
version: 版本号1
https://api.tscce.cn/api/newpay/sendredpack?appid=14936872341446&devkey=14915485974028&sid=YzT0CfCcZgqQV1dG0dZ77GR17d1R1Dqf&scode=005e15ed67176af569d6a170ef3981fa&orderid=1&fee=100&wishing=红包祝福语&act_name=活动名称&remark=备注&send_type=1&version=1

Binary file not shown.