oauthModel.php 766 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class reimplat_oauthClassModel extends reimplatModel
  3. {
  4. public function login()
  5. {
  6. $platsign = $this->rock->session('platsign');
  7. if(isempt($platsign))return returnerror('无效登录');
  8. $url = $this->geturl('openoauth','oauthinfo', array(
  9. 'platsign' => $platsign
  10. ));
  11. $result = c('curl')->getcurl($url);
  12. $barr = $this->recordchu($result);
  13. if(!$barr['success'])return $barr;
  14. $info = $barr['data']['userinfo'];
  15. $user = $info['user'];
  16. $usr = m('admin')->getone("`status`=1 and `user`='$user'");
  17. if(!$usr)return returnerror('oa上用户不存在');
  18. c('cache')->set('login'.$usr['user'].'', $usr['id'], 60);
  19. return returnsuccess(array(
  20. 'user' => $user,
  21. 'pass' => md5($usr['pass'])
  22. ));
  23. }
  24. }
粤ICP备19079148号