Merge remote-tracking branch 'origin/mark' into su

This commit is contained in:
苏尹岚
2019-11-12 17:52:12 +08:00
22 changed files with 266 additions and 172 deletions

View File

@@ -6,7 +6,6 @@ import (
"net/http"
"strings"
"git.rosy.net.cn/baseapi/platformapi/weixinapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/dingding"
@@ -14,7 +13,6 @@ import (
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/password"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego"
)
@@ -297,30 +295,3 @@ func (c *Auth2Controller) ChangePassword() {
return retVal, "", err
})
}
// @Title 解密小程序数据
// @Description 解密小程序数据
// @Param token header string true "认证token"
// @Param data formData string true "加密数据"
// @Param iv formData string true "iv"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /MiniDecryptData [post]
func (c *Auth2Controller) MiniDecryptData() {
c.callMiniDecryptData(func(params *tAuth2MiniDecryptDataParams) (retVal interface{}, errCode string, err error) {
authInfo, err := params.Ctx.GetV2AuthInfo()
if err == nil {
decryptedDataBase64, err2 := weixin.AutherObjMini.DecryptData(authInfo, params.Data, params.Iv)
if err = err2; err == nil {
var userInfo *weixinapi.MiniUserInfo
if err = utils.UnmarshalUseNumber([]byte(decryptedDataBase64), &userInfo); err == nil {
if user := params.Ctx.GetFullUser(); user != nil {
user.Avatar = userInfo.AvatarURL
dao.UpdateEntity(dao.GetDB(), user, "Avatar")
}
}
}
}
return retVal, "", err
})
}

View File

@@ -237,7 +237,7 @@ func (c *StoreController) TmpGetJxBadCommentsByStoreId() {
if err = err2; err == nil {
pageSize := jxutils.FormalizePageSize(params.Size)
offset := (params.Page - 1) * pageSize
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, []int{params.JxStoreId}, offset, pageSize, params.Type, timeList[0], timeList[1])
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, "", []int{params.JxStoreId}, offset, pageSize, params.Type, timeList[0], timeList[1])
}
return retVal, "", err
})
@@ -247,11 +247,12 @@ func (c *StoreController) TmpGetJxBadCommentsByStoreId() {
// @Description 得到门店评价列表(多店)
// @Param token header string true "认证token"
// @Param type query int true "评论类型0差评1所有2已解决"
// @Param keyword query string false "关键字"
// @Param storeIDs query string false "门店I列表"
// @Param offset query int false "起始页从1开始"
// @Param pageSize query int false "页大小(-1表示无限大"
// @Param fromTime query string false "创建起始时间"
// @Param toTime query string false "创建结束时间"
// @Param offset query int false "起始页从1开始"
// @Param pageSize query int false "页大小(-1表示无限大"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetJxBadComments [get]
@@ -261,7 +262,7 @@ func (c *StoreController) TmpGetJxBadComments() {
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
if err = err2; err == nil {
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, storeIDs, params.Offset, params.PageSize, params.Type, timeList[0], timeList[1])
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.Keyword, storeIDs, params.Offset, params.PageSize, params.Type, timeList[0], timeList[1])
}
}
return retVal, "", err

View File

@@ -1,13 +1,16 @@
package controllers
import (
"git.rosy.net.cn/baseapi/platformapi/weixinapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/authz"
"git.rosy.net.cn/jx-callback/business/authz/autils"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"github.com/astaxie/beego"
)
@@ -374,3 +377,37 @@ func (c *User2Controller) GetSelfInfo() {
return retVal, "", err
})
}
// @Title 根据小程序jsCode修改用户信息
// @Description 根据小程序jsCode修改用户信息
// @Param token header string true "认证token"
// @Param jsCode query string true "小程序jsCode"
// @Param data query string true "加密数据"
// @Param iv query string true "iv"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateUserByMiniInfo [put]
func (c *Auth2Controller) UpdateUserByMiniInfo() {
c.callUpdateUserByMiniInfo(func(params *tAuth2UpdateUserByMiniInfoParams) (retVal interface{}, errCode string, err error) {
authInfo, err := params.Ctx.GetV2AuthInfo()
if err == nil {
decryptedDataBase64, err2 := weixin.AutherObjMini.DecryptData(authInfo, GetComposedCode(&c.Controller, params.JsCode), params.Data, params.Iv)
if err = err2; err == nil {
var userInfo *weixinapi.MiniUserInfo
if err = utils.UnmarshalUseNumber([]byte(decryptedDataBase64), &userInfo); err == nil {
retVal = userInfo
if user := params.Ctx.GetFullUser(); user != nil {
if userInfo.AvatarURL != "" {
user.Avatar = userInfo.AvatarURL
}
if userInfo.PurePhoneNumber != "" {
user.Mobile = utils.String2Pointer(userInfo.PurePhoneNumber)
}
dao.UpdateEntity(dao.GetDB(), user)
}
}
}
}
return retVal, "", err
})
}