package logic import ( "context" "git.i2edu.net/i2/i2-bill-erp/utils" "git.i2edu.net/i2/i2-bill-erp/internal/svc" "git.i2edu.net/i2/i2-bill-erp/transform" "git.i2edu.net/i2/go-zero/core/logx" ) type GetErpActiveLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewGetErpActiveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetErpActiveLogic { return &GetErpActiveLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *GetErpActiveLogic) GetErpActive(in *transform.GetErpActiveReq) (*transform.GetErpActiveRes, error) { // todo: add your logic here and delete this line type Active struct { MaName string `json:"ma_name"` ActiveId int64 `json:"active_id"` } actives := new([]*transform.Active) var parmas = make(map[string]interface{}) parmas["school_id"] = in.SchId result, err := utils.AllSearch(l.svcCtx.DB, "mkt_activity", "all", "mkt_activity", parmas) if err != nil { logx.Error(err.Error()) return nil, err } for _, act := range result { active := new(transform.Active) active.MaName = act["ma_name"].(string) active.ActiveId = act["active_id"].(int64) *actives = append(*actives, active) } return &transform.GetErpActiveRes{Active: *actives}, nil }