Files
jx-callback/controllers/cms_user.go
2018-09-12 15:18:56 +08:00

98 lines
3.9 KiB
Go

package controllers
import (
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"github.com/astaxie/beego"
)
type UserController struct {
beego.Controller
}
// @Title 得到门店用户信息
// @Description 得到门店用户信息
// @Param token header string true "认证token"
// @Param storeID query int true "门店号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetStoreUsers [get]
func (c *UserController) TmpGetStoreUsers() {
c.callTmpGetStoreUsers(func(params *tUserTmpGetStoreUsersParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStoreUsers(params.StoreID)
return retVal, "", err
})
}
// @Title 得到用户门店及成员信息
// @Description 得到用户门店及成员信息
// @Param token header string true "认证token"
// @Param mobile query string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetUserInfo [get]
func (c *UserController) TmpGetUserInfo() {
c.callTmpGetUserInfo(func(params *tUserTmpGetUserInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetUserInfo(params.Mobile)
return retVal, "", err
})
}
// @Title 取消手机门店绑定
// @Description 此操作会将此手机关联的所有门店信息清除(取消组长,取消自己为他组组员),如果此人为组长,取消后组员也相应会取消门店绑定(但组员的成员关系还在)
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpUnbindMobile [put]
func (c *UserController) TmpUnbindMobile() {
c.callTmpUnbindMobile(func(params *tUserTmpUnbindMobileParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.UnbindMobile(params.Mobile)
return retVal, "", err
})
}
// @Title 手机门店绑定
// @Description 此操作会将此手机设置成为相应门的组长,如果之前有组员关系,则此操作后,组员也会自动与门店绑定
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号"
// @Param storeID formData int true "门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpBindMobile2Store [put]
func (c *UserController) TmpBindMobile2Store() {
c.callTmpBindMobile2Store(func(params *tUserTmpBindMobile2StoreParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.BindMobile2Store(params.Mobile, params.StoreID)
return retVal, "", err
})
}
// @Title 将手机加到另一手机上
// @Description 将手机加到另一手机上
// @Param token header string true "认证token"
// @Param parentMobile formData string true "父手机号"
// @Param mobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpAddMobile2Mobile [put]
func (c *UserController) TmpAddMobile2Mobile() {
c.callTmpAddMobile2Mobile(func(params *tUserTmpAddMobile2MobileParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.AddMobile2Mobile(params.ParentMobile, params.Mobile)
return retVal, "", err
})
}
// @Title 变更手机号
// @Description 变更手机号
// @Param token header string true "认证token"
// @Param curMobile formData string true "当前手机号"
// @Param expectedMobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpChangeMobile [put]
func (c *UserController) TmpChangeMobile() {
c.callTmpChangeMobile(func(params *tUserTmpChangeMobileParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.ChangeMobile(params.CurMobile, params.ExpectedMobile)
return retVal, "", err
})
}