Compare commits

...

14 Commits

  1. 38
      link_homework/api/v1/ClientPage/ClientPage.go
  2. 1
      link_homework/api/v1/hello.go
  3. 46
      link_homework/api/v1/record/Record.go
  4. 19
      link_homework/go.mod
  5. 106
      link_homework/go.sum
  6. 2
      link_homework/hack/config.yaml
  7. 49
      link_homework/internal/cmd/cmd.go
  8. 76
      link_homework/internal/controller/clientPage/clientPage.go
  9. 100
      link_homework/internal/controller/record/manageRecord.go
  10. 24
      link_homework/internal/dao/internal/activity_interactive_form.go
  11. 24
      link_homework/internal/dao/internal/activity_interactive_group.go
  12. 24
      link_homework/internal/dao/internal/activity_interactive_record.go
  13. 22
      link_homework/internal/dao/internal/fx_article.go
  14. 24
      link_homework/internal/dao/internal/live.go
  15. 22
      link_homework/internal/dao/internal/member_info.go
  16. 87
      link_homework/internal/logic/client/client.go
  17. 0
      link_homework/internal/logic/homework/.gitkeep
  18. 6
      link_homework/internal/logic/logic.go
  19. 144
      link_homework/internal/logic/record/record.go
  20. 24
      link_homework/internal/model/dto/ToolStruct.go
  21. 34
      link_homework/internal/service/client.go
  22. 8
      link_homework/internal/service/middleware.go
  23. 39
      link_homework/internal/service/record.go
  24. 2
      link_homework/main.go
  25. 7
      link_homework/manifest/config/config.yaml

38
link_homework/api/v1/ClientPage/ClientPage.go

@ -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:简答"`
}

1
link_homework/api/v1/hello.go

@ -1 +0,0 @@
package v1

46
link_homework/api/v1/record/Record.go

