using System; using System.Text; using System.Web; using WX.CRM.BLL.Util; using WX.CRM.Common; using WX.CRM.IBLL.Soft; using WX.CRM.Model.MAP; using WX.Interface.Security; namespace WX.CRM.BLL.Soft { public class SOFT_REGANDORDERLINK_BL : ISOFT_REGANDORDERLINK { CACHE_BL cache_BL = new CACHE_BL(); public SOFT_REGANDORDERLINK RegToUP(string userName, string mobile, string ch, string platForm, string guid, string password, decimal eid) { var ieid = Convert.ToInt32(eid); var apiDomain = cache_BL.GetValue_Parameter(Model.Enum.Parameter.Soft_RegApiDomain); var regApi = string.Format("{0}/login/cgi/username_register", apiDomain); // https://r2.soft.dn8188.com/; var parms = string.Format("guid={0}&username={1}&password={2}&mobile={3}&platform={4}&channel={5}&eid={6}", guid, userName, password, mobile, platForm, ch, ieid); try { string res = Utility.PostData(regApi, parms, Encoding.UTF8); return Utility.JSONToObject(res); } catch (Exception ex) { LogHelper.Error(ex); return new SOFT_REGANDORDERLINK { ret = -9999, msg = "program error" }; } } public bool HasUserName(string userName) { var apiDomain = cache_BL.GetValue_Parameter(Model.Enum.Parameter.Soft_RegApiDomain); var regApi = string.Format("{0}/login/cgi/check_username", apiDomain); // https://r2.soft.dn8188.com/login/cgi/check_username; var parms = string.Format("username={0}", userName); try { string response = Utility.PostData(regApi, parms, Encoding.UTF8); var res = Utility.JSONToObject(response); if (res.ret == 0) { return false; } else { return true; } } catch (Exception ex) { LogHelper.Error(ex); return true; } } public SOFT_USERINFO GetUserInfo(string userName) { var apiDomain = cache_BL.GetValue_Parameter(Model.Enum.Parameter.Soft_RegApiDomain); var regApi = string.Format("{0}/login/cgi/get_userinfo", apiDomain); // https://r2.soft.dn8188.com/login/cgi/check_username; var parms = string.Format("username={0}", userName); try { string response = Utility.PostData(regApi, parms, Encoding.UTF8); var res = Utility.JSONToObject(response); return res; } catch (Exception ex) { LogHelper.Error(ex); return null; } } public string EncyptData(string data, string key) { EncDecUtil util = new EncDecUtil(); var enrStr = util.encyptData(data, key); return HttpUtility.UrlEncode(enrStr); } } }