diff --git a/support/reach/src/dto/trigger/global_config.rs b/support/reach/src/dto/trigger/global_config.rs index 21bc6a69b..93862d3de 100644 --- a/support/reach/src/dto/trigger/global_config.rs +++ b/support/reach/src/dto/trigger/global_config.rs @@ -11,12 +11,14 @@ use tardis::{ use crate::dto::*; /// 添加 用户触达触发实例配置请求 -#[derive(Debug, poem_openapi::Object, Serialize, Deserialize)] +#[derive(Debug, poem_openapi::Object, Serialize, Deserialize, Default)] pub struct ReachTriggerGlobalConfigAddReq { /// 关联的触发场景id pub rel_reach_trigger_scene_id: String, /// 关联的触达通道 pub rel_reach_channel: ReachChannelKind, + #[serde(default)] + #[oai(default)] /// 用户触达消息签名Id pub rel_reach_msg_signature_id: String, /// 用户触达消息模板Id diff --git a/support/reach/src/serv/trigger_global_config.rs b/support/reach/src/serv/trigger_global_config.rs index f92440fcf..4c205f39e 100644 --- a/support/reach/src/serv/trigger_global_config.rs +++ b/support/reach/src/serv/trigger_global_config.rs @@ -39,19 +39,18 @@ impl .count(Query::select().column(trigger_scene::Column::Id).from(trigger_scene::Entity).and_where(trigger_scene::Column::Id.eq(&add_req.rel_reach_trigger_scene_id))) .await? { - return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_trigger_scene_id is exist", "")); + return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_trigger_scene_id doesn't exist", "")); } - if 1 != funs - .db() - .count( - Query::select() - .column(message_signature::Column::Id) - .from(message_signature::Entity) - .and_where(message_signature::Column::Id.eq(&add_req.rel_reach_msg_signature_id)), - ) - .await? - { - return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_msg_signature_id is exist", "")); + if !add_req.rel_reach_msg_signature_id.is_empty() && 1 != funs + .db() + .count( + Query::select() + .column(message_signature::Column::Id) + .from(message_signature::Entity) + .and_where(message_signature::Column::Id.eq(&add_req.rel_reach_msg_signature_id)), + ) + .await? { + return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_msg_signature_id doesn't exist", "")); } if 1 != funs .db() @@ -60,7 +59,7 @@ impl ) .await? { - return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_msg_template_id is exist", "")); + return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_msg_template_id doesn't exist", "")); } let mut filter = ReachTriggerGlobalConfigFilterReq { rel_reach_trigger_scene_id: Some(add_req.rel_reach_trigger_scene_id.clone()), diff --git a/support/reach/src/serv/trigger_instance_config.rs b/support/reach/src/serv/trigger_instance_config.rs index 47600eaa0..2b7c7353c 100644 --- a/support/reach/src/serv/trigger_instance_config.rs +++ b/support/reach/src/serv/trigger_instance_config.rs @@ -87,6 +87,7 @@ impl ReachTriggerInstanceConfigService { filter.rel_reach_channel = Some(req.rel_reach_channel); filter.rel_reach_trigger_scene_id = Some(req.rel_reach_trigger_scene_id.clone()); filter.receive_group_code = Some(vec![req.receive_group_code.clone()]); + filter.rel_item_id = Some(req.rel_item_id.clone()); if let Some(trigger_instance_config) = Self::find_one_rbum(&filter, funs, ctx).await? { if req.delete_kind { Self::delete_rbum(&trigger_instance_config.id, funs, ctx).await?; diff --git a/support/reach/src/task/message_send_listener.rs b/support/reach/src/task/message_send_listener.rs index 4fa843110..5683f4d43 100644 --- a/support/reach/src/task/message_send_listener.rs +++ b/support/reach/src/task/message_send_listener.rs @@ -28,7 +28,7 @@ impl Default for MessageSendListener { } impl MessageSendListener { - async fn execute_send_account(&self, message: message::Model, template: message_template::Model) -> TardisResult<()> { + async fn execute_send_account(&self, message: message::Model, template: message_template::Model, _signarure: Option) -> TardisResult<()> { let content_replace: ContentReplace = message.content_replace.parse()?; let cfg = self.funs.conf::(); let _lock = self.sync.lock().await; @@ -132,20 +132,18 @@ impl MessageSendListener { else { continue; }; - let Some(_signature) = db - .get_dto::( - Query::select() - .columns(message_signature::Column::iter()) - .from(message_signature::Entity) - .and_where(message_signature::Column::Id.eq(&message.rel_reach_msg_signature_id)), - ) - .await? - else { - continue; - }; + // signature is not necessary now + // let signature = db + // .get_dto::( + // Query::select() + // .columns(message_signature::Column::iter()) + // .from(message_signature::Entity) + // .and_where(message_signature::Column::Id.eq(&message.rel_reach_msg_signature_id)), + // ) + // .await?; match message.receive_kind { ReachReceiveKind::Account => { - let _res = self.execute_send_account(message, template).await; + let _res = self.execute_send_account(message, template, None).await; } ReachReceiveKind::Tenant => { // do nothing