package logic import ( . "app.yhyue.com/moapp/jybase/es" "bp.jydev.jianyu360.cn/CRM/application/api/internal/svc" "bp.jydev.jianyu360.cn/CRM/application/api/internal/types" "context" "github.com/zeromicro/go-zero/core/logx" ) var ( findfields = `"project_name", "id"` ) type PrPnameAssLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewPrPnameAssLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PrPnameAssLogic { return &PrPnameAssLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *PrPnameAssLogic) PrPnameAss(req *types.PnameAssReq) (resp *types.Reply, err error) { resp = &types.Reply{} if req.ProjectName != "" { esq := `{"query": {"bool": {"must": [{"match": {"project_name.pname": "` + req.ProjectName + `" }}]}}}` binfo := GetAllByNgram("transaction_info", "transaction_info", esq, "", "", findfields, 0, 10, 0, false) if binfo != nil && len(*binfo) > 0 { resp.Error_code = 0 resp.Data = *binfo } } else { resp.Error_code = -1 resp.Error_msg = "项目名称不能为空" } return }