Commit bc9c0054 authored by sugar's avatar sugar

热更新

parent d5b252be
......@@ -10,6 +10,7 @@ namespace app\api\controller;
use app\api\model\Addr;
use app\api\model\FriendCommentModel;
use app\api\model\FriendLikeModel;
use app\api\model\HotcircleModel;
use app\common\controller\Api;
use fast\Tree;
use think\Db;
......@@ -21,6 +22,43 @@ class Friend extends Api{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 热门圈子列表
*/
public function getCircleList(){
$page = $this->request->post('page',1);
$type = $this->request->post('type','');//my_circle:我的圈子
$where = ['status' =>1];
if($type == 'my_circle'){
$where['user_id'] = $this->auth->id;
}
$list = HotcircleModel::where($where)
->page($page)
->limit($this->pageSize)
->select();
$this->success('获取成功',['list' =>$list]);
}
/**
* 热门圈子列表
*/
public function getMyCircles(){
$page = $this->request->post('page',1);
$type = $this->request->post('type','');//my_circle:我的圈子
$where = ['status' =>1];
if($type == 'my_circle'){
$where['user_id'] = $this->auth->id;
}
$list = HotcircleModel::alais('hc')
->join('join_circle jc','hc.id=jc.hot_circle_id')
->where($where)
->page($page)
->limit($this->pageSize)
->select();
$this->success('获取成功',['list' =>$list]);
}
/**
* 发布朋友圈
* @param content 朋友圈信息
......@@ -47,7 +85,7 @@ class Friend extends Api{
'nickname' =>$fastim['nickname'],
'ip' =>$this->request->ip(),
'create_time' =>time(),
'province' =>$addr['Name']
'addr' =>$addr['Name']
];
$res=Friendcircle::create($data);
if(!$res->id){
......@@ -113,7 +151,12 @@ class Friend extends Api{
*/
public function getFriendList(){
$page = $this->request->post('page',1);
$list = Friendcircle::where(['status' =>1])
$type = $this->request->post('type','');//my_circle:我的圈子
$where = ['status' =>1];
if($type == 'my_circle'){
$where['user_id'] = $this->auth->id;
}
$list = Friendcircle::where($where)
->page($page)
->limit($this->pageSize)
->select();
......
<?php
/**
* Created by PhpStorm.
* User: pc
* Date: 2023/8/21
* Time: 14:41
*/
namespace app\api\model;
use think\Model;
class HotcircleModel extends Model
{
// 表名
protected $name = 'hot_circle';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 追加属性
protected $append = [
];
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment