添加用户配送地址管理API
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
@@ -248,3 +249,78 @@ func (c *User2Controller) TransferLegacyWeixins() {
|
||||
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 true "详细地址"
|
||||
// @Param lng formData float64 true "经度"
|
||||
// @Param lat formData float64 true "纬度"
|
||||
// @Param tag formData string false "标签"
|
||||
// @Param remark formData string false "备注"
|
||||
// @Param isDefault formData bool 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
|
||||
params.MapData["isDefault"] = utils.Bool2Int(params.IsDefault)
|
||||
if err = utils.Map2StructByJson(params.MapData, &address, true); err == nil {
|
||||
retVal, err = cms.AddMyDeliveryAddress(params.Ctx, address)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 用户自己删除配送地址
|
||||
// @Description 用户自己删除送地址
|
||||
// @Param token header string true "认证token"
|
||||
// @Param addressID 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.AddressID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 用户自己修改配送地址
|
||||
// @Description 用户自己修改配送地址
|
||||
// @Param token header string true "认证token"
|
||||
// @Param addressID formData int true "地址ID"
|
||||
// @Param consigneeName formData string false "收货人"
|
||||
// @Param consigneeMobile formData string false "收货人手机"
|
||||
// @Param address 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 bool false "是否是默认"
|
||||
// @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) {
|
||||
params.MapData["isDefault"] = utils.Bool2Int(params.IsDefault)
|
||||
err = cms.UpdateMyDeliveryAddress(params.Ctx, params.AddressID, 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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user