Index.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Author: luzheng.liu
  4. * Time: 2020/12/5 17:55
  5. */
  6. namespace app\index\controller;
  7. use app\common\service\CommonService;
  8. use think\facade\Session;
  9. class Index {
  10. public function index() {
  11. $visitorId = input('visitorId');
  12. $notifyUrl = input('notify_url');
  13. $channelId = input('channelId');
  14. $data = CommonService::getSetData($channelId);
  15. if (empty(Session::get('wxId'))){
  16. header("Location:".CommonService::getAuthUrl($channelId));
  17. die();
  18. }
  19. //增加客户自己的验证逻辑,例如登录,关注,付费,填手机号等
  20. $key = md5($visitorId.$data['channel_auth_code']);
  21. if(strpos($notifyUrl,'?') !== false){//url参数处理,将key加到url参数中
  22. $returnUrl = $notifyUrl."&key=".$key."&expire=3600";
  23. }else{
  24. $returnUrl = $notifyUrl."?key=".$key."&expire=3600";
  25. }
  26. header("Location:".$returnUrl);//跳转到直播观看页
  27. // redirect($returnUrl);
  28. }
  29. }