|
@@ -12,7 +12,7 @@ class Info
|
|
return $table;
|
|
return $table;
|
|
}
|
|
}
|
|
|
|
|
|
- public function getData($method = 'getAll', $uid, $cate_id = false, $type = false, $type_id = false, $total = false, $id = false, $times = false, $day = false)
|
|
|
|
|
|
+ public function getData($method = 'getAll', $uid, $cate_id = false, $type = false, $type_id = false, $total = false, $id = false, $times = false, $day = false, $collection_id = false)
|
|
{
|
|
{
|
|
# 获取分类下的帖子
|
|
# 获取分类下的帖子
|
|
$where['cate_id'] = $cate_id;
|
|
$where['cate_id'] = $cate_id;
|
|
@@ -34,12 +34,9 @@ class Info
|
|
$data['total'] = Dever::db('community/info')->getTotal($where);
|
|
$data['total'] = Dever::db('community/info')->getTotal($where);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if ($times && $times > 0) {
|
|
|
|
- $times = Dever::db('collection/times')->one($times);
|
|
|
|
- }
|
|
|
|
if ($data['info']) {
|
|
if ($data['info']) {
|
|
foreach ($data['info'] as $k => $v) {
|
|
foreach ($data['info'] as $k => $v) {
|
|
- $data['info'][$k] = $this->one($uid, $v, $times);
|
|
|
|
|
|
+ $data['info'][$k] = $this->one($uid, $v, $times, $collection_id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -66,7 +63,7 @@ class Info
|
|
}
|
|
}
|
|
|
|
|
|
# 发表信息
|
|
# 发表信息
|
|
- public function submit($uid, $cate_id, $id, $type, $pic, $content, $to_id, $to_uid, $day = false)
|
|
|
|
|
|
+ public function submit($uid, $cate_id, $id, $type, $pic, $content, $to_id, $to_uid, $day = false, $score_type = false, $score_type_id = false)
|
|
{
|
|
{
|
|
$where['uid'] = $uid;
|
|
$where['uid'] = $uid;
|
|
$where['cate_id'] = $cate_id;
|
|
$where['cate_id'] = $cate_id;
|
|
@@ -97,7 +94,18 @@ class Info
|
|
|
|
|
|
Dever::db($table)->insert($where);
|
|
Dever::db($table)->insert($where);
|
|
|
|
|
|
- Dever::score($uid, 'submit_community', '发表帖子');
|
|
|
|
|
|
+ if ($to_uid && $to_uid != $uid) {
|
|
|
|
+ Dever::score($uid, 'reply_community', '回复帖子', false, false, false, $score_type, $score_type_id);
|
|
|
|
+
|
|
|
|
+ Dever::score($to_uid, 'reply_me_community', '被回复帖子', false, false, false, $score_type, $score_type_id);
|
|
|
|
+
|
|
|
|
+ # 建立聊天相关信息
|
|
|
|
+ Dever::load('community/lib/chat')->add($uid, $to_uid, $score_type_id, $content, $pic, $day);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ Dever::score($uid, 'submit_community', '发表帖子', false, false, false, $score_type, $score_type_id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
# 更新评论数
|
|
# 更新评论数
|
|
/*
|
|
/*
|
|
@@ -114,27 +122,12 @@ class Info
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- private function one($uid, $info, $times = false)
|
|
|
|
|
|
+ private function one($uid, $info, $times = false, $collection_id = false)
|
|
{
|
|
{
|
|
$info['pic'] = explode(',', $info['pic']);
|
|
$info['pic'] = explode(',', $info['pic']);
|
|
- $info['user'] = Dever::load('passport/api')->info($info['uid']);
|
|
|
|
- if ($info['day'] > 0) {
|
|
|
|
- if ($times && $times['year']) {
|
|
|
|
- $year = $times['year'];
|
|
|
|
- } else {
|
|
|
|
- $year = substr($info['day'],0,4);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $month = substr($info['day'],4,2);
|
|
|
|
- $day = substr($info['day'],6,2);
|
|
|
|
- $string = $year . '-' . $month . '-' . $day;
|
|
|
|
- } elseif ($times && $times['year']) {
|
|
|
|
- $string = $times['year'] . '-m-d';
|
|
|
|
- } else {
|
|
|
|
- $string = 'Y-m-d';
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $info['cdate_string'] = date($string . ' H:i', $info['cdate']);
|
|
|
|
|
|
+ $info['user'] = Dever::load('collection/lib/user')->get($info['uid'], $collection_id);
|
|
|
|
+
|
|
|
|
+ $info['cdate_string'] = Dever::load('collection/lib/times')->getDate($info['day'], $info['cdate'], $times);
|
|
|
|
|
|
# 点赞数
|
|
# 点赞数
|
|
$info['num_up'] = $info['num_up'] + 0;
|
|
$info['num_up'] = $info['num_up'] + 0;
|
|
@@ -158,7 +151,7 @@ class Info
|
|
# 获取引用的数据
|
|
# 获取引用的数据
|
|
$info['to_user'] = array();
|
|
$info['to_user'] = array();
|
|
if ($info['to_uid']) {
|
|
if ($info['to_uid']) {
|
|
- $info['to_user'] = Dever::load('passport/api')->info($info['to_uid']);
|
|
|
|
|
|
+ $info['to_user'] = Dever::load('collection/lib/user')->get($info['to_uid'], $collection_id);
|
|
}
|
|
}
|
|
|
|
|
|
# 获取热门的子信息
|
|
# 获取热门的子信息
|
|
@@ -176,4 +169,25 @@ class Info
|
|
|
|
|
|
return $info;
|
|
return $info;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function getCdate(&$info, $times = false)
|
|
|
|
+ {
|
|
|
|
+ if ($info['day'] > 0) {
|
|
|
|
+ if ($times && $times['year']) {
|
|
|
|
+ $year = $times['year'];
|
|
|
|
+ } else {
|
|
|
|
+ $year = substr($info['day'],0,4);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $month = substr($info['day'],4,2);
|
|
|
|
+ $day = substr($info['day'],6,2);
|
|
|
|
+ $string = $year . '-' . $month . '-' . $day;
|
|
|
|
+ } elseif ($times && $times['year']) {
|
|
|
|
+ $string = $times['year'] . '-m-d';
|
|
|
|
+ } else {
|
|
|
|
+ $string = 'Y-m-d';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $info['cdate_string'] = date($string . ' H:i', $info['cdate']);
|
|
|
|
+ }
|
|
}
|
|
}
|