Invite.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Act\Lib;
  3. use Dever;
  4. class Invite
  5. {
  6. # 获取小刊的邀请排行
  7. public function getList($uid, $id, $type = 4)
  8. {
  9. $where['source_uid'] = $uid;
  10. $where['type'] = $type;
  11. $where['data_id'] = $id;
  12. $data = Dever::db('act/invite')->getAll($where);
  13. if ($data) {
  14. foreach ($data as $k => $v) {
  15. $user = Dever::load('passport/api')->info($v['uid']);
  16. $data[$k]['username'] = $user['username'];
  17. $data[$k]['avatar'] = $user['avatar'];
  18. }
  19. }
  20. return $data;
  21. }
  22. public function submit($source_uid, $uid, $id, $type = 4)
  23. {
  24. $where['source_uid'] = $source_uid;
  25. $where['uid'] = $uid;
  26. $where['data_id'] = $id;
  27. $where['type'] = $type;
  28. $table = 'act/invite';
  29. $info = Dever::db($table)->one($where);
  30. if (!$info) {
  31. Dever::db($table)->insert($where);
  32. }
  33. return true;
  34. }
  35. }