|
@@ -54,6 +54,7 @@ func (self *PermitController) XcxAuthorize() {
|
|
|
channel, _ := self.GetInt64("channel", 0)
|
|
channel, _ := self.GetInt64("channel", 0)
|
|
|
// beego.BeeLogger.Warn("XcxAuthorize userinfo: %s", params)
|
|
// beego.BeeLogger.Warn("XcxAuthorize userinfo: %s", params)
|
|
|
inviteId, _ := self.GetInt64("invite_id", 0)
|
|
inviteId, _ := self.GetInt64("invite_id", 0)
|
|
|
|
|
+ first := false
|
|
|
beego.BeeLogger.Warn("XcxAuthorize inviteId: %d", inviteId)
|
|
beego.BeeLogger.Warn("XcxAuthorize inviteId: %d", inviteId)
|
|
|
type UserInfo struct {
|
|
type UserInfo struct {
|
|
|
NickName string `json:"nickName"` // 用户的昵称
|
|
NickName string `json:"nickName"` // 用户的昵称
|
|
@@ -121,6 +122,8 @@ func (self *PermitController) XcxAuthorize() {
|
|
|
if wxUser != nil {
|
|
if wxUser != nil {
|
|
|
wxUser.Openid = encryptedData.OpenId
|
|
wxUser.Openid = encryptedData.OpenId
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ //首次授权
|
|
|
|
|
+ first = true
|
|
|
introUserId := int64(1)
|
|
introUserId := int64(1)
|
|
|
if inviteId == int64(0) {
|
|
if inviteId == int64(0) {
|
|
|
inviteId = int64(1)
|
|
inviteId = int64(1)
|
|
@@ -162,6 +165,10 @@ func (self *PermitController) XcxAuthorize() {
|
|
|
if wxUser != nil {
|
|
if wxUser != nil {
|
|
|
self.SetSession(apps.SessionWxUserKey, wxUser.Id)
|
|
self.SetSession(apps.SessionWxUserKey, wxUser.Id)
|
|
|
}
|
|
}
|
|
|
|
|
+ //赠送积分
|
|
|
|
|
+ if first {
|
|
|
|
|
+ go helpers.SendCent(wxUser.Id, inviteId)
|
|
|
|
|
+ }
|
|
|
// 如果微信用户已绑定手机,则找出userId,并且赋值给session[userId]
|
|
// 如果微信用户已绑定手机,则找出userId,并且赋值给session[userId]
|
|
|
if wxUser != nil && wxUser.UserId > 0 {
|
|
if wxUser != nil && wxUser.UserId > 0 {
|
|
|
user := user_model.GetUserById(wxUser.UserId, false)
|
|
user := user_model.GetUserById(wxUser.UserId, false)
|