change struct
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Models\Api\Post;
|
||||
|
||||
use App\Bean\Queue\Api\QueueAddPostBean;
|
||||
use App\Exceptions\ModelException;
|
||||
use App\Jobs\Api\AddPostQueue;
|
||||
use App\Models\Api\Base\ApiBaseModel;
|
||||
use App\Models\Api\Post\Structs\PostParamsStruct;
|
||||
use App\Tools\Tools;
|
||||
@ -82,7 +84,11 @@ class PostModel extends ApiBaseModel
|
||||
$aItem['created_at'] = $sDateTime;
|
||||
$res = $this->addItem($aItem);
|
||||
if ($res) {
|
||||
$this->pushToQueue(self::TYPE_POST, $res->id);
|
||||
//发送到消息队列处理新增post
|
||||
$oQueueAddPostBean = new QueueAddPostBean();
|
||||
$oQueueAddPostBean->setId($res->id);
|
||||
$oQueueAddPostBean->setType(self::TYPE_POST);
|
||||
AddPostQueue::putToQueue(new QueueAddPostBean(['id' => $res->id, 'type' => $type]));
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
@ -99,12 +105,6 @@ class PostModel extends ApiBaseModel
|
||||
}
|
||||
}
|
||||
|
||||
//发送到消息队列处理新增post
|
||||
function pushToQueue($type, $id): void
|
||||
{
|
||||
PostPushBoxModel::addPostQueueProducer(['type' => $type, 'id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ModelException
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user