Browse Source

作业列表修改

majun
majun 5 months ago
parent
commit
653e16ecc7
  1. 2
      link_homework/hack/config.yaml
  2. 24
      link_homework/internal/dao/internal/activity_interactive_form.go
  3. 24
      link_homework/internal/dao/internal/activity_interactive_group.go
  4. 24
      link_homework/internal/dao/internal/activity_interactive_record.go
  5. 22
      link_homework/internal/dao/internal/fx_article.go
  6. 24
      link_homework/internal/dao/internal/live.go
  7. 22
      link_homework/internal/dao/internal/member_info.go
  8. 3
      link_homework/internal/logic/homework/homework.go
  9. 4
      link_homework/internal/logic/logic.go
  10. 6
      link_homework/internal/model/entity/activity_interactive_group.go

2
link_homework/hack/config.yaml

@ -5,7 +5,7 @@ gfcli:
gen:
dao:
- link: "mysql:live:p4jMAMShNM8HTrbX@tcp(39.101.133.168:3306)/live?charset=utf8mb4&parseTime=True&loc=Local"
group: "live"
group: "default"
tables: "live, activity_interactive_form, activity_interactive_group, activity_interactive_record"
descriptionTag: true
- link: "mysql:cms:AF42R3ib6YkFaemm@tcp(39.101.133.168:3306)/cms?charset=utf8mb4&parseTime=True&loc=Local"

24
link_homework/internal/dao/internal/activity_interactive_form.go

