diff --git a/support/reach/src/serv/message_send.rs b/support/reach/src/serv/message_send.rs index 2177594b5..05cddf5d7 100644 --- a/support/reach/src/serv/message_send.rs +++ b/support/reach/src/serv/message_send.rs @@ -83,7 +83,7 @@ pub async fn message_send(send_req: ReachMsgSendReq, funs: &TardisFunsInst, ctx: for (_kind, gc) in global_configs { for (receive_kind, to_res_ids) in &other_receive_collect { - if other_group_code.contains(&gc.rel_reach_channel) { + if other_group_code.contains(&gc.rel_reach_channel) && !gc.rel_reach_msg_signature_id.is_empty() && !gc.rel_reach_msg_template_id.is_empty() { ReachMessageServ::add_rbum( &mut ReachMessageAddReq { rbum_item_add_req: RbumItemAddReq { diff --git a/support/reach/src/serv/trigger_global_config.rs b/support/reach/src/serv/trigger_global_config.rs index 4c205f39e..723d7880f 100644 --- a/support/reach/src/serv/trigger_global_config.rs +++ b/support/reach/src/serv/trigger_global_config.rs @@ -8,7 +8,7 @@ use tardis::basic::result::TardisResult; use tardis::db::reldb_client::TardisActiveModel; use tardis::db::sea_orm::sea_query::{Query, SelectStatement}; use tardis::db::sea_orm::*; -use tardis::{TardisFuns, TardisFunsInst}; +use tardis::{TardisFuns, TardisFunsInst, log}; pub struct ReachTriggerGlobalConfigService; @@ -50,7 +50,8 @@ impl .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", "")); + return Ok(()) + // 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() @@ -59,7 +60,8 @@ impl ) .await? { - return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "rel_reach_msg_template_id doesn't exist", "")); + return Ok(()); + // 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()), @@ -69,7 +71,9 @@ impl filter.base_filter.basic.with_sub_own_paths = true; if 0 != Self::count_rbums(&filter, funs, ctx).await? { - return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "reach_trigger_scene_id and reach_channel is exist", "")); + log::warn!("[Reach] reach_trigger_scene_id {id} and reach_channel {chan} is exist", id = add_req.rel_reach_trigger_scene_id, chan = add_req.rel_reach_channel); + return Ok(()); + // return Err(funs.err().bad_request("reach_trigger_global_config", "before_add_rbum", "reach_trigger_scene_id and reach_channel is exist", "")); } Ok(()) } @@ -115,6 +119,7 @@ impl ReachTriggerGlobalConfigService { } pub async fn add_or_modify_global_config(agg_req: ReachTriggerGlobalConfigAddOrModifyAggReq, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<()> { for req in agg_req.global_config { + Self::add_or_modify_by_single_req(req, funs, ctx).await?; } Ok(()) diff --git a/support/reach/src/task/message_send_listener.rs b/support/reach/src/task/message_send_listener.rs index 198ac7895..fa35e2477 100644 --- a/support/reach/src/task/message_send_listener.rs +++ b/support/reach/src/task/message_send_listener.rs @@ -28,8 +28,7 @@ impl Default for MessageSendListener { } impl MessageSendListener { - async fn execute_send_account(&self, message: message::Model, template: message_template::Model, _signarure: Option) -> TardisResult<()> { - let content_replace: ContentReplace = message.content_replace.parse()?; + async fn execute_send_account(&self, content_replace: ContentReplace, message: message::Model, template: message_template::Model, _signarure: Option) -> TardisResult<()> { let cfg = self.funs.conf::(); let _lock = self.sync.lock().await; let ctx = TardisContext { @@ -150,9 +149,10 @@ impl MessageSendListener { // .and_where(message_signature::Column::Id.eq(&message.rel_reach_msg_signature_id)), // ) // .await?; + let content_replace: ContentReplace = message.content_replace.parse()?; match message.receive_kind { ReachReceiveKind::Account => { - let _res = self.execute_send_account(message, template, None).await; + let _res = self.execute_send_account(content_replace, message, template, None).await; } ReachReceiveKind::Tenant => { // do nothing