public static Response Process_Company_Search4Exhibit(Request request) { var pre_Ei = request.Preprocess2Either(true); if (pre_Ei.HasLeft) { return(pre_Ei.Left); } //ServiceImpl.Process_ExtQuery_Hot("31", "5"); var request_Body = request.GetBody <Req_Info_Query>(); // get request body var op_Log = pre_Ei.Right.To_AppOrgCompanyLog().Set_Uid(request_Body.u_id).Set_Uname(request_Body.u_name).Set_Action(Constants.Op_Exhibit_Query); DataAccess.AppOrgCompanyLog_Insert(op_Log); var res_mb = request.GetBody <Req_Info_Query>().ToMaybe() .DoWhen(s => s.pg_index < 1, s => s.pg_index = 1) .DoWhen(b => !string.IsNullOrEmpty(b.query_str), p => DataAccess.SearchHistoryExt_Insert(p.Type_Set(31), p.u_id.ToInt() > 0)) .Select(s => ESClient.Exhibit_Search(s).ToMaybe()) .Select(r => ResponseAdaptor.ExhibitSearch2List(r).ToMaybe()); var body = res_mb.HasValue ? res_mb.Value : new Resp_Exhibit_List() { exhibits = new List <SearchExhibit>() }; var response = Util.Normal_Resp_Create(body.ToJson(), EncryptType.AES | EncryptType.Gzip); return(response); }
public static IEnumerable <ES_Company> ScrollSearch() { var set = ESClient.Company_Search4Export("腾讯", 0); var total = set.Values.Count(); return(set.Values); }
public IActionResult func_sendSMS(SendSMSModel model) { if (model.pname.IsNullOrEmpty()) { return(this.FuncResult(new APIReturn(10000, $"参数错误(pname)"))); } if (model.message.IsNullOrEmpty()) { return(this.FuncResult(new APIReturn(10000, $"参数错误(message)"))); } if (model.type == 0) { return(this.FuncResult(new APIReturn(10000, $"参数错误(type)"))); } if ((model.type == 1 || model.type == 4) && model.validcode.IsNullOrEmpty()) { return(this.FuncResult(new APIReturn(10000, $"参数错误(validcode)"))); } /* * string apm_enc = string.Format("act={0}&pname={1}&message={2}&telnumbers={3}&type={4}&validcode={5}&displaynum={6}&server={7}&userid_from={8}&userid_to={9}", "sendsms", model.pname, model.message, model.telnumbers, model.type, model.validcode, model.displaynum, model.server, model.userid_from, model.userid_to); * string result = string.Empty; * result = this.SendToICC(apm_enc); */ SmsType smsType = (SmsType)model.type; CallResult callResult = ESClient.SendSms("if2017", model.pname, model.telnumbers, model.message, smsType, model.validcode); if (callResult.Code == 0) { //JToken jobject = JToken.Parse(callResult.Message); JToken jobject = JToken.Parse(callResult.Source.ToString()); int code = jobject.Value <int>("Code"); //1验证码 2国际短信 3语音短信 4单向互动短信 5双向互动短信 6游戏内招募短信 7通知短信 8内部报警短信 11礼包短信 if (code == 0 && (model.type == 1 || model.type == 4)) { string key = Guid.NewGuid().ToString("N"); RedisHelper.Set(key, model.validcode, 5 * 60); Hashtable table = new Hashtable(); table["smskey"] = key; return(this.FuncResult(new APIReturn(0, "发送成功", table))); } else { return(this.FuncResult(new APIReturn(10130, $"发送失败({code},{ jobject.Value<string>("Message")})"))); } } else { throw new Exception($"调用发送短信中控接口失败({callResult.Message})"); } }
public void EnsureIndexWithMapping <T>(string indexName = null, Func <PutMappingDescriptor <T>, PutMappingDescriptor <T> > customMapping = null) where T : class { if (String.IsNullOrEmpty(indexName)) { indexName = this.DefaultIndex; } // Map type T to that index ESClient.ConnectionSettings.DefaultIndices.Add(typeof(T), indexName); // Does the index exists? var indexExistsResponse = ESClient.Indices.Exists(new IndexExistsRequest(indexName)); if (!indexExistsResponse.IsValid) { throw new InvalidOperationException(indexExistsResponse.DebugInformation); } // If exists, return if (indexExistsResponse.Exists) { return; } // Otherwise create the index and the type mapping var createIndexRes = ESClient.Indices.Create(indexName); if (!createIndexRes.IsValid) { throw new InvalidOperationException(createIndexRes.DebugInformation); } var res = ESClient.Map <T>(m => { m.AutoMap().Index(indexName); if (customMapping != null) { m = customMapping(m); } return(m); }); if (!res.IsValid) { throw new InvalidOperationException(res.DebugInformation); } }
private static Resp_Company_List NextGen_Company_Search(Company c) { Nest.ISearchResponse <Instrument.Client.ES_Company> resp; if (c.q_type == q_type.q_general) { resp = Company.Filter_Flag_Get(c) ? ESClient.Company_General_Filter_Search(c) : ESClient.Company_General_Search(c); } else { if (c.oc_trade == "00") { c.oc_trade = ""; } resp = ESClient.Company_Advanced_Search(c); } return(ResponseAdaptor.Search2CompanyList(resp, c)); }
private static Response Company_SearchByTradeName(Request request, TradeQueryType type) { var pre_Ei = request.Preprocess2Either(true); if (pre_Ei.HasLeft) { return(pre_Ei.Left); } var req_body = request.GetBody <Req_TradeSearch>(); if (string.IsNullOrWhiteSpace(req_body.trd_name)) { var head = new Response_Head(); head.Action = Message_Action.Logic_Err; head.Text = "查询字符串不能为空"; var headJson = head.ToJson().ToEncryption(EncryptType.PT); return(new Response(headJson, "")); } string fieldName = type == TradeQueryType.forward ? Es_Consts.Company_FwdTrade : Es_Consts.Company_ExhTrade; var op_Log = pre_Ei.Right.To_AppOrgCompanyLog().Set_Uid(req_body.u_id).Set_Uname(req_body.u_name).Set_Action(Constants.Op_Trade_Search + fieldName); DataAccess.AppOrgCompanyLog_Insert(op_Log); var query = new Req_Info_Query(); query.Type_Set((byte)((int)type & 0x11100)); query.u_id = req_body.u_id; query.u_name = req_body.u_name; query.query_str = req_body.trd_name; DataAccess.SearchHistoryExt_Insert(query, query.u_id.ToInt() > 0); var list = ResponseAdaptor.TradeSearch2CompanyList(ESClient.Company_TradeNameSearch(req_body, fieldName)); var response = Util.Normal_Resp_Create(list.ToJson(), EncryptType.AES | EncryptType.Gzip); return(response); }
private static Response Company_SearchByTradeCode(Request request, string fieldName) { var pre_Ei = request.Preprocess2Either(true); if (pre_Ei.HasLeft) { return(pre_Ei.Left); } var req_body = request.GetBody <Req_TradeSearch>(); var op_Log = pre_Ei.Right.To_AppOrgCompanyLog().Set_Uid(req_body.u_id).Set_Uname(req_body.u_name).Set_Action(Constants.Op_Trade_Search + fieldName); DataAccess.AppOrgCompanyLog_Insert(op_Log); var list = ResponseAdaptor.TradeSearch2CompanyList(ESClient.Company_TradeCodeSearch(req_body, fieldName)); var response = Util.Normal_Resp_Create(list.ToJson(), EncryptType.AES | EncryptType.Gzip); return(response); }
public static Response Process_Company_UniversalTradeSearch(Request request) { var pre_Ei = request.Preprocess2Either(true); if (pre_Ei.HasLeft) { return(pre_Ei.Left); } var req_body = request.GetBody <Req_Trade_UniversalSearch>(); var res_mb = req_body.ToMaybe() .DoWhen(s => s.pg_index < 1, s => s.pg_index = 1) .Select(s => ESClient.Company_TradeUniversalSearch(s).ToMaybe()) .Select(r => ResponseAdaptor.TradeSearch2CompanyList(r, req_body).ToMaybe()); var body = res_mb.HasValue ? res_mb.Value : new Resp_Company_List() { oc_list = new List <Resp_Oc_Abs>() }; var response = Util.Normal_Resp_Create(body.ToJson(), EncryptType.AES | EncryptType.Gzip); return(response); }
public ESCall(ILogger <ESCall> logger, IConfiguration config, ESClient client) { _logger = logger; _client = client; _settings = config.GetSection("AppSettings:ESConnection").Get <ESConnection>(); }
public static void Company_GeneraiFilterByTrade() { var resp = ESClient.Company_FilterByTrade_Search("bytrade", "65", "上海元实信息技术有限公司"); }
public static IEnumerable <ES_Company> Regexp_Test(string keyword) => ESClient.Regexp_Test(keyword).Documents;
public static IEnumerable <ES_Company> SpanNot_Test(string keyword) => ESClient.SpanNot_Test(keyword).Documents;
public static IEnumerable <string> CompanySearch(string keyword) => ESClient.Company_General_Search(new QZ.Instrument.Model.Company() { oc_name = keyword }).Documents.Select(d => d.oc_name);
public static void Company_Script_Search() => ESClient.Script_Search();