User.php 1013 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Author: luzheng.liu
  4. * Time: 2020/12/5 17:15
  5. */
  6. namespace app\index\controller;
  7. use app\common\service\CommonService;
  8. use app\index\BaseController;
  9. use app\index\exception\ApiException;
  10. use think\facade\Session;
  11. class User extends BaseController {
  12. public function login() {
  13. $channelId = input('channelId');
  14. if (empty($channelId)){
  15. throw new ApiException('渠道id不为空');
  16. }
  17. $params = [
  18. 'id' => $channelId,
  19. 'userid' => input('unionid'),
  20. 'name' => input('nickName'),
  21. 'avatar' => input('avatar'),
  22. 'key' => md5(input('unionid').CommonService::getSetData($channelId)['channel_auth_code'])
  23. ];
  24. Session::set('wxId',input('unionid'));
  25. header('Location:http://mudu.tv/activity.php?a=userAssign&'.http_build_query($params));
  26. }
  27. public function clearSession() {
  28. var_dump($_SESSION);
  29. Session::clear();
  30. var_dump($_SESSION);
  31. }
  32. }