67 lines
2.3 KiB
PHP
67 lines
2.3 KiB
PHP
<?php
|
|
namespace app\mp\controller;
|
|
use app\mp\model\QqminCode;
|
|
use app\Controller;
|
|
use EasyWeChat\OpenPlatform\Auth\VerifyTicket;
|
|
use think\facade\Cache;
|
|
|
|
class Index extends Controller
|
|
{
|
|
//接入事件
|
|
public function Index(){
|
|
$id=input('id',0);
|
|
$appid=input('appid','');
|
|
$wechat_model = new \addon\wxoplatform\model\Oplatform($id,$appid);
|
|
if(in_array($appid,['wx570bc396a51b8ff8','wxd101a85aa106f53e'])){
|
|
$wechat_model->openCheck($appid,$id);
|
|
}else{
|
|
// file_put_contents(app()->getRuntimePath().'log/'.$appid.'_'.time().'.txt', '------'.json_encode($postStr).'-------'.request()->url());
|
|
// $wechat_model->MsgEvent($appid,$id);
|
|
$wechat_model->message($appid);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 授权事件
|
|
*/
|
|
public function ticket(){
|
|
$weapp_model = new \addon\wxoplatform\model\Oplatform();
|
|
// $postStr = file_get_contents("php://input");
|
|
// $postStr =request()->getInput();
|
|
// var_dump(request()->url());die;
|
|
// file_put_contents(root_path().'runtime/log/'.time().'TTT.TXT', $postStr.'-------------'.request()->url());
|
|
// file_put_contents(app()->getRuntimePath().'log/'.date('YmdHis',time()).'ticket.txt', $postStr.'-------------'.request()->url());
|
|
return $weapp_model->server()->send();
|
|
}
|
|
|
|
public function test(){
|
|
$weapp_model = new \addon\wxoplatform\model\Oplatform();
|
|
$verify_ticket = new VerifyTicket($weapp_model->app);
|
|
|
|
var_dump(Cache::get('ComponentVerifyTicket'));
|
|
$verify_ticket->setTicket('ticket@@@JhyXMjGomvGgquyu7o16slQcvjeNRzqum6YQSKHi0nev9BNJHRPFrk7WN0wGCNU1A3ldtAuaCe7OZVhKrXXvtg');
|
|
|
|
var_dump($verify_ticket->getCache()->get('easywechat.open_platform.verify_ticket.wx5a0154894cdbf490'));
|
|
}
|
|
|
|
/**
|
|
* QQ推送事件
|
|
*/
|
|
public function qticket(){
|
|
// $postStr = file_get_contents("php://input");
|
|
// file_put_contents(app()->getRuntimePath().'log/'.time().'qqticket.txt',$postStr .'------'.json_encode(input('')));
|
|
$qq_modle=new QqminCode();
|
|
return $qq_modle->ticket();
|
|
}
|
|
|
|
|
|
/***
|
|
* QQ事件消息
|
|
*/
|
|
public function qqevent(){
|
|
$postStr = file_get_contents("php://input");
|
|
file_put_contents(app()->getRuntimePath().'log/'.time().'qqevent.txt',$postStr .'------'.json_encode(input('')));
|
|
}
|
|
|
|
}
|