mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 09:34:05 +08:00
opt mp
This commit is contained in:
parent
4b4506b16c
commit
68e6c7f293
@ -97,7 +97,7 @@ var Index = &ice.Context{Name: LARK, Help: "机器人",
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Load()
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, LARK, m.Conf(APP, kit.Keys(kit.MDB_META, LARK)))
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, LARK, m.Conf(APP, kit.Keym(LARK)))
|
||||
}},
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Save()
|
||||
@ -371,7 +371,7 @@ var Index = &ice.Context{Name: LARK, Help: "机器人",
|
||||
}
|
||||
|
||||
// 执行命令
|
||||
if msg := m.Cmd(cmds); msg.Hand == true {
|
||||
if msg := m.Cmd(cmds); len(msg.Appendv(ice.MSG_APPEND)) > 0 || len(msg.Resultv()) > 0 {
|
||||
if m.Copy(msg); len(m.Resultv()) == 0 {
|
||||
m.Table()
|
||||
}
|
||||
@ -412,7 +412,7 @@ var Index = &ice.Context{Name: LARK, Help: "机器人",
|
||||
case P2P_CHAT_CREATE, ADD_BOT:
|
||||
// 创建对话
|
||||
if m.Options(OPEN_CHAT_ID) {
|
||||
m.Cmdy(SEND, m.Option(OPEN_CHAT_ID), m.Conf(APP, kit.Keys(kit.MDB_META, "template", m.Option("type"))))
|
||||
m.Cmdy(SEND, m.Option(OPEN_CHAT_ID), m.Conf(APP, kit.Keym(kit.MDB_TEMPLATE, m.Option("type"))))
|
||||
}
|
||||
default:
|
||||
switch m.Option("msg_type") {
|
||||
@ -458,8 +458,8 @@ var Index = &ice.Context{Name: LARK, Help: "机器人",
|
||||
|
||||
m.Option(mdb.FIELDS, "time,appid,appmm,token,expire")
|
||||
m.Cmd(mdb.SELECT, m.Prefix(APP), "", mdb.HASH, kit.MDB_NAME, "bot").Table(func(index int, value map[string]string, head []string) {
|
||||
m.Render("redirect", kit.MergeURL2(m.Conf(APP, kit.Keys(kit.MDB_META, LARK)), "/open-apis/authen/v1/index"),
|
||||
"app_id", value[APPID], "redirect_uri", kit.MergeURL2(m.Conf(web.SHARE, "meta.domain"), "/chat/lark/sso"),
|
||||
m.Render("redirect", kit.MergeURL2(m.Conf(APP, kit.Keym(LARK)), "/open-apis/authen/v1/index"),
|
||||
"app_id", value[APPID], "redirect_uri", kit.MergeURL2(m.Conf(web.SHARE, kit.Keym(kit.MDB_DOMAIN)), "/chat/lark/sso"),
|
||||
)
|
||||
})
|
||||
}},
|
||||
|
@ -6,7 +6,7 @@ refer "官网" `
|
||||
后台管理 https://www.feishu.cn/admin
|
||||
应用管理 https://open.feishu.cn/app
|
||||
`
|
||||
image qrcode `https://www.feishu.cn/`
|
||||
image qrcode `https://applink.feishu.cn/client/bot/open?appId=cli_9d3b9d146a7cd103`
|
||||
|
||||
chapter "应用"
|
||||
field "app" web.chat.lark.app
|
||||
@ -14,8 +14,8 @@ field "group" web.chat.lark.group
|
||||
field "company" web.chat.lark.company
|
||||
|
||||
chapter "权限"
|
||||
field user aaa.user
|
||||
field sess aaa.sess
|
||||
field user aaa.user
|
||||
|
||||
chapter "项目"
|
||||
field "icebergs" web.code.git.trend args `icebergs`
|
||||
|
@ -9,16 +9,17 @@ image `/share/local/usr/image/gh_61ea404535e4_258.jpg`
|
||||
|
||||
chapter "应用"
|
||||
field scan web.chat.scan
|
||||
field paste web.chat.paste
|
||||
field files web.chat.files
|
||||
field paste web.chat.paste
|
||||
field location web.chat.location
|
||||
|
||||
chapter "权限"
|
||||
field access web.chat.mp.access
|
||||
field share web.share
|
||||
field user aaa.user
|
||||
field sess aaa.sess
|
||||
field user aaa.user
|
||||
|
||||
chapter "项目"
|
||||
field "icebergs" web.code.git.trend args `icebergs`
|
||||
field "icebergs" web.code.inner args `usr/icebergs/ misc/mp/mp.go`
|
||||
|
||||
|
@ -20,10 +20,10 @@ import (
|
||||
|
||||
func _wx_sign(m *ice.Message, nonce, stamp string) string {
|
||||
b := sha1.Sum([]byte(strings.Join(kit.Sort([]string{
|
||||
fmt.Sprintf("noncestr=%s", nonce),
|
||||
fmt.Sprintf("timestamp=%s", stamp),
|
||||
fmt.Sprintf("url=%s", m.Option(ice.MSG_USERWEB)),
|
||||
fmt.Sprintf("jsapi_ticket=%s", m.Cmdx(ACCESS, TICKET)),
|
||||
fmt.Sprintf("url=%s", m.Option(ice.MSG_USERWEB)),
|
||||
fmt.Sprintf("timestamp=%s", stamp),
|
||||
fmt.Sprintf("noncestr=%s", nonce),
|
||||
}), "&")))
|
||||
return hex.EncodeToString(b[:])
|
||||
}
|
||||
@ -38,9 +38,9 @@ func _wx_parse(m *ice.Message) {
|
||||
ToUserName string
|
||||
CreateTime int64
|
||||
MsgId int64
|
||||
Event string
|
||||
MsgType string
|
||||
Content string
|
||||
Event string
|
||||
}{}
|
||||
xml.NewDecoder(m.R.Body).Decode(&data)
|
||||
m.Debug("data: %#v", data)
|
||||
@ -48,11 +48,11 @@ func _wx_parse(m *ice.Message) {
|
||||
m.Option("FromUserName", data.FromUserName)
|
||||
m.Option("ToUserName", data.ToUserName)
|
||||
m.Option("CreateTime", data.CreateTime)
|
||||
|
||||
m.Option("MsgId", data.MsgId)
|
||||
|
||||
m.Option("Event", data.Event)
|
||||
m.Option("MsgType", data.MsgType)
|
||||
m.Option("Content", data.Content)
|
||||
m.Option("Event", data.Event)
|
||||
}
|
||||
func _wx_reply(m *ice.Message, tmpl string) {
|
||||
m.Render(m.Conf(LOGIN, kit.Keym(kit.MDB_TEMPLATE, tmpl)))
|
||||
@ -75,10 +75,10 @@ func _wx_action(m *ice.Message) {
|
||||
m.Echo(`<Articles>`)
|
||||
m.Table(func(index int, value map[string]string, head []string) {
|
||||
m.Echo(`<item>
|
||||
<Title><![CDATA[%s]]></Title>
|
||||
<Description><![CDATA[%s]]></Description>
|
||||
<PicUrl><![CDATA[%s]]></PicUrl>
|
||||
<Url><![CDATA[%s]]></Url>
|
||||
<Title><![CDATA[%s]]></Title>
|
||||
<Description><![CDATA[%s]]></Description>
|
||||
<PicUrl><![CDATA[%s]]></PicUrl>
|
||||
<Url><![CDATA[%s]]></Url>
|
||||
</item>
|
||||
`, value[wiki.TITLE], value[wiki.SPARK], value[wiki.IMAGE], value[wiki.REFER])
|
||||
})
|
||||
@ -128,7 +128,7 @@ var Index = &ice.Context{Name: WX, Help: "公众号",
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Load()
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, WEIXIN, m.Conf(LOGIN, kit.Keys(kit.MDB_META, WEIXIN)))
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, WEIXIN, m.Conf(LOGIN, kit.Keym(WEIXIN)))
|
||||
}},
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Save()
|
||||
@ -136,14 +136,14 @@ var Index = &ice.Context{Name: WX, Help: "公众号",
|
||||
|
||||
ACCESS: {Name: "access appid auto ticket token login", Help: "认证", Action: map[string]*ice.Action{
|
||||
LOGIN: {Name: "login appid appmm token", Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Conf(LOGIN, kit.Keys(kit.MDB_META, APPID), m.Option(APPID))
|
||||
m.Conf(LOGIN, kit.Keys(kit.MDB_META, APPMM), m.Option(APPMM))
|
||||
m.Conf(LOGIN, kit.Keys(kit.MDB_META, TOKEN), m.Option(TOKEN))
|
||||
m.Conf(LOGIN, kit.Keym(APPID), m.Option(APPID))
|
||||
m.Conf(LOGIN, kit.Keym(APPMM), m.Option(APPMM))
|
||||
m.Conf(LOGIN, kit.Keym(TOKEN), m.Option(TOKEN))
|
||||
}},
|
||||
TOKEN: {Name: "token", Help: "令牌", Hand: func(m *ice.Message, arg ...string) {
|
||||
if now := time.Now().Unix(); m.Conf(LOGIN, kit.Keym(ACCESS, TOKEN)) == "" || now > kit.Int64(m.Conf(LOGIN, kit.Keym(ACCESS, EXPIRE))) {
|
||||
msg := m.Cmd(web.SPIDE, WEIXIN, web.SPIDE_GET, "/cgi-bin/token?grant_type=client_credential",
|
||||
APPID, m.Conf(LOGIN, kit.Keys(kit.MDB_META, APPID)), "secret", m.Conf(LOGIN, kit.Keys(kit.MDB_META, APPMM)))
|
||||
APPID, m.Conf(LOGIN, kit.Keym(APPID)), "secret", m.Conf(LOGIN, kit.Keym(APPMM)))
|
||||
if m.Warn(msg.Append("errcode") != "", "%v: %v", msg.Append("errcode"), msg.Append("errmsg")) {
|
||||
return
|
||||
}
|
||||
@ -172,7 +172,7 @@ var Index = &ice.Context{Name: WX, Help: "公众号",
|
||||
|
||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Echo(m.Conf(LOGIN, kit.Keys(kit.MDB_META, APPID)))
|
||||
m.Echo(m.Conf(LOGIN, kit.Keym(APPID)))
|
||||
}},
|
||||
|
||||
MENU: {Name: "menu name auto", Help: "菜单", Action: map[string]*ice.Action{
|
||||
|
@ -9,16 +9,16 @@ image `/share/local/usr/image/qrcode_for_gh_1c21ed4eb46b_258.jpg`
|
||||
|
||||
chapter "应用"
|
||||
field scan web.chat.scan
|
||||
field paste web.chat.paste
|
||||
field files web.chat.files
|
||||
field paste web.chat.paste
|
||||
field location web.chat.location
|
||||
|
||||
chapter "权限"
|
||||
field access web.chat.wx.access
|
||||
field menu web.chat.wx.menu
|
||||
field share web.share
|
||||
field user aaa.user
|
||||
field sess aaa.sess
|
||||
field user aaa.user
|
||||
|
||||
chapter "项目"
|
||||
field "icebergs" web.code.git.trend args `icebergs`
|
||||
|
Loading…
x
Reference in New Issue
Block a user