fix:修复bug

This commit is contained in:
henry
2022-05-02 14:37:37 +08:00
parent cb4e02e6e3
commit ae823d6aa8
2 changed files with 26 additions and 7 deletions

View File

@ -39,8 +39,9 @@ type (
AchievementDetail struct {
ID string `json:"id"`
*model2.TechnologyAchievement
Customers []string `json:"customers"`
Keywords []string `json:"keywords"`
Customers []string `json:"customers"`
Keywords []string `json:"keywords"`
Config *model2.TechnologyAchievementConfig `json:"config"`
}
// AchievementParams 成果参数信息
AchievementParams struct {
@ -48,7 +49,10 @@ type (
Title, Image, File, Introduce, Description string
Mode, Maturity, LeadStandard, CooperationMode int // 技术成熟度 领先标准 合作模式
Industrys, Customers, Keywords []string // 所属客户 关键词
IsSubmit int // 是否提交审核
VideoFile string // 视频文件
VideoPrice float64 // 视频价格
VideoFreeTime int
IsSubmit int // 是否提交审核
}
)
@ -143,6 +147,7 @@ func (c *Achievement) Detail(id uint64) (*AchievementDetail, error) {
TechnologyAchievement: mTechnologyAchievement.TechnologyAchievement,
Customers: mTechnologyAchievement.GetCustomerAttribute(),
Keywords: mTechnologyAchievement.GetKeywordAttribute(),
Config: mTechnologyAchievement.GetConfigAttribute(),
}, nil
}
@ -178,6 +183,11 @@ func (c *Achievement) Form(params *AchievementParams) error {
mTechnologyAchievement.SetKeywordAttribute(params.Keywords)
mTechnologyAchievement.Introduce = params.Introduce
mTechnologyAchievement.Description = params.Description
mTechnologyAchievement.SetConfigAttribute(&model2.TechnologyAchievementConfig{
VideoFile: params.VideoFile,
VideoPrice: params.VideoPrice,
VideoFreeTime: params.VideoFreeTime,
})
if mTechnologyAchievement.ID > 0 {
mTechnologyAchievement.Status = model2.TechnologyStatusKindForExamining
@ -203,11 +213,12 @@ func (c *Achievement) Shelf(id uint64, status int) error {
return err
} else if !isExist {
return errors.New("操作错误,成果信息不存在或已被删除")
} else if mTechnologyAchievement.UID != c.UID {
return errors.New("无权限操作")
} else if mTechnologyAchievement.ShelfStatus == model2.ShelfStatusKind(status) {
return errors.New("操作错误,无需变更上下架状态")
}
//else if mTechnologyAchievement.UID != c.UID {
// return errors.New("无权限操作")
//}
if err = model2.Updates(mTechnologyAchievement.TechnologyAchievement, map[string]interface{}{
"shelf_status": status, "updated_at": time.Now(),