28 lines
635 B
Go
Executable File
28 lines
635 B
Go
Executable File
package activity
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// ModifyIssue 修改活动期
|
|
// 参数: issueID 期ID, in 修改输入
|
|
// 返回: 错误信息
|
|
func (s *service) ModifyIssue(ctx context.Context, issueID int64, in ModifyIssueInput) error {
|
|
item, err := s.readDB.ActivityIssues.WithContext(ctx).Where(s.readDB.ActivityIssues.ID.Eq(issueID)).First()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if in.IssueNumber != "" {
|
|
item.IssueNumber = in.IssueNumber
|
|
}
|
|
if in.Status != 0 {
|
|
item.Status = in.Status
|
|
}
|
|
if in.Sort != 0 {
|
|
item.Sort = in.Sort
|
|
}
|
|
item.UpdatedAt = time.Now()
|
|
return s.writeDB.ActivityIssues.WithContext(ctx).Save(item)
|
|
}
|