@ -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:"门店名"`
}

19
link_homework/go.mod

@ -4,33 +4,36 @@ go 1.21.13
require (
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.1
github.com/gogf/gf/v2 v2.8.1
github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.2
github.com/gogf/gf/v2 v2.8.2
)
require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/clbanning/mxj/v2 v2.7.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/goflyfox/gtoken v1.5.10 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/redis/go-redis/v9 v9.7.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

106
link_homework/go.sum

@ -1,134 +1,80 @@
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME=
github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/goflyfox/gtoken v1.5.10 h1:oj/v5r/1TjMMZvxpyEZYdsEvG2ZK/SGGnyjvsKi4uHk=
github.com/goflyfox/gtoken v1.5.10/go.mod h1:YpoSAn9tbfrSBoQnY7raQP0HaiRjQAE+4J179ecRH5I=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.1 h1:jbaPawkb8qmaYzrmBDbTa8Zkhzacq1RBOZw+qRJExI4=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.1/go.mod h1:s2aI1fV9AvKi4NtMpv3pV0EHtazkvfUNVQmzapr7UJQ=
github.com/gogf/gf/v2 v2.5.4/go.mod h1:7yf5qp0BznfsYx7Sw49m3mQvBsHpwAjJk3Q9ZnKoUEc=
github.com/gogf/gf/v2 v2.8.1 h1:1oVQg3G5OgCats4qWFTH3pHLe92nfUQeUDta05tUs1g=
github.com/gogf/gf/v2 v2.8.1/go.mod h1:6iYuZZ+A0ZcH8+4MDS/P0SvTPCvKzRvyAsY1kbkJYJc=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.2 h1:w8EfQgPvKfLBvS1rEFJfirixCRJYiSauOYlrjCZ2Y/Q=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.2/go.mod h1:9oQtAMrDDbVIWSSb9NTMAywpZ1cqtywgpzwbHk0lvxM=
github.com/gogf/gf/v2 v2.8.2 h1:4k641rn+hV1COAKygqsqcTm8+lDTkcO8HQ4iBv/uTFs=
github.com/gogf/gf/v2 v2.8.2/go.mod h1:n++xPYGUUMadw6IygLEgGZqc6y6DRLrJKg5kqCrPLWY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4=
github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM=
go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

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"

49
link_homework/internal/cmd/cmd.go

@ -2,10 +2,12 @@ package cmd
import (
"context"
"github.com/goflyfox/gtoken/gtoken"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gcmd"
"link_homework/internal/controller/clientPage"
"link_homework/internal/controller/record"
"link_homework/internal/logic/middleware"
)
var (
@ -17,32 +19,41 @@ var (
s := g.Server()
//后台
//启动gtoken
// 创建一个GfToken对象,用于处理用户登录、登出、权限验证等操作
gfToken := &gtoken.GfToken{
// 设置登录路径,即用户登录接口登入成功后会获得一个Token
LoginPath: "/login",
//// 设置登录前执行的函数,在用户登录之前会调用这个函数进行一些预处理,比如验证用户名和密码等。
//LoginBeforeFunc: loginFunc, //手动编写 没有同时配置登入路径,登入方法,登出路径启动时会报错
// 设置登出路径,即用户登出接口登入成功后会删除Token
LogoutPath: "/user/logout",
//// 设置需要拦截的路径,按照前缀拦截,所有以/user或/system开头的路径都需要进行Token认证。
//AuthPaths: g.SliceStr{"/user", "/system"},
//// 设置不需要拦截的路径,所有以/user/info或/system/user/开头的路径都不需要进行Token认证。
//AuthExcludePaths: g.SliceStr{"/user/info", "/system/user/*"},
//// 开启全局拦截,默认关闭,如果设置为true,则所有请求都会经过Token认证中间件,如果设置为false,则只有指定路径的请求会经过Token认证中间件。
//GlobalMiddleware: true,
}
////启动gtoken
//// 创建一个GfToken对象,用于处理用户登录、登出、权限验证等操作
//gfToken := &gtoken.GfToken{
// // 设置登录路径,即用户登录接口登入成功后会获得一个Token
// LoginPath: "/login",
// //// 设置登录前执行的函数,在用户登录之前会调用这个函数进行一些预处理,比如验证用户名和密码等。
// //LoginBeforeFunc: loginFunc, //手动编写 没有同时配置登入路径,登入方法,登出路径启动时会报错
// // 设置登出路径,即用户登出接口登入成功后会删除Token
// LogoutPath: "/user/logout",
// //// 设置需要拦截的路径,按照前缀拦截,所有以/user或/system开头的路径都需要进行Token认证。
// //AuthPaths: g.SliceStr{"/user", "/system"},
// //// 设置不需要拦截的路径,所有以/user/info或/system/user/开头的路径都不需要进行Token认证。
// //AuthExcludePaths: g.SliceStr{"/user/info", "/system/user/*"},
// //// 开启全局拦截,默认关闭,如果设置为true,则所有请求都会经过Token认证中间件,如果设置为false,则只有指定路径的请求会经过Token认证中间件。
// //GlobalMiddleware: true,
//}
s.Group("/api/homework_manage", func(group *ghttp.RouterGroup) {
group.Middleware(middleware.MiddlewareCORS)
//group.Middleware(middleware.MiddlewareIsLogin)
gfToken.Middleware(ctx, group)
//gfToken.Middleware(ctx, group)
//直接写接口,不用再分组
group.POST("/getrecordlist", record.NewManageRecord().GetRecordList)
group.POST("/getrecordbycondition", record.NewManageRecord().GetRecordByCondition)
group.POST("/getdeptinfo", record.NewManageRecord().GetDeptInfo)
group.POST("/getshopinfo", record.NewManageRecord().GetShopInfo)
})
//客户端
s.Group("/api/homework_client", func(group *ghttp.RouterGroup) {
group.Middleware(middleware.MiddlewareCORS)
//group.Middleware(middleware.MiddlewareIsLogin)
gfToken.Middleware(ctx, group)
//gfToken.Middleware(ctx, group)
//直接写接口,不用再分组
group.POST("/gethomeworklist", clientPage.NewClientPage().GetHomeworkList)
group.POST("/gethomeworkquestion", clientPage.NewClientPage().GetHomeworkQuestion)
group.POST("/commithomework", clientPage.NewClientPage().CommitHomework)
})
s.Run()

76
link_homework/internal/controller/clientPage/clientPage.go

@ -1 +1,77 @@
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(),
})
}
result, err := service.Client().GetHomeworkQuestion(r.Context(), req.Id)
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: "提交作业成功",
})
}

100
link_homework/internal/controller/record/manageRecord.go

@ -0,0 +1,100 @@
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(),
})
}
result, err := service.Record().GetRecordList(r.Context(), req.Id, req.PageNo, req.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(),
})
}
result, err := service.Record().GetRecordByCondition(r.Context(), req.Id, req.Jwcode, req.DeptId, req.ShopId, req.PageNo, req.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(),
})
}
result, err := service.Record().GetShopInfoByDeptId(r.Context(), req.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,
})
}

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)

87
link_homework/internal/logic/client/client.go

@ -0,0 +1,87 @@
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 { //单选或者多选
_, err := dao.ActivityInteractiveRecord.Ctx(ctx).Data(g.Map{
"jwcode": jwcode,
"form_id": answer.Id,
"group_id": req.GroupId,
"content": answer.Answer[0],
}).Insert()
if err != nil {
return err
}
} else if answer.Type == 2 { //多选
_, err := dao.ActivityInteractiveRecord.Ctx(ctx).Data(g.Map{
"jwcode": jwcode,
"form_id": answer.Id,
"group_id": req.GroupId,
"content": answer.Answer,
}).Insert()
if err != nil {
return err
}
} else if answer.Type == 3 { //简答
_, 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()
if err != nil {
return err
}
}
}
return
}

0
link_homework/internal/logic/homework/.gitkeep

6
link_homework/internal/logic/logic.go

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

144
link_homework/internal/logic/record/record.go

@ -0,0 +1,144 @@
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 {
return nil, errors.New("无条件查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 {
return nil, errors.New("无条件根据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) //不是最新的,需要再改
if err != nil {
return nil, err
}
for i, title := range recordInfo {
err = dao.ActivityInteractiveForm.Ctx(ctx).Fields("description", "type").Where("id", title.FormId).Scan(&recordInfo[i])
if err != nil {
return nil, err
}
}
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 recordList, err
}
//判断传来的jwcode, deptId, shopId是否为空,根据情况进行不同的筛选
if jwcode == 0 { //没有传jwcode
if deptId == "" && shopId == "" { //000
return recordList, err
} 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
}

24
link_homework/internal/model/dto/ToolStruct.go

@ -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:"提交时间/更新时间"`
}

34
link_homework/internal/service/client.go

@ -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
}

8
link_homework/internal/service/middleware.go

@ -0,0 +1,8 @@
// ================================================================================
// 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
type ()

39
link_homework/internal/service/record.go

@ -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
}

2
link_homework/main.go

@ -8,6 +8,8 @@ import (
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
"link_homework/internal/cmd"
_ "link_homework/internal/logic"

7
link_homework/manifest/config/config.yaml

@ -18,4 +18,9 @@ database:
link: "mysql:cms:AF42R3ib6YkFaemm@tcp(39.101.133.168:3306)/cms?charset=utf8mb4&parseTime=True&loc=Local"
debug: true
# redis暂不配置,记得加
# redis配置
redis:
default:
addr: "127.0.0.1:6379"
password: ""
db: 0
Loading…
Cancel
Save