12345678910111213141516171819202122232425262728293031323334353637 |
- package pack
- import (
- "youngee_b_api/consts"
- "youngee_b_api/model/gorm_model"
- "youngee_b_api/model/http_model"
- "github.com/issue9/conv"
- )
- func MGormFullProjectToHttpFullProjectPreview(gormProjectInfos []*gorm_model.ProjectInfo) []*http_model.FullProjectPreview {
- var httpProjectPreviews []*http_model.FullProjectPreview
- for _, gormProjectInfo := range gormProjectInfos {
- httpProjectPreview := GormFullProjectToHttpFullProjectPreview(gormProjectInfo)
- httpProjectPreviews = append(httpProjectPreviews, httpProjectPreview)
- }
- return httpProjectPreviews
- }
- func GormFullProjectToHttpFullProjectPreview(gormProjectInfo *gorm_model.ProjectInfo) *http_model.FullProjectPreview {
- updatedTime := conv.MustString(gormProjectInfo.UpdatedAt)
- updatedTime = updatedTime[0:19]
- return &http_model.FullProjectPreview{
- ProjectId: gormProjectInfo.ProjectID,
- ProjectName: gormProjectInfo.ProjectName,
- ProjectStatus: consts.GetProjectStatus(gormProjectInfo.ProjectStatus),
- ProjectPlatform: consts.GetProjectPlatform(gormProjectInfo.ProjectPlatform),
- ProjectForm: consts.GetProjectForm(gormProjectInfo.ProjectForm),
- ProjectContentType: consts.GetProjectContentType(gormProjectInfo.ContentType),
- ProjectType: consts.GetProjectType(gormProjectInfo.ProjectType),
- ProjectUpdated: updatedTime,
- ProductId: gormProjectInfo.ProductID,
- EstimatedCost: gormProjectInfo.EstimatedCost,
- RecruitDdl: conv.MustString(gormProjectInfo.RecruitDdl)[0:19],
- ServiceChargeRate: gormProjectInfo.ServiceChargeRate,
- ServiceCharge: gormProjectInfo.ServiceChargeRate * gormProjectInfo.EstimatedCost * 0.01,
- }
- }
|