/// <summary> /// 短信账户充值 /// </summary> /// <param name="info"></param> /// <returns></returns> public bool SmsBankRecharge(EyouSoft.Model.SmsStructure.MSmsBankChargeInfo info) { if (info == null || string.IsNullOrEmpty(info.AccountId) || string.IsNullOrEmpty(info.AppKey) || string.IsNullOrEmpty(info.AppSecret) || info.ChargeAmount <= 0 || string.IsNullOrEmpty(info.ChargeComName)) { return(false); } var api = GetSmsCenterApi(); var apiRequestInfo = new EyouSoft.BLL.SmsCenter.MSmsBankCharge(); apiRequestInfo.AccountId = info.AccountId; apiRequestInfo.AppKey = info.AppKey; apiRequestInfo.AppSecret = info.AppSecret; apiRequestInfo.ChargeAmount = info.ChargeAmount; apiRequestInfo.ChargeComName = info.ChargeComName; apiRequestInfo.ChargeName = info.ChargeName; apiRequestInfo.ChargeTelephone = info.ChargeTelephone; apiRequestInfo.IssueTime = DateTime.Now; apiRequestInfo.RealAmount = 0; apiRequestInfo.Status = EyouSoft.BLL.SmsCenter.ChargeStatus.未审核; apiRequestInfo.SysType = EyouSoft.BLL.SmsCenter.SystemType.峡州; return(api.RechargeByCostomer(apiRequestInfo) == 1); }
/// <summary> /// 获取短信充值明细集合 /// </summary> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="searchInfo">查询信息</param> /// <returns></returns> public IList <EyouSoft.Model.SmsStructure.MSmsBankChargeInfo> GetSmsBankCharges(int pageSize, int pageIndex, out int recordCount, EyouSoft.Model.SmsStructure.MSmsBankChargeSearchInfo searchInfo) { recordCount = 0; IList <EyouSoft.Model.SmsStructure.MSmsBankChargeInfo> items = new List <EyouSoft.Model.SmsStructure.MSmsBankChargeInfo>(); var api = GetSmsCenterApi(); var apiSearchInfo = new EyouSoft.BLL.SmsCenter.MQuerySmsBankCharge(); if (searchInfo != null) { apiSearchInfo.AccountId = searchInfo.AccountId; apiSearchInfo.AppKey = searchInfo.AppKey; apiSearchInfo.AppSecret = searchInfo.AppSecret; apiSearchInfo.ChargeComName = searchInfo.ChargeComName; apiSearchInfo.ChargeName = searchInfo.ChargeName; apiSearchInfo.EndTime = searchInfo.EndTime; apiSearchInfo.StartTime = searchInfo.StartTime; apiSearchInfo.Status = (EyouSoft.BLL.SmsCenter.ChargeStatus?)searchInfo.Status; } var apiRetItems = api.GetSmsBankCharge(pageSize, pageIndex, ref recordCount, apiSearchInfo); if (apiRetItems != null && apiRetItems.Length > 0) { foreach (var item in apiRetItems) { var tmp = new EyouSoft.Model.SmsStructure.MSmsBankChargeInfo(); tmp.AccountId = item.AccountId; tmp.AppKey = item.AppKey; tmp.AppSecret = item.AppSecret; tmp.ChargeAmount = item.ChargeAmount; tmp.ChargeComName = item.ChargeComName; tmp.ChargeId = item.ChargeId; tmp.ChargeName = item.ChargeName; tmp.ChargeTelephone = item.ChargeTelephone; tmp.IssueTime = item.IssueTime; tmp.RealAmount = item.RealAmount; tmp.Status = (int)item.Status; tmp.SysTypeName = item.SysType.ToString(); tmp.ShenHeBeiZhu = item.ShenHeBeiZhu; tmp.ShenHeRen = item.ShenHeRen; tmp.ShenHeShiJian = item.ShenHeShiJian; items.Add(tmp); } } return(items); }
/// <summary> /// 保存 /// </summary> private void Save() { string Msg = string.Empty; if (Utils.GetDecimal(Utils.GetFormValue("txtMoney")) == 0) { Msg += "请输入有效的充值金额!"; } if (!string.IsNullOrEmpty(Msg)) { Msg = UtilsCommons.AjaxReturnJson("0", Msg); } else { var setting = new EyouSoft.BLL.ComStructure.BComSetting().GetModel(CurrentUserCompanyID); if (setting != null && setting.SmsConfig != null && setting.SmsConfig.IsEnabled) { EyouSoft.Model.SmsStructure.MSmsBankChargeInfo model = new EyouSoft.Model.SmsStructure.MSmsBankChargeInfo(); model.AccountId = setting.SmsConfig.Account; model.AppKey = setting.SmsConfig.AppKey; model.AppSecret = setting.SmsConfig.AppSecret; model.ChargeAmount = Utils.GetDecimal(Utils.GetFormValue("txtMoney")); model.ChargeComName = SiteUserInfo.CompanyName; model.ChargeName = SiteUserInfo.Name; model.ChargeTelephone = SiteUserInfo.Telephone; model.IssueTime = DateTime.Now; model.Status = 0; bool Result = new EyouSoft.BLL.SmsStructure.BSmsAccount().SmsBankRecharge(model); Msg = Result ? UtilsCommons.AjaxReturnJson("1", "充值成功,正在审核中...") : UtilsCommons.AjaxReturnJson("0", "充值失败!"); } else { Msg = UtilsCommons.AjaxReturnJson("0", "操作失败,请联系客服!"); } } Response.Clear(); Response.Write(Msg); Response.End(); }