1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

fix weixin

This commit is contained in:
shylinux 2019-09-22 20:47:38 +08:00
parent 12a921458b
commit 3f19571c05
6 changed files with 38 additions and 5 deletions

View File

@ -4,5 +4,5 @@ var version = struct {
host string
self int
}{
"2019-09-22 16:06:14", "com", 628,
"2019-09-22 20:28:29", "com", 635,
}

View File

@ -17,6 +17,7 @@ func (c *Context) Register(s *Context, x Server, args ...interface{}) *Context {
case bool:
force = arg
case string:
force = true
name, s.Name = arg, arg
}
}

View File

@ -89,6 +89,18 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
},
Commands: map[string]*ctx.Command{
"login": &ctx.Command{Name: "login [username password]", Help: "登录", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if len(arg) > 0 {
switch arg[0] {
case "weixin":
if msg := m.Find("cli.weixin", true); msg != nil {
msg.Cmd("js_token")
m.Copy(msg, "append")
m.Table()
}
return
}
}
// 非登录态
if !m.Options("sessid") || !m.Options("username") {
if len(arg) > 0 {
@ -121,7 +133,6 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
case "rename":
m.Cmd("aaa.auth", "username", m.Option("username"), "data", "nickname", arg[1])
case "weixin":
}
}

View File

@ -55,3 +55,9 @@ kit wss "推送" private "web.wss" \
button "返回" click Last \
exports wss key
kit pos "位置" private \
button "查看" click getLocation \
button "显示" click openLocation \
text "0.0062" name x \
text "0.0014" name y \
text "当前位置" name pos \

View File

@ -57,6 +57,7 @@ var Index = &ctx.Context{Name: "weixin", Help: "微信后台",
Commands: map[string]*ctx.Command{
"access": &ctx.Command{Name: "access", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
m.Option("format", "object")
m.Option("temp_expire", "1")
now := kit.Int(time.Now().Unix())
access := m.Confm("chat", "access")
@ -70,6 +71,7 @@ var Index = &ctx.Context{Name: "weixin", Help: "微信后台",
}},
"ticket": &ctx.Command{Name: "ticket", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
m.Option("format", "object")
m.Option("temp_expire", "1")
now := kit.Int(time.Now().Unix())
ticket := m.Confm("chat", "ticket")

View File

@ -150,13 +150,13 @@ function Page(page) {
wx.error(function(res){})
wx.ready(function(){
page.getLocation = function(cb) {
wx.getLocation({success: function (res) {cb(res)}})
wx.getLocation({success: function (res) {
cb(res)
}})
}
page.openLocation = function(latitude, longitude, name) {
wx.openLocation({latitude: parseFloat(latitude), longitude: parseFloat(longitude), name:name||"here"})
}
wx.getNetworkType({success: function (res) {}})
wx.getLocation({success: function (res) {
page.footer.Pane.State("site", parseInt(res.latitude*10000)+","+parseInt(res.longitude*10000))
}})
@ -810,6 +810,19 @@ function Plugin(page, pane, field, runs) {
}), plugin.Check()
},
getLocation: function(event, target, option, field, cb) {
page.getLocation && page.getLocation(cb || (function(res) {
page.ontoast(JSON.stringify(res))
}))
},
openLocation: function(event) {
var x = parseFloat(option.x.value)
var y = parseFloat(option.y.value)
page.getLocation && page.getLocation(function(res) {
page.openLocation && page.openLocation(res.latitude+y, res.longitude+x, option.pos.value)
})
},
Help: function(type, action) {
var text = []
switch (type) {