Index.php 1002 B

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. if (empty(Session::get('wxId'))){
  14. header("Location:".CommonService::getAuthUrl());
  15. // redirect(CommonService::getAuthUrl());
  16. die();
  17. }
  18. //增加客户自己的验证逻辑,例如登录,关注,付费,填手机号等
  19. $key = md5($visitorId.CommonService::getSetData()['channel_auth_code']);
  20. if(strpos($notifyUrl,'?') !== false){//url参数处理,将key加到url参数中
  21. $returnUrl = $notifyUrl."&key=".$key."&expire=3600";
  22. }else{
  23. $returnUrl = $notifyUrl."?key=".$key."&expire=3600";
  24. }
  25. header("Location:".$returnUrl);//跳转到直播观看页
  26. // redirect($returnUrl);
  27. }
  28. }