App/Wap/Controller/WxapiController.class.php
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Wap\Controller;
use Think\Controller;
use Think\Model;
class WxapiController extends Controller{
public function _initialize(){
}
public function index(){
header("Content-Type:text/html; charset=utf-8");
$weixin1=M('weixin')->getById(I('get.id'));
define("TOKEN",$weixin1['token']);
define('DEBUG', true);
$weixin =new \Org\Util\Wxapilib(TOKEN,DEBUG); //实例化
$weixin->valid();
$weixin->getMsg();
$type = $weixin->msgtype;//消息类型
$username = $weixin->msg['FromUserName'];
$weixinuserm=M(tablecopy('wxuser',$weixin1['id']));
$weixinuser=$weixinuserm->getByWx($username);
$sg=0;
if($weixinuser){
$sg=1;
}else{
$sg=0;
$updata=array('wx'=>$username,'partner_id'=>$weixin1['id'],'wxtime'=>time(),'address'=>getClientIp());
$wx_id = $weixinuserm->add($updata);
$weixinuser=$weixinuserm->getById($wx_id);
}
$url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='.D('Admin', 'Service')->getAccessToken($weixin1['id'],$weixin1).'&openid='.$username.'&lang=zh_CN';
$userinfo = cohttps_request($url);
$userinfo = json_decode($userinfo, true);
$uparray=array('id'=>$weixinuser['id'], 'name'=>$userinfo['nickname'],'pic'=>$userinfo['headimgurl'],'address'=>$userinfo['province'].$userinfo['city'],'sex'=>$userinfo['sex'],'hqxxzt' =>'1','wxtime'=>time());
$weixinuserm->save($uparray);
if($type==='event'){
if(($weixin->msg['Event']=='SCAN')||($weixin->msg['Event']=='subscribe'&&$weixin->msg['EventKey'])){
// 'qrscene_'.'110000'
if($weixin->msg['Event']=='SCAN'){
$EventKey=intval($weixin->msg['EventKey']);
}else{
$EventKey=intval(substr($weixin->msg['EventKey'],8));
}
if($EventKey>100000){
$hongbao=M('hongbao')->getByScene_id($EventKey);
if($hongbao['openid']==$username&&$hongbao['status']==3){
$token='oLEr3jkOAr4qKpZu';
$nonce=time();
$tmpArr = array($token, $hongbao['openid'], $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$signature=$tmpStr = sha1( $tmpStr );
$url = "http://demo.0766city.com/diyapi/hongbao/index.php?yzstr=".$signature."&nonce=".$nonce."&openid=".$hongbao['openid']."&weixinid=".$hongbao['weixinid']."&id=".$hongbao['id'];
$hongbao_json = cohttps_request($url);
$hongbao_array = json_decode($hongbao_json, true);
}
}
}else if($weixin->msg['Event']=='subscribe'){
后面还有 183 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。