Skip to content

Commit

Permalink
fix cmd/events
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Oct 24, 2019
1 parent 027f9d7 commit 22d22e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl AppEnvironment {
let tail = if is_html { "</table>" } else { "" };
let row_begin = if is_html { "<tr><td>" } else { "" };
let row_split = if is_html { "</td><td>" } else { ": " };
let row_end = if is_html { "</td></tr>" } else { "" };
let row_end = if is_html { "</td></tr>" } else { "\n" };
let mut row_host = String::from("");
for v in self.get_hosts() {
if let Ok(saddr_iter) = v.to_socket_addrs() {
Expand Down Expand Up @@ -410,6 +410,10 @@ impl AppEnvironment {
for cmd in ref_x.cmds.iter() {
info!("load global command \"{}\" success", cmd.name());
}

for cmd in ref_x.events.iter() {
info!("load global event \"{}\" success", cmd.name());
}
}
}

Expand Down
19 changes: 13 additions & 6 deletions src/wxwork_robot/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,22 @@ impl WXWorkProject {

if let Some(kvs) = json.as_object() {
if let Some(cmds_json) = kvs.get("cmds") {
proj_events = command::WXWorkCommand::parse(cmds_json);
proj_cmds = command::WXWorkCommand::parse(cmds_json);
} else {
proj_events = Vec::new();
proj_cmds = Vec::new();
}
} else {
proj_events = Vec::new();
proj_cmds = Vec::new();
}

if let Some(kvs) = json.as_object() {
if let Some(cmds_json) = kvs.get("events") {
proj_cmds = command::WXWorkCommand::parse(cmds_json);
proj_events = command::WXWorkCommand::parse(cmds_json);
} else {
proj_cmds = Vec::new();
proj_events = Vec::new();
}
} else {
proj_cmds = Vec::new();
proj_events = Vec::new();
}

for cmd in proj_cmds.iter() {
Expand All @@ -153,6 +153,13 @@ impl WXWorkProject {
cmd.name()
);
}
for cmd in proj_events.iter() {
info!(
"project \"{}\" load event \"{}\" success",
proj_name,
cmd.name()
);
}
debug!("project \"{}\" with token(base64): \"{}\", aes key(base64): \"{}\" , env vars({}), load success.", proj_name, proj_token, proj_aes_key, envs_var_count);
}

Expand Down

0 comments on commit 22d22e0

Please sign in to comment.