推拉函数与queue
This commit is contained in:
@ -4,8 +4,56 @@
|
||||
namespace App\Http\Controllers\Post;
|
||||
|
||||
use App\Http\Controllers\Base\BaseController;
|
||||
use App\Models\Post\PostModel;
|
||||
use App\Models\Post\PostPushBoxModel;
|
||||
use App\Service\AuthService;
|
||||
|
||||
class PostController extends BaseController
|
||||
{
|
||||
//$uid, $content = null, $media = null,$mid = null,$sBachSn = null
|
||||
public array $validateMethodParams = [
|
||||
'addPost' => [
|
||||
'type' => 'required|numeric|max:2',
|
||||
'content' => 'required|numeric|max:255',
|
||||
'media' => 'json',
|
||||
],
|
||||
'pullPostList' => [
|
||||
'lastId' => 'numeric|max:10',
|
||||
'limit' => 'numeric|max:5',
|
||||
],
|
||||
];
|
||||
public function addPost(): \Illuminate\Http\JsonResponse
|
||||
{
|
||||
$aParams = request()->only([
|
||||
'type',
|
||||
'content',
|
||||
'media',
|
||||
]);
|
||||
if (!in_array($aParams['type'], [PostModel::TYPE_POST, PostModel::TYPE_REPOST])) return $this->error('type params error');
|
||||
|
||||
$oAuthService = new AuthService();
|
||||
$aUser = $oAuthService->getCurrentUser();
|
||||
$oFollowModel = new PostModel();
|
||||
$aParams['uid'] = $aUser['id'];
|
||||
|
||||
$oFollowModel->addBatchPost([$aParams]);
|
||||
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
function pullPostList()
|
||||
{
|
||||
$aParams = request()->only([
|
||||
'lastId',
|
||||
'limit',
|
||||
]);
|
||||
$oAuthService = new AuthService();
|
||||
$aUser = $oAuthService->getCurrentUser();
|
||||
$oPostModel = new PostPushBoxModel();
|
||||
$aPostList = $oPostModel->getPushBoxList($aUser['id'],$aParams['lastId']??0,$aParams['limit']??15);
|
||||
return $this->success($aPostList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user