重命名消息类型

This commit is contained in:
codeboss 2025-06-10 14:21:55 +08:00
parent 86df9ab110
commit 6602641bcc
4 changed files with 19 additions and 16 deletions

View File

@ -15,9 +15,9 @@ QString ComponentsInfoPull::name() const
#include <QVariant> #include <QVariant>
#include <QJsonArray> #include <QJsonArray>
void ComponentsInfoPull::execute(std::shared_ptr<Immediate> map, void ComponentsInfoPull::execute(std::shared_ptr<Immediate> map,
std::shared_ptr<const ComponentInfosQuery> in, QList<std::shared_ptr<ComponentInfoQueryResult>>& out) std::shared_ptr<const ComponentDatasQuery> in, QList<std::shared_ptr<ComponentDatasQueryResult>>& out)
{ {
auto rst = std::make_shared<ComponentInfoQueryResult>(); auto rst = std::make_shared<ComponentDatasQueryResult>();
rst->reset(in->targetEntity(), in->sourceEntity()); rst->reset(in->targetEntity(), in->sourceEntity());
auto bind_e = this->_bind_entity.lock(); auto bind_e = this->_bind_entity.lock();

View File

@ -2,8 +2,11 @@
#include <messagebasic.h> #include <messagebasic.h>
#include "componentbasic.h" #include "componentbasic.h"
/// <summary>
/// 组件信息提取
/// </summary>
class COMPONENTBASIC_EXPORT ComponentsInfoPull : public ProcList< class COMPONENTBASIC_EXPORT ComponentsInfoPull : public ProcList<
WsRespond<ComponentInfosQuery, ComponentInfoQueryResult> WsRespond<ComponentDatasQuery, ComponentDatasQueryResult>
> { > {
private: private:
std::weak_ptr<WsEntity> _bind_entity; std::weak_ptr<WsEntity> _bind_entity;
@ -15,7 +18,7 @@ public:
void bindEntity(std::weak_ptr<WsEntity> ins) override; void bindEntity(std::weak_ptr<WsEntity> ins) override;
QString name() const override; QString name() const override;
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const ComponentInfosQuery> in, QList<std::shared_ptr<ComponentInfoQueryResult>>& out) override; void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const ComponentDatasQuery> in, QList<std::shared_ptr<ComponentDatasQueryResult>>& out) override;
std::shared_ptr<WsComponent> defaultNew() const override; std::shared_ptr<WsComponent> defaultNew() const override;
void recoveryFrom(const QJsonObject& obj) override; void recoveryFrom(const QJsonObject& obj) override;

View File

@ -234,33 +234,33 @@ TypesQuery::TypesQuery()
:AbstractMessage(NAME(TypesQuery)) { :AbstractMessage(NAME(TypesQuery)) {
} }
ComponentInfosQuery::ComponentInfosQuery() ComponentDatasQuery::ComponentDatasQuery()
:AbstractMessage(NAME(ComponentInfosQuery)) { :AbstractMessage(NAME(ComponentDatasQuery)) {
} }
void ComponentInfosQuery::recoveryFrom(const QJsonObject& obj) void ComponentDatasQuery::recoveryFrom(const QJsonObject& obj)
{ {
AbstractMessage::recoveryFrom(obj); AbstractMessage::recoveryFrom(obj);
UINT64_PEAK(_bind_entity_id); UINT64_PEAK(_bind_entity_id);
} }
void ComponentInfosQuery::saveTo(QJsonObject& obj) const void ComponentDatasQuery::saveTo(QJsonObject& obj) const
{ {
AbstractMessage::saveTo(obj); AbstractMessage::saveTo(obj);
UINT64_SAVE(_bind_entity_id); UINT64_SAVE(_bind_entity_id);
} }
ComponentInfoQueryResult::ComponentInfoQueryResult() ComponentDatasQueryResult::ComponentDatasQueryResult()
:AbstractMessage(NAME(ComponentInfoQueryResult)) { :AbstractMessage(NAME(ComponentDatasQueryResult)) {
} }
void ComponentInfoQueryResult::recoveryFrom(const QJsonObject& obj) void ComponentDatasQueryResult::recoveryFrom(const QJsonObject& obj)
{ {
AbstractMessage::recoveryFrom(obj); AbstractMessage::recoveryFrom(obj);
_entity_json = obj["result_json"].toObject(); _entity_json = obj["result_json"].toObject();
} }
void ComponentInfoQueryResult::saveTo(QJsonObject& obj) const void ComponentDatasQueryResult::saveTo(QJsonObject& obj) const
{ {
AbstractMessage::saveTo(obj); AbstractMessage::saveTo(obj);
obj["result_json"] = _entity_json; obj["result_json"] = _entity_json;

View File

@ -209,20 +209,20 @@ struct MESSAGEBASIC_EXPORT EntityTotalList : public AbstractMessage {
/// <summary> /// <summary>
/// 获取指定实体的所有组件数据 /// 获取指定实体的所有组件数据
/// </summary> /// </summary>
struct MESSAGEBASIC_EXPORT ComponentInfosQuery : public AbstractMessage { struct MESSAGEBASIC_EXPORT ComponentDatasQuery : public AbstractMessage {
uint64_t _bind_entity_id = 0; uint64_t _bind_entity_id = 0;
ComponentInfosQuery(); ComponentDatasQuery();
// 通过 WsMessage 继承 // 通过 WsMessage 继承
void recoveryFrom(const QJsonObject& obj) override; void recoveryFrom(const QJsonObject& obj) override;
void saveTo(QJsonObject& obj) const override; void saveTo(QJsonObject& obj) const override;
}; };
struct MESSAGEBASIC_EXPORT ComponentInfoQueryResult : public AbstractMessage { struct MESSAGEBASIC_EXPORT ComponentDatasQueryResult : public AbstractMessage {
QJsonObject _entity_json; QJsonObject _entity_json;
ComponentInfoQueryResult(); ComponentDatasQueryResult();
// 通过 WsMessage 继承 // 通过 WsMessage 继承
void recoveryFrom(const QJsonObject& obj) override; void recoveryFrom(const QJsonObject& obj) override;