Index.php 1.1 KB

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