38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package response
|
|
|
|
import "psi/models"
|
|
|
|
type CarShopInfo struct {
|
|
ShopID string `json:"id"` // 店铺ID
|
|
ShopName string `json:"shop_name"` //店铺名称
|
|
ShopType int8 `json:"shop_type"` //店铺类型
|
|
ShopTypeText string `json:"shop_type_text"` //店铺类型文本
|
|
}
|
|
type CarResponse struct {
|
|
ID int64 `json:"id"`
|
|
WarehouseID int64 `json:"warehouse_id"`
|
|
PushType int8 `json:"push_type"`
|
|
Code int64 `json:"code"`
|
|
Name string `json:"name"`
|
|
Capacity int64 `json:"capacity"`
|
|
Appearance int64 `json:"appearance"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
Shops []CarShopInfo `json:"shops"`
|
|
}
|
|
|
|
func ConvertCarToResponse(car models.Car) CarResponse {
|
|
return CarResponse{
|
|
ID: car.ID,
|
|
WarehouseID: car.WarehouseID,
|
|
PushType: car.PushType,
|
|
Code: car.Code,
|
|
Name: car.Name,
|
|
Capacity: car.Capacity,
|
|
Appearance: car.Appearance,
|
|
CreatedAt: car.CreatedAt,
|
|
UpdatedAt: car.UpdatedAt,
|
|
Shops: []CarShopInfo{},
|
|
}
|
|
}
|