profile.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
  19. // $this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
  20. if (isset($intp['qq']))
  21. $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
  22. $this->uprofile->groups = 'vip';
  23. return $this->uprofile->insert();
  24. }
  25. public function ZGinsertProfile($uid = 0, $realname)
  26. {
  27. if (!isset($uid))
  28. return FALSE;
  29. $this->uprofile->userid = $uid;
  30. $this->uprofile->name = $realname;
  31. $this->uprofile->company = '';
  32. $this->uprofile->jobs = '';
  33. $this->uprofile->phone = '';
  34. $this->uprofile->mobile = '';
  35. $this->uprofile->qq = '';
  36. $this->uprofile->groups = 'vip';
  37. return $this->uprofile->insert();
  38. }
  39. public function getProWithUid($userid = 0)
  40. {
  41. if (!isset($userid))
  42. return FALSE;
  43. return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
  44. }
  45. public function getVerifiedMobile($userid = 0)
  46. {
  47. if (!isset($userid))
  48. return FALSE;
  49. return $this->uprofile->getOne(array('where' => 'userid=? and isnotice=1', 'param' => array($userid), 'asArray' => TRUE));
  50. }
  51. public function setAvatar($userid = 0, $avaurl)
  52. {
  53. if (!isset($userid))
  54. return FALSE;
  55. $this->uprofile->avatar = $avaurl;
  56. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  57. }
  58. public function upProfile($userid, $proArray)
  59. {
  60. $this->uprofile->name = $proArray['name'];
  61. $this->uprofile->company = $proArray['company'];
  62. $this->uprofile->jobs = $proArray['jobs'];
  63. $this->uprofile->phone = $proArray['phone'];
  64. $this->uprofile->mobile = $proArray['mobile'];
  65. if (isset($proArray['qq']) && $proArray['qq'])
  66. $this->uprofile->qq = $proArray['qq'];
  67. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  68. }
  69. public function updateMobile($userid, $mobile)
  70. {
  71. $this->uprofile->mobile = $mobile;
  72. $this->uprofile->isnotice = 1;
  73. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  74. }
  75. public function checkMobile($number)
  76. {
  77. return $this->uprofile->count(array('where' => 'mobile=?', 'param' => array($number), 'asArray' => TRUE));
  78. }
  79. }
  80. ?>