mirror of
https://shylinux.com/x/ContextOS
synced 2025-06-26 18:07:30 +08:00
fix weixin
This commit is contained in:
parent
12a921458b
commit
3f19571c05
@ -4,5 +4,5 @@ var version = struct {
|
|||||||
host string
|
host string
|
||||||
self int
|
self int
|
||||||
}{
|
}{
|
||||||
"2019-09-22 16:06:14", "com", 628,
|
"2019-09-22 20:28:29", "com", 635,
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ func (c *Context) Register(s *Context, x Server, args ...interface{}) *Context {
|
|||||||
case bool:
|
case bool:
|
||||||
force = arg
|
force = arg
|
||||||
case string:
|
case string:
|
||||||
|
force = true
|
||||||
name, s.Name = arg, arg
|
name, s.Name = arg, arg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,18 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
|||||||
},
|
},
|
||||||
Commands: map[string]*ctx.Command{
|
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) {
|
"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 !m.Options("sessid") || !m.Options("username") {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
@ -121,7 +133,6 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
|||||||
case "rename":
|
case "rename":
|
||||||
m.Cmd("aaa.auth", "username", m.Option("username"), "data", "nickname", arg[1])
|
m.Cmd("aaa.auth", "username", m.Option("username"), "data", "nickname", arg[1])
|
||||||
|
|
||||||
case "weixin":
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,3 +55,9 @@ kit wss "推送" private "web.wss" \
|
|||||||
button "返回" click Last \
|
button "返回" click Last \
|
||||||
exports wss key
|
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 \
|
||||||
|
@ -57,6 +57,7 @@ var Index = &ctx.Context{Name: "weixin", Help: "微信后台",
|
|||||||
Commands: map[string]*ctx.Command{
|
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) {
|
"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("format", "object")
|
||||||
|
m.Option("temp_expire", "1")
|
||||||
now := kit.Int(time.Now().Unix())
|
now := kit.Int(time.Now().Unix())
|
||||||
|
|
||||||
access := m.Confm("chat", "access")
|
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) {
|
"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("format", "object")
|
||||||
|
m.Option("temp_expire", "1")
|
||||||
now := kit.Int(time.Now().Unix())
|
now := kit.Int(time.Now().Unix())
|
||||||
|
|
||||||
ticket := m.Confm("chat", "ticket")
|
ticket := m.Confm("chat", "ticket")
|
||||||
|
@ -150,13 +150,13 @@ function Page(page) {
|
|||||||
wx.error(function(res){})
|
wx.error(function(res){})
|
||||||
wx.ready(function(){
|
wx.ready(function(){
|
||||||
page.getLocation = function(cb) {
|
page.getLocation = function(cb) {
|
||||||
wx.getLocation({success: function (res) {cb(res)}})
|
wx.getLocation({success: function (res) {
|
||||||
|
cb(res)
|
||||||
|
}})
|
||||||
}
|
}
|
||||||
page.openLocation = function(latitude, longitude, name) {
|
page.openLocation = function(latitude, longitude, name) {
|
||||||
wx.openLocation({latitude: parseFloat(latitude), longitude: parseFloat(longitude), name:name||"here"})
|
wx.openLocation({latitude: parseFloat(latitude), longitude: parseFloat(longitude), name:name||"here"})
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.getNetworkType({success: function (res) {}})
|
|
||||||
wx.getLocation({success: function (res) {
|
wx.getLocation({success: function (res) {
|
||||||
page.footer.Pane.State("site", parseInt(res.latitude*10000)+","+parseInt(res.longitude*10000))
|
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()
|
}), 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) {
|
Help: function(type, action) {
|
||||||
var text = []
|
var text = []
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user