12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace Act\Lib;
- use Dever;
- class Invite
- {
- # 获取小刊的邀请排行
- public function getList($uid, $id, $type = 4, $num = false)
- {
- $where['source_uid'] = $uid;
- $where['type'] = $type;
- $where['data_id'] = $id;
- if ($num > 0) {
- $where['page'] = array(6, 'list');
- }
- $where['avatar'] = 'null';
- $data = Dever::db('act/invite')->getAll($where);
- /*
- if ($data) {
- foreach ($data as $k => $v) {
- $user = Dever::load('passport/api')->info($v['uid']);
- $data[$k]['username'] = $user['username'];
- $data[$k]['avatar'] = $user['avatar'];
- }
- }
- */
- return $data;
- }
- # 获取小刊的邀请数量
- public function getTotal($uid, $id, $type = 4)
- {
- $where['source_uid'] = $uid;
- $where['type'] = $type;
- $where['data_id'] = $id;
- $data = Dever::db('act/invite')->total($where);
- return $data;
- }
- public function submit($source_uid, $uid, $id, $type = 4)
- {
- $where['source_uid'] = $source_uid;
- $where['uid'] = $uid;
- $where['data_id'] = $id;
- $where['type'] = $type;
- $table = 'act/invite';
- $info = Dever::db($table)->one($where);
- if (!$info) {
- Dever::db($table)->insert($where);
- }
- return true;
- }
- }
|