profile.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. Doo::loadModel('uprofile');
  3. class Profile
  4. {
  5. private $uprofile;
  6. public function __construct()
  7. {
  8. $this->uprofile = new Uprofile();
  9. }
  10. public function insertProfile($intp = array())
  11. {
  12. if (!isset($intp['userid']))
  13. return FALSE;
  14. $this->uprofile->userid = filter_var($intp['userid'], FILTER_VALIDATE_INT);
  15. $this->uprofile->name = filter_var($intp['realname'], FILTER_SANITIZE_STRING);
  16. $this->uprofile->company = filter_var($intp['company'], FILTER_SANITIZE_STRING);
  17. $this->uprofile->jobs = filter_var($intp['jobs'], FILTER_SANITIZE_STRING);
  18. $this->uprofile->remark = filter_var($intp['remark'], FILTER_SANITIZE_STRING);
  19. $this->uprofile->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
  20. // $this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
  21. if (isset($intp['qq']))
  22. $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
  23. $this->uprofile->groups = 'vip';
  24. return $this->uprofile->insert();
  25. }
  26. public function getProWithUid($userid = 0)
  27. {
  28. if (!isset($userid))
  29. return FALSE;
  30. return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
  31. }
  32. public function getVerifiedMobile($userid = 0)
  33. {
  34. if (!isset($userid))
  35. return FALSE;
  36. return $this->uprofile->getOne(array('where' => 'userid=? and isnotice=1', 'param' => array($userid), 'asArray' => TRUE));
  37. }
  38. public function setAvatar($userid = 0, $avaurl)
  39. {
  40. if (!isset($userid))
  41. return FALSE;
  42. $this->uprofile->avatar = $avaurl;
  43. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  44. }
  45. public function setSignPath($userid = 0, $avaurl)
  46. {
  47. if (!isset($userid))
  48. return FALSE;
  49. $this->uprofile->signpath = $avaurl;
  50. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  51. }
  52. public function upProfile($userid, $proArray)
  53. {
  54. $this->uprofile->name = $proArray['name'];
  55. $this->uprofile->company = $proArray['company'];
  56. $this->uprofile->jobs = $proArray['jobs'];
  57. $this->uprofile->remark = $proArray['remark'];
  58. $this->uprofile->phone = $proArray['phone'];
  59. $this->uprofile->mobile = $proArray['mobile'];
  60. if (isset($proArray['qq']) && $proArray['qq'])
  61. $this->uprofile->qq = $proArray['qq'];
  62. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  63. }
  64. public function updateMobile($userid, $mobile)
  65. {
  66. $this->uprofile->mobile = $mobile;
  67. $this->uprofile->isnotice = 1;
  68. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  69. }
  70. public function checkMobile($number)
  71. {
  72. return $this->uprofile->count(array('where' => 'mobile=?', 'param' => array($number), 'asArray' => TRUE));
  73. }
  74. }
  75. ?>