|
@@ -10,29 +10,19 @@ use app\common\library\Keyworld;
|
|
|
*/
|
|
|
class Topicdongtai extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = ['info','floor_info','topic_list'];
|
|
|
+ protected $noNeedLogin = [''];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
//发布动态
|
|
|
public function adddongtai(){
|
|
|
$content = input('content','', 'trim');
|
|
|
$images = input('images','', 'trim');
|
|
|
-// $show_real = input('show_real', 0, 'intval'); //是否标记真人:0=否,1=是
|
|
|
- //$address = input('address', '', 'trim'); //位置
|
|
|
$topic_id = input('topic_id', 0, 'intval'); //热门话题id
|
|
|
$type = input('type', 0, 'intval'); //类型:0=文字,1=图片,2=视频
|
|
|
if(!$content && !$images){
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
|
- /* if (!in_array($show_real, [0, 1])) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- }*/
|
|
|
- /*if ($show_real == 1 && $this->auth->real_status != 1) { //验证是否已经通过真人认证
|
|
|
- $this->error('您尚未通过真人认证,暂不能标记真人');
|
|
|
- }*/
|
|
|
- /*if (iconv_strlen($address, 'utf-8') > 255) {
|
|
|
- $this->error('请选择正确位置');
|
|
|
- }*/
|
|
|
+
|
|
|
if ($topic_id) {
|
|
|
$topic_info = Db::name('topic_hub')->where(['id' => $topic_id])->find();
|
|
|
if (!$topic_info) {
|
|
@@ -49,20 +39,14 @@ class Topicdongtai extends Api
|
|
|
//关键字替换
|
|
|
$content = Keyworld::sensitive($content);
|
|
|
|
|
|
-// $address = $this->ip_to_address();
|
|
|
-// $address = $address['provincename'].$address['cityname'];
|
|
|
|
|
|
$data = [
|
|
|
'topic_id' => $topic_id,
|
|
|
'user_id' => $this->auth->id,
|
|
|
'content' => $content,
|
|
|
'images' => $images,
|
|
|
-// 'longitude' => input('longitude',''),
|
|
|
-// 'latitude' => input('latitude',''),
|
|
|
'createtime' => time(),
|
|
|
'updatetime' => time(),
|
|
|
-// 'is_show_real' => $show_real,
|
|
|
-// 'address' => $address,
|
|
|
'type' => $type
|
|
|
];
|
|
|
|
|
@@ -134,7 +118,7 @@ class Topicdongtai extends Api
|
|
|
->join('user','dt.user_id = user.id','LEFT')
|
|
|
->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
->join('topic_hub th','dt.topic_id = th.id','LEFT')
|
|
|
- ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.is_hideaddress,th.name,user.real_status,uw.vip_endtime')
|
|
|
+ ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.real_status,user.is_hideaddress,th.name,uw.vip_endtime')
|
|
|
->where($where)
|
|
|
->where($where_follow)
|
|
|
->order($orderby)->autopage()->select();
|
|
@@ -205,7 +189,7 @@ class Topicdongtai extends Api
|
|
|
->join('user','dt.user_id = user.id','LEFT')
|
|
|
->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
->join('topic_hub th','dt.topic_id = th.id','LEFT')
|
|
|
- ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.is_hideaddress,th.name,user.real_status,user.idcard_status,uw.vip_endtime')
|
|
|
+ ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.real_status,user.is_hideaddress,th.name,uw.vip_endtime')
|
|
|
->where($where)
|
|
|
->order($orderby)->autopage()->select();
|
|
|
$list = list_domain_image($list,['images','avatar']);
|
|
@@ -223,6 +207,7 @@ class Topicdongtai extends Api
|
|
|
|
|
|
|
|
|
foreach ($list as &$val) {
|
|
|
+ $val['name'] = $val['name'] ? : '';
|
|
|
$val['birthday'] = birthtime_to_age($val['birthday']);
|
|
|
$val['createtime'] = get_last_time($val['createtime']);
|
|
|
$val['cityname'] = $val['is_hideaddress'] ? '' : $val['address'];
|
|
@@ -270,9 +255,9 @@ class Topicdongtai extends Api
|
|
|
|
|
|
$info = Db::name('topic_dongtai')->alias('dt')
|
|
|
->join('user','dt.user_id = user.id','LEFT')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
->join('topic_hub th','dt.topic_id = th.id','LEFT')
|
|
|
- ->join('user_wallet uw','dt.user_id = uw.user_id','LEFT')
|
|
|
- ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.is_hideaddress,th.name,user.real_status,uw.vip_endtime')
|
|
|
+ ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.real_status,user.is_hideaddress,th.name,uw.vip_endtime')
|
|
|
->where('dt.id',$id)->find();
|
|
|
if (!$info) {
|
|
|
$this->error('您的网络开小差啦~');
|
|
@@ -286,8 +271,9 @@ class Topicdongtai extends Api
|
|
|
$info['birthday'] = birthtime_to_age($info['birthday']);
|
|
|
$info['createtime'] = get_last_time($info['createtime']);
|
|
|
$info['cityname'] = $info['is_hideaddress'] ? '' : $info['address'];
|
|
|
- //vip用户
|
|
|
+ //用户vip
|
|
|
$info['is_vip'] = $info['vip_endtime'] > time() ? 1 : 0;
|
|
|
+ unset($info['vip_endtime']);
|
|
|
|
|
|
//是否点赞过
|
|
|
$info['isgood'] = $this->is_good($id,$this->auth->id);
|