559 lines
24 KiB
Go
559 lines
24 KiB
Go
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/jxutils/jsonerr"
|
||
"git.rosy.net.cn/jx-callback/business/model"
|
||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type User2Controller struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 用户注册
|
||
// @Description 用户注册
|
||
// @Param token header string false "管理员token"
|
||
// @Param payload formData string true "json数据,User对象(手机号必填)"
|
||
// @Param mobileVerifyCode formData string false "手机验证码(通过auth2.SendVerifyCode获得)(mobileVerifyCode与authToken不能同时为空)"
|
||
// @Param authToken formData string false "之前通过login得到的认证TOKEN(mobileVerifyCode与authToken不能同时为空)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /RegisterUser [post]
|
||
func (c *User2Controller) RegisterUser() {
|
||
c.callRegisterUser(func(params *tUser2RegisterUserParams) (retVal interface{}, errCode string, err error) {
|
||
var (
|
||
user model.User
|
||
inAuthInfo, manTokenInfo *auth2.AuthInfo
|
||
)
|
||
if params.AuthToken != "" {
|
||
inAuthInfo, err = auth2.GetTokenInfo(params.AuthToken)
|
||
} else if params.Token != "" {
|
||
manTokenInfo, err = auth2.GetTokenInfo(params.Token)
|
||
}
|
||
if err == nil {
|
||
if err = jxutils.Strings2Objs(params.Payload, &user); err == nil {
|
||
user.Type = 0
|
||
retVal, err = cms.RegisterUserWithMobile(params.Ctx, &user, params.MobileVerifyCode, inAuthInfo, manTokenInfo)
|
||
}
|
||
}
|
||
return retVal, errCode, err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户已经成功绑定的认证信息
|
||
// @Description 得到用户已经成功绑定的认证信息
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetBindAuthInfo [get]
|
||
func (c *User2Controller) GetBindAuthInfo() {
|
||
c.callGetBindAuthInfo(func(params *tUser2GetBindAuthInfoParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetUserBindAuthInfo(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户列表
|
||
// @Description 得到用户列表
|
||
// @Param token header string true "认证token"
|
||
// @Param userType query int true "用户类型(0表示全部)"
|
||
// @Param keyword query string faslse "关键字,可以部分匹配"
|
||
// @Param userIDs query string faslse "用户id列表"
|
||
// @Param userID2 query string faslse "用户id2,必须全匹配(外部唯一标识)"
|
||
// @Param mobile query string faslse "用户手机,必须全匹配"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetUsers [get]
|
||
func (c *User2Controller) GetUsers() {
|
||
c.callGetUsers(func(params *tUser2GetUsersParams) (retVal interface{}, errCode string, err error) {
|
||
var userIDs []string
|
||
if err = jxutils.Strings2Objs(params.UserIDs, &userIDs); err == nil {
|
||
retVal, err = cms.GetUsers(params.Ctx, params.UserType, params.Keyword, userIDs, params.UserID2, params.Mobile, params.Offset, params.PageSize)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户自己的门店列表
|
||
// @Description 得到用户自己的门店列表
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetMyStoreList [get]
|
||
func (c *User2Controller) GetMyStoreList() {
|
||
c.callGetMyStoreList(func(params *tUser2GetMyStoreListParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, errCode, err = cms.GetMyStoreListNew(params.Ctx)
|
||
return retVal, errCode, err
|
||
})
|
||
}
|
||
|
||
// @Title 得到可用的门店角色列表
|
||
// @Description 得到可用的门店角色列表
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreRoleList [get]
|
||
func (c *User2Controller) GetStoreRoleList() {
|
||
c.callGetStoreRoleList(func(params *tUser2GetStoreRoleListParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetStoreRoleList(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户所具有的角色列表
|
||
// @Description 得到用户所具有的角色列表
|
||
// @Param token header string true "认证token"
|
||
// @Param userID query string true "用户i"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetUserRoleList [get]
|
||
func (c *User2Controller) GetUserRoleList() {
|
||
c.callGetUserRoleList(func(params *tUser2GetUserRoleListParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetUserRoleList(params.Ctx, params.UserID)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到角色包括的用户列表
|
||
// @Description 得到角色包括的用户列表
|
||
// @Param token header string true "认证token"
|
||
// @Param roleName query string true "角色名"
|
||
// @Param storeID query int false "门店ID(如果是全局角色不用填)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetRoleUserList [get]
|
||
func (c *User2Controller) GetRoleUserList() {
|
||
c.callGetRoleUserList(func(params *tUser2GetRoleUserListParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetRoleUserList(params.Ctx, autils.NewRole(params.RoleName, params.StoreID))
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 批量得到角色包括的用户列表
|
||
// @Description 批量得到角色包括的用户列表
|
||
// @Param token header string true "认证token"
|
||
// @Param roleNames query string true "角色名"
|
||
// @Param storeIDs query string false "门店ID(如果是全局角色不用填)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetRolesUserList [get]
|
||
func (c *User2Controller) GetRolesUserList() {
|
||
c.callGetRolesUserList(func(params *tUser2GetRolesUserListParams) (retVal interface{}, errCode string, err error) {
|
||
var roleNames []string
|
||
var storeIDs []int
|
||
if err = jxutils.Strings2Objs(params.RoleNames, &roleNames, params.StoreIDs, &storeIDs); err == nil {
|
||
var roleList []*authz.RoleInfo
|
||
for _, roleName := range roleNames {
|
||
if roleName == authz.StoreRoleBoss {
|
||
for _, storeID := range storeIDs {
|
||
roleList = append(roleList, autils.NewRole(roleName, storeID))
|
||
}
|
||
} else {
|
||
roleList = append(roleList, autils.NewRole(roleName, 0))
|
||
}
|
||
}
|
||
retVal, err = cms.GetRolesUserList(params.Ctx, roleList)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 给指定用户添加角色列表
|
||
// @Description 给指定用户添加角色列表
|
||
// @Param token header string true "认证token"
|
||
// @Param userID formData string true "用户ID"
|
||
// @Param roleList formData string true "角色列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /AddRoles4User [post]
|
||
func (c *User2Controller) AddRoles4User() {
|
||
c.callAddRoles4User(func(params *tUser2AddRoles4UserParams) (retVal interface{}, errCode string, err error) {
|
||
var roleList []*authz.RoleInfo
|
||
if err = jxutils.Strings2Objs(params.RoleList, &roleList); err == nil {
|
||
err = cms.AddRoles4User(params.Ctx, params.UserID, roleList)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 给指定用户删除角色列表
|
||
// @Description 给指定用户删除角色列表
|
||
// @Param token header string true "认证token"
|
||
// @Param userID query string true "用户ID"
|
||
// @Param roleList query string true "角色列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteRoles4User [delete]
|
||
func (c *User2Controller) DeleteRoles4User() {
|
||
c.callDeleteRoles4User(func(params *tUser2DeleteRoles4UserParams) (retVal interface{}, errCode string, err error) {
|
||
var roleList []*authz.RoleInfo
|
||
if err = jxutils.Strings2Objs(params.RoleList, &roleList); err == nil {
|
||
err = cms.DeleteRoles4User(params.Ctx, params.UserID, roleList)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 给指定角色添加用户列表
|
||
// @Description 给指定角色添加用户列表
|
||
// @Param token header string true "认证token"
|
||
// @Param roleName formData string true "角色名"
|
||
// @Param storeID formData int false "门店ID"
|
||
// @Param userIDs formData string true "用户ID列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /AddUsers4Role [post]
|
||
func (c *User2Controller) AddUsers4Role() {
|
||
c.callAddUsers4Role(func(params *tUser2AddUsers4RoleParams) (retVal interface{}, errCode string, err error) {
|
||
var userIDs []string
|
||
if err = jxutils.Strings2Objs(params.UserIDs, &userIDs); err == nil {
|
||
err = cms.AddUsers4Role(params.Ctx, autils.NewRole(params.RoleName, params.StoreID), userIDs)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 给指定角色删除用户列表
|
||
// @Description 给指定角色删除用户列表
|
||
// @Param token header string true "认证token"
|
||
// @Param roleName query string true "角色名"
|
||
// @Param storeID query int false "门店ID"
|
||
// @Param userIDs query string true "用户ID列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteUsers4Role [delete]
|
||
func (c *User2Controller) DeleteUsers4Role() {
|
||
c.callDeleteUsers4Role(func(params *tUser2DeleteUsers4RoleParams) (retVal interface{}, errCode string, err error) {
|
||
var userIDs []string
|
||
if err = jxutils.Strings2Objs(params.UserIDs, &userIDs); err == nil {
|
||
err = cms.DeleteUsers4Role(params.Ctx, autils.NewRole(params.RoleName, params.StoreID), userIDs)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 给指定角色添加用户列表
|
||
// @Description 给指定角色添加用户列表
|
||
// @Param token header string true "认证token"
|
||
// @Param mobile formData string false "手机号"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /TransferLegacyWeixins [post]
|
||
func (c *User2Controller) TransferLegacyWeixins() {
|
||
c.callTransferLegacyWeixins(func(params *tUser2TransferLegacyWeixinsParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.TransferLegacyWeixins(params.Mobile)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 用户自己增加配送地址
|
||
// @Description 用户自己增加配送地址
|
||
// @Param token header string true "认证token"
|
||
// @Param consigneeName formData string true "收货人"
|
||
// @Param consigneeMobile formData string true "收货人手机"
|
||
// @Param address formData string false "地址(区县以下,门牌号以上的地址信息)"
|
||
// @Param detailAddress formData string false "门牌号"
|
||
// @Param lng formData float64 true "经度"
|
||
// @Param lat formData float64 true "纬度"
|
||
// @Param tag formData string false "标签"
|
||
// @Param remark formData string false "备注"
|
||
// @Param isDefault formData int false "是否是默认"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /AddMyDeliveryAddress [post]
|
||
func (c *User2Controller) AddMyDeliveryAddress() {
|
||
c.callAddMyDeliveryAddress(func(params *tUser2AddMyDeliveryAddressParams) (retVal interface{}, errCode string, err error) {
|
||
// var address *model.UserDeliveryAddress
|
||
// if err = utils.Map2StructByJson(params.MapData, &address, true); err == nil {
|
||
// retVal, err = cms.AddMyDeliveryAddress(params.Ctx, address)
|
||
// }
|
||
address := &model.UserDeliveryAddress{
|
||
ConsigneeName: params.ConsigneeName,
|
||
ConsigneeMobile: params.ConsigneeMobile,
|
||
Address: params.Address,
|
||
DetailAddress: params.DetailAddress,
|
||
Lng: params.Lng,
|
||
Lat: params.Lat,
|
||
Tag: params.Tag,
|
||
Remark: params.Remark,
|
||
IsDefault: int8(params.IsDefault),
|
||
}
|
||
retVal, err = cms.AddMyDeliveryAddress(params.Ctx, address)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 用户自己删除配送地址
|
||
// @Description 用户自己删除送地址
|
||
// @Param token header string true "认证token"
|
||
// @Param id query int true "地址ID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteMyDeliveryAddress [delete]
|
||
func (c *User2Controller) DeleteMyDeliveryAddress() {
|
||
c.callDeleteMyDeliveryAddress(func(params *tUser2DeleteMyDeliveryAddressParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.DeleteMyDeliveryAddress(params.Ctx, params.Id)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 用户自己修改配送地址
|
||
// @Description 用户自己修改配送地址
|
||
// @Param token header string true "认证token"
|
||
// @Param id formData int true "地址ID"
|
||
// @Param consigneeName formData string false "收货人"
|
||
// @Param consigneeMobile formData string false "收货人手机"
|
||
// @Param address formData string false "地址(区县以下,门牌号以上的地址信息)"
|
||
// @Param detailAddress formData string false "门牌号"
|
||
// @Param lng formData float64 false "经度"
|
||
// @Param lat formData float64 false "纬度"
|
||
// @Param tag formData string false "标签"
|
||
// @Param remark formData string false "备注"
|
||
// @Param isDefault formData int false "是否是默认(0:否,1:是)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateMyDeliveryAddress [put]
|
||
func (c *User2Controller) UpdateMyDeliveryAddress() {
|
||
c.callUpdateMyDeliveryAddress(func(params *tUser2UpdateMyDeliveryAddressParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.UpdateMyDeliveryAddress(params.Ctx, params.Id, params.MapData)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 用户查询自己的配送地址
|
||
// @Description 用户查询自己的配送地址
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /QueryMyDeliveryAddress [get]
|
||
func (c *User2Controller) QueryMyDeliveryAddress() {
|
||
c.callQueryMyDeliveryAddress(func(params *tUser2QueryMyDeliveryAddressParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.QueryMyDeliveryAddress(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户指定门店的购物车信息
|
||
// @Description 得到用户指定门店的购物车信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeIDs query string true "门店ID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /LoadMyCart [get]
|
||
func (c *User2Controller) LoadMyCart() {
|
||
c.callLoadMyCart(func(params *tUser2LoadMyCartParams) (retVal interface{}, errCode string, err error) {
|
||
_, userID := params.Ctx.GetMobileAndUserID()
|
||
var storeIDs []int
|
||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||
retVal, err = cms.LoadUserCart(params.Ctx, userID, storeIDs)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 存储用户指定门店的购物车信息
|
||
// @Description 存储用户指定门店的购物车信息
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "门店ID"
|
||
// @Param payload formData string false "完整的购物车商品列表"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /SaveMyCart [post]
|
||
func (c *User2Controller) SaveMyCart() {
|
||
c.callSaveMyCart(func(params *tUser2SaveMyCartParams) (retVal interface{}, errCode string, err error) {
|
||
var cartItems []*model.UserCartItem
|
||
_, userID := params.Ctx.GetMobileAndUserID()
|
||
if err = jxutils.Strings2Objs(params.Payload, &cartItems); err == nil {
|
||
err = cms.SaveUserCart(params.Ctx, userID, params.StoreID, cartItems)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户自己的信息
|
||
// @Description 得到用户自己的信息
|
||
// @Param token header string true "认证token"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetSelfInfo [get]
|
||
func (c *User2Controller) GetSelfInfo() {
|
||
c.callGetSelfInfo(func(params *tUser2GetSelfInfoParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetSelfInfo(params.Ctx)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 根据小程序jsCode修改用户信息
|
||
// @Description 根据小程序jsCode修改用户信息
|
||
// @Param token header string true "认证token"
|
||
// @Param data query string true "加密数据"
|
||
// @Param iv query string true "iv"
|
||
// @Param jsCode query string false "小程序jsCode"
|
||
// @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)
|
||
}
|
||
_, err = dao.UpdateEntity(dao.GetDB(), user)
|
||
if err != nil && dao.IsDuplicateError(err) {
|
||
if mobileAuth, err2 := auth2.LoginInternal(params.Ctx.Context, auth2.AuthTypeMobile, userInfo.PurePhoneNumber, auth2.UserIDMobile, auth2.InternalAuthSecret); err2 == nil {
|
||
err = jsonerr.New(mobileAuth, model.ErrCodeJsonUserAlreadyExist)
|
||
}
|
||
} else if err == nil && userInfo.PurePhoneNumber != "" {
|
||
if tokenInfo, err := auth2.GetTokenInfo(params.Token); err == nil {
|
||
tokenInfo.Mobile = userInfo.PurePhoneNumber
|
||
auth2.SetUserInfo(params.Token, tokenInfo, auth2.DefTokenDuration)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 查找京东用户
|
||
// @Description 查找京东用户
|
||
// @Param token header string true "认证token"
|
||
// @Param isAsync formData bool false "是否异步操作"
|
||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetJdUsers [post]
|
||
func (c *User2Controller) GetJdUsers() {
|
||
c.callGetJdUsers(func(params *tUser2GetJdUsersParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetJdUsers(params.Ctx, params.IsAsync, params.IsContinueWhenError)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 更新用户分成比例
|
||
// @Description 更新用户分成比例
|
||
// @Param token header string true "认证token"
|
||
// @Param userID formData string true "用户userID"
|
||
// @Param dividePercentage formData int fasle "用户分成比例"
|
||
// @Param isReceiver formData bool true "是否加入分账接收方,默认是"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateUserWxNoAndPercent [put]
|
||
func (c *User2Controller) UpdateUserWxNoAndPercent() {
|
||
c.callUpdateUserWxNoAndPercent(func(params *tUser2UpdateUserWxNoAndPercentParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.UpdateUserWxNoAndPercent(&model.User{
|
||
UserID: params.UserID,
|
||
DividePercentage: params.DividePercentage,
|
||
}, params.IsReceiver)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 禁用用户(删除离职用户信息)
|
||
// @Description 禁用用户(删除离职用户信息)
|
||
// @Param token header string true "认证token"
|
||
// @Param userID query string true "用户userID"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /DeleteUserInfo [delete]
|
||
func (c *User2Controller) DeleteUserInfo() {
|
||
c.callDeleteUserInfo(func(params *tUser2DeleteUserInfoParams) (retVal interface{}, errCode string, err error) {
|
||
err = cms.DeleteUserInfo(params.Ctx, params.UserID)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 得到用户自己的门店列表(商城用)
|
||
// @Description 得到用户自己的门店列表(商城用)
|
||
// @Param token header string false "认证token"
|
||
// @Param mobile query string true "电话"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetMyJxStoreList [get]
|
||
func (c *User2Controller) GetMyJxStoreList() {
|
||
c.callGetMyJxStoreList(func(params *tUser2GetMyJxStoreListParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetMyJxStoreList(params.Ctx, params.Mobile)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 插入用户协议表
|
||
// @Description 插入用户协议表
|
||
// @Param token header string false "认证token"
|
||
// @Param payload formData string true "格式数据,UserAgreement"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /CreateUserAgreement [post]
|
||
func (c *User2Controller) CreateUserAgreement() {
|
||
c.callCreateUserAgreement(func(params *tUser2CreateUserAgreementParams) (retVal interface{}, errCode string, err error) {
|
||
var userAgrs []*model.UserAgreement
|
||
if err = jxutils.Strings2Objs(params.Payload, &userAgrs); err == nil {
|
||
cms.CreateUserAgreement(params.Ctx, userAgrs)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 查询用户协议表
|
||
// @Description 查询用户协议表
|
||
// @Param token header string false "认证token"
|
||
// @Param name query string false "名字"
|
||
// @Param idNumber query string false "身份证号"
|
||
// @Param bankNumber query string false "银行卡号"
|
||
// @Param mobile query string false "电话"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetUserAgreement [get]
|
||
func (c *User2Controller) GetUserAgreement() {
|
||
c.callGetUserAgreement(func(params *tUser2GetUserAgreementParams) (retVal interface{}, errCode string, err error) {
|
||
cms.GetUserAgreement(params.Ctx, params.Name, params.IdNumber, params.BankNumber, params.Mobile)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 查询京西商城用户信息
|
||
// @Description 查询京西商城用户信息
|
||
// @Param token header string true "认证token"
|
||
// @Param keyword query string false "关键字"
|
||
// @Param fromTime query string false "开始时间"
|
||
// @Param toTime query string false "结束时间"
|
||
// @Param vendorIDs query string false "平台号"
|
||
// @Param offset query int false "结果起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetJxShopUsers [get]
|
||
func (c *User2Controller) GetJxShopUsers() {
|
||
c.callGetJxShopUsers(func(params *tUser2GetJxShopUsersParams) (retVal interface{}, errCode string, err error) {
|
||
var vendorIDs []int
|
||
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs); err == nil {
|
||
retVal, err = localjx.GetJxShopUsers(params.Ctx, params.Keyword, params.FromTime, params.ToTime, vendorIDs, params.Offset, params.PageSize)
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|