You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.8 KiB
Go
109 lines
2.8 KiB
Go
package handler
|
|
|
|
import (
|
|
"context"
|
|
"joybuywork/internal/service"
|
|
pb "joybuywork/proto/go_proto/w_library"
|
|
)
|
|
|
|
type WLibraryServer struct{}
|
|
|
|
// QaGroup 题库列表
|
|
func (s *WLibraryServer) QaGroup(ctx context.Context, req *pb.QaGroupReq, res *pb.QaGroupRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.QaGroup(req, res)
|
|
return err
|
|
}
|
|
|
|
// StoreQaGroup 创建题库
|
|
func (s *WLibraryServer) StoreQaGroup(ctx context.Context, req *pb.StoreQaGroupReq, res *pb.StoreQaGroupRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.StoreQaGroup(req, res)
|
|
return err
|
|
}
|
|
|
|
// UpdateQaGroup 更新题库
|
|
func (s *WLibraryServer) UpdateQaGroup(ctx context.Context, req *pb.UpdateQaGroupReq, res *pb.UpdateQaGroupRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.UpdateQaGroup(req, res)
|
|
return err
|
|
}
|
|
|
|
// DestroyQaGroup 删除题库
|
|
func (s *WLibraryServer) DestroyQaGroup(ctx context.Context, req *pb.DestroyQaGroupReq, res *pb.DestroyQaGroupRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.DestroyQaGroup(req, res)
|
|
return err
|
|
}
|
|
|
|
// QaList 问题列表
|
|
func (s *WLibraryServer) QaList(ctx context.Context, req *pb.QaListReq, res *pb.QaListRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.QaList(req, res)
|
|
return err
|
|
}
|
|
|
|
// StoreQa 创建题目
|
|
func (s *WLibraryServer) StoreQa(ctx context.Context, req *pb.StoreQaReq, res *pb.StoreQaRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.StoreQa(req, res)
|
|
return err
|
|
}
|
|
|
|
// UpdateQa 更新题目
|
|
func (s *WLibraryServer) UpdateQa(ctx context.Context, req *pb.UpdateQaReq, res *pb.UpdateQaRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.UpdateQa(req, res)
|
|
return err
|
|
}
|
|
|
|
// DestroyQa 删除题目
|
|
func (s *WLibraryServer) DestroyQa(ctx context.Context, req *pb.DestroyQaReq, res *pb.DestroyQaRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.DestroyQa(req, res)
|
|
return err
|
|
}
|
|
|
|
// QaGroupSelect 题库选项
|
|
func (s *WLibraryServer) QaGroupSelect(ctx context.Context, req *pb.QaGroupSelectReq, res *pb.QaGroupSelectRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.QaGroupSelect(req, res)
|
|
return err
|
|
}
|
|
|
|
// QaRand 随机问题
|
|
func (s *WLibraryServer) QaRand(ctx context.Context, req *pb.QaRandReq, res *pb.QaRandRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.QaRand(req, res)
|
|
return err
|
|
}
|
|
|
|
// QaShow 问题详情
|
|
func (s *WLibraryServer) QaShow(ctx context.Context, req *pb.QaShowReq, res *pb.QaShowRes) (err error) {
|
|
//初始化服务
|
|
srv := service.WLibrary{}
|
|
srv.Init(ctx)
|
|
err = srv.QaShow(req, res)
|
|
return err
|
|
}
|