新增打包脚本,新增商品基础逻辑
This commit is contained in:
parent
3e9263324b
commit
6d9923b4f2
|
|
@ -26,6 +26,7 @@ type LoginResponse struct {
|
|||
NickName string `json:"nickName"`
|
||||
HeadImgUrl string `json:"headImgUrl"`
|
||||
Amount int `json:"amount"`
|
||||
Discount float32 `json:"discount"`
|
||||
Role int `json:"role"`
|
||||
UserPets []UserPetInfo `json:"userPets"`
|
||||
Car models.ServiceCar `json:"car"`
|
||||
|
|
@ -92,6 +93,7 @@ func (p DefParty) login() web_iris.Party {
|
|||
HeadImgUrl: userInfo.HeadImgUrl,
|
||||
Amount: userInfo.Amount,
|
||||
Role: userInfo.Role,
|
||||
Discount: float32(userInfo.Discount) / 100,
|
||||
}
|
||||
if userInfo.Role == 1 {
|
||||
var serviceCarUser models.ServiceCarUser
|
||||
|
|
@ -99,7 +101,9 @@ func (p DefParty) login() web_iris.Party {
|
|||
response.Car = CarMap[serviceCarUser.CarId]
|
||||
response.Car.ServiceAddr = ServiceAddrMap[response.Car.ServiceAddrId]
|
||||
}
|
||||
|
||||
if response.Amount == 0 {
|
||||
response.Discount = 100
|
||||
}
|
||||
response.UserPets = GetUserPets(userInfo.Id)
|
||||
Success(ctx, loginRequest, response)
|
||||
})
|
||||
|
|
@ -155,6 +159,7 @@ type GetUserInfoResponse struct {
|
|||
Uid int64 `json:"uid"`
|
||||
NickName string `json:"nickName"`
|
||||
HeadImgUrl string `json:"headImgUrl"`
|
||||
Discount float32 `json:"discount"`
|
||||
Amount int `json:"amount"`
|
||||
Role int `json:"role"`
|
||||
UserPets []UserPetInfo `json:"userPets"`
|
||||
|
|
@ -176,9 +181,13 @@ func (p DefParty) getUserInfo() web_iris.Party {
|
|||
NickName: userInfo.NickName,
|
||||
HeadImgUrl: userInfo.HeadImgUrl,
|
||||
Amount: userInfo.Amount,
|
||||
Discount: float32(userInfo.Discount) / 100,
|
||||
Role: userInfo.Role,
|
||||
UserPets: GetUserPets(userInfo.Id),
|
||||
}
|
||||
if getUserInfoResponse.Amount == 0 {
|
||||
getUserInfoResponse.Discount = 1
|
||||
}
|
||||
Success(ctx, headerInfo, getUserInfoResponse)
|
||||
})
|
||||
}}
|
||||
|
|
@ -188,7 +197,7 @@ type UserUploadFileResponse struct {
|
|||
FileName string `json:"fileName"` //文件名
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
// 用户上传文件
|
||||
func (p DefParty) userUploadFile() web_iris.Party {
|
||||
return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
|
||||
index.Post(AuthBase+"/userUploadFile", func(ctx *context.Context) {
|
||||
|
|
|
|||
|
|
@ -60,26 +60,35 @@ func (p DefParty) goodsList() web_iris.Party {
|
|||
var goodsT2 []GoodsDetail
|
||||
var goodsT3 []GoodsDetail
|
||||
for _, value := range goodsList {
|
||||
if value.GoodsType == 3 {
|
||||
goodsT3 = append(goodsT3, value)
|
||||
}
|
||||
if value.GoodsType == 2 {
|
||||
goodsT2 = append(goodsT2, value)
|
||||
}
|
||||
if value.GoodsType == 3 {
|
||||
goodsT3 = append(goodsT3, value)
|
||||
}
|
||||
if value.GoodsType == 1 {
|
||||
goodsT1 = append(goodsT1, value)
|
||||
}
|
||||
}
|
||||
for index, t2 := range goodsT2 {
|
||||
t2.GoodsSubList = goodsT3
|
||||
goodsT2[index] = t2
|
||||
goodsT1Main := GoodsDetail{
|
||||
Name: "基础服务",
|
||||
GoodsSubList: goodsT1,
|
||||
GoodsType: 1,
|
||||
}
|
||||
for index, t1 := range goodsT1 {
|
||||
t1.GoodsSubList = goodsT2
|
||||
goodsT1[index] = t1
|
||||
goodsT2Main := GoodsDetail{
|
||||
Name: "附加产品",
|
||||
GoodsSubList: goodsT2,
|
||||
GoodsType: 2,
|
||||
}
|
||||
goodsT3Main := GoodsDetail{
|
||||
Name: "附加服务",
|
||||
GoodsSubList: goodsT3,
|
||||
GoodsType: 3,
|
||||
}
|
||||
var goodsTs []GoodsDetail
|
||||
goodsTs = append(goodsTs, goodsT1Main, goodsT2Main, goodsT3Main)
|
||||
zap_server.ZAPLOG.Info("key", zap.Any("key1", key), zap.Any("key2", key1), zap.Any("key3", key2), zap.Any("key4", key3), zap.Any("key5", key4))
|
||||
Success(ctx, goodsListRequest, GoodsListResponse{goodsT1})
|
||||
Success(ctx, goodsListRequest, GoodsListResponse{goodsTs})
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,5 @@ if [ -f "$app_name" ]; then
|
|||
fi
|
||||
export GOOS=linux
|
||||
export GOARCH=amd64
|
||||
go clean -cache
|
||||
go build -trimpath -o petHouseApp main.go
|
||||
echo "编译完成"
|
||||
|
|
@ -17,6 +17,7 @@ type User struct {
|
|||
UserType int `json:"userType"` //用户类型 0微信 1手机号
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Role int `json:"role"` //用户角色 0普通用户 1护理人员
|
||||
Discount int `json:"discount"` //折扣
|
||||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"createTime"` //创建时间
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue