Index.php 948 B

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