This commit is contained in:
jhc 2023-03-08 09:02:18 +08:00
parent f376a1f0f7
commit 90490a9151
6 changed files with 32 additions and 26 deletions

Binary file not shown.

Binary file not shown.

View File

@ -108,25 +108,27 @@ func ArtShowListWithRel(in *artShow.ShowListReq) (err error, total int64, out []
}
func ArtShowList(in *artShow.ShowListReq) (err error, total int64, out []*model.ArtShowRes) {
queryDB := db.DbArtShow.Model(&model.ArtShow{}).
Select("show_uid, show_seq, show_name, artist_name, artist_uid, artwork_num, ruler, price, create_time, operator, is_show")
queryDB := db.DbArtShow.Table("art_show as a ").Omit("a.created_at").Distinct("a.id").
Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.operator, a.is_show, c.address ,c.show_time, a.created_at").
Joins("left join show_rel as c on a.show_uid = c.show_uid ")
countDB := db.DbArtShow.Table("art_show as a ").Distinct("a.id").
Select("a.show_uid, a.show_seq, a.show_name, a.artist_name, a.artist_uid, a.artwork_num, a.ruler, a.price, a.create_time, a.operator, a.is_show, c.address ,c.show_time, a.created_at").
Joins("left join show_rel as c on a.show_uid = c.show_uid ")
if len(in.IsShow) > 0 {
queryDB.Where(" is_show in ?", in.IsShow)
countDB.Where(" is_show in ?", in.IsShow)
}
//if in.StartTime != "" && in.EndTime != "" {
// queryDB.Where("convert(a.create_time, date) between ? and ?", in.StartTime, in.EndTime)
//}
out = make([]*model.ArtShowRes, 0)
err = queryDB.Offset(int((in.Page - 1) * in.PageSize)).
Limit(int(in.PageSize)).Find(&out).Error
err = queryDB.Where("a.deleted_at is null and c.deleted_at is null").Offset(int((in.Page - 1) * in.PageSize)).
Limit(int(in.PageSize)).Order("a.created_at desc ").Find(&out).Error
if err != nil {
zap.L().Error("ArtShowList Find err", zap.Error(err))
return
}
err = queryDB.Count(&total).Error
err = countDB.Where("a.deleted_at is null").Group("a.id").Count(&total).Error
if err != nil {
zap.L().Error("ArtShowList Count err", zap.Error(err))
return

View File

@ -11,7 +11,7 @@ mode = prod #正式prod #测试dev
;DbPassWord = 123456
;DbName = art_show
;正式服 192.168.12.3
;正式服 192.168.12.3 old
;[mysql]
;Db = mysql
;DbHost = mysql
@ -20,14 +20,14 @@ mode = prod #正式prod #测试dev
;DbPassWord = sLl0b7stlbwvZ883TV
;DbName = art_show
;正式服 172.16.100.30
;[mysql]
;Db = mysql
;DbHost = 172.16.100.30
;DbPort = 3306
;DbUser = root
;DbPassWord = IhQmhg8HZjDmU=Ove5PnA^D
;DbName = art_show
;正式服 172.16.100.30 now
[mysql]
Db = mysql
DbHost = 172.16.100.30
DbPort = 3306
DbUser = root
DbPassWord = IhQmhg8HZjDmU=Ove5PnA^D
DbName = art_show
;188
;[mysql]
@ -40,13 +40,13 @@ mode = prod #正式prod #测试dev
;214
[mysql]
Db = mysql
;Db = mysql
;DbHost = 172.16.100.99 #214
DbHost = 172.16.39.93 #214
DbPort = 9007
DbUser = artuser
DbPassWord = "C250PflXIWv2SQm8"
DbName = art_show
;;DbHost = 172.16.39.93 #214
;DbPort = 9007
;DbUser = artuser
;DbPassWord = "C250PflXIWv2SQm8"
;DbName = art_show
;[mysql]
;Db = mysql

View File

@ -3,8 +3,8 @@ dubbo:
demoZK:
protocol: zookeeper
timeout: 3s
# address: zookeeper:2181 # 正式服务
address: 127.0.0.1:2181 # 测试服务
address: zookeeper:2181 # 正式服务
# address: 127.0.0.1:2181 # 测试服务
protocols:
triple: #triple
name: tri

View File

@ -83,6 +83,10 @@ func CalcPrice(total_price int64, total_ruler int32, artworksPrices []*model.Art
artworksPrices[maxId].CopyrightPrice = artworksPrices[maxId].CopyrightPrice + loss_copyright_price
}
for i := 0; i < len(artworksPrices); i++ {
artworksPrices[i].Price = artworksPrices[i].ArtworkPrice + artworksPrices[i].CopyrightPrice
}
return artworksPrices
}