15 changed files with 613 additions and 9 deletions
-
38link_homework/api/v1/ClientPage/ClientPage.go
-
46link_homework/api/v1/record/Record.go
-
19link_homework/internal/cmd/cmd.go
-
79link_homework/internal/controller/clientPage/clientPage.go
-
110link_homework/internal/controller/record/manageRecord.go
-
81link_homework/internal/logic/client/client.go
-
2link_homework/internal/logic/homework/homework.go
-
2link_homework/internal/logic/logic.go
-
138link_homework/internal/logic/record/record.go
-
24link_homework/internal/model/dto/ToolStruct.go
-
34link_homework/internal/service/client.go
-
2link_homework/internal/service/homework.go
-
39link_homework/internal/service/record.go
-
2link_homework/main.go
-
6link_homework/manifest/config/config.yaml
@ -0,0 +1,38 @@ |
|||||
|
package ClientPage |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
type GetHomeworkListRse struct { |
||||
|
Id int `json:"groupId" orm:"table:activity_interactive_group;column:id" dc:"id" ` |
||||
|
Name string `json:"name" orm:"table:activity_interactive_group;column:name" dc:"作业题目"` |
||||
|
EndDate *gtime.Time `json:"endData" orm:"table:activity_interactive_group;column:end_date;time_format:yy-MM-dd" dc:"作业截止时间"` |
||||
|
Submit int `json:"submit"` |
||||
|
} |
||||
|
|
||||
|
type GetHomeworkQuestionReq struct { |
||||
|
Id int `json:"id" dc:"作业id"` |
||||
|
} |
||||
|
|
||||
|
type GetHomeworkQuestionRes struct { |
||||
|
Id int `json:"id" orm:"table:activity_interactive_form;column:id" dc:"题目id"` |
||||
|
Name string `json:"name" orm:"table:activity_interactive_form;column:name" dc:"作业名称"` |
||||
|
Description string `json:"description" orm:"table:activity_interactive_form;column:description" dc:"作业题目名字"` |
||||
|
Content string `json:"content" orm:"table:activity_interactive_form;column:content" dc:"题目内容"` |
||||
|
Status int `json:"status"` |
||||
|
Type int `json:"type" orm:"table:activity_interactive_form;column:type" dc:"题目类型"` |
||||
|
} |
||||
|
|
||||
|
//需要id(group_id)(form表),查id,form.name是作业的题目,form.description是作业题目的名字,content, status,type
|
||||
|
|
||||
|
type CommitHomeworkReq struct { |
||||
|
GroupId int `json:"id" v:"required:#作业id不能为空" dc:"作业id"` |
||||
|
CommitedAnswer []CommitAnswer `json:"homework" dc:"传过来的答案"` |
||||
|
} |
||||
|
|
||||
|
type CommitAnswer struct { |
||||
|
Id int `json:"id" orm:"table:activity_interactive_record;column:form_id" dc:"作业题目id"` |
||||
|
Answer []string `json:"answer" dc:"作业答案,包含两部分,第一部分是题目,第二部分是答案,使用','分割的"` |
||||
|
Type int `json:"type" dc:"题目类型,1:单选,2:多选,3:简答"` |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package record |
||||
|
|
||||
|
import "link_homework/internal/model/dto" |
||||
|
|
||||
|
type GetRecordListReq struct { |
||||
|
Id int `json:"id" orm:"" dc:"作业id"` |
||||
|
PageNo int `json:"pageNo" dc:"当前页"` |
||||
|
PageSize int `json:"pageSize" dc:"每页条数"` |
||||
|
} |
||||
|
|
||||
|
// 合并并返回的提交详情所用信息
|
||||
|
type GetRecordListRes struct { |
||||
|
Total int `json:"total" dc:"总条数"` |
||||
|
Jwcode int `json:"jwcode" orm:"db:cms;table:member_info;column:jwcode" dc:"精网号"` |
||||
|
Name string `json:"name" orm:"db:cms;table:member_info;column:name" dc:"用户名字"` |
||||
|
DeptId string `json:"deptId" orm:"db:cms;table:member_info;column:deptId" dc:"部门id"` |
||||
|
DeptName string `json:"deptName" orm:"db:cms;member_info;column:deptName" dc:"部门名"` |
||||
|
ShopId string `json:"shopId" orm:"db:cms;member_info;column:shopId" dc:"门店id"` |
||||
|
ShopName string `json:"shopName" orm:"db:cms;member_info;column:shopName" dc:"门店名"` |
||||
|
Reply []dto.RecordInfo |
||||
|
} |
||||
|
|
||||
|
type GetRecordByConditionReq struct { |
||||
|
Id int `json:"id" orm:"" dc:"作业id"` |
||||
|
Jwcode int `json:"jwcode" dc:"精网号"` |
||||
|
DeptId string `json:"deptId" dc:"部门id"` |
||||
|
ShopId string `json:"shopId" dc:"门店id"` |
||||
|
PageNo int `json:"pageNo" dc:"当前页"` |
||||
|
PageSize int `json:"pageSize" dc:"每页条数"` |
||||
|
} |
||||
|
|
||||
|
/*GetRecordByConditionRes的返回值与GetRecordListRes的一致,所以直接套用*/ |
||||
|
|
||||
|
type GetDeptInfoRes struct { |
||||
|
DeptId string `json:"deptId" orm:"db:cms;table:member_info;column:deptId" dc:"部门id"` |
||||
|
DeptName string `json:"deptName" orm:"db:cms;member_info;column:deptName" dc:"部门名"` |
||||
|
} |
||||
|
|
||||
|
type GetShopInfoByDeptIdReq struct { |
||||
|
DeptId string `json:"deptId" dc:"部门id"` |
||||
|
} |
||||
|
|
||||
|
type GetShopInfoByDeptIdRes struct { |
||||
|
ShopId string `json:"shopId" orm:"db:cms;member_info;column:shopId" dc:"门店id"` |
||||
|
ShopName string `json:"shopName" orm:"db:cms;member_info;column:shopName" dc:"门店名"` |
||||
|
} |
@ -0,0 +1,79 @@ |
|||||
|
package clientPage |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/net/ghttp" |
||||
|
CPage "link_homework/api/v1/ClientPage" |
||||
|
"link_homework/internal/model/dto" |
||||
|
"link_homework/internal/service" |
||||
|
) |
||||
|
|
||||
|
type ClientPage struct{} |
||||
|
|
||||
|
func NewClientPage() *ClientPage { |
||||
|
return &ClientPage{} |
||||
|
} |
||||
|
|
||||
|
// 查询作业列表
|
||||
|
func (c *ClientPage) GetHomeworkList(r *ghttp.Request) { |
||||
|
//请求中不需要携带任何参数
|
||||
|
result, err := service.Client().ClientGetHomeworkList(r.Context()) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: result, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询题目列表
|
||||
|
func (c *ClientPage) GetHomeworkQuestion(r *ghttp.Request) { |
||||
|
var req CPage.GetHomeworkQuestionReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
groupId := req.Id |
||||
|
result, err := service.Client().GetHomeworkQuestion(r.Context(), groupId) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: result, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
func (c *ClientPage) CommitHomework(r *ghttp.Request) { |
||||
|
var jwcode int = 90038794 |
||||
|
var req CPage.CommitHomeworkReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
err := service.Client().CommitHomework(r.Context(), req, jwcode) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
}) |
||||
|
|
||||
|
} |
@ -0,0 +1,110 @@ |
|||||
|
package record |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/net/ghttp" |
||||
|
"link_homework/api/v1/record" |
||||
|
"link_homework/internal/model/dto" |
||||
|
"link_homework/internal/service" |
||||
|
) |
||||
|
|
||||
|
type ManageRecord struct{} |
||||
|
|
||||
|
func NewManageRecord() *ManageRecord { |
||||
|
return &ManageRecord{} |
||||
|
} |
||||
|
|
||||
|
// 查询所有提交记录
|
||||
|
func (m *ManageRecord) GetRecordList(r *ghttp.Request) { |
||||
|
var req record.GetRecordListReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
groupId := req.Id |
||||
|
pageNo := req.PageNo |
||||
|
pageSize := req.PageSize |
||||
|
result, err := service.Record().GetRecordList(r.Context(), groupId, pageNo, pageSize) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: result, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 根据条件查询提交记录
|
||||
|
func (m *ManageRecord) GetRecordByCondition(r *ghttp.Request) { |
||||
|
var req record.GetRecordByConditionReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
groupId := req.Id |
||||
|
jwcode := req.Jwcode |
||||
|
deptId := req.DeptId |
||||
|
shopId := req.ShopId |
||||
|
pageNo := req.PageNo |
||||
|
pageSize := req.PageSize |
||||
|
result, err := service.Record().GetRecordByCondition(r.Context(), groupId, jwcode, deptId, shopId, pageNo, pageSize) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: result, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询用户部门信息
|
||||
|
func (m *ManageRecord) GetDeptInfo(r *ghttp.Request) { |
||||
|
result, err := service.Record().GetDeptInfo(r.Context()) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: result, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询用户门店信息
|
||||
|
func (m *ManageRecord) GetShopInfo(r *ghttp.Request) { |
||||
|
var req record.GetShopInfoByDeptIdReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
deptId := req.DeptId |
||||
|
result, err := service.Record().GetShopInfoByDeptId(r.Context(), deptId) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: result, |
||||
|
}) |
||||
|
|
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
package client |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
"fmt" |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
"link_homework/api/v1/ClientPage" |
||||
|
"link_homework/internal/dao" |
||||
|
"link_homework/internal/service" |
||||
|
) |
||||
|
|
||||
|
type sClient struct{} |
||||
|
|
||||
|
func init() { |
||||
|
service.RegisterClient(&sClient{}) |
||||
|
} |
||||
|
|
||||
|
func (s *sClient) ClientGetHomeworkList(ctx context.Context) (homeworkList []ClientPage.GetHomeworkListRse, err error) { |
||||
|
var jwcode = 90038794 //需要从token中获取当前的数据
|
||||
|
err = dao.ActivityInteractiveGroup.Ctx(ctx).Fields("id", "name", "DATE_FORMAT(end_date, '%Y-%m-%d') as end_date"). |
||||
|
Where("end_date>?", gtime.Now()).OrderDesc("end_date").Scan(&homeworkList) |
||||
|
if err != nil { |
||||
|
fmt.Println("作业列表查询失败:", err) |
||||
|
return |
||||
|
} |
||||
|
for i, item := range homeworkList { |
||||
|
var count int |
||||
|
count, err = dao.ActivityInteractiveRecord.Ctx(ctx).Where("group_id=?", item.Id).Where("jwcode", jwcode).Count() //只有精网号和作业id查出来的结果是所需要的结果的题目数倍数
|
||||
|
if err != nil { |
||||
|
fmt.Println("提交记录数查询失败:", err) |
||||
|
return |
||||
|
} |
||||
|
num, err1 := dao.ActivityInteractiveForm.Ctx(ctx).Where("group_id", item.Id).Count() |
||||
|
if err1 != nil { |
||||
|
fmt.Println("题目数查询失败:", err1) |
||||
|
return |
||||
|
} |
||||
|
homeworkList[i].Submit = count / num |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
func (s *sClient) GetHomeworkQuestion(ctx context.Context, groupId int) (questions []ClientPage.GetHomeworkQuestionRes, err error) { |
||||
|
err = dao.ActivityInteractiveForm.Ctx(ctx).Fields("id", "name", "content", "status", "type"). |
||||
|
Where("group_id", groupId).Scan(&questions) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
func (s *sClient) CommitHomework(ctx context.Context, req ClientPage.CommitHomeworkReq, jwcode int) (err error) { |
||||
|
//req中需要有:作业id,提交的每一个题的答案,每一个提的类型
|
||||
|
for _, answer := range req.CommitedAnswer { |
||||
|
if answer.Type == 1 { //单选或者多选
|
||||
|
num, err := dao.ActivityInteractiveRecord.Ctx(ctx).Data(g.Map{ |
||||
|
"jwcode": jwcode, |
||||
|
"form_id": answer.Id, |
||||
|
"group_id": req.GroupId, |
||||
|
"content": answer.Answer[0], |
||||
|
}).Insert() |
||||
|
fmt.Println(num, err) |
||||
|
} else if answer.Type == 2 { //多选
|
||||
|
num, err := dao.ActivityInteractiveRecord.Ctx(ctx).Data(g.Map{ |
||||
|
"jwcode": jwcode, |
||||
|
"form_id": answer.Id, |
||||
|
"group_id": req.GroupId, |
||||
|
"content": answer.Answer, |
||||
|
}).Insert() |
||||
|
fmt.Println(num, err) |
||||
|
} else if answer.Type == 3 { //简答
|
||||
|
num, err := dao.ActivityInteractiveRecord.Ctx(ctx).Data(g.Map{ |
||||
|
"jwcode": jwcode, |
||||
|
"form_id": answer.Id, |
||||
|
"group_id": req.GroupId, |
||||
|
"content_title": answer.Answer[0], |
||||
|
"content": answer.Answer[1], |
||||
|
}).Insert() |
||||
|
fmt.Println(num, err) |
||||
|
} |
||||
|
} |
||||
|
return |
||||
|
} |
@ -0,0 +1,138 @@ |
|||||
|
package record |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
"errors" |
||||
|
"fmt" |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
pkgRecord "link_homework/api/v1/record" |
||||
|
"link_homework/internal/dao" |
||||
|
"link_homework/internal/model/dto" |
||||
|
"link_homework/internal/service" |
||||
|
) |
||||
|
|
||||
|
type sRecord struct{} |
||||
|
|
||||
|
func init() { |
||||
|
service.RegisterRecord(&sRecord{}) |
||||
|
} |
||||
|
|
||||
|
func NewRecord() *sRecord { |
||||
|
return &sRecord{} |
||||
|
} |
||||
|
|
||||
|
// 无条件全查
|
||||
|
func (s *sRecord) GetRecordList(ctx context.Context, groupId, pageNo, pageSize int) (record []pkgRecord.GetRecordListRes, err error) { |
||||
|
//从record表中查询出jwcode,根据group_id
|
||||
|
err = dao.ActivityInteractiveRecord.Ctx(ctx).Fields("jwcode").Where("group_id", groupId).Group("jwcode"). |
||||
|
Page(pageNo, pageSize).Scan(&record) |
||||
|
if err != nil { |
||||
|
panic("无条件查jwcode失败") |
||||
|
} |
||||
|
|
||||
|
fmt.Println(record) |
||||
|
//根据jwcode在member_info表中查询姓名(name), 部门id(deptId), 部门名(deptName), 门店id(shopId), 门店名(shopName)
|
||||
|
for i, info := range record { |
||||
|
err = g.DB("cms").Model("member_info").Fields("jwcode", "name", "deptId", "deptName", "shopId", "shopName"). |
||||
|
Where("jwcode", info.Jwcode).Scan(&record[i]) |
||||
|
if err != nil { |
||||
|
panic("无条件根据jwcode查member_info表失败") |
||||
|
} |
||||
|
total, err1 := dao.ActivityInteractiveRecord.Ctx(ctx).Fields("jwcode").Where("group_id", groupId).Group("jwcode").Count() |
||||
|
if err1 != nil { |
||||
|
return |
||||
|
} |
||||
|
record[i].Total = total |
||||
|
//根据jwcode,groupId在record表中查询最新的提交记录进行存放
|
||||
|
var recordInfo []dto.RecordInfo |
||||
|
err = dao.ActivityInteractiveRecord.Ctx(ctx).Fields("content", "content_title", "updated_at", "form_id"). |
||||
|
Where("jwcode", info.Jwcode).Where("group_id", groupId).Group("form_id").Order("updated_at desc").Scan(&recordInfo) //不是最新的,需要再改
|
||||
|
for i, title := range recordInfo { |
||||
|
err = dao.ActivityInteractiveForm.Ctx(ctx).Fields("description", "type").Where("id", title.FormId).Scan(&recordInfo[i]) |
||||
|
} |
||||
|
record[i].Reply = recordInfo |
||||
|
fmt.Println(record) |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 根据条件查询
|
||||
|
func (s *sRecord) GetRecordByCondition(ctx context.Context, groupId, jwcode int, deptId, shopId string, pageNo, pageSize int) (record []pkgRecord.GetRecordListRes, err error) { |
||||
|
//全查
|
||||
|
recordList, err := s.GetRecordList(ctx, groupId, pageNo, pageSize) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
//判断传来的jwcode, deptId, shopId是否为空,根据情况进行不同的筛选
|
||||
|
if jwcode == 0 { //没有传jwcode
|
||||
|
if deptId == "" && shopId == "" { //000
|
||||
|
return recordList, nil |
||||
|
} else if deptId != "" && shopId == "" { //010
|
||||
|
for _, info := range recordList { |
||||
|
if info.DeptId == deptId { |
||||
|
record = append(record, info) |
||||
|
} |
||||
|
} |
||||
|
if record == nil { |
||||
|
return nil, errors.New("只部门没有查询到相关记录") |
||||
|
} |
||||
|
return record, err |
||||
|
} else if deptId != "" && shopId != "" { //011
|
||||
|
for _, info := range recordList { |
||||
|
if info.DeptId == deptId && info.ShopId == shopId { |
||||
|
record = append(record, info) |
||||
|
} |
||||
|
} |
||||
|
if record == nil { |
||||
|
return nil, errors.New("部门,门店 没有查询到相关记录") |
||||
|
} |
||||
|
return record, err |
||||
|
} |
||||
|
} else { //传了jwcode
|
||||
|
if deptId == "" && shopId == "" { //100
|
||||
|
for _, info := range recordList { |
||||
|
if info.Jwcode == jwcode { |
||||
|
record = append(record, info) |
||||
|
} |
||||
|
} |
||||
|
if record == nil { |
||||
|
return nil, errors.New("只精网号没有查询到相关记录") |
||||
|
} |
||||
|
return record, err |
||||
|
} else if deptId != "" && shopId == "" { //110
|
||||
|
for _, info := range recordList { |
||||
|
if info.Jwcode == jwcode && info.DeptId == deptId { |
||||
|
record = append(record, info) |
||||
|
} |
||||
|
} |
||||
|
if record == nil { |
||||
|
return nil, errors.New("精网号,部门 没有查询到相关记录") |
||||
|
} |
||||
|
return record, err |
||||
|
} else if deptId != "" && shopId != "" { //111
|
||||
|
for _, info := range recordList { |
||||
|
if info.Jwcode == jwcode && info.DeptId == deptId && info.ShopId == shopId { |
||||
|
record = append(record, info) |
||||
|
} |
||||
|
} |
||||
|
if record == nil { |
||||
|
return nil, errors.New("精网号,部门,门店 没有查询到相关记录") |
||||
|
} |
||||
|
return record, err |
||||
|
} |
||||
|
} |
||||
|
return nil, errors.New("检查一下穿的参数是否正常") |
||||
|
} |
||||
|
|
||||
|
// 查询部门信息
|
||||
|
func (s *sRecord) GetDeptInfo(ctx context.Context) (depts []pkgRecord.GetDeptInfoRes, err error) { |
||||
|
err = g.DB("cms").Model("member_info").Fields("deptId", "deptName").Group("deptId").Scan(&depts) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 根据部门信息查询门店信息
|
||||
|
func (s *sRecord) GetShopInfoByDeptId(ctx context.Context, deptId string) (shops []pkgRecord.GetShopInfoByDeptIdRes, err error) { |
||||
|
err = g.DB("cms").Model("member_info").Fields("shopId", "shopName"). |
||||
|
Where("deptId", deptId).Group("shopId").Scan(&shops) |
||||
|
return |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package dto |
||||
|
|
||||
|
import "github.com/gogf/gf/v2/os/gtime" |
||||
|
|
||||
|
// 从cms库中查询用户信息
|
||||
|
type MemberInfo struct { |
||||
|
Jwcode int `json:"jwcode" orm:"db:cms;table:member_info;column:jwcode" dc:"精网号"` |
||||
|
Name string `json:"name" orm:"db:cms;table:member_info;column:name" dc:"用户名字"` |
||||
|
DeptId string `json:"deptId" orm:"db:cms;table:member_info;column:deptId" dc:"部门id"` |
||||
|
DeptName string `json:"deptName" orm:"db:cms;member_info;column:deptName" dc:"部门名"` |
||||
|
ShopId string `json:"shopId" orm:"db:cms;member_info;column:shopId" dc:"门店id"` |
||||
|
ShopName string `json:"shopName" orm:"db:cms;member_info;column:shopName" dc:"门店名"` |
||||
|
} |
||||
|
|
||||
|
// 从live库里查询作业信息
|
||||
|
type RecordInfo struct { |
||||
|
//Jwcode int `json:"jwcode" orm:"db:default;table:activity_interactive_record;column:jwcode" dc:"精网号"`
|
||||
|
FormId int `json:"formId" orm:"db:default;table:activity_interactive_record;column:form_id" dc:"题目id"` |
||||
|
Type int `json:"type" orm:"db:default;table:activity_interactive_form;column:type" dc:"题目类型"` |
||||
|
Description string `json:"formTitle" orm:"db:default;table:activity_interactive_form;column:description" dc:"题目"` |
||||
|
ContentTitle string `json:"contentTitle" orm:"db:default;table:activity_interactive_record;column:content_title" dc:"作答标题"` |
||||
|
Content string `json:"content" orm:"db:default;table:activity_interactive_record;column:content" dc:"作答内容"` |
||||
|
UpdatedAt gtime.Time `json:"submitTime" orm:"db:default;table:activity_interactive_record;column:updated_at" dc:"提交时间/更新时间"` |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
// ================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// You can delete these comments if you wish manually maintain this interface file.
|
||||
|
// ================================================================================
|
||||
|
|
||||
|
package service |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
"link_homework/api/v1/ClientPage" |
||||
|
) |
||||
|
|
||||
|
type ( |
||||
|
IClient interface { |
||||
|
ClientGetHomeworkList(ctx context.Context) (homeworkList []ClientPage.GetHomeworkListRse, err error) |
||||
|
GetHomeworkQuestion(ctx context.Context, groupId int) (questions []ClientPage.GetHomeworkQuestionRes, err error) |
||||
|
CommitHomework(ctx context.Context, req ClientPage.CommitHomeworkReq, jwcode int) (err error) |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
var ( |
||||
|
localClient IClient |
||||
|
) |
||||
|
|
||||
|
func Client() IClient { |
||||
|
if localClient == nil { |
||||
|
panic("implement not found for interface IClient, forgot register?") |
||||
|
} |
||||
|
return localClient |
||||
|
} |
||||
|
|
||||
|
func RegisterClient(i IClient) { |
||||
|
localClient = i |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
// ================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// You can delete these comments if you wish manually maintain this interface file.
|
||||
|
// ================================================================================
|
||||
|
|
||||
|
package service |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
pkgRecord "link_homework/api/v1/record" |
||||
|
) |
||||
|
|
||||
|
type ( |
||||
|
IRecord interface { |
||||
|
// 无条件全查
|
||||
|
GetRecordList(ctx context.Context, groupId int, pageNo int, pageSize int) (record []pkgRecord.GetRecordListRes, err error) |
||||
|
// 根据条件查询
|
||||
|
GetRecordByCondition(ctx context.Context, groupId int, jwcode int, deptId string, shopId string, pageNo int, pageSize int) (record []pkgRecord.GetRecordListRes, err error) |
||||
|
// 查询部门信息
|
||||
|
GetDeptInfo(ctx context.Context) (depts []pkgRecord.GetDeptInfoRes, err error) |
||||
|
// 根据部门信息查询门店信息
|
||||
|
GetShopInfoByDeptId(ctx context.Context, deptId string) (shops []pkgRecord.GetShopInfoByDeptIdRes, err error) |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
var ( |
||||
|
localRecord IRecord |
||||
|
) |
||||
|
|
||||
|
func Record() IRecord { |
||||
|
if localRecord == nil { |
||||
|
panic("implement not found for interface IRecord, forgot register?") |
||||
|
} |
||||
|
return localRecord |
||||
|
} |
||||
|
|
||||
|
func RegisterRecord(i IRecord) { |
||||
|
localRecord = i |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue