科创地图打包
This commit is contained in:
parent
31a6568cbe
commit
cbed318832
@ -15,6 +15,8 @@ import (
|
||||
|
||||
// Project 管理端项目
|
||||
var Project = Proj{
|
||||
"user": User,
|
||||
"salesman": Salesman,
|
||||
"lxcx": Lxcx,
|
||||
"wechat": Wechat,
|
||||
"websocket": WebsocketCtr,
|
||||
|
66
example/app/salesman.go
Normal file
66
example/app/salesman.go
Normal file
@ -0,0 +1,66 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
)
|
||||
|
||||
var Salesman = Ctr{
|
||||
//用户微信公众号或者小程序登录
|
||||
"login": func(that *Context) {
|
||||
acttoken := that.Req.FormValue("acttoken")
|
||||
retoken := that.Req.FormValue("retoken")
|
||||
appid := that.Req.FormValue("appid")
|
||||
unionid := that.Req.FormValue("unionid")
|
||||
openid := that.Req.FormValue("openid")
|
||||
nickname := that.Req.FormValue("nickname")
|
||||
avatar := that.Req.FormValue("avatar")
|
||||
phone := that.Req.FormValue("phone")
|
||||
Type := ObjToInt(that.Req.FormValue("type"))
|
||||
|
||||
if acttoken == "" || retoken == "" || appid == "" || unionid == "" || openid == "" || nickname == "" || avatar == "" || that.Req.FormValue("type") == "" || phone == "" {
|
||||
that.Display(3, "请求参数异常,请校验参数")
|
||||
return
|
||||
}
|
||||
|
||||
wechat := that.Db.Get("wechat", "*", Map{"AND": Map{"openid": openid, "del_flag": 0}})
|
||||
salesman := that.Db.Get("salesman", "*", Map{"phone": phone})
|
||||
|
||||
if salesman == nil {
|
||||
that.Display(3, "找不到企服商")
|
||||
return
|
||||
}
|
||||
|
||||
if wechat != nil {
|
||||
//有用户直接返回
|
||||
if wechat.GetCeilInt("salesman_id") != 0 && wechat.GetCeilInt64("salesman_id") == salesman.GetInt64("id") {
|
||||
that.Display(0, wechat)
|
||||
return
|
||||
}
|
||||
|
||||
that.Db.Update("wechat", Map{"salesman_id": salesman.GetCeilInt64("id")}, Map{"id": wechat.GetInt64("id")})
|
||||
|
||||
wechat["salesman_id"] = salesman.GetCeilInt64("id")
|
||||
that.Display(0, wechat)
|
||||
return
|
||||
}
|
||||
|
||||
wechat = Map{}
|
||||
wechat["salesman_id"] = salesman.GetCeilInt("id")
|
||||
wechat["acttoken"] = acttoken
|
||||
wechat["retoken"] = retoken
|
||||
wechat["appid"] = appid
|
||||
wechat["unionid"] = unionid
|
||||
wechat["openid"] = openid
|
||||
wechat["nickname"] = nickname
|
||||
wechat["avatar"] = avatar
|
||||
wechat["type"] = Type
|
||||
wechat["id"] = that.Db.Insert("wechat", wechat)
|
||||
if wechat.GetCeilInt("id") == 0 {
|
||||
that.Display(4, "创建用户失败")
|
||||
return
|
||||
}
|
||||
that.Display(0, wechat)
|
||||
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user