/// <summary> /// 账号充值 /// </summary> /// <param name="accountID">充值账号</param> /// <param name="quantity">充值数</param> /// <param name="operatorAccount">操作人</param> /// <returns></returns> public RPCResult AccountPrepaid(string accountID, uint quantity, string operatorAccount) { try { if (string.IsNullOrEmpty(accountID)) { LogHelper.LogWarn("SMSService", "SMSService.AccountPrepaid", "充值账号为空"); return(new RPCResult(false, "充值账号不能为空!")); } Account account = AccountDB.GetAccount(accountID);//AccountServer.Instance.GetAccount(accountID); if (account == null) { LogHelper.LogWarn("SMSService", "SMSService.AccountPrepaid", "充值账号不存在"); return(new RPCResult(false, "账号不存在")); } if (account.SMSNumber + (int)quantity < 0 && quantity > 10000000) { return(new RPCResult(false, "充值金额太大")); } if (AccountDB.AccountPrepaid(account.AccountID, (int)quantity)) { PrepaidRecordDB.Add(operatorAccount, accountID, quantity); return(new RPCResult(true, "充值成功")); } LogHelper.LogWarn("SMSService", "SMSService.AccountPrepaid", "充值数据库操作失败"); return(new RPCResult(false, "充值失败")); } catch (Exception ex) { LogHelper.LogError("SMSService", "SMSService.AccountPrepaid", ex.ToString()); return(new RPCResult(false, "充值失败")); } }
public void Test() { var oaccount = "operaterAccount"; var prepaidAccount = "prepaidAccount"; var b = PrepaidRecordDB.Add(oaccount, prepaidAccount, 100); Assert.IsTrue(b); var list = PrepaidRecordDB.Get(DateTime.MinValue, DateTime.MaxValue); Assert.IsTrue(list.Count > 0); }