Index.php 919 B

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