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