@ -11,14 +11,14 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// ActivityInteractiveFormDao is the data access object for the table activity_interactive_form.
// ActivityInteractiveFormDao is the data access object for table activity_interactive_form.
type ActivityInteractiveFormDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
group string // group is the database configuration group name of current DAO.
columns ActivityInteractiveFormColumns // columns contains all the column names of Table for convenient usage.
}
// ActivityInteractiveFormColumns defines and stores column names for the table activity_interactive_form.
// ActivityInteractiveFormColumns defines and stores column names for table activity_interactive_form.
type ActivityInteractiveFormColumns struct {
Id string //
Name string // 名称
@ -32,7 +32,7 @@ type ActivityInteractiveFormColumns struct {
GroupId string // 问题分组id
}
// activityInteractiveFormColumns holds the columns for the table activity_interactive_form.
// activityInteractiveFormColumns holds the columns for table activity_interactive_form.
var activityInteractiveFormColumns = ActivityInteractiveFormColumns{
Id: "id",
Name: "name",
@ -49,42 +49,42 @@ var activityInteractiveFormColumns = ActivityInteractiveFormColumns{
// NewActivityInteractiveFormDao creates and returns a new DAO object for table data access.
func NewActivityInteractiveFormDao() *ActivityInteractiveFormDao {
return &ActivityInteractiveFormDao{
group: "live",
group: "default",
table: "activity_interactive_form",
columns: activityInteractiveFormColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ActivityInteractiveFormDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
// Table returns the table name of current dao.
func (dao *ActivityInteractiveFormDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
// Columns returns all column names of current dao.
func (dao *ActivityInteractiveFormDao) Columns() ActivityInteractiveFormColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
// Group returns the configuration group name of database of current dao.
func (dao *ActivityInteractiveFormDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *ActivityInteractiveFormDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *ActivityInteractiveFormDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

24
link_homework/internal/dao/internal/activity_interactive_group.go

@ -11,14 +11,14 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// ActivityInteractiveGroupDao is the data access object for the table activity_interactive_group.
// ActivityInteractiveGroupDao is the data access object for table activity_interactive_group.
type ActivityInteractiveGroupDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
group string // group is the database configuration group name of current DAO.
columns ActivityInteractiveGroupColumns // columns contains all the column names of Table for convenient usage.
}
// ActivityInteractiveGroupColumns defines and stores column names for the table activity_interactive_group.
// ActivityInteractiveGroupColumns defines and stores column names for table activity_interactive_group.
type ActivityInteractiveGroupColumns struct {
Id string //
Name string // 表单名称
@ -32,7 +32,7 @@ type ActivityInteractiveGroupColumns struct {
EndDate string // 作业结束时间
}
// activityInteractiveGroupColumns holds the columns for the table activity_interactive_group.
// activityInteractiveGroupColumns holds the columns for table activity_interactive_group.
var activityInteractiveGroupColumns = ActivityInteractiveGroupColumns{
Id: "id",
Name: "name",
@ -49,42 +49,42 @@ var activityInteractiveGroupColumns = ActivityInteractiveGroupColumns{
// NewActivityInteractiveGroupDao creates and returns a new DAO object for table data access.
func NewActivityInteractiveGroupDao() *ActivityInteractiveGroupDao {
return &ActivityInteractiveGroupDao{
group: "live",
group: "default",
table: "activity_interactive_group",
columns: activityInteractiveGroupColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ActivityInteractiveGroupDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
// Table returns the table name of current dao.
func (dao *ActivityInteractiveGroupDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
// Columns returns all column names of current dao.
func (dao *ActivityInteractiveGroupDao) Columns() ActivityInteractiveGroupColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
// Group returns the configuration group name of database of current dao.
func (dao *ActivityInteractiveGroupDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *ActivityInteractiveGroupDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *ActivityInteractiveGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

24
link_homework/internal/dao/internal/activity_interactive_record.go

@ -11,14 +11,14 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// ActivityInteractiveRecordDao is the data access object for the table activity_interactive_record.
// ActivityInteractiveRecordDao is the data access object for table activity_interactive_record.
type ActivityInteractiveRecordDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
group string // group is the database configuration group name of current DAO.
columns ActivityInteractiveRecordColumns // columns contains all the column names of Table for convenient usage.
}
// ActivityInteractiveRecordColumns defines and stores column names for the table activity_interactive_record.
// ActivityInteractiveRecordColumns defines and stores column names for table activity_interactive_record.
type ActivityInteractiveRecordColumns struct {
Id string //
Jwcode string //
@ -30,7 +30,7 @@ type ActivityInteractiveRecordColumns struct {
ContentTitle string //
}
// activityInteractiveRecordColumns holds the columns for the table activity_interactive_record.
// activityInteractiveRecordColumns holds the columns for table activity_interactive_record.
var activityInteractiveRecordColumns = ActivityInteractiveRecordColumns{
Id: "id",
Jwcode: "jwcode",
@ -45,42 +45,42 @@ var activityInteractiveRecordColumns = ActivityInteractiveRecordColumns{
// NewActivityInteractiveRecordDao creates and returns a new DAO object for table data access.
func NewActivityInteractiveRecordDao() *ActivityInteractiveRecordDao {
return &ActivityInteractiveRecordDao{
group: "live",
group: "default",
table: "activity_interactive_record",
columns: activityInteractiveRecordColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ActivityInteractiveRecordDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
// Table returns the table name of current dao.
func (dao *ActivityInteractiveRecordDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
// Columns returns all column names of current dao.
func (dao *ActivityInteractiveRecordDao) Columns() ActivityInteractiveRecordColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
// Group returns the configuration group name of database of current dao.
func (dao *ActivityInteractiveRecordDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *ActivityInteractiveRecordDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *ActivityInteractiveRecordDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

22
link_homework/internal/dao/internal/fx_article.go

@ -11,14 +11,14 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// FxArticleDao is the data access object for the table fx_article.
// FxArticleDao is the data access object for table fx_article.
type FxArticleDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
group string // group is the database configuration group name of current DAO.
columns FxArticleColumns // columns contains all the column names of Table for convenient usage.
}
// FxArticleColumns defines and stores column names for the table fx_article.
// FxArticleColumns defines and stores column names for table fx_article.
type FxArticleColumns struct {
Id string //
Title string // 标题
@ -117,7 +117,7 @@ type FxArticleColumns struct {
VideoType string // 视频类型 1 横屏 2 竖屏
}
// fxArticleColumns holds the columns for the table fx_article.
// fxArticleColumns holds the columns for table fx_article.
var fxArticleColumns = FxArticleColumns{
Id: "id",
Title: "title",
@ -225,36 +225,36 @@ func NewFxArticleDao() *FxArticleDao {
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *FxArticleDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
// Table returns the table name of current dao.
func (dao *FxArticleDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
// Columns returns all column names of current dao.
func (dao *FxArticleDao) Columns() FxArticleColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
// Group returns the configuration group name of database of current dao.
func (dao *FxArticleDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *FxArticleDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *FxArticleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

24
link_homework/internal/dao/internal/live.go

@ -11,14 +11,14 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// LiveDao is the data access object for the table live.
// LiveDao is the data access object for table live.
type LiveDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
group string // group is the database configuration group name of current DAO.
columns LiveColumns // columns contains all the column names of Table for convenient usage.
}
// LiveColumns defines and stores column names for the table live.
// LiveColumns defines and stores column names for table live.
type LiveColumns struct {
Id string //
Jwcode string //
@ -106,7 +106,7 @@ type LiveColumns struct {
JoinClassButton string // 进群按钮 1:开启
}
// liveColumns holds the columns for the table live.
// liveColumns holds the columns for table live.
var liveColumns = LiveColumns{
Id: "id",
Jwcode: "jwcode",
@ -197,42 +197,42 @@ var liveColumns = LiveColumns{
// NewLiveDao creates and returns a new DAO object for table data access.
func NewLiveDao() *LiveDao {
return &LiveDao{
group: "live",
group: "default",
table: "live",
columns: liveColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *LiveDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
// Table returns the table name of current dao.
func (dao *LiveDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
// Columns returns all column names of current dao.
func (dao *LiveDao) Columns() LiveColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
// Group returns the configuration group name of database of current dao.
func (dao *LiveDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *LiveDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *LiveDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

22
link_homework/internal/dao/internal/member_info.go

@ -11,14 +11,14 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// MemberInfoDao is the data access object for the table member_info.
// MemberInfoDao is the data access object for table member_info.
type MemberInfoDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
group string // group is the database configuration group name of current DAO.
columns MemberInfoColumns // columns contains all the column names of Table for convenient usage.
}
// MemberInfoColumns defines and stores column names for the table member_info.
// MemberInfoColumns defines and stores column names for table member_info.
type MemberInfoColumns struct {
Id string //
Jwcode string //
@ -60,7 +60,7 @@ type MemberInfoColumns struct {
CreateTime string // 账号注册时间
}
// memberInfoColumns holds the columns for the table member_info.
// memberInfoColumns holds the columns for table member_info.
var memberInfoColumns = MemberInfoColumns{
Id: "id",
Jwcode: "jwcode",
@ -111,36 +111,36 @@ func NewMemberInfoDao() *MemberInfoDao {
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *MemberInfoDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
// Table returns the table name of current dao.
func (dao *MemberInfoDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
// Columns returns all column names of current dao.
func (dao *MemberInfoDao) Columns() MemberInfoColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
// Group returns the configuration group name of database of current dao.
func (dao *MemberInfoDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *MemberInfoDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *MemberInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

3
link_homework/internal/logic/homework/homework.go

@ -3,6 +3,7 @@ package homework
import (
"context"
"link_homework/api/v1/homework"
"link_homework/internal/dao"
"link_homework/internal/model/entity"
"link_homework/internal/service"
)
@ -20,5 +21,7 @@ func New() service.IHomework {
}
func (s *sHomework) GetHomeworkList(ctx context.Context, req *homework.GetHomeworkListReq) (homeworkList []*entity.ActivityInteractiveGroup, err error) {
req = &homework.GetHomeworkListReq{}
err = dao.ActivityInteractiveGroup.Ctx(ctx).Scan(&homeworkList)
return
}

4
link_homework/internal/logic/logic.go

@ -1 +1,5 @@
package logic
import (
_ "link_homework/internal/logic/homework"
)

6
link_homework/internal/model/entity/activity_interactive_group.go

@ -20,7 +20,7 @@ type ActivityInteractiveGroup struct {
LiveId int `json:"liveId" orm:"live_id" description:"关联直播id"` // 关联直播id
StartDate *gtime.Time `json:"startDate" orm:"start_date" description:"作业开始时间"` // 作业开始时间
EndDate *gtime.Time `json:"endDate" orm:"end_date" description:"作业结束时间"` // 作业结束时间
Article *FxArticle `json:"article" orm:"with:id=article_id" description:"关联文章"` // 关联文章
Live *Live `json:"live" orm:"with:id=live_id" description:"关联直播"` // 关联直播
Count int `json:"count" description:"作业提交次数"`
//Article *FxArticle `json:"article" orm:"with:id=article_id" description:"关联文章"` // 关联文章
//Live *Live `json:"live" orm:"with:id=live_id" description:"关联直播"` // 关联直播
Count int `json:"count" description:"作业提交次数"` // 作业结束时间
}
Loading…
Cancel
Save