|
@@ -14,6 +14,19 @@ class Moment
|
|
|
return $table;
|
|
|
}
|
|
|
|
|
|
+ public function del($uid, $id, $state = 2)
|
|
|
+ {
|
|
|
+ $where['id'] = $id;
|
|
|
+ $where['uid'] = $uid;
|
|
|
+ $info = Dever::db($this->table)->one($where);
|
|
|
+ if ($info) {
|
|
|
+ $update['where_id'] = $id;
|
|
|
+ $update['state'] = $state;
|
|
|
+ Dever::db($this->table)->update($update);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
public function getData($method = 'getAll', $uid, $type = false, $type_id = false, $total = false, $id = false, $times = false, $day = false, $collection_id = false)
|
|
|
{
|
|
|
$where['type'] = $type;
|
|
@@ -68,10 +81,16 @@ class Moment
|
|
|
$where['uid'] = $uid;
|
|
|
$where['type_id'] = $id;
|
|
|
$where['type'] = $type;
|
|
|
- $where['content'] = $content;
|
|
|
+ $where['state'] = 1;
|
|
|
$table = $this->table;
|
|
|
- //$info = Dever::db($table)->one($where);
|
|
|
- $info = false;
|
|
|
+ $info = Dever::db($table)->one($where);
|
|
|
+
|
|
|
+ $where['content'] = $content;
|
|
|
+
|
|
|
+ if ($info) {
|
|
|
+ Dever::alert('已发布过动态,仅能发布一次,可删除旧动态后再添加');
|
|
|
+ }
|
|
|
+ //$info = false;
|
|
|
if ($pic) {
|
|
|
$where['pic'] = $pic;
|
|
|
}
|
|
@@ -107,6 +126,14 @@ class Moment
|
|
|
|
|
|
private function one($uid, $info, $times = false, $collection_id = false)
|
|
|
{
|
|
|
+ # 验证消息是否是自己的
|
|
|
+ $info['me'] = 2;
|
|
|
+ $info['del'] = '';
|
|
|
+ if ($uid == $info['uid']) {
|
|
|
+ $info['me'] = 1;
|
|
|
+ $info['del'] = '删除';
|
|
|
+ $info['del_state'] = 2;
|
|
|
+ }
|
|
|
$key = 30;
|
|
|
$info['pic'] = explode(',', $info['pic']);
|
|
|
$info['user'] = Dever::load('user/lib/info')->get($info['uid'], $collection_id, true);
|
|
@@ -116,9 +143,13 @@ class Moment
|
|
|
# 点赞数
|
|
|
$info['num_up'] = $info['num_up'] + 0;
|
|
|
$info['up_list'] = array();
|
|
|
+ $info['up_list']['user'] = (object) array();
|
|
|
+ $info['up_list']['total'] = 0;
|
|
|
+ $info['up_list_total'] = 0;
|
|
|
if ($info['num_up'] > 0) {
|
|
|
# 批量获取最新的点赞名单
|
|
|
$info['up_list'] = Dever::load('community/lib/up')->getData($info['id'], $key, $collection_id);
|
|
|
+ $info['up_list_total'] = count($info['up_list']['user']);
|
|
|
}
|
|
|
|
|
|
# 反对数
|