UserController.class.php 870 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. use User\Model\UserModel;
  5. use User\Model\SkillModel;
  6. class UserController extends Controller{
  7. private $userModel, $skillModel;
  8. public function __construct(){
  9. $this->userModel = new UserModel();
  10. $this->skillModel = new SkillModel();
  11. }
  12. public function login(){
  13. $data = decode($_POST);
  14. $info = $this->userModel->loginByUid($data['u']);
  15. $info['skill'] = $this->skillModel->getUserSkill($info['i']);
  16. $this->ajaxReturn($info);
  17. }
  18. public function getskill(){
  19. $data = decode($_POST);
  20. $info = $this->skillModel->getSkillById($data['i']);
  21. return $this->ajaxReturn($info);
  22. }
  23. public function addskill(){
  24. $data = decode($_POST);
  25. $info = $this->skillModel->addUserSkill($data['u'], $data['s']);
  26. return $this->ajaxReturn($info);
  27. }
  28. }