using Ninject; using System; using System.Collections.Generic; using System.Linq; using System.Text; using WX.CRM.Common; using WX.CRM.IBLL.Util; using WX.CRM.Model.Entity; using WX.CRM.WebHelper.Infrastructure; namespace WX.CRM.WEB.ViewModel.SMS { public class GetOpenSms { public List GetSmsList(out string msg, string resid, string username) { List list = new List(); msg = ""; if (string.IsNullOrWhiteSpace(resid) && string.IsNullOrWhiteSpace(username)) { msg = "resid和用户名不能同时为空!"; return list; } SmsopenModel model = new SmsopenModel(); model.resid = resid; model.username = username; string json = Utility.ObjectToJson(model); //try //{ ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string url = Utility.GetSettingByKey("SmsGetOpenList"); string key = sHelper.createSignEncodingStr(json); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData("UPWEBSITE", response); SmsopenResult result = Utility.JSONToObject(_retmsg); if (result.result) { list = result.SmsList; msg = "调用成功"; } else { msg = "接口数据:" + result.retMessage; } //}catch (Exception ex) //{ // msg = "接口数据:" + ex.Message; //} return list; } public List GetopenUserDetial(out string msg, string stime, string etime, string DEPTCDOE) { List list = new List(); msg = ""; if (string.IsNullOrWhiteSpace(stime) && string.IsNullOrWhiteSpace(etime)) { msg = "营业部编号和查找时间不能同时为空!"; return list; } SmsopenUserModel model = new SmsopenUserModel(); model.DEPTCDOE = DEPTCDOE; model.stime = stime; model.etime = etime; string json = Utility.ObjectToJson(model); //try //{ ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string url = Utility.GetSettingByKey("GetopenUserDetialt"); string key = sHelper.createSignEncodingStr(json); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData("UPWEBSITE", response); SmsopenverifResult result = Utility.JSONToObject(_retmsg); if (result.result) { list = result.SmsList; msg = "调用成功"; } else { msg = "接口数据:" + result.retMessage; } //}catch (Exception ex) //{ // msg = "接口数据:" + ex.Message; //} return list; } public List GetopenUserDetialtList(out string msg, string stime, string etime, string DEPTCDOE, ref Pager pager, string STATUS) { DEPTCDOE = DEPTCDOE.Substring(0, DEPTCDOE.Length - 2); List list = new List(); list = GetopenUserDetial(out msg, stime, etime, DEPTCDOE); //通过resid获取用户开户状态 //foreach (var item in list) //{ // var customer = _gjs_customer.GetGjsCustomersByResIds(item.VERIFYRESID); // if (customer != null) // { // item.SCHEDULESTATUS = customer.SCHEDULESTATUS; // item.TRADECODE = customer.TRADECODE; // } //} if (STATUS != "-1") { if (STATUS == "1") { list = list.Where(p => p.SCHEDULESTATUS != null).ToList(); } else { list = list.Where(p => p.SCHEDULESTATUS == null).ToList(); } } list = list.OrderByDescending(p => p.EXPIRETIME).ToList(); //分页 pager.totalRows = list.Count(); if (pager.totalRows > 0) { if (pager.page <= 1) { list = list.Take(pager.rows).ToList(); } else { list = list.Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); ;//分页 } } return list; } } /// /// 开户短信查询 /// public class SmsopenModel { public string resid { get; set; } public string username { get; set; } } /// /// 已生成开户验证码用户开户查询 /// public class SmsopenUserModel { /// ///开始时间 /// public string stime { get; set; } /// ///结束时间 /// public string etime { get; set; } /// /// 营业部编号(如:UJHD) /// public string DEPTCDOE { get; set; } } public class SmsopenResult { public bool result { get; set; } public int retcode { get; set; } public List SmsList { get; set; } public string retMessage { get; set; } } public class openverifSms { /// ///过期时间 /// public DateTime EXPIRETIME { get; set; } /// /// 营业部编号(如:600000175) /// public string VERIFYRESID { get; set; } public string USERNAME { get; set; } public string VERIFYCODE { get; set; } public decimal? SCHEDULESTATUS { get; set; } public string TRADECODE { get; set; } } public class SmsopenverifResult { public bool result { get; set; } public int retcode { get; set; } public List SmsList { get; set; } public string retMessage { get; set; } } }