diff --git a/api/admin/admin.go b/api/admin/admin.go new file mode 100644 index 0000000..059b672 --- /dev/null +++ b/api/admin/admin.go @@ -0,0 +1,15 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package admin + +import ( + "context" + + "server/api/admin/v1" +) + +type IAdminV1 interface { + AdminInfo(ctx context.Context, req *v1.AdminInfoReq) (res *v1.AdminInfoRes, err error) +} diff --git a/api/auth/auth.go b/api/auth/auth.go new file mode 100644 index 0000000..f84dedd --- /dev/null +++ b/api/auth/auth.go @@ -0,0 +1,17 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package auth + +import ( + "context" + + "server/api/auth/v1" +) + +type IAuthV1 interface { + AdminLogin(ctx context.Context, req *v1.AdminLoginReq) (res *v1.AdminLoginRes, err error) + MerchantLogin(ctx context.Context, req *v1.MerchantLoginReq) (res *v1.MerchantLoginRes, err error) + StoreLogin(ctx context.Context, req *v1.StoreLoginReq) (res *v1.StoreLoginRes, err error) +} diff --git a/api/wx/wx.go b/api/wx/wx.go new file mode 100644 index 0000000..082d178 --- /dev/null +++ b/api/wx/wx.go @@ -0,0 +1,18 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package wx + +import ( + "context" + + "server/api/wx/v1" +) + +type IWxV1 interface { + WeChatLogin(ctx context.Context, req *v1.WeChatLoginReq) (res *v1.WeChatLoginRes, err error) + WeChatEvent(ctx context.Context, req *v1.WeChatEventReq) (res *v1.WeChatEventRes, err error) + WeChatVertify(ctx context.Context, req *v1.WeChatVertifyReq) (res *v1.WeChatVertifyRes, err error) + WeChatPolling(ctx context.Context, req *v1.WeChatPollingReq) (res *v1.WeChatPollingRes, err error) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..6ed0316 --- /dev/null +++ b/go.mod @@ -0,0 +1,42 @@ +module server + +go 1.24.2 + +require ( + github.com/casbin/casbin/v2 v2.105.0 + github.com/go-resty/resty/v2 v2.16.5 + github.com/gogf/gf/v2 v2.9.0 + github.com/golang-jwt/jwt/v5 v5.2.2 + github.com/google/uuid v1.6.0 + github.com/hailaz/gf-casbin-adapter/v2 v2.8.1 + golang.org/x/crypto v0.38.0 +) + +require ( + github.com/BurntSushi/toml v1.4.0 // indirect + github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect + github.com/casbin/govaluate v1.3.0 // indirect + github.com/clbanning/mxj/v2 v2.7.0 // indirect + github.com/emirpasic/gods v1.18.1 // 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/gorilla/websocket v1.5.3 // indirect + github.com/grokify/html-strip-tags-go v0.1.0 // indirect + github.com/kr/text v0.2.0 // 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.16 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect + golang.org/x/net v0.33.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.25.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6f8629c --- /dev/null +++ b/go.sum @@ -0,0 +1,98 @@ +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/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/casbin/casbin/v2 v2.105.0 h1:dLj5P6pLApBRat9SADGiLxLZjiDPvA1bsPkyV4PGx6I= +github.com/casbin/casbin/v2 v2.105.0/go.mod h1:Ee33aqGrmES+GNL17L0h9X28wXuo829wnNUnS0edAco= +github.com/casbin/govaluate v1.3.0 h1:VA0eSY0M2lA86dYd5kPPuNZMUD9QkWnOCnavGrw9myc= +github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= +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/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +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/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +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.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-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM= +github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA= +github.com/gogf/gf/v2 v2.9.0 h1:semN5Q5qGjDQEv4620VzxcJzJlSD07gmyJ9Sy9zfbHk= +github.com/gogf/gf/v2 v2.9.0/go.mod h1:sWGQw+pLILtuHmbOxoe0D+0DdaXxbleT57axOLH2vKI= +github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= +github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +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/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +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.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= +github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= +github.com/hailaz/gf-casbin-adapter/v2 v2.8.1 h1:ZFIlfQAYmrL2Fe6/dZz6vCA5hYK0NxhnoKMQpbklgqc= +github.com/hailaz/gf-casbin-adapter/v2 v2.8.1/go.mod h1:Jk91dRBZuMVjBMu2oQmqMRc6xuL5V+rzgHeFWvI+wlg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +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.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.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/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/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-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/controller/admin/admin.go b/internal/controller/admin/admin.go new file mode 100644 index 0000000..f122676 --- /dev/null +++ b/internal/controller/admin/admin.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package admin diff --git a/internal/controller/admin/admin_new.go b/internal/controller/admin/admin_new.go new file mode 100644 index 0000000..ec91d7a --- /dev/null +++ b/internal/controller/admin/admin_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package admin + +import ( + "server/api/admin" +) + +type ControllerV1 struct{} + +func NewV1() admin.IAdminV1 { + return &ControllerV1{} +} diff --git a/internal/controller/admin/admin_v1_admin_info.go b/internal/controller/admin/admin_v1_admin_info.go new file mode 100644 index 0000000..ce89e44 --- /dev/null +++ b/internal/controller/admin/admin_v1_admin_info.go @@ -0,0 +1,14 @@ +package admin + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "server/api/admin/v1" +) + +func (c *ControllerV1) AdminInfo(ctx context.Context, req *v1.AdminInfoReq) (res *v1.AdminInfoRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/internal/controller/auth/auth.go b/internal/controller/auth/auth.go new file mode 100644 index 0000000..52ff940 --- /dev/null +++ b/internal/controller/auth/auth.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package auth diff --git a/internal/controller/auth/auth_new.go b/internal/controller/auth/auth_new.go new file mode 100644 index 0000000..938b497 --- /dev/null +++ b/internal/controller/auth/auth_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package auth + +import ( + "server/api/auth" +) + +type ControllerV1 struct{} + +func NewV1() auth.IAuthV1 { + return &ControllerV1{} +} diff --git a/internal/controller/auth/auth_v1_admin_login.go b/internal/controller/auth/auth_v1_admin_login.go new file mode 100644 index 0000000..63bcf13 --- /dev/null +++ b/internal/controller/auth/auth_v1_admin_login.go @@ -0,0 +1,14 @@ +package auth + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "server/api/auth/v1" +) + +func (c *ControllerV1) AdminLogin(ctx context.Context, req *v1.AdminLoginReq) (res *v1.AdminLoginRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/internal/controller/auth/auth_v1_merchant_login.go b/internal/controller/auth/auth_v1_merchant_login.go new file mode 100644 index 0000000..f3d2e5a --- /dev/null +++ b/internal/controller/auth/auth_v1_merchant_login.go @@ -0,0 +1,14 @@ +package auth + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "server/api/auth/v1" +) + +func (c *ControllerV1) MerchantLogin(ctx context.Context, req *v1.MerchantLoginReq) (res *v1.MerchantLoginRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/internal/controller/auth/auth_v1_store_login.go b/internal/controller/auth/auth_v1_store_login.go new file mode 100644 index 0000000..f64162d --- /dev/null +++ b/internal/controller/auth/auth_v1_store_login.go @@ -0,0 +1,14 @@ +package auth + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "server/api/auth/v1" +) + +func (c *ControllerV1) StoreLogin(ctx context.Context, req *v1.StoreLoginReq) (res *v1.StoreLoginRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/internal/controller/wx/wx.go b/internal/controller/wx/wx.go new file mode 100644 index 0000000..19030a5 --- /dev/null +++ b/internal/controller/wx/wx.go @@ -0,0 +1,5 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package wx diff --git a/internal/controller/wx/wx_new.go b/internal/controller/wx/wx_new.go new file mode 100644 index 0000000..563afab --- /dev/null +++ b/internal/controller/wx/wx_new.go @@ -0,0 +1,15 @@ +// ================================================================================= +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// ================================================================================= + +package wx + +import ( + "server/api/wx" +) + +type ControllerV1 struct{} + +func NewV1() wx.IWxV1 { + return &ControllerV1{} +} diff --git a/internal/controller/wx/wx_v1_we_chat_event.go b/internal/controller/wx/wx_v1_we_chat_event.go new file mode 100644 index 0000000..ddf70c1 --- /dev/null +++ b/internal/controller/wx/wx_v1_we_chat_event.go @@ -0,0 +1,33 @@ +package wx + +import ( + "context" + "github.com/gogf/gf/v2/os/glog" + + "server/api/auth/v1" +) + +func (c *ControllerV1) WeChatEvent(ctx context.Context, req *v1.WeChatEventReq) (res *v1.WeChatEventRes, err error) { + // 收到微信订阅事件 + glog.Infof(ctx, + "微信消息推送:时间=%d, 消息类型=%s, 事件=%s, 事件Key=%s", + req.CreateTime, + req.MsgType, + req.Event, + req.EventKey, + ) + // 根据事件类型进行不同的处理: + switch req.MsgType { + case "event": + switch req.Event { + case "subscribe": + // 未关注,扫描关注后, 注册账号,关联微信的 open_id + case "SCAN": + // 已关注,扫描后,根据 open_id 查找用户生成 token + default: + // 处理其他事件 + } + } + return nil, nil + +} diff --git a/internal/controller/wx/wx_v1_we_chat_login.go b/internal/controller/wx/wx_v1_we_chat_login.go new file mode 100644 index 0000000..304e43c --- /dev/null +++ b/internal/controller/wx/wx_v1_we_chat_login.go @@ -0,0 +1,59 @@ +package wx + +import ( + "context" + "encoding/json" + "fmt" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/glog" + "server/utility/ecode" + "server/utility/wechat" + + "os" + "server/api/auth/v1" +) + +func (c *ControllerV1) WeChatLogin(ctx context.Context, req *v1.WeChatLoginReq) (res *v1.WeChatLoginRes, err error) { + // 1、根据 uuid 构建redis 存入数据接口 + cache := struct { + Token string `json:"token"` + OpenID string `json:"openid"` + }{ + Token: "", + OpenID: "", + } + + marshal, err := json.Marshal(cache) + if err != nil { + glog.Errorf(ctx, "反序列化数据出现异常") + return nil, ecode.Fail.Sub("反序列化数据出现异常") + } + + // 2、存入 redis + _, err = g.Redis().Do(ctx, "SETEX", fmt.Sprintf("login_status:%s", req.UUID), 300, marshal) + if err != nil { + glog.Errorf(ctx, "写入 Redis 异常:%v", err) + return nil, ecode.Fail.Sub("写入 Redis 登录状态失败") + } + + // 3、开始获取图片 + weChatClient := wechat.GetWeChatClient() + ticket, err := weChatClient.GetTicket(req.UUID) + if err != nil { + return nil, ecode.Fail.Sub("微信登录获取 ticket 错误") + } + imagePath, err := weChatClient.GetQrCode(ticket, req.UUID+".jpg") + if err != nil { + return nil, ecode.Fail.Sub("微信登录获取二维码错误") + } + imageData, err := os.ReadFile(imagePath) + if err != nil { + return nil, ecode.Fail.Sub("读取二维码图片失败") + } + defer os.Remove(imagePath) + resp := g.RequestFromCtx(ctx).Response + resp.Header().Set("Content-Type", "image/jpeg") + resp.Write(imageData) + + return nil, nil +} diff --git a/internal/controller/wx/wx_v1_we_chat_polling.go b/internal/controller/wx/wx_v1_we_chat_polling.go new file mode 100644 index 0000000..c031f96 --- /dev/null +++ b/internal/controller/wx/wx_v1_we_chat_polling.go @@ -0,0 +1,15 @@ +package wx + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "server/api/auth/v1" +) + +func (c *ControllerV1) WeChatPolling(ctx context.Context, req *v1.WeChatPollingReq) (res *v1.WeChatPollingRes, err error) { + // 收到请求根据 uuid 查询缓存中的数据,看看是否生成了 token + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/internal/controller/wx/wx_v1_we_chat_vertify.go b/internal/controller/wx/wx_v1_we_chat_vertify.go new file mode 100644 index 0000000..067f99c --- /dev/null +++ b/internal/controller/wx/wx_v1_we_chat_vertify.go @@ -0,0 +1,32 @@ +package wx + +import ( + "context" + "github.com/gogf/gf/v2/crypto/gsha1" + "github.com/gogf/gf/v2/frame/g" + "server/utility/ecode" + "sort" + "strings" + + "server/api/auth/v1" +) + +func (c *ControllerV1) WeChatVertify(ctx context.Context, req *v1.WeChatVertifyReq) (res *v1.WeChatVertifyRes, err error) { + + weChatToken := g.Config().MustGet(ctx, "wechat.token").String() + // 1. 将 token、timestamp、nonce 组成 slice + params := []string{weChatToken, req.Timestamp, req.Nonce} + // 2. 字典序排序 + sort.Strings(params) + // 3. 拼接字符串 + joined := strings.Join(params, "") + // 4. SHA1 加密 + encrypt := gsha1.Encrypt(joined) + + // 5. 与 signature 对比 + if encrypt != req.Signature { + return nil, ecode.InvalidOperation.Sub("微信服务器验证失败") + } + g.RequestFromCtx(ctx).Response.WriteJson(req.EchoStr) + return +} diff --git a/internal/dao/admins.go b/internal/dao/admins.go new file mode 100644 index 0000000..d741e91 --- /dev/null +++ b/internal/dao/admins.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalAdminsDao is an internal type for wrapping the internal DAO implementation. +type internalAdminsDao = *internal.AdminsDao + +// adminsDao is the data access object for the table admins. +// You can define custom methods on it to extend its functionality as needed. +type adminsDao struct { + internalAdminsDao +} + +var ( + // Admins is a globally accessible object for table admins operations. + Admins = adminsDao{ + internal.NewAdminsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/competition_awards.go b/internal/dao/competition_awards.go new file mode 100644 index 0000000..0820a29 --- /dev/null +++ b/internal/dao/competition_awards.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalCompetitionAwardsDao is an internal type for wrapping the internal DAO implementation. +type internalCompetitionAwardsDao = *internal.CompetitionAwardsDao + +// competitionAwardsDao is the data access object for the table competition_awards. +// You can define custom methods on it to extend its functionality as needed. +type competitionAwardsDao struct { + internalCompetitionAwardsDao +} + +var ( + // CompetitionAwards is a globally accessible object for table competition_awards operations. + CompetitionAwards = competitionAwardsDao{ + internal.NewCompetitionAwardsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/competition_participants.go b/internal/dao/competition_participants.go new file mode 100644 index 0000000..251707a --- /dev/null +++ b/internal/dao/competition_participants.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalCompetitionParticipantsDao is an internal type for wrapping the internal DAO implementation. +type internalCompetitionParticipantsDao = *internal.CompetitionParticipantsDao + +// competitionParticipantsDao is the data access object for the table competition_participants. +// You can define custom methods on it to extend its functionality as needed. +type competitionParticipantsDao struct { + internalCompetitionParticipantsDao +} + +var ( + // CompetitionParticipants is a globally accessible object for table competition_participants operations. + CompetitionParticipants = competitionParticipantsDao{ + internal.NewCompetitionParticipantsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/competitions.go b/internal/dao/competitions.go new file mode 100644 index 0000000..a3c50d6 --- /dev/null +++ b/internal/dao/competitions.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalCompetitionsDao is an internal type for wrapping the internal DAO implementation. +type internalCompetitionsDao = *internal.CompetitionsDao + +// competitionsDao is the data access object for the table competitions. +// You can define custom methods on it to extend its functionality as needed. +type competitionsDao struct { + internalCompetitionsDao +} + +var ( + // Competitions is a globally accessible object for table competitions operations. + Competitions = competitionsDao{ + internal.NewCompetitionsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/feedbacks.go b/internal/dao/feedbacks.go new file mode 100644 index 0000000..2938821 --- /dev/null +++ b/internal/dao/feedbacks.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalFeedbacksDao is an internal type for wrapping the internal DAO implementation. +type internalFeedbacksDao = *internal.FeedbacksDao + +// feedbacksDao is the data access object for the table feedbacks. +// You can define custom methods on it to extend its functionality as needed. +type feedbacksDao struct { + internalFeedbacksDao +} + +var ( + // Feedbacks is a globally accessible object for table feedbacks operations. + Feedbacks = feedbacksDao{ + internal.NewFeedbacksDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/internal/admins.go b/internal/dao/internal/admins.go new file mode 100644 index 0000000..3214897 --- /dev/null +++ b/internal/dao/internal/admins.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// AdminsDao is the data access object for the table admins. +type AdminsDao 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. + columns AdminsColumns // columns contains all the column names of Table for convenient usage. +} + +// AdminsColumns defines and stores column names for the table admins. +type AdminsColumns struct { + Id string // 管理员ID + Username string // 管理员用户名 + PasswordHash string // 密码哈希 + RealName string // 真实姓名 + Phone string // 手机号 + Email string // 邮箱 + Role string // 角色:1=超级管理员,2=运营管理员,3=客服管理员,4=财务管理员 + Status string // 状态:1=正常,2=禁用 + LastLoginAt string // 最后登录时间 + LastLoginIp string // 最后登录IP + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// adminsColumns holds the columns for the table admins. +var adminsColumns = AdminsColumns{ + Id: "id", + Username: "username", + PasswordHash: "password_hash", + RealName: "real_name", + Phone: "phone", + Email: "email", + Role: "role", + Status: "status", + LastLoginAt: "last_login_at", + LastLoginIp: "last_login_ip", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewAdminsDao creates and returns a new DAO object for table data access. +func NewAdminsDao() *AdminsDao { + return &AdminsDao{ + group: "default", + table: "admins", + columns: adminsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *AdminsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *AdminsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *AdminsDao) Columns() AdminsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *AdminsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *AdminsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *AdminsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/competition_awards.go b/internal/dao/internal/competition_awards.go new file mode 100644 index 0000000..a20551b --- /dev/null +++ b/internal/dao/internal/competition_awards.go @@ -0,0 +1,93 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// CompetitionAwardsDao is the data access object for the table competition_awards. +type CompetitionAwardsDao 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. + columns CompetitionAwardsColumns // columns contains all the column names of Table for convenient usage. +} + +// CompetitionAwardsColumns defines and stores column names for the table competition_awards. +type CompetitionAwardsColumns struct { + Id string // 赛事获奖ID + CompetitionId string // 赛事ID + UserId string // 获奖用户ID + AwardRank string // 获奖名次(1:冠军,2:亚军,3:季军,依次类推) + RewardType string // 奖励类型:1=平台奖励,2=门店奖励 + RewardId string // 对应奖励ID + Amount string // 奖励数量 + IssuedAt string // 奖励发放时间 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间 +} + +// competitionAwardsColumns holds the columns for the table competition_awards. +var competitionAwardsColumns = CompetitionAwardsColumns{ + Id: "id", + CompetitionId: "competition_id", + UserId: "user_id", + AwardRank: "award_rank", + RewardType: "reward_type", + RewardId: "reward_id", + Amount: "amount", + IssuedAt: "issued_at", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewCompetitionAwardsDao creates and returns a new DAO object for table data access. +func NewCompetitionAwardsDao() *CompetitionAwardsDao { + return &CompetitionAwardsDao{ + group: "default", + table: "competition_awards", + columns: competitionAwardsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *CompetitionAwardsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *CompetitionAwardsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *CompetitionAwardsDao) Columns() CompetitionAwardsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *CompetitionAwardsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *CompetitionAwardsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *CompetitionAwardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/competition_participants.go b/internal/dao/internal/competition_participants.go new file mode 100644 index 0000000..515d13c --- /dev/null +++ b/internal/dao/internal/competition_participants.go @@ -0,0 +1,87 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// CompetitionParticipantsDao is the data access object for the table competition_participants. +type CompetitionParticipantsDao 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. + columns CompetitionParticipantsColumns // columns contains all the column names of Table for convenient usage. +} + +// CompetitionParticipantsColumns defines and stores column names for the table competition_participants. +type CompetitionParticipantsColumns struct { + Id string // 参赛记录ID + CompetitionId string // 赛事ID + UserId string // 参赛用户ID + RegistrationTime string // 报名时间 + Status string // 参赛状态:1=已报名,2=已取消,3=已禁赛 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间 +} + +// competitionParticipantsColumns holds the columns for the table competition_participants. +var competitionParticipantsColumns = CompetitionParticipantsColumns{ + Id: "id", + CompetitionId: "competition_id", + UserId: "user_id", + RegistrationTime: "registration_time", + Status: "status", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewCompetitionParticipantsDao creates and returns a new DAO object for table data access. +func NewCompetitionParticipantsDao() *CompetitionParticipantsDao { + return &CompetitionParticipantsDao{ + group: "default", + table: "competition_participants", + columns: competitionParticipantsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *CompetitionParticipantsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *CompetitionParticipantsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *CompetitionParticipantsDao) Columns() CompetitionParticipantsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *CompetitionParticipantsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *CompetitionParticipantsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *CompetitionParticipantsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/competitions.go b/internal/dao/internal/competitions.go new file mode 100644 index 0000000..0642e30 --- /dev/null +++ b/internal/dao/internal/competitions.go @@ -0,0 +1,99 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// CompetitionsDao is the data access object for the table competitions. +type CompetitionsDao 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. + columns CompetitionsColumns // columns contains all the column names of Table for convenient usage. +} + +// CompetitionsColumns defines and stores column names for the table competitions. +type CompetitionsColumns struct { + Id string // 赛事唯一标识符 + Name string // 赛事名称 + Description string // 赛事描述 + GameMode string // 游戏模式 + Conditions string // 赛事条件 + Rules string // 赛事规则说明 + StartTime string // 赛事开始时间 + EndTime string // 赛事结束时间 + IsActive string // 赛事是否启用 + MerchantId string // 所属商户ID + StoreId string // 所属门店ID + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// competitionsColumns holds the columns for the table competitions. +var competitionsColumns = CompetitionsColumns{ + Id: "id", + Name: "name", + Description: "description", + GameMode: "game_mode", + Conditions: "conditions", + Rules: "rules", + StartTime: "start_time", + EndTime: "end_time", + IsActive: "is_active", + MerchantId: "merchant_id", + StoreId: "store_id", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewCompetitionsDao creates and returns a new DAO object for table data access. +func NewCompetitionsDao() *CompetitionsDao { + return &CompetitionsDao{ + group: "default", + table: "competitions", + columns: competitionsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *CompetitionsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *CompetitionsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *CompetitionsDao) Columns() CompetitionsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *CompetitionsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *CompetitionsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *CompetitionsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/feedbacks.go b/internal/dao/internal/feedbacks.go new file mode 100644 index 0000000..60773b2 --- /dev/null +++ b/internal/dao/internal/feedbacks.go @@ -0,0 +1,91 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// FeedbacksDao is the data access object for the table feedbacks. +type FeedbacksDao 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. + columns FeedbacksColumns // columns contains all the column names of Table for convenient usage. +} + +// FeedbacksColumns defines and stores column names for the table feedbacks. +type FeedbacksColumns struct { + Id string // 反馈唯一标识符 + UserId string // 提交者用户ID + Title string // 反馈标题 + Content string // 反馈内容 + FeedbackType string // 反馈类型:1=BUG,2=建议,3=投诉,4=其他 + Status string // 处理状态:0=待处理,1=处理中,2=已处理,3=已驳回 + Reply string // 管理员回复内容 + CreatedAt string // 反馈提交时间 + UpdatedAt string // 反馈更新时间 + DeletedAt string // 软删除时间戳 +} + +// feedbacksColumns holds the columns for the table feedbacks. +var feedbacksColumns = FeedbacksColumns{ + Id: "id", + UserId: "user_id", + Title: "title", + Content: "content", + FeedbackType: "feedback_type", + Status: "status", + Reply: "reply", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewFeedbacksDao creates and returns a new DAO object for table data access. +func NewFeedbacksDao() *FeedbacksDao { + return &FeedbacksDao{ + group: "default", + table: "feedbacks", + columns: feedbacksColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *FeedbacksDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *FeedbacksDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *FeedbacksDao) Columns() FeedbacksColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *FeedbacksDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *FeedbacksDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *FeedbacksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/merchant_admins.go b/internal/dao/internal/merchant_admins.go new file mode 100644 index 0000000..69594e4 --- /dev/null +++ b/internal/dao/internal/merchant_admins.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// MerchantAdminsDao is the data access object for the table merchant_admins. +type MerchantAdminsDao 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. + columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage. +} + +// MerchantAdminsColumns defines and stores column names for the table merchant_admins. +type MerchantAdminsColumns struct { + Id string // 商户管理员ID + MerchantId string // 所属商户ID + Username string // 用户名 + PasswordHash string // 密码哈希 + RealName string // 真实姓名 + Phone string // 手机号 + Email string // 邮箱 + Role string // 角色:1=超级管理员,2=普通管理员 + Status string // 状态:1=正常,2=禁用 + LastLoginAt string // 最后登录时间 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// merchantAdminsColumns holds the columns for the table merchant_admins. +var merchantAdminsColumns = MerchantAdminsColumns{ + Id: "id", + MerchantId: "merchant_id", + Username: "username", + PasswordHash: "password_hash", + RealName: "real_name", + Phone: "phone", + Email: "email", + Role: "role", + Status: "status", + LastLoginAt: "last_login_at", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewMerchantAdminsDao creates and returns a new DAO object for table data access. +func NewMerchantAdminsDao() *MerchantAdminsDao { + return &MerchantAdminsDao{ + group: "default", + table: "merchant_admins", + columns: merchantAdminsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *MerchantAdminsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *MerchantAdminsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *MerchantAdminsDao) Columns() MerchantAdminsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *MerchantAdminsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *MerchantAdminsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *MerchantAdminsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/merchants.go b/internal/dao/internal/merchants.go new file mode 100644 index 0000000..2d89a9d --- /dev/null +++ b/internal/dao/internal/merchants.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// MerchantsDao is the data access object for the table merchants. +type MerchantsDao 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. + columns MerchantsColumns // columns contains all the column names of Table for convenient usage. +} + +// MerchantsColumns defines and stores column names for the table merchants. +type MerchantsColumns struct { + Id string // 商户ID + Name string // 商户名称 + BusinessLicense string // 营业执照号 + LegalPerson string // 法人姓名 + ContactName string // 联系人姓名 + ContactPhone string // 联系人电话 + ContactEmail string // 联系人邮箱 + Address string // 商户地址 + Status string // 状态:1=正常,2=禁用,3=待审核 + ExpireAt string // 服务到期时间 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// merchantsColumns holds the columns for the table merchants. +var merchantsColumns = MerchantsColumns{ + Id: "id", + Name: "name", + BusinessLicense: "business_license", + LegalPerson: "legal_person", + ContactName: "contact_name", + ContactPhone: "contact_phone", + ContactEmail: "contact_email", + Address: "address", + Status: "status", + ExpireAt: "expire_at", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewMerchantsDao creates and returns a new DAO object for table data access. +func NewMerchantsDao() *MerchantsDao { + return &MerchantsDao{ + group: "default", + table: "merchants", + columns: merchantsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *MerchantsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *MerchantsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *MerchantsDao) Columns() MerchantsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *MerchantsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *MerchantsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *MerchantsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/notices.go b/internal/dao/internal/notices.go new file mode 100644 index 0000000..5cc451a --- /dev/null +++ b/internal/dao/internal/notices.go @@ -0,0 +1,93 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// NoticesDao is the data access object for the table notices. +type NoticesDao 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. + columns NoticesColumns // columns contains all the column names of Table for convenient usage. +} + +// NoticesColumns defines and stores column names for the table notices. +type NoticesColumns struct { + Id string // 通知ID + Title string // 通知标题 + Content string // 通知内容 + Type string // 通知类型:1=系统公告,2=活动通知,3=维护通知 + Status string // 状态:0=关闭,1=发布 + VisibleTo string // 可见范围:1=所有人,2=仅门店,3=仅用户 + MerchantId string // 所属商户ID + StoreId string // 所属门店ID + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// noticesColumns holds the columns for the table notices. +var noticesColumns = NoticesColumns{ + Id: "id", + Title: "title", + Content: "content", + Type: "type", + Status: "status", + VisibleTo: "visible_to", + MerchantId: "merchant_id", + StoreId: "store_id", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewNoticesDao creates and returns a new DAO object for table data access. +func NewNoticesDao() *NoticesDao { + return &NoticesDao{ + group: "default", + table: "notices", + columns: noticesColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *NoticesDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *NoticesDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *NoticesDao) Columns() NoticesColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *NoticesDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *NoticesDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *NoticesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/reward_distributions.go b/internal/dao/internal/reward_distributions.go new file mode 100644 index 0000000..52937b1 --- /dev/null +++ b/internal/dao/internal/reward_distributions.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// RewardDistributionsDao is the data access object for the table reward_distributions. +type RewardDistributionsDao 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. + columns RewardDistributionsColumns // columns contains all the column names of Table for convenient usage. +} + +// RewardDistributionsColumns defines and stores column names for the table reward_distributions. +type RewardDistributionsColumns struct { + Id string // 奖励下发记录ID + UserId string // 接收奖励的用户ID + TaskId string // 触发该奖励的任务ID + RewardId string // 奖励ID + RewardSource string // 奖励来源:1=平台,2=门店 + Amount string // 奖励数量 + StoreId string // 所属门店ID + Status string // 发放状态:0=待发放,1=已发放,2=失败 + IssuedAt string // 实际发放时间 + Remark string // 备注信息 + CreatedAt string // 记录创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// rewardDistributionsColumns holds the columns for the table reward_distributions. +var rewardDistributionsColumns = RewardDistributionsColumns{ + Id: "id", + UserId: "user_id", + TaskId: "task_id", + RewardId: "reward_id", + RewardSource: "reward_source", + Amount: "amount", + StoreId: "store_id", + Status: "status", + IssuedAt: "issued_at", + Remark: "remark", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewRewardDistributionsDao creates and returns a new DAO object for table data access. +func NewRewardDistributionsDao() *RewardDistributionsDao { + return &RewardDistributionsDao{ + group: "default", + table: "reward_distributions", + columns: rewardDistributionsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *RewardDistributionsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *RewardDistributionsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *RewardDistributionsDao) Columns() RewardDistributionsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *RewardDistributionsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *RewardDistributionsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *RewardDistributionsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/store_admins.go b/internal/dao/internal/store_admins.go new file mode 100644 index 0000000..f88a28f --- /dev/null +++ b/internal/dao/internal/store_admins.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// StoreAdminsDao is the data access object for the table store_admins. +type StoreAdminsDao 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. + columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage. +} + +// StoreAdminsColumns defines and stores column names for the table store_admins. +type StoreAdminsColumns struct { + Id string // 门店管理员ID + StoreId string // 所属门店ID + Username string // 用户名 + PasswordHash string // 密码哈希 + RealName string // 真实姓名 + Phone string // 手机号 + Email string // 邮箱 + Role string // 角色:1=店长,2=收银员,3=网管 + Status string // 状态:1=正常,2=禁用 + LastLoginAt string // 最后登录时间 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// storeAdminsColumns holds the columns for the table store_admins. +var storeAdminsColumns = StoreAdminsColumns{ + Id: "id", + StoreId: "store_id", + Username: "username", + PasswordHash: "password_hash", + RealName: "real_name", + Phone: "phone", + Email: "email", + Role: "role", + Status: "status", + LastLoginAt: "last_login_at", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreAdminsDao creates and returns a new DAO object for table data access. +func NewStoreAdminsDao() *StoreAdminsDao { + return &StoreAdminsDao{ + group: "default", + table: "store_admins", + columns: storeAdminsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreAdminsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreAdminsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreAdminsDao) Columns() StoreAdminsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreAdminsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *StoreAdminsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *StoreAdminsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/store_rewards.go b/internal/dao/internal/store_rewards.go new file mode 100644 index 0000000..9e0590a --- /dev/null +++ b/internal/dao/internal/store_rewards.go @@ -0,0 +1,91 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// StoreRewardsDao is the data access object for the table store_rewards. +type StoreRewardsDao 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. + columns StoreRewardsColumns // columns contains all the column names of Table for convenient usage. +} + +// StoreRewardsColumns defines and stores column names for the table store_rewards. +type StoreRewardsColumns struct { + Id string // 门店奖励ID + StoreId string // 所属门店ID + RewardType string // 奖励类型:1=积分,2=优惠券,3=商品,4=抽奖券 + RewardName string // 奖励名称 + Amount string // 奖励数量 + Total string // 该奖励总库存(NULL 表示无限) + MerchantId string // 所属商户ID + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// storeRewardsColumns holds the columns for the table store_rewards. +var storeRewardsColumns = StoreRewardsColumns{ + Id: "id", + StoreId: "store_id", + RewardType: "reward_type", + RewardName: "reward_name", + Amount: "amount", + Total: "total", + MerchantId: "merchant_id", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreRewardsDao creates and returns a new DAO object for table data access. +func NewStoreRewardsDao() *StoreRewardsDao { + return &StoreRewardsDao{ + group: "default", + table: "store_rewards", + columns: storeRewardsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreRewardsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreRewardsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreRewardsDao) Columns() StoreRewardsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreRewardsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *StoreRewardsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *StoreRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/store_task_rewards.go b/internal/dao/internal/store_task_rewards.go new file mode 100644 index 0000000..6baa6c1 --- /dev/null +++ b/internal/dao/internal/store_task_rewards.go @@ -0,0 +1,87 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// StoreTaskRewardsDao is the data access object for the table store_task_rewards. +type StoreTaskRewardsDao 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. + columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage. +} + +// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards. +type StoreTaskRewardsColumns struct { + Id string // 门店奖励记录ID + StoreId string // 门店ID + TaskId string // 任务ID + StoreRewardId string // 门店奖励ID + IsEnabled string // 是否启用 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// storeTaskRewardsColumns holds the columns for the table store_task_rewards. +var storeTaskRewardsColumns = StoreTaskRewardsColumns{ + Id: "id", + StoreId: "store_id", + TaskId: "task_id", + StoreRewardId: "store_reward_id", + IsEnabled: "is_enabled", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access. +func NewStoreTaskRewardsDao() *StoreTaskRewardsDao { + return &StoreTaskRewardsDao{ + group: "default", + table: "store_task_rewards", + columns: storeTaskRewardsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreTaskRewardsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreTaskRewardsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreTaskRewardsDao) Columns() StoreTaskRewardsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreTaskRewardsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *StoreTaskRewardsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *StoreTaskRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/stores.go b/internal/dao/internal/stores.go new file mode 100644 index 0000000..0f1f706 --- /dev/null +++ b/internal/dao/internal/stores.go @@ -0,0 +1,95 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// StoresDao is the data access object for the table stores. +type StoresDao 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. + columns StoresColumns // columns contains all the column names of Table for convenient usage. +} + +// StoresColumns defines and stores column names for the table stores. +type StoresColumns struct { + Id string // 门店ID + MerchantId string // 所属商户ID + Name string // 门店名称 + StoreCode string // 门店编号 + Address string // 门店地址 + ContactName string // 联系人姓名 + ContactPhone string // 联系人电话 + BusinessHours string // 营业时间 + Status string // 状态:1=正常营业,2=暂停营业,3=已关闭 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// storesColumns holds the columns for the table stores. +var storesColumns = StoresColumns{ + Id: "id", + MerchantId: "merchant_id", + Name: "name", + StoreCode: "store_code", + Address: "address", + ContactName: "contact_name", + ContactPhone: "contact_phone", + BusinessHours: "business_hours", + Status: "status", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoresDao creates and returns a new DAO object for table data access. +func NewStoresDao() *StoresDao { + return &StoresDao{ + group: "default", + table: "stores", + columns: storesColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoresDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoresDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoresDao) Columns() StoresColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoresDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *StoresDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *StoresDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/system_operation_logs.go b/internal/dao/internal/system_operation_logs.go new file mode 100644 index 0000000..2ab3be3 --- /dev/null +++ b/internal/dao/internal/system_operation_logs.go @@ -0,0 +1,111 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// SystemOperationLogsDao is the data access object for the table system_operation_logs. +type SystemOperationLogsDao 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. + columns SystemOperationLogsColumns // columns contains all the column names of Table for convenient usage. +} + +// SystemOperationLogsColumns defines and stores column names for the table system_operation_logs. +type SystemOperationLogsColumns struct { + Id string // 日志ID + OperatorType string // 操作者类型:1=系统管理员,2=商户管理员,3=门店管理员,4=普通用户 + OperatorId string // 操作者ID + MerchantId string // 所属商户ID + StoreId string // 所属门店ID + Module string // 操作模块 + Action string // 操作类型 + TargetType string // 操作对象类型 + TargetId string // 操作对象ID + Content string // 操作内容描述 + RequestMethod string // 请求方法 + RequestUrl string // 请求URL + RequestParams string // 请求参数 + ResponseCode string // 响应状态码 + ResponseMessage string // 响应信息 + IpAddress string // 操作IP地址 + UserAgent string // 用户代理信息 + CreatedAt string // 操作时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// systemOperationLogsColumns holds the columns for the table system_operation_logs. +var systemOperationLogsColumns = SystemOperationLogsColumns{ + Id: "id", + OperatorType: "operator_type", + OperatorId: "operator_id", + MerchantId: "merchant_id", + StoreId: "store_id", + Module: "module", + Action: "action", + TargetType: "target_type", + TargetId: "target_id", + Content: "content", + RequestMethod: "request_method", + RequestUrl: "request_url", + RequestParams: "request_params", + ResponseCode: "response_code", + ResponseMessage: "response_message", + IpAddress: "ip_address", + UserAgent: "user_agent", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewSystemOperationLogsDao creates and returns a new DAO object for table data access. +func NewSystemOperationLogsDao() *SystemOperationLogsDao { + return &SystemOperationLogsDao{ + group: "default", + table: "system_operation_logs", + columns: systemOperationLogsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *SystemOperationLogsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *SystemOperationLogsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *SystemOperationLogsDao) Columns() SystemOperationLogsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *SystemOperationLogsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *SystemOperationLogsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *SystemOperationLogsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/tasks.go b/internal/dao/internal/tasks.go new file mode 100644 index 0000000..298c5f8 --- /dev/null +++ b/internal/dao/internal/tasks.go @@ -0,0 +1,81 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// TasksDao is the data access object for the table tasks. +type TasksDao 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. + columns TasksColumns // columns contains all the column names of Table for convenient usage. +} + +// TasksColumns defines and stores column names for the table tasks. +type TasksColumns struct { + Id string // 任务ID + QqTaskId string // QQ网吧任务ID + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// tasksColumns holds the columns for the table tasks. +var tasksColumns = TasksColumns{ + Id: "id", + QqTaskId: "qq_task_id", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewTasksDao creates and returns a new DAO object for table data access. +func NewTasksDao() *TasksDao { + return &TasksDao{ + group: "default", + table: "tasks", + columns: tasksColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *TasksDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *TasksDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *TasksDao) Columns() TasksColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *TasksDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *TasksDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *TasksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/user_login_records.go b/internal/dao/internal/user_login_records.go new file mode 100644 index 0000000..37d4703 --- /dev/null +++ b/internal/dao/internal/user_login_records.go @@ -0,0 +1,97 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// UserLoginRecordsDao is the data access object for the table user_login_records. +type UserLoginRecordsDao 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. + columns UserLoginRecordsColumns // columns contains all the column names of Table for convenient usage. +} + +// UserLoginRecordsColumns defines and stores column names for the table user_login_records. +type UserLoginRecordsColumns struct { + Id string // 记录ID + UserId string // 用户ID + StoreId string // 登录门店ID + MerchantId string // 所属商户ID + LoginIp string // 登录IP地址 + LoginDevice string // 登录设备信息 + LoginPlatform string // 登录平台:1=Web,2=iOS,3=Android,4=微信小程序,5=支付宝小程序,6=其他 + LoginType string // 登录方式:1=微信,2=手机号,3=账号密码,4=其他 + LoginStatus string // 登录状态:1=成功,2=失败 + FailReason string // 失败原因 + CreatedAt string // 登录时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// userLoginRecordsColumns holds the columns for the table user_login_records. +var userLoginRecordsColumns = UserLoginRecordsColumns{ + Id: "id", + UserId: "user_id", + StoreId: "store_id", + MerchantId: "merchant_id", + LoginIp: "login_ip", + LoginDevice: "login_device", + LoginPlatform: "login_platform", + LoginType: "login_type", + LoginStatus: "login_status", + FailReason: "fail_reason", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewUserLoginRecordsDao creates and returns a new DAO object for table data access. +func NewUserLoginRecordsDao() *UserLoginRecordsDao { + return &UserLoginRecordsDao{ + group: "default", + table: "user_login_records", + columns: userLoginRecordsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *UserLoginRecordsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *UserLoginRecordsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *UserLoginRecordsDao) Columns() UserLoginRecordsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *UserLoginRecordsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *UserLoginRecordsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *UserLoginRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/user_task_records.go b/internal/dao/internal/user_task_records.go new file mode 100644 index 0000000..56fd6fd --- /dev/null +++ b/internal/dao/internal/user_task_records.go @@ -0,0 +1,91 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// UserTaskRecordsDao is the data access object for the table user_task_records. +type UserTaskRecordsDao 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. + columns UserTaskRecordsColumns // columns contains all the column names of Table for convenient usage. +} + +// UserTaskRecordsColumns defines and stores column names for the table user_task_records. +type UserTaskRecordsColumns struct { + Id string // 任务记录ID + UserId string // 用户ID + TaskId string // 任务ID + Status string // 任务状态:0=未开始,1=进行中,2=已完成,3=已领取奖励 + Progress string // 任务进度 + FinishedAt string // 完成时间 + RewardReceivedAt string // 领取奖励时间 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间 +} + +// userTaskRecordsColumns holds the columns for the table user_task_records. +var userTaskRecordsColumns = UserTaskRecordsColumns{ + Id: "id", + UserId: "user_id", + TaskId: "task_id", + Status: "status", + Progress: "progress", + FinishedAt: "finished_at", + RewardReceivedAt: "reward_received_at", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewUserTaskRecordsDao creates and returns a new DAO object for table data access. +func NewUserTaskRecordsDao() *UserTaskRecordsDao { + return &UserTaskRecordsDao{ + group: "default", + table: "user_task_records", + columns: userTaskRecordsColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *UserTaskRecordsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *UserTaskRecordsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *UserTaskRecordsDao) Columns() UserTaskRecordsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *UserTaskRecordsDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *UserTaskRecordsDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *UserTaskRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/users.go b/internal/dao/internal/users.go new file mode 100644 index 0000000..0c18daa --- /dev/null +++ b/internal/dao/internal/users.go @@ -0,0 +1,101 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// UsersDao is the data access object for the table users. +type UsersDao 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. + columns UsersColumns // columns contains all the column names of Table for convenient usage. +} + +// UsersColumns defines and stores column names for the table users. +type UsersColumns struct { + Id string // 用户唯一标识符 + WxOpenId string // 微信 OpenID + Username string // 用户名 + Nickname string // 昵称 + Avatar string // 用户头像URL + PasswordHash string // 密码哈希 + Email string // 邮箱地址 + PhoneNumber string // 手机号 + WxPopenId string // 微信 PopenID + QqPopenId string // QQ PopenID + FirstVisitAt string // 首次访问时间 + LastLoginAt string // 最后登录时间 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间 +} + +// usersColumns holds the columns for the table users. +var usersColumns = UsersColumns{ + Id: "id", + WxOpenId: "wx_open_id", + Username: "username", + Nickname: "nickname", + Avatar: "avatar", + PasswordHash: "password_hash", + Email: "email", + PhoneNumber: "phone_number", + WxPopenId: "wx_popen_id", + QqPopenId: "qq_popen_id", + FirstVisitAt: "first_visit_at", + LastLoginAt: "last_login_at", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewUsersDao creates and returns a new DAO object for table data access. +func NewUsersDao() *UsersDao { + return &UsersDao{ + group: "default", + table: "users", + columns: usersColumns, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *UsersDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *UsersDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *UsersDao) Columns() UsersColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *UsersDao) Group() string { + return dao.group +} + +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. +func (dao *UsersDao) 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 commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *UsersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/merchant_admins.go b/internal/dao/merchant_admins.go new file mode 100644 index 0000000..433fc82 --- /dev/null +++ b/internal/dao/merchant_admins.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalMerchantAdminsDao is an internal type for wrapping the internal DAO implementation. +type internalMerchantAdminsDao = *internal.MerchantAdminsDao + +// merchantAdminsDao is the data access object for the table merchant_admins. +// You can define custom methods on it to extend its functionality as needed. +type merchantAdminsDao struct { + internalMerchantAdminsDao +} + +var ( + // MerchantAdmins is a globally accessible object for table merchant_admins operations. + MerchantAdmins = merchantAdminsDao{ + internal.NewMerchantAdminsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/merchants.go b/internal/dao/merchants.go new file mode 100644 index 0000000..dcd29c2 --- /dev/null +++ b/internal/dao/merchants.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalMerchantsDao is an internal type for wrapping the internal DAO implementation. +type internalMerchantsDao = *internal.MerchantsDao + +// merchantsDao is the data access object for the table merchants. +// You can define custom methods on it to extend its functionality as needed. +type merchantsDao struct { + internalMerchantsDao +} + +var ( + // Merchants is a globally accessible object for table merchants operations. + Merchants = merchantsDao{ + internal.NewMerchantsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/notices.go b/internal/dao/notices.go new file mode 100644 index 0000000..872ffbb --- /dev/null +++ b/internal/dao/notices.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalNoticesDao is an internal type for wrapping the internal DAO implementation. +type internalNoticesDao = *internal.NoticesDao + +// noticesDao is the data access object for the table notices. +// You can define custom methods on it to extend its functionality as needed. +type noticesDao struct { + internalNoticesDao +} + +var ( + // Notices is a globally accessible object for table notices operations. + Notices = noticesDao{ + internal.NewNoticesDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/reward_distributions.go b/internal/dao/reward_distributions.go new file mode 100644 index 0000000..b82d143 --- /dev/null +++ b/internal/dao/reward_distributions.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalRewardDistributionsDao is an internal type for wrapping the internal DAO implementation. +type internalRewardDistributionsDao = *internal.RewardDistributionsDao + +// rewardDistributionsDao is the data access object for the table reward_distributions. +// You can define custom methods on it to extend its functionality as needed. +type rewardDistributionsDao struct { + internalRewardDistributionsDao +} + +var ( + // RewardDistributions is a globally accessible object for table reward_distributions operations. + RewardDistributions = rewardDistributionsDao{ + internal.NewRewardDistributionsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/store_admins.go b/internal/dao/store_admins.go new file mode 100644 index 0000000..ddfcc8a --- /dev/null +++ b/internal/dao/store_admins.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalStoreAdminsDao is an internal type for wrapping the internal DAO implementation. +type internalStoreAdminsDao = *internal.StoreAdminsDao + +// storeAdminsDao is the data access object for the table store_admins. +// You can define custom methods on it to extend its functionality as needed. +type storeAdminsDao struct { + internalStoreAdminsDao +} + +var ( + // StoreAdmins is a globally accessible object for table store_admins operations. + StoreAdmins = storeAdminsDao{ + internal.NewStoreAdminsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/store_rewards.go b/internal/dao/store_rewards.go new file mode 100644 index 0000000..d925850 --- /dev/null +++ b/internal/dao/store_rewards.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalStoreRewardsDao is an internal type for wrapping the internal DAO implementation. +type internalStoreRewardsDao = *internal.StoreRewardsDao + +// storeRewardsDao is the data access object for the table store_rewards. +// You can define custom methods on it to extend its functionality as needed. +type storeRewardsDao struct { + internalStoreRewardsDao +} + +var ( + // StoreRewards is a globally accessible object for table store_rewards operations. + StoreRewards = storeRewardsDao{ + internal.NewStoreRewardsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/store_task_rewards.go b/internal/dao/store_task_rewards.go new file mode 100644 index 0000000..d3c923e --- /dev/null +++ b/internal/dao/store_task_rewards.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalStoreTaskRewardsDao is an internal type for wrapping the internal DAO implementation. +type internalStoreTaskRewardsDao = *internal.StoreTaskRewardsDao + +// storeTaskRewardsDao is the data access object for the table store_task_rewards. +// You can define custom methods on it to extend its functionality as needed. +type storeTaskRewardsDao struct { + internalStoreTaskRewardsDao +} + +var ( + // StoreTaskRewards is a globally accessible object for table store_task_rewards operations. + StoreTaskRewards = storeTaskRewardsDao{ + internal.NewStoreTaskRewardsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/stores.go b/internal/dao/stores.go new file mode 100644 index 0000000..2f7acde --- /dev/null +++ b/internal/dao/stores.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalStoresDao is an internal type for wrapping the internal DAO implementation. +type internalStoresDao = *internal.StoresDao + +// storesDao is the data access object for the table stores. +// You can define custom methods on it to extend its functionality as needed. +type storesDao struct { + internalStoresDao +} + +var ( + // Stores is a globally accessible object for table stores operations. + Stores = storesDao{ + internal.NewStoresDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/system_operation_logs.go b/internal/dao/system_operation_logs.go new file mode 100644 index 0000000..e51b65c --- /dev/null +++ b/internal/dao/system_operation_logs.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalSystemOperationLogsDao is an internal type for wrapping the internal DAO implementation. +type internalSystemOperationLogsDao = *internal.SystemOperationLogsDao + +// systemOperationLogsDao is the data access object for the table system_operation_logs. +// You can define custom methods on it to extend its functionality as needed. +type systemOperationLogsDao struct { + internalSystemOperationLogsDao +} + +var ( + // SystemOperationLogs is a globally accessible object for table system_operation_logs operations. + SystemOperationLogs = systemOperationLogsDao{ + internal.NewSystemOperationLogsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/tasks.go b/internal/dao/tasks.go new file mode 100644 index 0000000..e3e2e27 --- /dev/null +++ b/internal/dao/tasks.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalTasksDao is an internal type for wrapping the internal DAO implementation. +type internalTasksDao = *internal.TasksDao + +// tasksDao is the data access object for the table tasks. +// You can define custom methods on it to extend its functionality as needed. +type tasksDao struct { + internalTasksDao +} + +var ( + // Tasks is a globally accessible object for table tasks operations. + Tasks = tasksDao{ + internal.NewTasksDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/user_login_records.go b/internal/dao/user_login_records.go new file mode 100644 index 0000000..a3c1c3e --- /dev/null +++ b/internal/dao/user_login_records.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalUserLoginRecordsDao is an internal type for wrapping the internal DAO implementation. +type internalUserLoginRecordsDao = *internal.UserLoginRecordsDao + +// userLoginRecordsDao is the data access object for the table user_login_records. +// You can define custom methods on it to extend its functionality as needed. +type userLoginRecordsDao struct { + internalUserLoginRecordsDao +} + +var ( + // UserLoginRecords is a globally accessible object for table user_login_records operations. + UserLoginRecords = userLoginRecordsDao{ + internal.NewUserLoginRecordsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/user_task_records.go b/internal/dao/user_task_records.go new file mode 100644 index 0000000..e4c294d --- /dev/null +++ b/internal/dao/user_task_records.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalUserTaskRecordsDao is an internal type for wrapping the internal DAO implementation. +type internalUserTaskRecordsDao = *internal.UserTaskRecordsDao + +// userTaskRecordsDao is the data access object for the table user_task_records. +// You can define custom methods on it to extend its functionality as needed. +type userTaskRecordsDao struct { + internalUserTaskRecordsDao +} + +var ( + // UserTaskRecords is a globally accessible object for table user_task_records operations. + UserTaskRecords = userTaskRecordsDao{ + internal.NewUserTaskRecordsDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/users.go b/internal/dao/users.go new file mode 100644 index 0000000..a7a7d3e --- /dev/null +++ b/internal/dao/users.go @@ -0,0 +1,27 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// internalUsersDao is an internal type for wrapping the internal DAO implementation. +type internalUsersDao = *internal.UsersDao + +// usersDao is the data access object for the table users. +// You can define custom methods on it to extend its functionality as needed. +type usersDao struct { + internalUsersDao +} + +var ( + // Users is a globally accessible object for table users operations. + Users = usersDao{ + internal.NewUsersDao(), + } +) + +// Add your custom methods and functionality below. diff --git a/internal/logic/logic.go b/internal/logic/logic.go new file mode 100644 index 0000000..cdd1ee2 --- /dev/null +++ b/internal/logic/logic.go @@ -0,0 +1,12 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package logic + +import ( + _ "server/internal/logic/admin" + _ "server/internal/logic/merchantAdmin" + _ "server/internal/logic/storeAdmin" + _ "server/internal/logic/user" +) diff --git a/internal/model/do/admins.go b/internal/model/do/admins.go new file mode 100644 index 0000000..611c3f9 --- /dev/null +++ b/internal/model/do/admins.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Admins is the golang structure of table admins for DAO operations like Where/Data. +type Admins struct { + g.Meta `orm:"table:admins, do:true"` + Id interface{} // 管理员ID + Username interface{} // 管理员用户名 + PasswordHash interface{} // 密码哈希 + RealName interface{} // 真实姓名 + Phone interface{} // 手机号 + Email interface{} // 邮箱 + Role interface{} // 角色:1=超级管理员,2=运营管理员,3=客服管理员,4=财务管理员 + Status interface{} // 状态:1=正常,2=禁用 + LastLoginAt *gtime.Time // 最后登录时间 + LastLoginIp interface{} // 最后登录IP + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/competition_awards.go b/internal/model/do/competition_awards.go new file mode 100644 index 0000000..b9aa6c7 --- /dev/null +++ b/internal/model/do/competition_awards.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// CompetitionAwards is the golang structure of table competition_awards for DAO operations like Where/Data. +type CompetitionAwards struct { + g.Meta `orm:"table:competition_awards, do:true"` + Id interface{} // 赛事获奖ID + CompetitionId interface{} // 赛事ID + UserId interface{} // 获奖用户ID + AwardRank interface{} // 获奖名次(1:冠军,2:亚军,3:季军,依次类推) + RewardType interface{} // 奖励类型:1=平台奖励,2=门店奖励 + RewardId interface{} // 对应奖励ID + Amount interface{} // 奖励数量 + IssuedAt *gtime.Time // 奖励发放时间 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间 +} diff --git a/internal/model/do/competition_participants.go b/internal/model/do/competition_participants.go new file mode 100644 index 0000000..3c8c791 --- /dev/null +++ b/internal/model/do/competition_participants.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// CompetitionParticipants is the golang structure of table competition_participants for DAO operations like Where/Data. +type CompetitionParticipants struct { + g.Meta `orm:"table:competition_participants, do:true"` + Id interface{} // 参赛记录ID + CompetitionId interface{} // 赛事ID + UserId interface{} // 参赛用户ID + RegistrationTime *gtime.Time // 报名时间 + Status interface{} // 参赛状态:1=已报名,2=已取消,3=已禁赛 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间 +} diff --git a/internal/model/do/competitions.go b/internal/model/do/competitions.go new file mode 100644 index 0000000..9a68aa0 --- /dev/null +++ b/internal/model/do/competitions.go @@ -0,0 +1,29 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Competitions is the golang structure of table competitions for DAO operations like Where/Data. +type Competitions struct { + g.Meta `orm:"table:competitions, do:true"` + Id interface{} // 赛事唯一标识符 + Name interface{} // 赛事名称 + Description interface{} // 赛事描述 + GameMode interface{} // 游戏模式 + Conditions interface{} // 赛事条件 + Rules interface{} // 赛事规则说明 + StartTime *gtime.Time // 赛事开始时间 + EndTime *gtime.Time // 赛事结束时间 + IsActive interface{} // 赛事是否启用 + MerchantId interface{} // 所属商户ID + StoreId interface{} // 所属门店ID + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/feedbacks.go b/internal/model/do/feedbacks.go new file mode 100644 index 0000000..ada2cd5 --- /dev/null +++ b/internal/model/do/feedbacks.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Feedbacks is the golang structure of table feedbacks for DAO operations like Where/Data. +type Feedbacks struct { + g.Meta `orm:"table:feedbacks, do:true"` + Id interface{} // 反馈唯一标识符 + UserId interface{} // 提交者用户ID + Title interface{} // 反馈标题 + Content interface{} // 反馈内容 + FeedbackType interface{} // 反馈类型:1=BUG,2=建议,3=投诉,4=其他 + Status interface{} // 处理状态:0=待处理,1=处理中,2=已处理,3=已驳回 + Reply interface{} // 管理员回复内容 + CreatedAt *gtime.Time // 反馈提交时间 + UpdatedAt *gtime.Time // 反馈更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/merchant_admins.go b/internal/model/do/merchant_admins.go new file mode 100644 index 0000000..9c14284 --- /dev/null +++ b/internal/model/do/merchant_admins.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// MerchantAdmins is the golang structure of table merchant_admins for DAO operations like Where/Data. +type MerchantAdmins struct { + g.Meta `orm:"table:merchant_admins, do:true"` + Id interface{} // 商户管理员ID + MerchantId interface{} // 所属商户ID + Username interface{} // 用户名 + PasswordHash interface{} // 密码哈希 + RealName interface{} // 真实姓名 + Phone interface{} // 手机号 + Email interface{} // 邮箱 + Role interface{} // 角色:1=超级管理员,2=普通管理员 + Status interface{} // 状态:1=正常,2=禁用 + LastLoginAt *gtime.Time // 最后登录时间 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/merchants.go b/internal/model/do/merchants.go new file mode 100644 index 0000000..e4904ba --- /dev/null +++ b/internal/model/do/merchants.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Merchants is the golang structure of table merchants for DAO operations like Where/Data. +type Merchants struct { + g.Meta `orm:"table:merchants, do:true"` + Id interface{} // 商户ID + Name interface{} // 商户名称 + BusinessLicense interface{} // 营业执照号 + LegalPerson interface{} // 法人姓名 + ContactName interface{} // 联系人姓名 + ContactPhone interface{} // 联系人电话 + ContactEmail interface{} // 联系人邮箱 + Address interface{} // 商户地址 + Status interface{} // 状态:1=正常,2=禁用,3=待审核 + ExpireAt *gtime.Time // 服务到期时间 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/notices.go b/internal/model/do/notices.go new file mode 100644 index 0000000..aa212ea --- /dev/null +++ b/internal/model/do/notices.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Notices is the golang structure of table notices for DAO operations like Where/Data. +type Notices struct { + g.Meta `orm:"table:notices, do:true"` + Id interface{} // 通知ID + Title interface{} // 通知标题 + Content interface{} // 通知内容 + Type interface{} // 通知类型:1=系统公告,2=活动通知,3=维护通知 + Status interface{} // 状态:0=关闭,1=发布 + VisibleTo interface{} // 可见范围:1=所有人,2=仅门店,3=仅用户 + MerchantId interface{} // 所属商户ID + StoreId interface{} // 所属门店ID + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/reward_distributions.go b/internal/model/do/reward_distributions.go new file mode 100644 index 0000000..797c9ae --- /dev/null +++ b/internal/model/do/reward_distributions.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// RewardDistributions is the golang structure of table reward_distributions for DAO operations like Where/Data. +type RewardDistributions struct { + g.Meta `orm:"table:reward_distributions, do:true"` + Id interface{} // 奖励下发记录ID + UserId interface{} // 接收奖励的用户ID + TaskId interface{} // 触发该奖励的任务ID + RewardId interface{} // 奖励ID + RewardSource interface{} // 奖励来源:1=平台,2=门店 + Amount interface{} // 奖励数量 + StoreId interface{} // 所属门店ID + Status interface{} // 发放状态:0=待发放,1=已发放,2=失败 + IssuedAt *gtime.Time // 实际发放时间 + Remark interface{} // 备注信息 + CreatedAt *gtime.Time // 记录创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/store_admins.go b/internal/model/do/store_admins.go new file mode 100644 index 0000000..2468d58 --- /dev/null +++ b/internal/model/do/store_admins.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreAdmins is the golang structure of table store_admins for DAO operations like Where/Data. +type StoreAdmins struct { + g.Meta `orm:"table:store_admins, do:true"` + Id interface{} // 门店管理员ID + StoreId interface{} // 所属门店ID + Username interface{} // 用户名 + PasswordHash interface{} // 密码哈希 + RealName interface{} // 真实姓名 + Phone interface{} // 手机号 + Email interface{} // 邮箱 + Role interface{} // 角色:1=店长,2=收银员,3=网管 + Status interface{} // 状态:1=正常,2=禁用 + LastLoginAt *gtime.Time // 最后登录时间 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/store_rewards.go b/internal/model/do/store_rewards.go new file mode 100644 index 0000000..5ac440a --- /dev/null +++ b/internal/model/do/store_rewards.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreRewards is the golang structure of table store_rewards for DAO operations like Where/Data. +type StoreRewards struct { + g.Meta `orm:"table:store_rewards, do:true"` + Id interface{} // 门店奖励ID + StoreId interface{} // 所属门店ID + RewardType interface{} // 奖励类型:1=积分,2=优惠券,3=商品,4=抽奖券 + RewardName interface{} // 奖励名称 + Amount interface{} // 奖励数量 + Total interface{} // 该奖励总库存(NULL 表示无限) + MerchantId interface{} // 所属商户ID + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/store_task_rewards.go b/internal/model/do/store_task_rewards.go new file mode 100644 index 0000000..da7de1b --- /dev/null +++ b/internal/model/do/store_task_rewards.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreTaskRewards is the golang structure of table store_task_rewards for DAO operations like Where/Data. +type StoreTaskRewards struct { + g.Meta `orm:"table:store_task_rewards, do:true"` + Id interface{} // 门店奖励记录ID + StoreId interface{} // 门店ID + TaskId interface{} // 任务ID + StoreRewardId interface{} // 门店奖励ID + IsEnabled interface{} // 是否启用 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/stores.go b/internal/model/do/stores.go new file mode 100644 index 0000000..ee62e32 --- /dev/null +++ b/internal/model/do/stores.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Stores is the golang structure of table stores for DAO operations like Where/Data. +type Stores struct { + g.Meta `orm:"table:stores, do:true"` + Id interface{} // 门店ID + MerchantId interface{} // 所属商户ID + Name interface{} // 门店名称 + StoreCode interface{} // 门店编号 + Address interface{} // 门店地址 + ContactName interface{} // 联系人姓名 + ContactPhone interface{} // 联系人电话 + BusinessHours interface{} // 营业时间 + Status interface{} // 状态:1=正常营业,2=暂停营业,3=已关闭 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/system_operation_logs.go b/internal/model/do/system_operation_logs.go new file mode 100644 index 0000000..fda3480 --- /dev/null +++ b/internal/model/do/system_operation_logs.go @@ -0,0 +1,35 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// SystemOperationLogs is the golang structure of table system_operation_logs for DAO operations like Where/Data. +type SystemOperationLogs struct { + g.Meta `orm:"table:system_operation_logs, do:true"` + Id interface{} // 日志ID + OperatorType interface{} // 操作者类型:1=系统管理员,2=商户管理员,3=门店管理员,4=普通用户 + OperatorId interface{} // 操作者ID + MerchantId interface{} // 所属商户ID + StoreId interface{} // 所属门店ID + Module interface{} // 操作模块 + Action interface{} // 操作类型 + TargetType interface{} // 操作对象类型 + TargetId interface{} // 操作对象ID + Content interface{} // 操作内容描述 + RequestMethod interface{} // 请求方法 + RequestUrl interface{} // 请求URL + RequestParams interface{} // 请求参数 + ResponseCode interface{} // 响应状态码 + ResponseMessage interface{} // 响应信息 + IpAddress interface{} // 操作IP地址 + UserAgent interface{} // 用户代理信息 + CreatedAt *gtime.Time // 操作时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/tasks.go b/internal/model/do/tasks.go new file mode 100644 index 0000000..d3e3331 --- /dev/null +++ b/internal/model/do/tasks.go @@ -0,0 +1,20 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Tasks is the golang structure of table tasks for DAO operations like Where/Data. +type Tasks struct { + g.Meta `orm:"table:tasks, do:true"` + Id interface{} // 任务ID + QqTaskId interface{} // QQ网吧任务ID + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/user_login_records.go b/internal/model/do/user_login_records.go new file mode 100644 index 0000000..42cae49 --- /dev/null +++ b/internal/model/do/user_login_records.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// UserLoginRecords is the golang structure of table user_login_records for DAO operations like Where/Data. +type UserLoginRecords struct { + g.Meta `orm:"table:user_login_records, do:true"` + Id interface{} // 记录ID + UserId interface{} // 用户ID + StoreId interface{} // 登录门店ID + MerchantId interface{} // 所属商户ID + LoginIp interface{} // 登录IP地址 + LoginDevice interface{} // 登录设备信息 + LoginPlatform interface{} // 登录平台:1=Web,2=iOS,3=Android,4=微信小程序,5=支付宝小程序,6=其他 + LoginType interface{} // 登录方式:1=微信,2=手机号,3=账号密码,4=其他 + LoginStatus interface{} // 登录状态:1=成功,2=失败 + FailReason interface{} // 失败原因 + CreatedAt *gtime.Time // 登录时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/user_task_records.go b/internal/model/do/user_task_records.go new file mode 100644 index 0000000..68df4b4 --- /dev/null +++ b/internal/model/do/user_task_records.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// UserTaskRecords is the golang structure of table user_task_records for DAO operations like Where/Data. +type UserTaskRecords struct { + g.Meta `orm:"table:user_task_records, do:true"` + Id interface{} // 任务记录ID + UserId interface{} // 用户ID + TaskId interface{} // 任务ID + Status interface{} // 任务状态:0=未开始,1=进行中,2=已完成,3=已领取奖励 + Progress interface{} // 任务进度 + FinishedAt *gtime.Time // 完成时间 + RewardReceivedAt *gtime.Time // 领取奖励时间 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间 +} diff --git a/internal/model/do/users.go b/internal/model/do/users.go new file mode 100644 index 0000000..10c510b --- /dev/null +++ b/internal/model/do/users.go @@ -0,0 +1,30 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// Users is the golang structure of table users for DAO operations like Where/Data. +type Users struct { + g.Meta `orm:"table:users, do:true"` + Id interface{} // 用户唯一标识符 + WxOpenId interface{} // 微信 OpenID + Username interface{} // 用户名 + Nickname interface{} // 昵称 + Avatar interface{} // 用户头像URL + PasswordHash interface{} // 密码哈希 + Email interface{} // 邮箱地址 + PhoneNumber interface{} // 手机号 + WxPopenId interface{} // 微信 PopenID + QqPopenId interface{} // QQ PopenID + FirstVisitAt *gtime.Time // 首次访问时间 + LastLoginAt *gtime.Time // 最后登录时间 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间 +} diff --git a/internal/model/entity/admins.go b/internal/model/entity/admins.go new file mode 100644 index 0000000..9097126 --- /dev/null +++ b/internal/model/entity/admins.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Admins is the golang structure for table admins. +type Admins struct { + Id int64 `json:"id" orm:"id" description:"管理员ID"` // 管理员ID + Username string `json:"username" orm:"username" description:"管理员用户名"` // 管理员用户名 + PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希 + RealName string `json:"realName" orm:"real_name" description:"真实姓名"` // 真实姓名 + Phone string `json:"phone" orm:"phone" description:"手机号"` // 手机号 + Email string `json:"email" orm:"email" description:"邮箱"` // 邮箱 + Role int `json:"role" orm:"role" description:"角色:1=超级管理员,2=运营管理员,3=客服管理员,4=财务管理员"` // 角色:1=超级管理员,2=运营管理员,3=客服管理员,4=财务管理员 + Status int `json:"status" orm:"status" description:"状态:1=正常,2=禁用"` // 状态:1=正常,2=禁用 + LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at" description:"最后登录时间"` // 最后登录时间 + LastLoginIp string `json:"lastLoginIp" orm:"last_login_ip" description:"最后登录IP"` // 最后登录IP + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/competition_awards.go b/internal/model/entity/competition_awards.go new file mode 100644 index 0000000..2b4815a --- /dev/null +++ b/internal/model/entity/competition_awards.go @@ -0,0 +1,24 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// CompetitionAwards is the golang structure for table competition_awards. +type CompetitionAwards struct { + Id int64 `json:"id" orm:"id" description:"赛事获奖ID"` // 赛事获奖ID + CompetitionId int64 `json:"competitionId" orm:"competition_id" description:"赛事ID"` // 赛事ID + UserId int64 `json:"userId" orm:"user_id" description:"获奖用户ID"` // 获奖用户ID + AwardRank int `json:"awardRank" orm:"award_rank" description:"获奖名次(1:冠军,2:亚军,3:季军,依次类推)"` // 获奖名次(1:冠军,2:亚军,3:季军,依次类推) + RewardType int `json:"rewardType" orm:"reward_type" description:"奖励类型:1=平台奖励,2=门店奖励"` // 奖励类型:1=平台奖励,2=门店奖励 + RewardId int64 `json:"rewardId" orm:"reward_id" description:"对应奖励ID"` // 对应奖励ID + Amount int `json:"amount" orm:"amount" description:"奖励数量"` // 奖励数量 + IssuedAt *gtime.Time `json:"issuedAt" orm:"issued_at" description:"奖励发放时间"` // 奖励发放时间 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间 +} diff --git a/internal/model/entity/competition_participants.go b/internal/model/entity/competition_participants.go new file mode 100644 index 0000000..ad3033c --- /dev/null +++ b/internal/model/entity/competition_participants.go @@ -0,0 +1,21 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// CompetitionParticipants is the golang structure for table competition_participants. +type CompetitionParticipants struct { + Id int64 `json:"id" orm:"id" description:"参赛记录ID"` // 参赛记录ID + CompetitionId int64 `json:"competitionId" orm:"competition_id" description:"赛事ID"` // 赛事ID + UserId int64 `json:"userId" orm:"user_id" description:"参赛用户ID"` // 参赛用户ID + RegistrationTime *gtime.Time `json:"registrationTime" orm:"registration_time" description:"报名时间"` // 报名时间 + Status int `json:"status" orm:"status" description:"参赛状态:1=已报名,2=已取消,3=已禁赛"` // 参赛状态:1=已报名,2=已取消,3=已禁赛 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间 +} diff --git a/internal/model/entity/competitions.go b/internal/model/entity/competitions.go new file mode 100644 index 0000000..b86a6fe --- /dev/null +++ b/internal/model/entity/competitions.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Competitions is the golang structure for table competitions. +type Competitions struct { + Id int64 `json:"id" orm:"id" description:"赛事唯一标识符"` // 赛事唯一标识符 + Name string `json:"name" orm:"name" description:"赛事名称"` // 赛事名称 + Description string `json:"description" orm:"description" description:"赛事描述"` // 赛事描述 + GameMode string `json:"gameMode" orm:"game_mode" description:"游戏模式"` // 游戏模式 + Conditions string `json:"conditions" orm:"conditions" description:"赛事条件"` // 赛事条件 + Rules string `json:"rules" orm:"rules" description:"赛事规则说明"` // 赛事规则说明 + StartTime *gtime.Time `json:"startTime" orm:"start_time" description:"赛事开始时间"` // 赛事开始时间 + EndTime *gtime.Time `json:"endTime" orm:"end_time" description:"赛事结束时间"` // 赛事结束时间 + IsActive int `json:"isActive" orm:"is_active" description:"赛事是否启用"` // 赛事是否启用 + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/feedbacks.go b/internal/model/entity/feedbacks.go new file mode 100644 index 0000000..cab8cbe --- /dev/null +++ b/internal/model/entity/feedbacks.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Feedbacks is the golang structure for table feedbacks. +type Feedbacks struct { + Id int64 `json:"id" orm:"id" description:"反馈唯一标识符"` // 反馈唯一标识符 + UserId int64 `json:"userId" orm:"user_id" description:"提交者用户ID"` // 提交者用户ID + Title string `json:"title" orm:"title" description:"反馈标题"` // 反馈标题 + Content string `json:"content" orm:"content" description:"反馈内容"` // 反馈内容 + FeedbackType int `json:"feedbackType" orm:"feedback_type" description:"反馈类型:1=BUG,2=建议,3=投诉,4=其他"` // 反馈类型:1=BUG,2=建议,3=投诉,4=其他 + Status int `json:"status" orm:"status" description:"处理状态:0=待处理,1=处理中,2=已处理,3=已驳回"` // 处理状态:0=待处理,1=处理中,2=已处理,3=已驳回 + Reply string `json:"reply" orm:"reply" description:"管理员回复内容"` // 管理员回复内容 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"反馈提交时间"` // 反馈提交时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"反馈更新时间"` // 反馈更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/merchant_admins.go b/internal/model/entity/merchant_admins.go new file mode 100644 index 0000000..1107715 --- /dev/null +++ b/internal/model/entity/merchant_admins.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// MerchantAdmins is the golang structure for table merchant_admins. +type MerchantAdmins struct { + Id int64 `json:"id" orm:"id" description:"商户管理员ID"` // 商户管理员ID + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + Username string `json:"username" orm:"username" description:"用户名"` // 用户名 + PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希 + RealName string `json:"realName" orm:"real_name" description:"真实姓名"` // 真实姓名 + Phone string `json:"phone" orm:"phone" description:"手机号"` // 手机号 + Email string `json:"email" orm:"email" description:"邮箱"` // 邮箱 + Role int `json:"role" orm:"role" description:"角色:1=超级管理员,2=普通管理员"` // 角色:1=超级管理员,2=普通管理员 + Status int `json:"status" orm:"status" description:"状态:1=正常,2=禁用"` // 状态:1=正常,2=禁用 + LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at" description:"最后登录时间"` // 最后登录时间 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/merchants.go b/internal/model/entity/merchants.go new file mode 100644 index 0000000..4b6ac90 --- /dev/null +++ b/internal/model/entity/merchants.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Merchants is the golang structure for table merchants. +type Merchants struct { + Id int64 `json:"id" orm:"id" description:"商户ID"` // 商户ID + Name string `json:"name" orm:"name" description:"商户名称"` // 商户名称 + BusinessLicense string `json:"businessLicense" orm:"business_license" description:"营业执照号"` // 营业执照号 + LegalPerson string `json:"legalPerson" orm:"legal_person" description:"法人姓名"` // 法人姓名 + ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名 + ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话 + ContactEmail string `json:"contactEmail" orm:"contact_email" description:"联系人邮箱"` // 联系人邮箱 + Address string `json:"address" orm:"address" description:"商户地址"` // 商户地址 + Status int `json:"status" orm:"status" description:"状态:1=正常,2=禁用,3=待审核"` // 状态:1=正常,2=禁用,3=待审核 + ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at" description:"服务到期时间"` // 服务到期时间 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/notices.go b/internal/model/entity/notices.go new file mode 100644 index 0000000..b322ef0 --- /dev/null +++ b/internal/model/entity/notices.go @@ -0,0 +1,24 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Notices is the golang structure for table notices. +type Notices struct { + Id int64 `json:"id" orm:"id" description:"通知ID"` // 通知ID + Title string `json:"title" orm:"title" description:"通知标题"` // 通知标题 + Content string `json:"content" orm:"content" description:"通知内容"` // 通知内容 + Type int `json:"type" orm:"type" description:"通知类型:1=系统公告,2=活动通知,3=维护通知"` // 通知类型:1=系统公告,2=活动通知,3=维护通知 + Status int `json:"status" orm:"status" description:"状态:0=关闭,1=发布"` // 状态:0=关闭,1=发布 + VisibleTo int `json:"visibleTo" orm:"visible_to" description:"可见范围:1=所有人,2=仅门店,3=仅用户"` // 可见范围:1=所有人,2=仅门店,3=仅用户 + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/reward_distributions.go b/internal/model/entity/reward_distributions.go new file mode 100644 index 0000000..102db18 --- /dev/null +++ b/internal/model/entity/reward_distributions.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// RewardDistributions is the golang structure for table reward_distributions. +type RewardDistributions struct { + Id int64 `json:"id" orm:"id" description:"奖励下发记录ID"` // 奖励下发记录ID + UserId int64 `json:"userId" orm:"user_id" description:"接收奖励的用户ID"` // 接收奖励的用户ID + TaskId int64 `json:"taskId" orm:"task_id" description:"触发该奖励的任务ID"` // 触发该奖励的任务ID + RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID + RewardSource int `json:"rewardSource" orm:"reward_source" description:"奖励来源:1=平台,2=门店"` // 奖励来源:1=平台,2=门店 + Amount int `json:"amount" orm:"amount" description:"奖励数量"` // 奖励数量 + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + Status int `json:"status" orm:"status" description:"发放状态:0=待发放,1=已发放,2=失败"` // 发放状态:0=待发放,1=已发放,2=失败 + IssuedAt *gtime.Time `json:"issuedAt" orm:"issued_at" description:"实际发放时间"` // 实际发放时间 + Remark string `json:"remark" orm:"remark" description:"备注信息"` // 备注信息 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"记录创建时间"` // 记录创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/store_admins.go b/internal/model/entity/store_admins.go new file mode 100644 index 0000000..a9c55d1 --- /dev/null +++ b/internal/model/entity/store_admins.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreAdmins is the golang structure for table store_admins. +type StoreAdmins struct { + Id int64 `json:"id" orm:"id" description:"门店管理员ID"` // 门店管理员ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + Username string `json:"username" orm:"username" description:"用户名"` // 用户名 + PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希 + RealName string `json:"realName" orm:"real_name" description:"真实姓名"` // 真实姓名 + Phone string `json:"phone" orm:"phone" description:"手机号"` // 手机号 + Email string `json:"email" orm:"email" description:"邮箱"` // 邮箱 + Role int `json:"role" orm:"role" description:"角色:1=店长,2=收银员,3=网管"` // 角色:1=店长,2=收银员,3=网管 + Status int `json:"status" orm:"status" description:"状态:1=正常,2=禁用"` // 状态:1=正常,2=禁用 + LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at" description:"最后登录时间"` // 最后登录时间 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/store_rewards.go b/internal/model/entity/store_rewards.go new file mode 100644 index 0000000..4ebef8c --- /dev/null +++ b/internal/model/entity/store_rewards.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreRewards is the golang structure for table store_rewards. +type StoreRewards struct { + Id int64 `json:"id" orm:"id" description:"门店奖励ID"` // 门店奖励ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + RewardType int `json:"rewardType" orm:"reward_type" description:"奖励类型:1=积分,2=优惠券,3=商品,4=抽奖券"` // 奖励类型:1=积分,2=优惠券,3=商品,4=抽奖券 + RewardName string `json:"rewardName" orm:"reward_name" description:"奖励名称"` // 奖励名称 + Amount int `json:"amount" orm:"amount" description:"奖励数量"` // 奖励数量 + Total int `json:"total" orm:"total" description:"该奖励总库存(NULL 表示无限)"` // 该奖励总库存(NULL 表示无限) + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/store_task_rewards.go b/internal/model/entity/store_task_rewards.go new file mode 100644 index 0000000..7c6c429 --- /dev/null +++ b/internal/model/entity/store_task_rewards.go @@ -0,0 +1,21 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreTaskRewards is the golang structure for table store_task_rewards. +type StoreTaskRewards struct { + Id int64 `json:"id" orm:"id" description:"门店奖励记录ID"` // 门店奖励记录ID + StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID"` // 门店ID + TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID + StoreRewardId int64 `json:"storeRewardId" orm:"store_reward_id" description:"门店奖励ID"` // 门店奖励ID + IsEnabled int `json:"isEnabled" orm:"is_enabled" description:"是否启用"` // 是否启用 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/stores.go b/internal/model/entity/stores.go new file mode 100644 index 0000000..d368123 --- /dev/null +++ b/internal/model/entity/stores.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Stores is the golang structure for table stores. +type Stores struct { + Id int64 `json:"id" orm:"id" description:"门店ID"` // 门店ID + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + Name string `json:"name" orm:"name" description:"门店名称"` // 门店名称 + StoreCode string `json:"storeCode" orm:"store_code" description:"门店编号"` // 门店编号 + Address string `json:"address" orm:"address" description:"门店地址"` // 门店地址 + ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名 + ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话 + BusinessHours string `json:"businessHours" orm:"business_hours" description:"营业时间"` // 营业时间 + Status int `json:"status" orm:"status" description:"状态:1=正常营业,2=暂停营业,3=已关闭"` // 状态:1=正常营业,2=暂停营业,3=已关闭 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/system_operation_logs.go b/internal/model/entity/system_operation_logs.go new file mode 100644 index 0000000..c11c3ea --- /dev/null +++ b/internal/model/entity/system_operation_logs.go @@ -0,0 +1,33 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// SystemOperationLogs is the golang structure for table system_operation_logs. +type SystemOperationLogs struct { + Id int64 `json:"id" orm:"id" description:"日志ID"` // 日志ID + OperatorType int `json:"operatorType" orm:"operator_type" description:"操作者类型:1=系统管理员,2=商户管理员,3=门店管理员,4=普通用户"` // 操作者类型:1=系统管理员,2=商户管理员,3=门店管理员,4=普通用户 + OperatorId int64 `json:"operatorId" orm:"operator_id" description:"操作者ID"` // 操作者ID + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + Module string `json:"module" orm:"module" description:"操作模块"` // 操作模块 + Action string `json:"action" orm:"action" description:"操作类型"` // 操作类型 + TargetType string `json:"targetType" orm:"target_type" description:"操作对象类型"` // 操作对象类型 + TargetId int64 `json:"targetId" orm:"target_id" description:"操作对象ID"` // 操作对象ID + Content string `json:"content" orm:"content" description:"操作内容描述"` // 操作内容描述 + RequestMethod string `json:"requestMethod" orm:"request_method" description:"请求方法"` // 请求方法 + RequestUrl string `json:"requestUrl" orm:"request_url" description:"请求URL"` // 请求URL + RequestParams string `json:"requestParams" orm:"request_params" description:"请求参数"` // 请求参数 + ResponseCode int `json:"responseCode" orm:"response_code" description:"响应状态码"` // 响应状态码 + ResponseMessage string `json:"responseMessage" orm:"response_message" description:"响应信息"` // 响应信息 + IpAddress string `json:"ipAddress" orm:"ip_address" description:"操作IP地址"` // 操作IP地址 + UserAgent string `json:"userAgent" orm:"user_agent" description:"用户代理信息"` // 用户代理信息 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"操作时间"` // 操作时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/tasks.go b/internal/model/entity/tasks.go new file mode 100644 index 0000000..f5c20eb --- /dev/null +++ b/internal/model/entity/tasks.go @@ -0,0 +1,18 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Tasks is the golang structure for table tasks. +type Tasks struct { + Id int64 `json:"id" orm:"id" description:"任务ID"` // 任务ID + QqTaskId string `json:"qqTaskId" orm:"qq_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/user_login_records.go b/internal/model/entity/user_login_records.go new file mode 100644 index 0000000..4c619fa --- /dev/null +++ b/internal/model/entity/user_login_records.go @@ -0,0 +1,26 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// UserLoginRecords is the golang structure for table user_login_records. +type UserLoginRecords struct { + Id int64 `json:"id" orm:"id" description:"记录ID"` // 记录ID + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID + StoreId int64 `json:"storeId" orm:"store_id" description:"登录门店ID"` // 登录门店ID + MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID + LoginIp string `json:"loginIp" orm:"login_ip" description:"登录IP地址"` // 登录IP地址 + LoginDevice string `json:"loginDevice" orm:"login_device" description:"登录设备信息"` // 登录设备信息 + LoginPlatform int `json:"loginPlatform" orm:"login_platform" description:"登录平台:1=Web,2=iOS,3=Android,4=微信小程序,5=支付宝小程序,6=其他"` // 登录平台:1=Web,2=iOS,3=Android,4=微信小程序,5=支付宝小程序,6=其他 + LoginType int `json:"loginType" orm:"login_type" description:"登录方式:1=微信,2=手机号,3=账号密码,4=其他"` // 登录方式:1=微信,2=手机号,3=账号密码,4=其他 + LoginStatus int `json:"loginStatus" orm:"login_status" description:"登录状态:1=成功,2=失败"` // 登录状态:1=成功,2=失败 + FailReason string `json:"failReason" orm:"fail_reason" description:"失败原因"` // 失败原因 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"登录时间"` // 登录时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/user_task_records.go b/internal/model/entity/user_task_records.go new file mode 100644 index 0000000..c032804 --- /dev/null +++ b/internal/model/entity/user_task_records.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// UserTaskRecords is the golang structure for table user_task_records. +type UserTaskRecords struct { + Id int64 `json:"id" orm:"id" description:"任务记录ID"` // 任务记录ID + UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID + TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID + Status int `json:"status" orm:"status" description:"任务状态:0=未开始,1=进行中,2=已完成,3=已领取奖励"` // 任务状态:0=未开始,1=进行中,2=已完成,3=已领取奖励 + Progress int `json:"progress" orm:"progress" description:"任务进度"` // 任务进度 + FinishedAt *gtime.Time `json:"finishedAt" orm:"finished_at" description:"完成时间"` // 完成时间 + RewardReceivedAt *gtime.Time `json:"rewardReceivedAt" orm:"reward_received_at" description:"领取奖励时间"` // 领取奖励时间 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间 +} diff --git a/internal/model/entity/users.go b/internal/model/entity/users.go new file mode 100644 index 0000000..406a22f --- /dev/null +++ b/internal/model/entity/users.go @@ -0,0 +1,28 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// Users is the golang structure for table users. +type Users struct { + Id int64 `json:"id" orm:"id" description:"用户唯一标识符"` // 用户唯一标识符 + WxOpenId string `json:"wxOpenId" orm:"wx_open_id" description:"微信 OpenID"` // 微信 OpenID + Username string `json:"username" orm:"username" description:"用户名"` // 用户名 + Nickname string `json:"nickname" orm:"nickname" description:"昵称"` // 昵称 + Avatar string `json:"avatar" orm:"avatar" description:"用户头像URL"` // 用户头像URL + PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希 + Email string `json:"email" orm:"email" description:"邮箱地址"` // 邮箱地址 + PhoneNumber string `json:"phoneNumber" orm:"phone_number" description:"手机号"` // 手机号 + WxPopenId string `json:"wxPopenId" orm:"wx_popen_id" description:"微信 PopenID"` // 微信 PopenID + QqPopenId string `json:"qqPopenId" orm:"qq_popen_id" description:"QQ PopenID"` // QQ PopenID + FirstVisitAt *gtime.Time `json:"firstVisitAt" orm:"first_visit_at" description:"首次访问时间"` // 首次访问时间 + LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at" description:"最后登录时间"` // 最后登录时间 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间 +} diff --git a/internal/service/admin.go b/internal/service/admin.go new file mode 100644 index 0000000..f673d9d --- /dev/null +++ b/internal/service/admin.go @@ -0,0 +1,33 @@ +// ================================================================================ +// 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" + "server/internal/model" +) + +type ( + IAdmin interface { + Login(ctx context.Context, in *model.AdminLoginIn) (out *model.LoginOut, err error) + Info(ctx context.Context, in *model.AdminInfoIn) (out *model.AdminInfoOut, err error) + } +) + +var ( + localAdmin IAdmin +) + +func Admin() IAdmin { + if localAdmin == nil { + panic("implement not found for interface IAdmin, forgot register?") + } + return localAdmin +} + +func RegisterAdmin(i IAdmin) { + localAdmin = i +} diff --git a/internal/service/merchant_admin.go b/internal/service/merchant_admin.go new file mode 100644 index 0000000..3d70438 --- /dev/null +++ b/internal/service/merchant_admin.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 () diff --git a/internal/service/store_admin.go b/internal/service/store_admin.go new file mode 100644 index 0000000..3d70438 --- /dev/null +++ b/internal/service/store_admin.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 () diff --git a/internal/service/user.go b/internal/service/user.go new file mode 100644 index 0000000..3d70438 --- /dev/null +++ b/internal/service/user.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 () diff --git a/utility/wechat/wechat.go b/utility/wechat/wechat.go new file mode 100644 index 0000000..4c703e8 --- /dev/null +++ b/utility/wechat/wechat.go @@ -0,0 +1,165 @@ +package wechat + +import ( + "context" + "github.com/go-resty/resty/v2" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/glog" + "io" + "os" + "server/utility/ecode" + "sync" + "time" +) + +type weChatClient struct { + AppId string + AppSecret string + TicketExpire int + Token string + accessToken string + expiresIn int + lastUpdated time.Time + mu sync.RWMutex +} + +var ( + instance *weChatClient + once sync.Once +) + +func GetWeChatClient() *weChatClient { + return instance +} +func init() { + once.Do(func() { + ctx := context.Background() + instance = &weChatClient{ + AppId: g.Config().MustGet(ctx, "wechat.appId").String(), + AppSecret: g.Config().MustGet(ctx, "wechat.appSecret").String(), + TicketExpire: g.Config().MustGet(ctx, "wechat.ticketExpire").Int(), + } + + go instance.autoRefreshToken(ctx) + }) +} + +func (c *weChatClient) getAccessToken() error { + result := struct { + AccessToken string `json:"access_token"` + ExpiresIn int `json:"expires_in"` + }{} + ctx := context.Background() + resp, err := resty.New().R(). + SetQueryParams(g.MapStrStr{ + "grant_type": "client_credential", + "appid": c.AppId, + "secret": c.AppSecret, + }). + SetResult(&result). + Get("https://api.weixin.qq.com/cgi-bin/token") + + if err != nil { + glog.Errorf(ctx, "发起 get access_token 请求出现异常: %+v", err) + return ecode.Fail.Sub("发起 get access_token 请求出现异常") + } + if resp.StatusCode() != 200 { + glog.Errorf(ctx, "获取微信 access_token 响应异常: %+v", resp.Status()) + return ecode.Fail.Sub("获取微信 access_token 失败") + } + + c.mu.Lock() + defer c.mu.Unlock() + + c.accessToken = result.AccessToken + c.expiresIn = result.ExpiresIn + c.lastUpdated = time.Now() + glog.Infof(ctx, "获取微信 access_token 成功: %+v", c.accessToken) + return nil +} +func (c *weChatClient) autoRefreshToken(ctx context.Context) { + for { + // 初次获取 + if err := c.getAccessToken(); err != nil { + time.Sleep(1 * time.Minute) + continue + } + + // 等待 expiresIn - 300 秒(即提前 5 分钟刷新) + c.mu.RLock() + expiresIn := c.expiresIn + c.mu.RUnlock() + + refreshAfter := time.Duration(expiresIn-300) * time.Second + time.Sleep(refreshAfter) + } +} +func (c *weChatClient) GetTicket(sceneID string) (string, error) { + body := map[string]interface{}{ + "expire_seconds": c.TicketExpire, + "action_name": "QR_SCENE", + "action_info": map[string]interface{}{ + "scene": map[string]interface{}{ + "scene_str": sceneID, + }, + }, + } + result := struct { + Ticket string `json:"ticket"` + ExpireSeconds int `json:"expire_seconds"` + Url string `json:"url"` + }{} + + resp, err := resty.New().R(). + SetQueryParams(g.MapStrStr{"access_token": c.accessToken}). + SetBody(body). + SetResult(&result). + Post("https://api.weixin.qq.com/cgi-bin/qrcode/create") + + if err != nil { + glog.Errorf(context.Background(), "发起 get ticket 请求出现异常: %+v", err) + return "", ecode.Fail.Sub("发起 get ticket 请求出现异常") + } + if resp.StatusCode() != 200 { + glog.Errorf(context.Background(), "获取微信 ticket 响应异常: %+v", resp.Status()) + return "", ecode.Fail.Sub("获取微信 ticket 失败") + } + + glog.Infof(context.Background(), "获取微信 ticket 成功: %+v", result.Ticket) + return result.Ticket, nil +} + +func (c *weChatClient) GetQrCode(ticket string, filename string) (imagePath string, err error) { + qrCodeUrl := "https://mp.weixin.qq.com/cgi-bin/showqrcode" + resp, err := resty.New().R(). + SetDoNotParseResponse(true). + SetQueryParams(g.MapStrStr{"ticket": ticket}). + Get(qrCodeUrl) + + if err != nil { + glog.Errorf(context.Background(), "获取二维码图片请求异常: %+v", err) + return "", ecode.Fail.Sub("获取二维码图片请求失败") + } + if resp.StatusCode() != 200 { + glog.Errorf(context.Background(), "获取二维码图片响应异常: %+v", resp.Status()) + return "", ecode.Fail.Sub("获取二维码图片失败") + } + + imagePath = filename + + data, readErr := io.ReadAll(resp.RawBody()) + if readErr != nil { + glog.Errorf(context.Background(), "读取二维码图片失败: %+v", readErr) + return "", ecode.Fail.Sub("读取二维码图片失败") + } + defer resp.RawBody().Close() + + writeErr := os.WriteFile(imagePath, data, 0644) + if writeErr != nil { + glog.Errorf(context.Background(), "保存二维码图片失败: %+v", writeErr) + return "", ecode.Fail.Sub("保存二维码图片失败") + } + + glog.Infof(context.Background(), "二维码图片保存成功: %s", imagePath) + return imagePath, nil +}