Index.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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. redirect(CommonService::getAuthUrl());
  15. die();
  16. }
  17. //增加客户自己的验证逻辑,例如登录,关注,付费,填手机号等
  18. $key = md5($visitorId.CommonService::getSetData()['channel_auth_code']);
  19. var_dump($key);
  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. var_dump($returnUrl);
  26. die();
  27. // header("Location:".$returnUrl);//跳转到直播观看页
  28. // redirect($returnUrl);
  29. }
  30. }