add delete facebook command action

This commit is contained in:
Jay
2019-08-20 09:29:06 +00:00
parent d24db4b509
commit 7cf63a4bfb
6 changed files with 45 additions and 2 deletions
+14
View File
@@ -81,3 +81,17 @@ func addFacebookPage(info EvtInfo, fbid, tmpl string) string {
}
return "Success"
}
func delFacebookPage(info EvtInfo, fbid string) string {
ch, err := dsmodel.GetChannelByID(info.Channel)
if err != nil {
return ""
}
err = ch.DeleteFacebookPage(fbid)
if err != nil {
return "delete facebook page fail"
}
return "Success"
}
+5 -2
View File
@@ -149,10 +149,13 @@ func parseTextMessage(msg string) (cmd string, keyword bool, payload string) {
return
}
func selectAction(info EvtInfo, key, value, payload string) string {
switch key {
func selectAction(info EvtInfo, cmdKey, cmdValue, payload string) string {
switch cmdKey {
case "ds_addserver":
return addServer(info, payload)
case "ds_addfacebook":
strs := strings.Split(payload, " ")
return addFacebookPage(info, strs[0], strings.Join(strs[1:], " "))
}
return ""