by Robin at 20240201;

This commit is contained in:
Leufolium 2024-02-01 09:52:45 +08:00
parent 13ec1265e3
commit c71c996afd
21 changed files with 493 additions and 12 deletions

View File

@ -140,6 +140,9 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeDailyStatementSrvFail: "每日报表表服务错误",
ErrCodeDailyStatementNotExist: "每日报表表不存在",
ErrCodeAppConfigSrvFail: "应用配置表服务错误",
ErrCodeAppConfigNotExist: "应用配置表不存在",
}
const (
@ -332,6 +335,11 @@ const (
ErrCodeDailyStatementSrvFail ErrCode = -26001 // 每日报表表服务错误
ErrCodeDailyStatementNotExist ErrCode = -26002 // 每日报表表不存在
// AppConfig: 27xxx
ErrCodeAppConfigSrvOk ErrCode = ErrCodeOk
ErrCodeAppConfigSrvFail ErrCode = -27001 // 应用配置表服务错误
ErrCodeAppConfigNotExist ErrCode = -27002 // 应用配置表不存在
// Media: 60xxx
ErrCodeMediaSrvOk ErrCode = ErrCodeOk
ErrCodeMediaSrvFail ErrCode = -60001 // 媒体服务错误

View File

@ -0,0 +1,21 @@
package proto
import (
"service/api/base"
"service/dbstruct"
)
// op 列表
type ApiListByKeyReq struct {
base.BaseRequest
ConfigKey string `json:"config_key"`
}
type ApiListByKeyData struct {
AppConfig *dbstruct.AppConfig `json:"app_config"`
}
type ApiListByKeyResp struct {
base.BaseResponse
Data *ApiListByKeyData `json:"data"`
}

View File

@ -0,0 +1,63 @@
package proto
import (
"service/api/base"
"service/dbstruct"
)
// op 创建
type OpCreateReq struct {
base.BaseRequest
*dbstruct.AppConfig
}
type OpCreateData struct {
}
type OpCreateResp struct {
base.BaseResponse
Data *OpCreateData `json:"data"`
}
// op 删除
type OpDeleteReq struct {
base.BaseRequest
Id int64 `json:"id"`
}
type OpDeleteData struct {
}
type OpDeleteResp struct {
base.BaseResponse
Data *OpDeleteData `json:"data"`
}
// op 更新
type OpUpdateReq struct {
base.BaseRequest
*dbstruct.AppConfig
}
type OpUpdateData struct {
}
type OpUpdateResp struct {
base.BaseResponse
Data *OpUpdateData `json:"data"`
}
// op 列表
type OpListByKeyReq struct {
base.BaseRequest
ConfigKey string `json:"config_key"`
}
type OpListByKeyData struct {
AppConfig *dbstruct.AppConfig `json:"app_config"`
}
type OpListByKeyResp struct {
base.BaseResponse
Data *OpListByKeyData `json:"data"`
}

View File

@ -0,0 +1,11 @@
package proto
import "service/library/validator"
func (p *ApiListByKeyReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewStringParam("请输入待查询配置的key", p.ConfigKey))
return
}

View File

@ -0,0 +1,19 @@
package proto
import "service/library/validator"
func (p *OpUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewStringPtrParam("请输入待更新配置的key", p.ConfigKey))
return
}
func (p *OpListByKeyReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewStringParam("请输入待查询配置的key", p.ConfigKey))
return
}

View File

