修复部分bug

This commit is contained in:
徐俊杰 2023-03-13 15:54:22 +08:00
parent 399834b842
commit ace17e00c2
3 changed files with 19 additions and 13 deletions

View File

@ -226,6 +226,7 @@ func GenerateArtworkSupplementInfo(artworkUids []string) error {
}
func PassedArtworkStatic(request *artistInfoArtwork.ArtistArtworkStaticRequest, uids []string) (res []model.ViewPassedArtworkStatic, err error) {
res = []model.ViewPassedArtworkStatic{}
var tx = db.DB.Model(&model.ViewPassedArtworkStatic{})
err = tx.Where("artist_uid in ?", uids).Scopes(db.Pagination(request.Page, request.PageSize)).Find(&res).Error
return
@ -241,7 +242,7 @@ func CountArtworkTotalWhichAuditPassed(artistUid string) (rulerPassedTotal int64
fmt.Println("service.GrpcArtistInfoArtworkImpl.GetArtworkLockRecords Error:", err.Error())
return 0, 0
}
if len(artworkList.Data) > 0 {
if len(artworkList.Data) == 0 {
fmt.Println("service.GrpcArtistInfoArtworkImpl.GetArtworkLockRecords :画作数量为0")
return 0, 0
}
@ -296,9 +297,9 @@ func CountAllArtworkTotal(artistUid string) (artworkTotal int64, artworkRulerTot
fmt.Println("画作列表查询失败", err.Error())
return 0, 0
}
artworkTotal = int64(artworkList.Count)
for _, v := range artworkList.Data {
artworkTotal++
artworkRulerTotal += int64(v.Ruler)
}
return artworkRulerTotal, artworkTotal
return artworkTotal, artworkRulerTotal
}

View File

@ -18,6 +18,7 @@ import (
"github.com/fonchain/fonchain-artistinfo/pb/artwork_query"
"github.com/fonchain/fonchain-artistinfo/pkg/m"
"github.com/fonchain/fonchain-artistinfo/pkg/service"
"github.com/fonchain/fonchain-artistinfo/pkg/util/stime"
"google.golang.org/protobuf/types/known/emptypb"
"strings"
)
@ -227,9 +228,9 @@ func (a ArtistInfoArtworkLogic) ArtworkStatic(request *artistInfoArtwork.ArtistA
}
//查询对应的画家信息
var gender int32 = -1
if request.ArtistGender != 1 {
if request.ArtistGender == 1 {
gender = 0
} else if request.ArtistGender != 2 {
} else if request.ArtistGender == 2 {
gender = 1
}
//查询匹配的画家数据列表
@ -244,6 +245,7 @@ func (a ArtistInfoArtworkLogic) ArtworkStatic(request *artistInfoArtwork.ArtistA
return nil, err
}
fmt.Println("\n artistUids:", artistUids, "\n")
fmt.Printf("\n\n artistList.Data: %+v\n\n", artistList.Data)
//查询这些画家审核通过的画作数据统计
res = &artistInfoArtwork.ArtistArtworkStaticResponse{
@ -281,7 +283,7 @@ func (a ArtistInfoArtworkLogic) ArtworkStatic(request *artistInfoArtwork.ArtistA
IsLock: v.IsLock,
ArtistUid: v.ArtistUid,
LatestLockTime: v.LatestLockTime,
LatestUpdatedAt: v.LatestUpdatedAt,
LatestUpdatedAt: stime.TimeToString(v.LatestUpdatedAt, stime.Format_Normal_YMDhms),
RealName: v.RealName,
PenName: penName,
StageName: stageName,

View File

@ -6,15 +6,18 @@
// -------------------------------------------
package model
import "gorm.io/gorm"
import (
"gorm.io/gorm"
"time"
)
type ViewPassedArtworkStatic struct {
ArtistUid string `json:"artistUid" gorm:"column:artist_uid;comment:画家uid"`
IsLock bool `json:"isLock" gorm:"column:is_lock;comment:是否锁定"`
LatestLockTime string `json:"latestLockTime" gorm:"column:latest_lock_time;comment:最近一次锁定时间"`
PasswdArtworkNumber int64 `json:"passwdArtworkNumber" gorm:"column:passwd_artwork_number;comment:审核通过的画作总数"`
LatestUpdatedAt string `json:"latestUpdatedAt" gorm:"column:latest_updated_at;comment:最近一次更新时间"`
RealName string `json:"realName" gorm:"column:real_name;comment:真实姓名"`
ArtistUid string `json:"artistUid" gorm:"column:artist_uid;comment:画家uid"`
IsLock bool `json:"isLock" gorm:"column:is_lock;comment:是否锁定"`
LatestLockTime string `json:"latestLockTime" gorm:"column:latest_lock_time;comment:最近一次锁定时间"`
PasswdArtworkNumber int64 `json:"passwdArtworkNumber" gorm:"column:passwd_artwork_number;comment:审核通过的画作总数"`
LatestUpdatedAt time.Time `json:"latestUpdatedAt" gorm:"column:latest_updated_at;comment:最近一次更新时间"`
RealName string `json:"realName" gorm:"column:real_name;comment:真实姓名"`
//---补充字段,转到pb文件
//Idx int64 `json:"idx" gorm:"-"`
//PenName string `json:"penName" gorm:"-"`