30 lines
738 B
Go
30 lines
738 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
|
|
"36wisdom/biz/dao"
|
|
)
|
|
|
|
type chapterReview struct{}
|
|
|
|
var ChapterReview = &chapterReview{}
|
|
|
|
// ListByChild 孩子温故记录。
|
|
func (s *chapterReview) ListByChild(ctx context.Context, childId int64) ([]gdb.Record, error) {
|
|
return dao.ChapterReview.Model().Ctx(ctx).Where("child_id", childId).Order("id DESC").All()
|
|
}
|
|
|
|
// Insert 创建温故记录。
|
|
func (s *chapterReview) Insert(ctx context.Context, childId, strategyId int64, levelIds string) (int64, error) {
|
|
return dao.ChapterReview.InsertAndReturnId(ctx, g.Map{
|
|
"child_id": childId,
|
|
"strategy_id": strategyId,
|
|
"level_ids": levelIds,
|
|
"status": 1,
|
|
})
|
|
}
|