info
This commit is contained in:
parent
8fe6e8be74
commit
c1203e8989
|
@ -49,42 +49,42 @@ func (l *UserAddAddressLogic) UserAddAddress(req *types.RequestAddAddress, useri
|
|||
isDefautl int64 = 1 // 默认地址为1
|
||||
)
|
||||
createOne := &gmodel.FsAddress{ // 构建FsAddress结构体
|
||||
Name: &req.Name,
|
||||
FirstName: &req.FirstName,
|
||||
LastName: &req.LastName,
|
||||
Mobile: &req.Mobile,
|
||||
Street: &req.Street,
|
||||
Suite: &req.Suite,
|
||||
City: &req.City,
|
||||
State: &req.State,
|
||||
Country: &country,
|
||||
Status: &status,
|
||||
UserId: &userinfo.UserId,
|
||||
ZipCode: &req.ZipCode,
|
||||
IsDefault: &isDefautl,
|
||||
AddressName: &req.Name,
|
||||
FirstName: &req.FirstName,
|
||||
LastName: &req.LastName,
|
||||
Mobile: &req.Mobile,
|
||||
Street: &req.Street,
|
||||
Suite: &req.Suite,
|
||||
City: &req.City,
|
||||
State: &req.State,
|
||||
Country: &country,
|
||||
Status: &status,
|
||||
UserId: &userinfo.UserId,
|
||||
ZipCode: &req.ZipCode,
|
||||
IsDefault: &isDefautl,
|
||||
}
|
||||
created, err := m.CreateOne(l.ctx, createOne) // 新增地址
|
||||
if err != nil {
|
||||
logx.Error(err) // 日志记录错误
|
||||
return resp.SetStatus(basic.CodeDbCreateErr) // 返回数据库创建错误
|
||||
}
|
||||
return resp.SetStatus(basic.CodeOK, map[string]int64{"id": created.Id}) // 返回成功并返回地址ID
|
||||
return resp.SetStatus(basic.CodeOK, map[string]int64{"id": created.AddressId}) // 返回成功并返回地址ID
|
||||
}
|
||||
|
||||
address := &gmodel.FsAddress{
|
||||
Id: req.Id,
|
||||
Name: &req.Name,
|
||||
FirstName: &req.FirstName,
|
||||
LastName: &req.LastName,
|
||||
Mobile: &req.Mobile,
|
||||
Street: &req.Street,
|
||||
Suite: &req.Suite,
|
||||
City: &req.City,
|
||||
State: &req.State,
|
||||
Status: &status,
|
||||
UserId: &userinfo.UserId,
|
||||
ZipCode: &req.ZipCode,
|
||||
IsDefault: &req.IsDefault,
|
||||
AddressId: req.Id,
|
||||
AddressName: &req.Name,
|
||||
FirstName: &req.FirstName,
|
||||
LastName: &req.LastName,
|
||||
Mobile: &req.Mobile,
|
||||
Street: &req.Street,
|
||||
Suite: &req.Suite,
|
||||
City: &req.City,
|
||||
State: &req.State,
|
||||
Status: &status,
|
||||
UserId: &userinfo.UserId,
|
||||
ZipCode: &req.ZipCode,
|
||||
IsDefault: &req.IsDefault,
|
||||
}
|
||||
|
||||
// 插入数据库 更新地址
|
||||
|
@ -94,5 +94,5 @@ func (l *UserAddAddressLogic) UserAddAddress(req *types.RequestAddAddress, useri
|
|||
return resp.SetStatus(basic.CodeDbUpdateErr)
|
||||
}
|
||||
|
||||
return resp.SetStatus(basic.CodeOK, map[string]int64{"id": address.Id})
|
||||
return resp.SetStatus(basic.CodeOK, map[string]int64{"id": address.AddressId})
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ type (
|
|||
|
||||
AddressObjectRequest {
|
||||
AddressId int64 `json:"address_id"` // 地址id
|
||||
Address string `json:"address"` // 地址
|
||||
AddressName string `json:"address_name"` // 地址
|
||||
}
|
||||
|
||||
AddressIdRequest {
|
||||
|
@ -41,6 +41,6 @@ type (
|
|||
}
|
||||
|
||||
AddressNameRequest {
|
||||
Address string `json:"address"` // 地址
|
||||
AddressName string `json:"address_name"` // 地址
|
||||
}
|
||||
)
|
Loading…
Reference in New Issue
Block a user