package logic import ( "github.com/fonchain/fonchain-artistinfo/cmd/internal/dao" "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement" "github.com/fonchain/fonchain-artistinfo/pkg/util/stime" "google.golang.org/protobuf/types/known/emptypb" ) type StatementServerLogic struct{} func (s *StatementServerLogic) CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res *artistinfoStatement.CreateStatementBatchResponse, err error) { res = &artistinfoStatement.CreateStatementBatchResponse{} data, err := dao.CreateStatementBatch(in) res.Id = data.ID return } func (s *StatementServerLogic) BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) (*emptypb.Empty, error) { return nil, dao.BatchCreateStatementBatch(in) } func (s *StatementServerLogic) GetStatementBatchList(in *artistinfoStatement.GetStatementBatchListRequest) (res *artistinfoStatement.GetStatementBatchListResponse, err error) { datas, total, err := dao.GetStatementBatchList(in) res = &artistinfoStatement.GetStatementBatchListResponse{ Page: &artistinfoStatement.StatementPageInfo{ Page: in.Page, PageSize: in.PageSize, Total: total, }, Data: []*artistinfoStatement.StatementBatchRequest{}, } for _, v := range datas { res.Data = append(res.Data, &artistinfoStatement.StatementBatchRequest{ StType: v.StType, ArtistUid: v.ArtistUid, ArtistRealName: v.ArtistRealName, FlowStatus: v.FlowStatus, BatchTime: v.BatchTime, MinPrice: v.MinPrice, GuaranteePrice: v.GuaranteePrice, Id: v.ID, CreatedAt: stime.TimeToString(v.CreatedAt, stime.Format_Normal_YMDhms), UpdatedAt: stime.TimeToString(v.UpdatedAt, stime.Format_Normal_YMDhms), DeletedAt: int64(v.DeletedAt), FileUrl: v.FileUrl, }) } return } func (s *StatementServerLogic) CreateStatementDetail(in *artistinfoStatement.StatementDetailRequest) (res *artistinfoStatement.CreateStatementDetailResponse, err error) { res = &artistinfoStatement.CreateStatementDetailResponse{} data, err := dao.CreateStatementDetail(in) res.Id = data.ID return } func (s *StatementServerLogic) BatchCreateStatementDetail(in *artistinfoStatement.BatchCreateStatementDetailRequest) (*emptypb.Empty, error) { return nil, dao.BatchCreateStatementDetail(in) } func (s *StatementServerLogic) GetStatementDetailList(in *artistinfoStatement.GetStatementDetailListRequest) (res *artistinfoStatement.GetStatementDetailListResponse, err error) { datas, total, err := dao.GetStatementDetailList(in) res = &artistinfoStatement.GetStatementDetailListResponse{ Data: []*artistinfoStatement.StatementDetailRequest{}, Page: &artistinfoStatement.StatementPageInfo{ Page: in.Page, PageSize: in.PageSize, Total: total, }, } for _, v := range datas { res.Data = append(res.Data, &artistinfoStatement.StatementDetailRequest{ BatchId: v.BatchId, TfNum: v.TfNum, ArtworkName: v.ArtworkName, Ruler: v.Ruler, SaleNo: v.SaleNo, CompleteDate: v.CompleteDate, Id: v.ID, CreatedAt: stime.TimeToString(v.CreatedAt, stime.Format_Normal_YMDhms), UpdatedAt: stime.TimeToString(v.UpdatedAt, stime.Format_Normal_YMDhms), DeletedAt: int64(v.DeletedAt), }) } return } func (s *StatementServerLogic) GetStatementBatchTimeMenus(in *artistinfoStatement.GetStatementBatchListRequest) (res *artistinfoStatement.GetStatementBatchTimeMenusResponse, err error) { res = &artistinfoStatement.GetStatementBatchTimeMenusResponse{} res.Data, err = dao.GetStatementBatchTimeMenus(in) return }