This commit is contained in:
laodaming 2023-06-20 18:37:56 +08:00
parent 313e8a9457
commit f6cee27c3f
19 changed files with 351 additions and 346 deletions

View File

@ -94,9 +94,9 @@ func (l *GetCanteenDetailLogic) GetCanteenDetail(req *types.GetCanteenDetailReq,
mapSize[v.Id] = v
}
//组装返回
list := make([]types.CanteenProduct, 0, len(canteenProductList))
list := make([]*types.CanteenProduct, 0, len(canteenProductList))
for _, v := range canteenProductList {
data := types.CanteenProduct{
data := &types.CanteenProduct{
Id: v.Id,
SizeId: *v.SizeId,
SId: *v.Sid,

View File

@ -10,9 +10,9 @@ type GetCanteenDetailReq struct {
}
type GetCanteenDetailRsp struct {
Id int64 `json:"id"`
Name string `json:"name"`
ProductList []CanteenProduct `json:"product_list"`
Id int64 `json:"id"`
Name string `json:"name"`
ProductList []*CanteenProduct `json:"product_list"`
}
type CanteenProduct struct {

View File

@ -63,7 +63,7 @@ func (l *GetMapLibraryListLogic) GetMapLibraryList(userinfo *auth.UserInfo) (res
}
//tag拼装
if tagIndex, ok := mapTag[*v.TagId]; ok {
data.Tag = types.MapLibraryListTag{
data.Tag = &types.MapLibraryListTag{
Id: templateTagList[tagIndex].Id,
Title: *templateTagList[tagIndex].Title,
}

View File

@ -6,10 +6,10 @@ import (
)
type GetMapLibraryListRsp struct {
Mid int64 `json:"mid"`
Ctime string `json:"ctime"`
Tag MapLibraryListTag `json:"tag"`
Info interface{} `json:"info"`
Mid int64 `json:"mid"`
Ctime string `json:"ctime"`
Tag *MapLibraryListTag `json:"tag"`
Info interface{} `json:"info"`
}
type MapLibraryListTag struct {
@ -31,33 +31,33 @@ type Tag struct {
}
type Info struct {
Id string `json:"id,optional"`
Tag string `json:"tag,optional"`
Title string `json:"title,optional"`
Type string `json:"type,optional"`
Text string `json:"text,optional"`
Fill string `json:"fill,optional"`
FontSize int64 `json:"fontSize,optional"`
FontFamily string `json:"fontFamily,optional"`
IfBr bool `json:"ifBr,optional"`
IfShow bool `json:"ifShow,optional"`
IfGroup bool `json:"ifGroup,optional"`
MaxNum int64 `json:"maxNum,optional"`
Rotation int64 `json:"rotation,optional"`
Align string `json:"align,optional"`
VerticalAlign string `json:"verticalAlign,optional"`
Material string `json:"material,optional"`
Width float64 `json:"width,optional"`
Height float64 `json:"height,optional"`
X float64 `json:"x,optional"`
Y float64 `json:"Y,optional"`
Opacity float64 `json:"opacity,optional"`
OptionalColor []OptionalColor `json:"optionalColor,optional"`
ZIndex int64 `json:"zIndex,optional"`
SvgPath string `json:"svgPath,optional"`
Follow Follow `json:"follow,optional"`
Group []Group `json:"group,optional"`
CameraStand CameraStand `json:"cameraStand,optional"`
Id string `json:"id,optional"`
Tag string `json:"tag,optional"`
Title string `json:"title,optional"`
Type string `json:"type,optional"`
Text string `json:"text,optional"`
Fill string `json:"fill,optional"`
FontSize int64 `json:"fontSize,optional"`
FontFamily string `json:"fontFamily,optional"`
IfBr bool `json:"ifBr,optional"`
IfShow bool `json:"ifShow,optional"`
IfGroup bool `json:"ifGroup,optional"`
MaxNum int64 `json:"maxNum,optional"`
Rotation int64 `json:"rotation,optional"`
Align string `json:"align,optional"`
VerticalAlign string `json:"verticalAlign,optional"`
Material string `json:"material,optional"`
Width float64 `json:"width,optional"`
Height float64 `json:"height,optional"`
X float64 `json:"x,optional"`
Y float64 `json:"Y,optional"`
Opacity float64 `json:"opacity,optional"`
OptionalColor []*OptionalColor `json:"optionalColor,optional"`
ZIndex int64 `json:"zIndex,optional"`
SvgPath string `json:"svgPath,optional"`
Follow Follow `json:"follow,optional"`
Group []*Group `json:"group,optional"`
CameraStand CameraStand `json:"cameraStand,optional"`
}
type Group struct {

View File

@ -45,32 +45,6 @@ func (l *GetOrderDetailLogic) GetOrderDetail(req *types.GetOrderDetailReq, useri
logx.Error(err)
return resp.SetStatus(basic.CodeServiceErr, "failed to get order info")
}
address := types.Address{}
//直接邮寄才有地址信息
if *orderInfo.DeliveryMethod == int64(constants.DELIVERY_METHOD_ADDRESS) {
addressInfo, err := gmodel.NewFsAddressModel(l.svcCtx.MysqlConn).GetOne(l.ctx, *orderInfo.AddressId, userinfo.UserId)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "address not exists")
}
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get address info")
}
address.Id = addressInfo.Id
address.UserId = *addressInfo.UserId
address.Name = *addressInfo.Name
address.FirstName = *addressInfo.FirstName
address.LastName = *addressInfo.LastName
address.Mobile = *addressInfo.Mobile
address.Street = *addressInfo.Street
address.Suite = *addressInfo.Suite
address.City = *addressInfo.City
address.State = *addressInfo.State
address.Country = *addressInfo.Country
address.ZipCode = *addressInfo.ZipCode
address.Status = *addressInfo.Status
address.IsDefault = *addressInfo.IsDefault
}
//获取订单详情
orderDetailModel := gmodel.NewFsOrderDetailModel(l.svcCtx.MysqlConn)
orderDetails, err := orderDetailModel.GetOrderDetailsByOrderId(l.ctx, orderInfo.Id)
@ -149,7 +123,7 @@ func (l *GetOrderDetailLogic) GetOrderDetail(req *types.GetOrderDetailReq, useri
//处理订单状态
orderStatus := order.GetOrderStatus(constants.Order(*orderInfo.Status), constants.DeliveryMethod(*orderInfo.DeliveryMethod))
//组装
productListRsp := make([]types.Product, 0, len(orderDetails))
productListRsp := make([]*types.Product, 0, len(orderDetails))
for _, v := range orderDetails {
cover := *v.Cover
if req.Size >= 200 {
@ -174,7 +148,7 @@ func (l *GetOrderDetailLogic) GetOrderDetail(req *types.GetOrderDetailReq, useri
if productIndex, ok := mapProduct[*v.ProductId]; ok {
Title = *productList[productIndex].Title
}
productListRsp = append(productListRsp, types.Product{
productListRsp = append(productListRsp, &types.Product{
Cover: cover,
Fitting: Fitting,
OptionPrice: *v.OptionPrice,
@ -198,10 +172,36 @@ func (l *GetOrderDetailLogic) GetOrderDetail(req *types.GetOrderDetailReq, useri
Sn: *orderInfo.Sn,
Status: int64(orderStatus),
Ctime: time.Unix(*orderInfo.Ctime, 0).Format("2006-01-02 15:04:05"),
PayInfo: types.PayInfo{},
Address: address,
Address: nil,
ProductList: productListRsp,
}
//直接邮寄才有地址信息
if *orderInfo.DeliveryMethod == int64(constants.DELIVERY_METHOD_ADDRESS) {
addressInfo, err := gmodel.NewFsAddressModel(l.svcCtx.MysqlConn).GetOne(l.ctx, *orderInfo.AddressId, userinfo.UserId)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "address not exists")
}
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get address info")
}
data.Address = &types.Address{
Id: addressInfo.Id,
UserId: *addressInfo.UserId,
Name: *addressInfo.Name,
FirstName: *addressInfo.FirstName,
LastName: *addressInfo.LastName,
Mobile: *addressInfo.Mobile,
Street: *addressInfo.Street,
Suite: *addressInfo.Suite,
City: *addressInfo.City,
State: *addressInfo.State,
Country: *addressInfo.Country,
ZipCode: *addressInfo.ZipCode,
Status: *addressInfo.Status,
IsDefault: *addressInfo.IsDefault,
}
}
//首款
if payIndex, ok := mapPay[1]; ok {
data.PayInfo.Deposit = types.Deposit{

View File

@ -21,18 +21,18 @@ type GetOrderDetailReq struct {
}
type GetOrderDetailRsp struct {
Id int64 `json:"id"`
TotalAmount int64 `json:"total_amount"`
Deposit int64 `json:"deposit"`
Remaining int64 `json:"remaining"`
IsPayCompleted int64 `json:"is_pay_completed"`
DeliveryMethod int64 `json:"delivery_method"`
Sn string `json:"sn"`
Status int64 `json:"status"`
Ctime string `json:"ctime"`
PayInfo PayInfo `json:"pay_info"`
Address Address `json:"address"`
ProductList []Product `json:"productList"`
Id int64 `json:"id"`
TotalAmount int64 `json:"total_amount"`
Deposit int64 `json:"deposit"`
Remaining int64 `json:"remaining"`
IsPayCompleted int64 `json:"is_pay_completed"`
DeliveryMethod int64 `json:"delivery_method"`
Sn string `json:"sn"`
Status int64 `json:"status"`
Ctime string `json:"ctime"`
PayInfo *PayInfo `json:"pay_info"`
Address *Address `json:"address"`
ProductList []*Product `json:"productList"`
}
type Product struct {

View File

@ -13,7 +13,7 @@ type GetTemplatevDetailReq struct {
type GetTemplatevDetailRsp struct {
ProductModelInfo interface{} `json:"product_model_info"`
ProductTemplate ProductTemplate `json:"product_template"`
LightList []Light `json:"light_list"`
LightList []*Light `json:"light_list"`
OptionModelInfo []interface{} `json:"option_model_info"`
Tag int64 `json:"tag"`
}
@ -24,28 +24,28 @@ type Tag struct {
}
type TemplateInfo struct {
Id int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
IsPublic bool `json:"isPublic"`
Material string `json:"material"`
MaterialList TemplateMateria `json:"materialList"`
Id int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
IsPublic bool `json:"isPublic"`
Material string `json:"material"`
MaterialList []*TemplateMateria `json:"materialList"`
}
type ProductTemplate struct {
CoverImg string `json:"cover_img"`
Id int64 `json:"id"`
IsPublic bool `json:"is_public"`
LogoHeight int64 `json:"logo_height"`
LogoWidth int64 `json:"logo_width"`
MaterialImg string `json:"material_img"`
ModelId int64 `json:"model_id"`
Name string `json:"name"`
ProductId int64 `json:"product_id"`
Sort int64 `json:"sort"`
Tag Tag `json:"tag"`
TemplateInfo TemplateInfo `json:"template_info"`
Title string `json:"title"`
CoverImg string `json:"cover_img"`
Id int64 `json:"id"`
IsPublic bool `json:"is_public"`
LogoHeight int64 `json:"logo_height"`
LogoWidth int64 `json:"logo_width"`
MaterialImg string `json:"material_img"`
ModelId int64 `json:"model_id"`
Name string `json:"name"`
ProductId int64 `json:"product_id"`
Sort int64 `json:"sort"`
Tag Tag `json:"tag"`
TemplateInfo *TemplateInfo `json:"template_info"`
Title string `json:"title"`
}
type Light struct {
@ -54,38 +54,38 @@ type Light struct {
}
type TemplateMateria struct {
Id string `json:"id"`
Tag string `json:"tag"`
Title string `json:"title"`
Type string `json:"type"`
Text string `json:"text"`
Fill string `json:"fill"`
FontSize int64 `json:"fontSize"`
FontFamily string `json:"fontFamily"`
IfBr bool `json:"ifBr"`
IfShow bool `json:"ifShow"`
IfGroup bool `json:"ifGroup"`
MaxNum int64 `json:"maxNum"`
Rotation int64 `json:"rotation"`
LineHeight int64 `json:"lineHeight"`
Align string `json:"align"`
VerticalAlign string `json:"verticalAlign"`
Material string `json:"material"`
MaterialTime string `json:"materialTime"`
MaterialName string `json:"materialName"`
QRcodeType string `json:"QRcodeType"`
Width int64 `json:"width"`
Height int64 `json:"height"`
Proportion int64 `json:"proportion"`
X int64 `json:"x"`
Y int64 `json:"y"`
Opacity int64 `json:"opacity"`
OptionalColor []OptionalColor `json:"optionalColor"`
ZIndex int64 `json:"zIndex"`
SvgPath string `json:"svgPath"`
Follow Follow `json:"follow"`
Group []interface{} `json:"group"`
CameraStand CameraStand `json:"cameraStand"`
Id string `json:"id"`
Tag string `json:"tag"`
Title string `json:"title"`
Type string `json:"type"`
Text string `json:"text"`
Fill string `json:"fill"`
FontSize int64 `json:"fontSize"`
FontFamily string `json:"fontFamily"`
IfBr bool `json:"ifBr"`
IfShow bool `json:"ifShow"`
IfGroup bool `json:"ifGroup"`
MaxNum int64 `json:"maxNum"`
Rotation int64 `json:"rotation"`
LineHeight int64 `json:"lineHeight"`
Align string `json:"align"`
VerticalAlign string `json:"verticalAlign"`
Material string `json:"material"`
MaterialTime string `json:"materialTime"`
MaterialName string `json:"materialName"`
QRcodeType string `json:"QRcodeType"`
Width int64 `json:"width"`
Height int64 `json:"height"`
Proportion int64 `json:"proportion"`
X int64 `json:"x"`
Y int64 `json:"y"`
Opacity int64 `json:"opacity"`
OptionalColor []*OptionalColor `json:"optionalColor"`
ZIndex int64 `json:"zIndex"`
SvgPath string `json:"svgPath"`
Follow Follow `json:"follow"`
Group []interface{} `json:"group"`
CameraStand CameraStand `json:"cameraStand"`
}
type LightInfo struct {

View File

@ -130,7 +130,7 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, useri
return resp.SetStatusWithMessage(basic.CodeServiceErr, "get product size count err")
}
//拼接返回
itemList := make([]types.Items, 0, productLen)
itemList := make([]*types.Items, 0, productLen)
for _, v := range productList {
minPrice, ok := mapProductMinPrice[v.Id]
_, tmpOk := mapProductTemplate[v.Id]
@ -138,7 +138,7 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, useri
if !ok || !tmpOk {
continue
}
item := types.Items{
item := &types.Items{
Id: v.Id,
Sn: *v.Sn,
Title: *v.Title,

View File

@ -103,8 +103,8 @@ func (l *GetSizeByProductLogic) GetSizeByProduct(userinfo *auth.UserInfo) (resp
}
// 第一层子层
func (l *GetSizeByProductLogic) GetFirstChildrenList(tag gmodel.FsTags, productList []gmodel.FsProduct, productSizeList []gmodel.FsProductSize, mapProductPrice map[int64]gmodel.FsProductPrice) (childrenList []types.Children, err error) {
childrenList = make([]types.Children, 0, len(productList))
func (l *GetSizeByProductLogic) GetFirstChildrenList(tag gmodel.FsTags, productList []gmodel.FsProduct, productSizeList []gmodel.FsProductSize, mapProductPrice map[int64]gmodel.FsProductPrice) (childrenList []*types.Children, err error) {
childrenList = make([]*types.Children, 0, len(productList))
for _, product := range productList {
if *product.Type != tag.Id {
continue
@ -114,7 +114,7 @@ func (l *GetSizeByProductLogic) GetFirstChildrenList(tag gmodel.FsTags, productL
return nil, err
}
//获取第二层子类
data := types.Children{
data := &types.Children{
Id: product.Id,
Name: *product.Title,
Cycle: int(*product.DeliveryDays + *product.ProduceDays),
@ -126,24 +126,26 @@ func (l *GetSizeByProductLogic) GetFirstChildrenList(tag gmodel.FsTags, productL
}
// 第2层子层
func (l *GetSizeByProductLogic) GetSecondChildrenList(product gmodel.FsProduct, productSizeList []gmodel.FsProductSize, mapProductPrice map[int64]gmodel.FsProductPrice) (childrenObjList []types.ChildrenObj, err error) {
childrenObjList = make([]types.ChildrenObj, 0, len(productSizeList))
func (l *GetSizeByProductLogic) GetSecondChildrenList(product gmodel.FsProduct, productSizeList []gmodel.FsProductSize, mapProductPrice map[int64]gmodel.FsProductPrice) (childrenObjList []*types.ChildrenObj, err error) {
childrenObjList = make([]*types.ChildrenObj, 0, len(productSizeList))
for _, productSize := range productSizeList {
if product.Id != *productSize.ProductId {
continue
}
priceList := make([]types.PriceObj, 0, len(productSizeList))
priceList := make([]*types.PriceObj, 0, len(productSizeList))
price, ok := mapProductPrice[productSize.Id]
//无对应尺寸价格
if !ok {
childrenObjList = append(childrenObjList, types.ChildrenObj{
Id: productSize.Id,
Name: *productSize.Capacity,
PriceList: []types.PriceObj{
{Num: 1, Price: 0},
{Num: 1, Price: 0},
{Num: 1, Price: 0},
},
for i := 0; i < 3; i++ {
priceList = append(priceList, &types.PriceObj{
Num: 1,
Price: 0,
})
}
childrenObjList = append(childrenObjList, &types.ChildrenObj{
Id: productSize.Id,
Name: *productSize.Capacity,
PriceList: priceList,
})
continue
}
@ -169,14 +171,14 @@ func (l *GetSizeByProductLogic) GetSecondChildrenList(product gmodel.FsProduct,
index := 0
// 最小购买数量小于 最大阶梯数量+5
for int(*price.MinBuyNum) < (stepNum[len(stepNum)-1]+5) && index < 3 {
priceList = append(priceList, types.PriceObj{
priceList = append(priceList, &types.PriceObj{
Num: int(*price.MinBuyNum * *price.EachBoxNum),
Price: step_price.GetStepPrice(int(*price.MinBuyNum), stepNum, stepPrice),
})
*price.MinBuyNum++
index++
}
data := types.ChildrenObj{
data := &types.ChildrenObj{
Id: productSize.Id,
Name: *productSize.Capacity,
PriceList: priceList,

View File

@ -19,9 +19,9 @@ type GetProductListRsp struct {
}
type Ob struct {
Items []Items `json:"items"`
Links Links `json:"_links"`
Meta Meta `json:"_meta"`
Items []*Items `json:"items"`
Links *Links `json:"_links"`
Meta *Meta `json:"_meta"`
}
type Meta struct {
@ -73,22 +73,22 @@ type GetSuccessRecommandRsp struct {
}
type GetSizeByProductRsp struct {
Id int64 `json:"id"`
Name string `json:"name"`
Children []Children `json:"children"`
Id int64 `json:"id"`
Name string `json:"name"`
Children []*Children `json:"children"`
}
type Children struct {
Id int64 `json:"id"`
Name string `json:"name"`
Cycle int `json:"cycle"`
ChildrenList []ChildrenObj `json:"children"`
Id int64 `json:"id"`
Name string `json:"name"`
Cycle int `json:"cycle"`
ChildrenList []*ChildrenObj `json:"children"`
}
type ChildrenObj struct {
Id int64 `json:"id"`
Name string `json:"name"`
PriceList []PriceObj `json:"price_list"`
Id int64 `json:"id"`
Name string `json:"name"`
PriceList []*PriceObj `json:"price_list"`
}
type PriceObj struct {

View File

@ -83,46 +83,49 @@ func (l *CartListLogic) CartList(req *types.CartListReq, userinfo *auth.UserInfo
name = *cartRelativeData.ProductList[productIndex].Title
productSn = strings.ToLower(*cartRelativeData.ProductList[productIndex].Sn)
}
capacity := ""
var sizeList types.CartSizeItem
if sizeIndex, ok := mapProductSize[*v.SizeId]; ok {
capacity = *cartRelativeData.ProductSizeList[sizeIndex].Capacity
err = json.Unmarshal([]byte(*cartRelativeData.ProductSizeList[sizeIndex].Title), &sizeList)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to parse product size`s title")
}
}
designSn := ""
if designIndex, ok := mapProductDesign[*v.DesignId]; ok {
designSn = strings.ToLower(*cartRelativeData.ProductDesignList[designIndex].Sn)
}
option := types.CartOption{}
if model3dIndex, ok := mapProductModel3d[*v.OptionalId]; ok {
option.Id = cartRelativeData.ProductModel3dList[model3dIndex].Id
option.Title = *cartRelativeData.ProductModel3dList[model3dIndex].Title
option.Price = float64(*cartRelativeData.ProductModel3dList[model3dIndex].Price) / float64(100)
}
pcList, err := l.getPcList(cartRelativeData.ProductPriceList, *v.ProductId, *v.MaterialId, *v.SizeId)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to calculate step price")
}
rspList = append(rspList, types.CartListRsp{
d := types.CartListRsp{
Id: v.Id,
Cover: *v.Cover,
Name: name,
Capacity: capacity,
Capacity: "",
ETA: time.Now().AddDate(0, 0, 60).Format("2006-01-02 15:04:05"),
Pcs: *v.BuyNum,
ProductSn: productSn,
DesignSn: designSn,
Option: option,
Option: nil,
IsCheck: *v.IsCheck,
TsTime: v.TsTime.Format("2006-01-02 15:04:05"),
PcsList: pcList,
Size: sizeList,
})
Size: nil,
}
var sizeList types.CartSizeItem
if sizeIndex, ok := mapProductSize[*v.SizeId]; ok {
d.Capacity = *cartRelativeData.ProductSizeList[sizeIndex].Capacity
err = json.Unmarshal([]byte(*cartRelativeData.ProductSizeList[sizeIndex].Title), &sizeList)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to parse product size`s title")
}
d.Size = &sizeList
}
if model3dIndex, ok := mapProductModel3d[*v.OptionalId]; ok {
d.Option = &types.CartOption{
Id: cartRelativeData.ProductModel3dList[model3dIndex].Id,
Title: *cartRelativeData.ProductModel3dList[model3dIndex].Title,
Price: float64(*cartRelativeData.ProductModel3dList[model3dIndex].Price) / float64(100),
}
}
rspList = append(rspList, d)
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", rspList)
}
@ -138,7 +141,7 @@ type GetUserCartRelativeListRsp struct {
}
// 获取阶梯对应的价格
func (l *CartListLogic) getPcList(productPriceList []gmodel.FsProductPrice, productId int64, materialId int64, sizeId int64) (list []types.PcsItem, err error) {
func (l *CartListLogic) getPcList(productPriceList []gmodel.FsProductPrice, productId int64, materialId int64, sizeId int64) (list []*types.PcsItem, err error) {
for _, price := range productPriceList {
if *price.ProductId != productId || *price.MaterialId != materialId || *price.SizeId != sizeId {
continue
@ -159,7 +162,7 @@ func (l *CartListLogic) getPcList(productPriceList []gmodel.FsProductPrice, prod
return nil, errors.New("step num or step price item count can`t be 0 ")
}
for int(*price.MinBuyNum) < stepNumSlice[lenStepNumSlice-1]+5 {
list = append(list, types.PcsItem{
list = append(list, &types.PcsItem{
Num: *price.MinBuyNum,
TotalNum: *price.MinBuyNum * *price.EachBoxNum,
Title: *price.Title,

View File

@ -109,9 +109,9 @@ func (l *CartOrderDetailLogic) CartOrderDetail(req *types.CartOrderDetailReq, us
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get address")
}
//处理订单数据
addressItems := make([]types.CartAddr, 0, len(addressList))
addressItems := make([]*types.CartAddr, 0, len(addressList))
for _, v := range addressList {
addressItems = append(addressItems, types.CartAddr{
addressItems = append(addressItems, &types.CartAddr{
Id: v.Id,
Name: *v.Name,
FirstName: *v.FirstName,
@ -125,7 +125,7 @@ func (l *CartOrderDetailLogic) CartOrderDetail(req *types.CartOrderDetailReq, us
IsDefault: *v.IsDefault,
})
}
items := make([]types.CartDetailItem, 0, len(orderDetailList))
items := make([]*types.CartDetailItem, 0, len(orderDetailList))
totalAmount := int64(0) //订单总金额
for _, v := range orderDetailList {
thisTotal := (*v.BuyNum) * (*v.Amount)
@ -140,7 +140,7 @@ func (l *CartOrderDetailLogic) CartOrderDetail(req *types.CartOrderDetailReq, us
if productIndex, ok := mapProduct[*v.ProductId]; ok {
name = *productList[productIndex].Title
}
items = append(items, types.CartDetailItem{
items = append(items, &types.CartDetailItem{
Cover: *v.Cover,
Pcs: *v.BuyNum,
Amount: fmt.Sprintf("$ %.2f", float64(thisTotal)/100),

View File

@ -24,19 +24,19 @@ type CartListReq struct {
}
type CartListRsp struct {
Id int64 `json:"id"`
Cover string `json:"cover"`
Name string `json:"name"`
Capacity string `json:"capacity"`
ETA string `json:"ETA"`
Pcs int64 `json:"pcs"`
ProductSn string `json:"product_sn"`
DesignSn string `json:"designSn"`
Option CartOption `json:"option"`
IsCheck int64 `json:"is_check"`
TsTime string `json:"ts_time"`
PcsList []PcsItem `json:"pcs_list"`
Size CartSizeItem `json:"size"`
Id int64 `json:"id"`
Cover string `json:"cover"`
Name string `json:"name"`
Capacity string `json:"capacity"`
ETA string `json:"ETA"`
Pcs int64 `json:"pcs"`
ProductSn string `json:"product_sn"`
DesignSn string `json:"designSn"`
Option *CartOption `json:"option"`
IsCheck int64 `json:"is_check"`
TsTime string `json:"ts_time"`
PcsList []*PcsItem `json:"pcs_list"`
Size *CartSizeItem `json:"size"`
}
type CartOption struct {
@ -62,16 +62,16 @@ type CartOrderDetailReq struct {
}
type CartOrderDetailRsp struct {
DeliveryMethod int64 `json:"delivery_method"`
AddressId int64 `json:"address_id"`
PayTime string `json:"pay_time"`
PayMethod int64 `json:"pay_method"`
PayStep int64 `json:"pay_step"`
Subtotal string `json:"subtotal"`
Total string `json:"total"`
Remaining string `json:"remaining"`
AddrList []CartAddr `json:"addr_list"`
Items []CartDetailItem `json:"items"`
DeliveryMethod int64 `json:"delivery_method"`
AddressId int64 `json:"address_id"`
PayTime string `json:"pay_time"`
PayMethod int64 `json:"pay_method"`
PayStep int64 `json:"pay_step"`
Subtotal string `json:"subtotal"`
Total string `json:"total"`
Remaining string `json:"remaining"`
AddrList []*CartAddr `json:"addr_list"`
Items []*CartDetailItem `json:"items"`
}
type CartDetailItem struct {

View File

@ -21,9 +21,9 @@ type GetCanteenDetailReq {
Id int64 `json:"id"`
}
type GetCanteenDetailRsp {
Id int64 `json:"id"`
Name string `json:"name"`
ProductList []CanteenProduct `json:"product_list"`
Id int64 `json:"id"`
Name string `json:"name"`
ProductList []*CanteenProduct `json:"product_list"`
}
type CanteenProduct {
Id int64 `json:"id"`

View File

@ -19,10 +19,10 @@ service map-library {
//获取贴图库列表
type GetMapLibraryListRsp {
Mid int64 `json:"mid"`
Ctime string `json:"ctime"`
Tag MapLibraryListTag `json:"tag"`
Info interface{} `json:"info"`
Mid int64 `json:"mid"`
Ctime string `json:"ctime"`
Tag *MapLibraryListTag `json:"tag"`
Info interface{} `json:"info"`
}
type MapLibraryListTag {
Id int64 `json:"id"`
@ -43,33 +43,33 @@ type Tag {
Title string `json:"title,optional"`
}
type Info {
Id string `json:"id,optional"`
Tag string `json:"tag,optional"`
Title string `json:"title,optional"`
Type string `json:"type,optional"`
Text string `json:"text,optional"`
Fill string `json:"fill,optional"`
FontSize int64 `json:"fontSize,optional"`
FontFamily string `json:"fontFamily,optional"`
IfBr bool `json:"ifBr,optional"`
IfShow bool `json:"ifShow,optional"`
IfGroup bool `json:"ifGroup,optional"`
MaxNum int64 `json:"maxNum,optional"`
Rotation int64 `json:"rotation,optional"`
Align string `json:"align,optional"`
VerticalAlign string `json:"verticalAlign,optional"`
Material string `json:"material,optional"`
Width float64 `json:"width,optional"`
Height float64 `json:"height,optional"`
X float64 `json:"x,optional"`
Y float64 `json:"Y,optional"`
Opacity float64 `json:"opacity,optional"`
OptionalColor []OptionalColor `json:"optionalColor,optional"`
ZIndex int64 `json:"zIndex,optional"`
SvgPath string `json:"svgPath,optional"`
Follow Follow `json:"follow,optional"`
Group []Group `json:"group,optional"`
CameraStand CameraStand `json:"cameraStand,optional"`
Id string `json:"id,optional"`
Tag string `json:"tag,optional"`
Title string `json:"title,optional"`
Type string `json:"type,optional"`
Text string `json:"text,optional"`
Fill string `json:"fill,optional"`
FontSize int64 `json:"fontSize,optional"`
FontFamily string `json:"fontFamily,optional"`
IfBr bool `json:"ifBr,optional"`
IfShow bool `json:"ifShow,optional"`
IfGroup bool `json:"ifGroup,optional"`
MaxNum int64 `json:"maxNum,optional"`
Rotation int64 `json:"rotation,optional"`
Align string `json:"align,optional"`
VerticalAlign string `json:"verticalAlign,optional"`
Material string `json:"material,optional"`
Width float64 `json:"width,optional"`
Height float64 `json:"height,optional"`
X float64 `json:"x,optional"`
Y float64 `json:"Y,optional"`
Opacity float64 `json:"opacity,optional"`
OptionalColor []*OptionalColor `json:"optionalColor,optional"`
ZIndex int64 `json:"zIndex,optional"`
SvgPath string `json:"svgPath,optional"`
Follow Follow `json:"follow,optional"`
Group []*Group `json:"group,optional"`
CameraStand CameraStand `json:"cameraStand,optional"`
}
type Group {
Tag string `json:"tag,optional"`

View File

@ -31,18 +31,18 @@ type GetOrderDetailReq {
Size int64 `form:"size, optional"`
}
type GetOrderDetailRsp {
Id int64 `json:"id"`
TotalAmount int64 `json:"total_amount"`
Deposit int64 `json:"deposit"`
Remaining int64 `json:"remaining"`
IsPayCompleted int64 `json:"is_pay_completed"`
DeliveryMethod int64 `json:"delivery_method"`
Sn string `json:"sn"`
Status int64 `json:"status"`
Ctime string `json:"ctime"`
PayInfo PayInfo `json:"pay_info"`
Address Address `json:"address"`
ProductList []Product `json:"productList"`
Id int64 `json:"id"`
TotalAmount int64 `json:"total_amount"`
Deposit int64 `json:"deposit"`
Remaining int64 `json:"remaining"`
IsPayCompleted int64 `json:"is_pay_completed"`
DeliveryMethod int64 `json:"delivery_method"`
Sn string `json:"sn"`
Status int64 `json:"status"`
Ctime string `json:"ctime"`
PayInfo *PayInfo `json:"pay_info"`
Address *Address `json:"address"`
ProductList []*Product `json:"productList"`
}
type Product {
Cover string `json:"cover"`

View File

@ -21,7 +21,7 @@ type GetTemplatevDetailReq {
type GetTemplatevDetailRsp {
ProductModelInfo interface{} `json:"product_model_info"`
ProductTemplate ProductTemplate `json:"product_template"`
LightList []Light `json:"light_list"`
LightList []*Light `json:"light_list"`
OptionModelInfo []interface{} `json:"option_model_info"`
Tag int64 `json:"tag"`
}
@ -31,27 +31,27 @@ type Tag {
Title string `json:"title"`
}
type TemplateInfo {
Id int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
IsPublic bool `json:"isPublic"`
Material string `json:"material"`
MaterialList TemplateMateria `json:"materialList"`
Id int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
IsPublic bool `json:"isPublic"`
Material string `json:"material"`
MaterialList []*TemplateMateria `json:"materialList"`
}
type ProductTemplate {
CoverImg string `json:"cover_img"`
Id int64 `json:"id"`
IsPublic bool `json:"is_public"`
LogoHeight int64 `json:"logo_height"`
LogoWidth int64 `json:"logo_width"`
MaterialImg string `json:"material_img"`
ModelId int64 `json:"model_id"`
Name string `json:"name"`
ProductId int64 `json:"product_id"`
Sort int64 `json:"sort"`
Tag Tag `json:"tag"`
TemplateInfo TemplateInfo `json:"template_info"`
Title string `json:"title"`
CoverImg string `json:"cover_img"`
Id int64 `json:"id"`
IsPublic bool `json:"is_public"`
LogoHeight int64 `json:"logo_height"`
LogoWidth int64 `json:"logo_width"`
MaterialImg string `json:"material_img"`
ModelId int64 `json:"model_id"`
Name string `json:"name"`
ProductId int64 `json:"product_id"`
Sort int64 `json:"sort"`
Tag Tag `json:"tag"`
TemplateInfo *TemplateInfo `json:"template_info"`
Title string `json:"title"`
}
type Light {
Id int64 `json:"id"`
@ -59,38 +59,38 @@ type Light {
}
type TemplateMateria {
Id string `json:"id"`
Tag string `json:"tag"`
Title string `json:"title"`
Type string `json:"type"`
Text string `json:"text"`
Fill string `json:"fill"`
FontSize int64 `json:"fontSize"`
FontFamily string `json:"fontFamily"`
IfBr bool `json:"ifBr"`
IfShow bool `json:"ifShow"`
IfGroup bool `json:"ifGroup"`
MaxNum int64 `json:"maxNum"`
Rotation int64 `json:"rotation"`
LineHeight int64 `json:"lineHeight"`
Align string `json:"align"`
VerticalAlign string `json:"verticalAlign"`
Material string `json:"material"`
MaterialTime string `json:"materialTime"`
MaterialName string `json:"materialName"`
QRcodeType string `json:"QRcodeType"`
Width int64 `json:"width"`
Height int64 `json:"height"`
Proportion int64 `json:"proportion"`
X int64 `json:"x"`
Y int64 `json:"y"`
Opacity int64 `json:"opacity"`
OptionalColor []OptionalColor `json:"optionalColor"`
ZIndex int64 `json:"zIndex"`
SvgPath string `json:"svgPath"`
Follow Follow `json:"follow"`
Group []interface{} `json:"group"`
CameraStand CameraStand `json:"cameraStand"`
Id string `json:"id"`
Tag string `json:"tag"`
Title string `json:"title"`
Type string `json:"type"`
Text string `json:"text"`
Fill string `json:"fill"`
FontSize int64 `json:"fontSize"`
FontFamily string `json:"fontFamily"`
IfBr bool `json:"ifBr"`
IfShow bool `json:"ifShow"`
IfGroup bool `json:"ifGroup"`
MaxNum int64 `json:"maxNum"`
Rotation int64 `json:"rotation"`
LineHeight int64 `json:"lineHeight"`
Align string `json:"align"`
VerticalAlign string `json:"verticalAlign"`
Material string `json:"material"`
MaterialTime string `json:"materialTime"`
MaterialName string `json:"materialName"`
QRcodeType string `json:"QRcodeType"`
Width int64 `json:"width"`
Height int64 `json:"height"`
Proportion int64 `json:"proportion"`
X int64 `json:"x"`
Y int64 `json:"y"`
Opacity int64 `json:"opacity"`
OptionalColor []*OptionalColor `json:"optionalColor"`
ZIndex int64 `json:"zIndex"`
SvgPath string `json:"svgPath"`
Follow Follow `json:"follow"`
Group []interface{} `json:"group"`
CameraStand CameraStand `json:"cameraStand"`
}
type LightInfo {
Name string `json:"name"`

View File

@ -35,9 +35,9 @@ type GetProductListRsp {
Description string `json:"description"`
}
type Ob {
Items []Items `json:"items"`
Links Links `json:"_links"`
Meta Meta `json:"_meta"`
Items []*Items `json:"items"`
Links *Links `json:"_links"`
Meta *Meta `json:"_meta"`
}
type Meta {
TotalCount int32 `json:"totalCount"`
@ -85,20 +85,20 @@ type GetSuccessRecommandRsp {
//获取分类下的产品以及尺寸
type GetSizeByProductRsp {
Id int64 `json:"id"`
Name string `json:"name"`
Children []Children `json:"children"`
Id int64 `json:"id"`
Name string `json:"name"`
Children []*Children `json:"children"`
}
type Children {
Id int64 `json:"id"`
Name string `json:"name"`
Cycle int `json:"cycle"`
ChildrenList []ChildrenObj `json:"children"`
Id int64 `json:"id"`
Name string `json:"name"`
Cycle int `json:"cycle"`
ChildrenList []*ChildrenObj `json:"children"`
}
type ChildrenObj {
Id int64 `json:"id"`
Name string `json:"name"`
PriceList []PriceObj `json:"price_list"`
Id int64 `json:"id"`
Name string `json:"name"`
PriceList []*PriceObj `json:"price_list"`
}
type PriceObj {
Num int `json:"num"`

View File

@ -47,19 +47,19 @@ type CartListReq {
Size uint32 `form:"size"`
}
type CartListRsp {
Id int64 `json:"id"`
Cover string `json:"cover"`
Name string `json:"name"`
Capacity string `json:"capacity"`
ETA string `json:"ETA"`
Pcs int64 `json:"pcs"`
ProductSn string `json:"product_sn"`
DesignSn string `json:"designSn"`
Option CartOption `json:"option"`
IsCheck int64 `json:"is_check"`
TsTime string `json:"ts_time"`
PcsList []PcsItem `json:"pcs_list"`
Size CartSizeItem `json:"size"`
Id int64 `json:"id"`
Cover string `json:"cover"`
Name string `json:"name"`
Capacity string `json:"capacity"`
ETA string `json:"ETA"`
Pcs int64 `json:"pcs"`
ProductSn string `json:"product_sn"`
DesignSn string `json:"designSn"`
Option *CartOption `json:"option"`
IsCheck int64 `json:"is_check"`
TsTime string `json:"ts_time"`
PcsList []*PcsItem `json:"pcs_list"`
Size *CartSizeItem `json:"size"`
}
type CartOption {
Id int64 `json:"id"`
@ -81,16 +81,16 @@ type CartOrderDetailReq {
Sn string `form:"sn"`
}
type CartOrderDetailRsp {
DeliveryMethod int64 `json:"delivery_method"`
AddressId int64 `json:"address_id"`
PayTime string `json:"pay_time"`
PayMethod int64 `json:"pay_method"`
PayStep int64 `json:"pay_step"`
Subtotal string `json:"subtotal"`
Total string `json:"total"`
Remaining string `json:"remaining"`
AddrList []CartAddr `json:"addr_list"`
Items []CartDetailItem `json:"items"`
DeliveryMethod int64 `json:"delivery_method"`
AddressId int64 `json:"address_id"`
PayTime string `json:"pay_time"`
PayMethod int64 `json:"pay_method"`
PayStep int64 `json:"pay_step"`
Subtotal string `json:"subtotal"`
Total string `json:"total"`
Remaining string `json:"remaining"`
AddrList []*CartAddr `json:"addr_list"`
Items []*CartDetailItem `json:"items"`
}
type CartDetailItem {
Cover string `json:"cover"`