初始化代码
This commit is contained in:
117
application/api/controller/UserZone.php
Normal file
117
application/api/controller/UserZone.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class UserZone extends Common
|
||||
{
|
||||
//获取社区列表
|
||||
public function get_zone_list()
|
||||
{
|
||||
$is_recommend = input('is_recommend', 0);
|
||||
$is_follow = input('is_follow', 0);
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$reslut = model('UserZone')->get_zone_list($this->uid, $is_recommend, $is_follow, $page, $page_limit);
|
||||
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//获取个人社区列表
|
||||
public function get_user_zone_list()
|
||||
{
|
||||
$from_id = input('from_id',0);
|
||||
$is_recommend = input('is_recommend', 0);
|
||||
$is_follow = input('is_follow', 0);
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$reslut = model('UserZone')->get_user_zone_list($this->uid, $from_id, $is_recommend, $is_follow, $page, $page_limit);
|
||||
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//获取社区列表
|
||||
public function get_zone_info()
|
||||
{
|
||||
$zid = input('zid', 0);
|
||||
$reslut = model('UserZone')->get_zone_info($this->uid, $zid);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//发布社区信息
|
||||
public function publish_zone()
|
||||
{
|
||||
$images = input('images', ''); //多图上传json 类型
|
||||
$sound = input('sound', '');
|
||||
$sound_duration = input('sound_duration', '');
|
||||
$video = input('video', '');
|
||||
$content = input('content', '');
|
||||
$reslut = model('UserZone')->publish_zone($this->uid, $images, $sound, $sound_duration, $video, $content);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//动态点赞
|
||||
public function praise_zone()
|
||||
{
|
||||
$key_name = "api:usezone:praise_zone:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$zid = input('zid', '');
|
||||
$reslut = model('UserZone')->praise_zone($this->uid, $zid);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//动态收藏
|
||||
public function praise_collect()
|
||||
{
|
||||
$key_name = "api:usezone:collect_zone:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$cid = input('cid', '');
|
||||
$reslut = model('UserZone')->praise_collect($this->uid, $cid);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//动态评论
|
||||
public function comment_zone()
|
||||
{
|
||||
$key_name = "api:usezone:comment_zone:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$zid = input('zid', 0);
|
||||
$content = input('content', '');
|
||||
$reslut = model('UserZone')->comment_zone($this->uid, $zid, $content);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//回复 点赞
|
||||
public function praise_comment()
|
||||
{
|
||||
$key_name = "api:usezone:praise_comment:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$cid = input('cid', 0);
|
||||
$content = input('content', '');
|
||||
$reslut = model('UserZone')->praise_comment($this->uid, $cid, $content);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//获取指定动态评论列表
|
||||
public function get_comment_list()
|
||||
{
|
||||
$key_name = "api:usezone:get_comment_list:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$zid = input('zid', 0);
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$reslut = model('UserZone')->get_comment_list($zid, $page, $page_limit);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//删除社区信息
|
||||
public function delete_zone()
|
||||
{
|
||||
$zid = input('zid', 0);
|
||||
$reslut = model('UserZone')->delete_zone($this->uid, $zid);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user