1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /**
- * Author: luzheng.liu
- * Time: 2020/12/5 17:55
- */
- namespace app\index\controller;
- use app\common\service\CommonService;
- use app\index\exception\ApiException;
- use think\facade\Session;
- class Index {
- public function index() {
- $visitorId = input('visitorId');
- $notifyUrl = input('notify_url');
- $channelId = input('channelId');
- if (empty($channelId)){
- throw new ApiException('渠道id不为空');
- }
- var_dump(input());
- Session::set('wxId','');
- var_dump(Session::get('wxId'));
- die();
- $data = CommonService::getSetData($channelId);
- if (empty(Session::get('wxId'))){
- Session::set('visitorId','');
- header("Location:".CommonService::getAuthUrl($channelId));
- die();
- }
- $visitorId = Session::get($visitorId);
- if(empty($visitorId)){
- Session::set('visitorId', $visitorId);
- }
- //增加客户自己的验证逻辑,例如登录,关注,付费,填手机号等
- $key = md5($visitorId.$data['channel_auth_code']);
- if(strpos($notifyUrl,'?') !== false){//url参数处理,将key加到url参数中
- $returnUrl = $notifyUrl."&key=".$key."&expire=3600";
- }else{
- $returnUrl = $notifyUrl."?key=".$key."&expire=3600";
- }
- header("Location:".$returnUrl);//跳转到直播观看页
- // redirect($returnUrl);
- }
- }
|