@ -14,6 +14,15 @@ type GetCoinsProductListData struct {
ListAlipayH5 []*dbstruct.Product `json:"list_alipay_h5"`
}
// 用户获取会员商品列表
type GetMembershipProductListReq struct {
base.BaseRequest
}
type GetMembershipProductListData struct {
List []*dbstruct.Product `json:"list"`
}
// 创建订单
const (
PayTypeOp = "op" // op直冲

View File

@ -0,0 +1,26 @@
package controller
import (
"service/api/errcode"
appconfigproto "service/api/proto/app_config/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func ApiGetAppConfigListByKey(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*appconfigproto.ApiListByKeyReq)
appconfig, ec := service.DefaultService.ApiGetAppConfigListByKey(ctx, req)
if ec != errcode.ErrCodeAppConfigSrvOk {
logger.Error("ApiGetAppConfigListByKey fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &appconfigproto.ApiListByKeyData{
AppConfig: appconfig,
}
ReplyOk(ctx, data)
}

View File

@ -0,0 +1,38 @@
package controller
import (
"service/api/errcode"
appconfigproto "service/api/proto/app_config/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func OpUpdateAppConfig(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*appconfigproto.OpUpdateReq)
ec := service.DefaultService.OpUpdateAppConfig(ctx, req)
if ec != errcode.ErrCodeAppConfigSrvOk {
logger.Error("OpUpdateAppConfig fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func OpGetAppConfigListByKey(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*appconfigproto.OpListByKeyReq)
appconfig, ec := service.DefaultService.OpGetAppConfigListByKey(ctx, req)
if ec != errcode.ErrCodeAppConfigSrvOk {
logger.Error("OpGetAppConfigListByKey fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &appconfigproto.OpListByKeyData{
AppConfig: appconfig,
}
ReplyOk(ctx, data)
}

View File

@ -20,6 +20,7 @@ import (
"service/api/errcode"
accountproto "service/api/proto/account/proto"
accountrelationproto "service/api/proto/accountrelation/proto"
appconfigproto "service/api/proto/app_config/proto"
callhistoryproto "service/api/proto/callhistory/proto"
contact_customer_serviceproto "service/api/proto/contact_customer_service/proto"
contact_customer_service_sessionproto "service/api/proto/contact_customer_service_session/proto"
@ -167,6 +168,10 @@ func Init(r *gin.Engine) {
apiContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateContactCustomerServiceSession)
apiContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetContactCustomerServiceSessionListByMid)
// 应用配置表
apiAppConfigGroup := r.Group("/api/app_config", PrepareToC())
apiAppConfigGroup.POST("list_by_key", middleware.JSONParamValidator(appconfigproto.ApiListByKeyReq{}), middleware.JwtAuthenticator(), ApiGetAppConfigListByKey)
// 主播标签
apiStreamerTagGroup := r.Group("/api/streamer_tag", PrepareToC())
apiStreamerTagGroup.POST("list", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetStreamerTagList)
@ -200,6 +205,7 @@ func Init(r *gin.Engine) {
// 支付相关
vasPayGroup := r.Group("/api/vas", PrepareToC())
vasPayGroup.POST("get_coins_product_list", middleware.JSONParamValidator(vasproto.GetCoinsProductListReq{}), GetCoinsProductList)
vasPayGroup.POST("get_membership_product_list", middleware.JSONParamValidator(vasproto.GetMembershipProductListReq{}), GetMembershipProductList)
vasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.CreateOrderReq{}), middleware.JwtAuthenticator(), CreateOrder)
vasPayGroup.POST("one_step_unlock", middleware.JSONParamValidator(vasproto.OneStepUnlockContactReq{}), OneStepUnlock)
vasPayGroup.POST("consumer_fill_contact", middleware.JSONParamValidator(vasproto.ConsumerFillContactReq{}), ConsumerFillContact)
@ -386,6 +392,11 @@ func Init(r *gin.Engine) {
opDailyStatementGroup := r.Group("/op/daily_statement", PrepareOp())
opDailyStatementGroup.POST("list", middleware.JSONParamValidator(daily_statementproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetDailyStatementList)
// 应用配置表
opAppConfigGroup := r.Group("/op/app_config", PrepareOp())
opAppConfigGroup.POST("update", middleware.JSONParamValidator(appconfigproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateAppConfig)
opAppConfigGroup.POST("list_by_key", middleware.JSONParamValidator(appconfigproto.OpListByKeyReq{}), middleware.JwtAuthenticator(), OpGetAppConfigListByKey)
// 账号相关
//accountGroup := r.Group("/account")

View File

@ -1,7 +1,6 @@
package controller
import (
"github.com/gin-gonic/gin"
"service/api/errcode"
vasproto "service/api/proto/vas/proto"
"service/app/mix/service"
@ -9,6 +8,8 @@ import (
"service/bizcommon/util"
"service/library/logger"
"time"
"github.com/gin-gonic/gin"
)
// 获取充值商品
@ -26,6 +27,21 @@ func GetCoinsProductList(ctx *gin.Context) {
ReplyOk(ctx, data)
}
// 获取会员商品
func GetMembershipProductList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*vasproto.GetMembershipProductListReq)
if req.Channel == "h5" {
req.DevType = common.DeviceTypeH5
}
data, ec := service.DefaultService.GetMembershipProductList(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("GetMembershipProductList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, data)
}
// 充值 创建订单
func CreateOrder(ctx *gin.Context) {
defer logger.Recover()

View File

@ -15,6 +15,7 @@ import (
accountproto "service/api/proto/account/proto"
accountrelationproto "service/api/proto/accountrelation/proto"
appconfigproto "service/api/proto/app_config/proto"
callhistoryproto "service/api/proto/callhistory/proto"
contact_customer_service_proto "service/api/proto/contact_customer_service/proto"
contact_customer_service_sessionproto "service/api/proto/contact_customer_service_session/proto"
@ -144,6 +145,9 @@ const (
DBDailyStatement = "daily_statement"
COLDailyStatement = "daily_statement"
DBAppConfig = "app_config"
COLAppConfig = "app_config"
)
// 商品表
@ -325,16 +329,21 @@ func (m *Mongo) getColTextAuditTask() *qmgo.Collection {
return m.clientMix.Database(DBTextAudit).Collection(COLTextAuditTask)
}
// 联系客服对话表
// 联系客服对话表
func (m *Mongo) getColContactCustomerServiceSession() *qmgo.Collection {
return m.clientMix.Database(DBContactCustomerServiceSession).Collection(COLContactCustomerServiceSession)
}
// 每日报表表
// 每日报表表
func (m *Mongo) getColDailyStatement() *qmgo.Collection {
return m.clientMix.Database(DBDailyStatement).Collection(COLDailyStatement)
}
// 应用配置表
func (m *Mongo) getColAppConfig() *qmgo.Collection {
return m.clientMix.Database(DBAppConfig).Collection(COLAppConfig)
}
// 商品相关
func (m *Mongo) CreateProduct(ctx *gin.Context, product *dbstruct.Product) error {
col := m.getColProduct()
@ -2860,3 +2869,49 @@ func (m *Mongo) GetDailyStatementList(ctx *gin.Context, req *daily_statementprot
}
return list, err
}
// 应用配置表相关
func (m *Mongo) CreateAppConfig(ctx *gin.Context, appconfig *dbstruct.AppConfig) error {
col := m.getColAppConfig()
_, err := col.InsertOne(ctx, appconfig)
return err
}
func (m *Mongo) UpdateAppConfig(ctx *gin.Context, appconfig *dbstruct.AppConfig) error {
col := m.getColAppConfig()
set := util.EntityToM(appconfig)
set["ut"] = time.Now().Unix()
up := qmgo.M{
"$set": set,
}
filter := qmgo.M{
"config_key": util.DerefString(appconfig.ConfigKey),
}
err := col.UpdateOne(ctx, filter, up)
return err
}
func (m *Mongo) DeleteAppConfig(ctx *gin.Context, id int64) error {
col := m.getColAppConfig()
update := qmgo.M{
"$set": qmgo.M{
"del_flag": 1,
},
}
err := col.UpdateId(ctx, id, update)
return err
}
func (m *Mongo) GetAppConfigListByKey(ctx *gin.Context, req *appconfigproto.OpListByKeyReq) (*dbstruct.AppConfig, error) {
appconfig := &dbstruct.AppConfig{}
col := m.getColAppConfig()
query := qmgo.M{
"del_flag": 0,
}
err := col.Find(ctx, query).One(appconfig)
if err == qmgo.ErrNoSuchDocuments {
err = nil
return nil, err
}
return appconfig, err
}

View File

@ -6,6 +6,7 @@ import (
"service/api/errcode"
accountproto "service/api/proto/account/proto"
accountrelationproto "service/api/proto/accountrelation/proto"
appconfigproto "service/api/proto/app_config/proto"
contact_customer_service_proto "service/api/proto/contact_customer_service/proto"
contact_customer_service_sessionproto "service/api/proto/contact_customer_service_session/proto"
feedbackproto "service/api/proto/feedback/proto"
@ -1804,3 +1805,17 @@ func (s *Service) ApiGetThumbsUpList(ctx *gin.Context, req *thumbsupproto.ApiLis
}
return
}
func (s *Service) ApiGetAppConfigListByKey(ctx *gin.Context, req *appconfigproto.ApiListByKeyReq) (appconfig *dbstruct.AppConfig, ec errcode.ErrCode) {
ec = errcode.ErrCodeAppConfigSrvOk
appconfig, err := _DefaultAppConfig.OpListByKey(ctx, &appconfigproto.OpListByKeyReq{
ConfigKey: req.ConfigKey,
})
if err != nil {
logger.Error("OpGetAppConfigListByKey fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAppConfigSrvFail
return
}
return
}

View File

@ -0,0 +1,65 @@
package logic
import (
"service/api/consts"
app_configproto "service/api/proto/app_config/proto"
"service/app/mix/dao"
"service/dbstruct"
"service/library/idgenerator"
"service/library/logger"
"time"
"github.com/gin-gonic/gin"
goproto "google.golang.org/protobuf/proto"
)
type AppConfig struct {
store *dao.Store
}
func NewAppConfig(store *dao.Store) (a *AppConfig) {
a = &AppConfig{
store: store,
}
return
}
func (p *AppConfig) OpCreate(ctx *gin.Context, req *app_configproto.OpCreateReq) error {
req.AppConfig.Id = goproto.Int64(idgenerator.GenAppConfigId())
req.AppConfig.Ct = goproto.Int64(time.Now().Unix())
req.AppConfig.Ut = goproto.Int64(time.Now().Unix())
req.AppConfig.DelFlag = goproto.Int64(consts.Exist)
err := p.store.CreateAppConfig(ctx, req.AppConfig)
if err != nil {
logger.Error("CreateAppConfig fail, err: %v", err)
return err
}
return nil
}
func (p *AppConfig) OpUpdate(ctx *gin.Context, req *app_configproto.OpUpdateReq) error {
err := p.store.UpdateAppConfig(ctx, req.AppConfig)
if err != nil {
logger.Error("UpdateAppConfig fail, err: %v", err)
return err
}
return nil
}
func (p *AppConfig) OpDelete(ctx *gin.Context, id int64) error {
err := p.store.DeleteAppConfig(ctx, id)
if err != nil {
logger.Error("DeleteAppConfig fail, err: %v", err)
return err
}
return nil
}
func (p *AppConfig) OpListByKey(ctx *gin.Context, req *app_configproto.OpListByKeyReq) (*dbstruct.AppConfig, error) {
appconfig, err := p.store.GetAppConfigListByKey(ctx, req)
if err != nil {
logger.Error("GetAppConfigListByKey fail, err: %v", err)
return nil, err
}
return appconfig, nil
}

View File

@ -76,6 +76,17 @@ func (v *Vas) GetCoinsProductList(ctx *gin.Context, req *vasproto.GetCoinsProduc
return
}
func (v *Vas) GetMembershipProductList(ctx *gin.Context, req *vasproto.GetMembershipProductListReq) (list []*dbstruct.Product, err error) {
// 获取所有会员商品
list, err = v.store.GetProductByDtType(ctx, req.DevType, dbstruct.ProductTypeMoneyMembership)
if err != nil {
logger.Error("GetProductByDtType fail, mid: %v, dt: %v", req.Mid, req.DevType)
return
}
logger.Info("GetProductByDtType, len: %v", len(list))
return
}
func (v *Vas) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data *vasproto.CreateOrderData, err error) {
var (
productId = req.ProductId

View File

@ -4,6 +4,7 @@ import (
"service/api/errcode"
accountproto "service/api/proto/account/proto"
accountrelationproto "service/api/proto/accountrelation/proto"
appconfigproto "service/api/proto/app_config/proto"
callhistoryproto "service/api/proto/callhistory/proto"
contact_customer_service_proto "service/api/proto/contact_customer_service/proto"
contact_customer_service_sessionproto "service/api/proto/contact_customer_service_session/proto"
@ -1231,3 +1232,37 @@ func (s *Service) OpGetThumbsUpListBusinessValidate(ctx *gin.Context, req *thumb
}
return
}
func (s *Service) OpUpdateAppConfigBusinessValidate(ctx *gin.Context, req *appconfigproto.OpUpdateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeAppConfigSrvOk
// 1.业务校验
result := businessvalidator.NewAuthBusinessValidator(ctx, req).
QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist().
EnsureIsOpRole().
Validate().
Collect()
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
logger.Error("OpUpdateAppConfig business validation failed")
return
}
return
}
func (s *Service) OpGetAppConfigListByKeyBusinessValidate(ctx *gin.Context, req *appconfigproto.OpListByKeyReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeAppConfigSrvOk
// 1.业务校验
result := businessvalidator.NewAuthBusinessValidator(ctx, req).
QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist().
EnsureIsOpRole().
Validate().
Collect()
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
logger.Error("OpGetAppConfigListByKey business validation failed")
return
}
return
}

View File

@ -9,6 +9,7 @@ import (
"service/api/errs"
accountproto "service/api/proto/account/proto"
accountrelationproto "service/api/proto/accountrelation/proto"
appconfigproto "service/api/proto/app_config/proto"
bannerproto "service/api/proto/banner/proto"
callhistoryproto "service/api/proto/callhistory/proto"
catalogproto "service/api/proto/catalog/proto"
@ -94,6 +95,7 @@ var (
_DefaultTextAuditTask *logic.TextAuditTask
_DefaultContactCustomerServiceSession *logic.ContactCustomerServiceSession
_DefaultDailyStatement *logic.DailyStatement
_DefaultAppConfig *logic.AppConfig
)
type Service struct {
@ -160,6 +162,7 @@ func (s *Service) Init(c any) (err error) {
_DefaultVas = logic.NewVas(store, _DefaultStreamer, _DefaultAccount)
_DefaultContactCustomerServiceSession = logic.NewContactCustomerServiceSession(store)
_DefaultDailyStatement = logic.NewDailyStatement(store)
_DefaultAppConfig = logic.NewAppConfig(store)
return
}
@ -933,7 +936,7 @@ func (s *Service) GetCoinsProductList(ctx *gin.Context, req *vasproto.GetCoinsPr
ok := false
listH5alipay, err := _DefaultVas.GetCoinsProductList(ctx, req)
if err != nil {
logger.Error("CreateOrder fail, err: %v", err)
logger.Error("GetCoinsProductList fail, err: %v", err)
ec, ok = errs.ErrEcMap[err]
if ok {
return
@ -947,6 +950,25 @@ func (s *Service) GetCoinsProductList(ctx *gin.Context, req *vasproto.GetCoinsPr
return
}
func (s *Service) GetMembershipProductList(ctx *gin.Context, req *vasproto.GetMembershipProductListReq) (data *vasproto.GetMembershipProductListData, ec errcode.ErrCode) {
ec = errcode.ErrCodeVasSrvOk
ok := false
list, err := _DefaultVas.GetMembershipProductList(ctx, req)
if err != nil {
logger.Error("GetMembershipProductList fail, err: %v", err)
ec, ok = errs.ErrEcMap[err]
if ok {
return
}
ec = errcode.ErrCodeVasSrvFail
return
}
data = &vasproto.GetMembershipProductListData{
List: list,
}
return
}
func (s *Service) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data *vasproto.CreateOrderData, ec errcode.ErrCode) {
switch req.ProductId {
case dbstruct.ProductIdMembership:
@ -2567,3 +2589,41 @@ func (s *Service) OpGetDailyStatementList(ctx *gin.Context, req *daily_statement
}
return
}
// AppConfig
func (s *Service) OpUpdateAppConfig(ctx *gin.Context, req *appconfigproto.OpUpdateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeAppConfigSrvOk
if ec = s.OpUpdateAppConfigBusinessValidate(ctx, req); ec != errcode.ErrCodeAppConfigSrvOk {
return
}
err := _DefaultAppConfig.OpUpdate(ctx, req)
if err == qmgo.ErrNoSuchDocuments {
ec = errcode.ErrCodeAppConfigNotExist
err = nil
return
}
if err != nil {
logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAppConfigSrvFail
return
}
return
}
func (s *Service) OpGetAppConfigListByKey(ctx *gin.Context, req *appconfigproto.OpListByKeyReq) (appconfig *dbstruct.AppConfig, ec errcode.ErrCode) {
ec = errcode.ErrCodeAppConfigSrvOk
if ec = s.OpGetAppConfigListByKeyBusinessValidate(ctx, req); ec != errcode.ErrCodeAppConfigSrvOk {
return
}
appconfig, err := _DefaultAppConfig.OpListByKey(ctx, req)
if err != nil {
logger.Error("OpGetAppConfigListByKey fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAppConfigSrvFail
return
}
return
}

View File

@ -9,10 +9,10 @@ import (
func main() {
genSource := &generator.GenSource{
EntityName: "DailyStatement",
ModuleName: "daily_statement",
EntityCNName: "每日报表表",
ErrCodeSeq: "26",
EntityName: "AppConfig",
ModuleName: "app_config",
EntityCNName: "应用配置表",
ErrCodeSeq: "27",
}
generator.CreateFileDirectory(genSource)

View File

@ -2,7 +2,7 @@
// #{EntityCNName}
op#{EntityName}Group := r.Group("/api/#{moduleName}", PrepareToC())
op#{EntityName}Group.POST("create", middleware.JSONParamValidator(#{moduleName}proto.OpCreateReq{}), OpCreate#{EntityName})
op#{EntityName}Group.POST("update", middleware.JSONParamValidator(#{moduleName}proto.OpUpdateReq{}), OpUpdate#{EntityName})
op#{EntityName}Group.POST("delete", middleware.JSONParamValidator(#{moduleName}proto.OpDeleteReq{}), OpDelete#{EntityName})
op#{EntityName}Group.POST("list", middleware.JSONParamValidator(#{moduleName}proto.OpListReq{}), OpGet#{EntityName}List)
op#{EntityName}Group.POST("create", middleware.JSONParamValidator(#{moduleName}proto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreate#{EntityName})
op#{EntityName}Group.POST("update", middleware.JSONParamValidator(#{moduleName}proto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdate#{EntityName})
op#{EntityName}Group.POST("delete", middleware.JSONParamValidator(#{moduleName}proto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDelete#{EntityName})
op#{EntityName}Group.POST("list", middleware.JSONParamValidator(#{moduleName}proto.OpListReq{}), middleware.JwtAuthenticator(), OpGet#{EntityName}List)

11
dbstruct/app_config.go Normal file
View File

@ -0,0 +1,11 @@
package dbstruct
type AppConfig struct {
Id *int64 `json:"id" bson:"_id"` // 配置id
ConfigKey *string `json:"config_key" bson:"config_key"` // 配置键
ConfigValue *[]string `json:"config_value" bson:"config_value"` // 配置值
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
}

View File

@ -46,6 +46,7 @@ const (
NodeTextAuditTask // node 文字审核任务
NodeDailyStatement // node 每日报表表
NodeWithdrawOrderId // node 提现订单
NodeAppConfig // node 应用配置表
)
func GenIdInt64(node int64) (int64, error) {
@ -203,3 +204,9 @@ func GenWithdrawOrderId() string {
id, _ := GenIdString(NodeWithdrawOrderId)
return id
}
// app_config
func GenAppConfigId() int64 {
id, _ := GenIdInt64(NodeAppConfig)
return id
}