12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace Act\Lib;
- use Dever;
- class Share
- {
- # 获取某个用户在某个图文的分享回流数
- public function getRefluxNum($uid, $id, $type)
- {
- $where['source_uid'] = $uid;
- $where['type'] = $type;
- $where['data_id'] = $id;
- return Dever::db('act/share_reflux')->total($where);
- }
- # 提交分享
- public function submit($uid, $id, $type)
- {
- $where['uid'] = $uid;
- $where['data_id'] = $id;
- $where['type'] = $type;
- $info = Dever::db('act/share')->one($where);
- if (!$info) {
- $where['num'] = 1;
- Dever::db('act/share')->insert($where);
- } else {
- $where['num'] = $info['num'] + 1;
- $where['where_id'] = $info['id'];
- Dever::db('act/share')->update($where);
- }
- return true;
- }
- # 回流
- public function submit_reflux($source_uid, $uid, $id, $type)
- {
- $where['source_uid'] = $source_uid;
- $where['uid'] = $uid;
- $where['data_id'] = $id;
- $where['type'] = $type;
- $info = Dever::db('act/share_reflux')->one($where);
- if (!$info) {
- Dever::db('act/share_reflux')->insert($where);
- return true;
- }
- return false;
- }
- }
|