1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Http\Logic;
- use App\Http\Utils\LoggerFactoryUtil;
- use App\Http\Utils\WechatAccountUtil;
- class WechatLogic extends BaseLogic
- {
- /**
- * 校验微信服务器
- */
- public static function checkServerlogic($code)
- {
- $app = WechatAccountUtil::getApp($code);
- $instance = new LoggerFactoryUtil(WechatLogic::class);
- $app->server->push(function ($message)use ($instance,$app,$code) {
- $instance->info("信息:".json_encode($message));
- switch ($message['MsgType']) {
- case 'event'://事件
- return "欢迎关注";
- break;
- case 'text'://文字
- break;
- case 'image'://图片
- break;
- case 'voice'://语音
- break;
- case 'video'://视频
- break;
- case 'location'://坐标
- break;
- case 'link'://链接
- break;
- case 'file'://文件
- // ... 其它消息
- default:
- break;
- }
- });
- $response = $app->server->serve();
- return $response;
- }
- }
|