Esempio n. 1
0
        //
        // GET: /Callback/
        public ActionResult Index()
        {
            Stream       postData    = Request.InputStream;
            StreamReader sRead       = new StreamReader(postData);
            string       postContent = sRead.ReadToEnd();

            sRead.Close();
            log.Error(postContent);
            int type = 0;//0.前台操作,1.后台操作

            var result = Request["response_content"];

            log.Error(result);

            //result = "[{\"opr_id\":\"0a50b06a-da9a-455b-a1a6-1a4dbb5f4d4a\",\"resolve_time\":\"2018-06-06 18:44:37\",\"status\":\"SUCCESS\",\"params\":{\"account_id\":30,\"count\":11,\"money\":1}}]";
            if (result == null)
            {
                return(Content(""));
            }
            var root = JsonHelper.JonsToList <Root>(result);

            if (root != null && root.Count > 0)
            {
                foreach (var example in root)
                {
                    if (example.opr_id == null)
                    {
                        continue;
                    }
                    List <DbParameter> parameter = new List <DbParameter>();
                    parameter.Add(DbFactory.CreateDbParameter("@Number", example.opr_id));
                    parameter.Add(DbFactory.CreateDbParameter("@Status", "0"));
                    var item = database.FindEntityByWhere <Am_Task>(" and Number=@Number and Status=@Status ", parameter.ToArray());
                    if (item == null || item.Number == null)
                    {
                        var bTast = database.FindEntityByWhere <Am_BackstageTask>(" and Number=@Number  and Status=@Status ", parameter.ToArray());

                        item = Mapper <Am_Task, Am_BackstageTask>(bTast);
                        if (item != null && item.Number != null)
                        {
                            type = 1;
                        }
                    }
                    //没有找任务
                    if (item == null || item.Number == null)
                    {
                        return(Content("SUCCESS"));
                    }

                    item.TaskMark = postContent;
                    if (example.status == "SUCCESS")
                    {
                        Success(result, example, item);
                    }
                    else if (example.status == "RESPONSE_FAIL")
                    {
                        item.Status    = 2;
                        item.StatusStr = "失败";
                        item.OverTime  = DateTime.Parse(example.resolve_time);
                        item.Remark    = example.error_msg;
                    }
                    else if (example.status == "FAIL")
                    {
                        item.Status    = 2;
                        item.StatusStr = "失败";
                        item.OverTime  = DateTime.Parse(example.resolve_time);
                    }
                    else if (example.status == "NOTSUPPORT")
                    {
                        item.Status    = 2;
                        item.StatusStr = "不支持此功能";
                        item.OverTime  = DateTime.Parse(example.resolve_time);
                    }
                    else if (example.status == "TIMEOUT")
                    {
                        item.Status    = 2;
                        item.StatusStr = "超时";
                        item.OverTime  = DateTime.Parse(example.resolve_time);
                    }
                    else if (example.status == "ACCEPTED")
                    {
                        item.StatusStr = "请求已接受";
                    }
                    else if (example.status == "QUEUE")
                    {
                        item.StatusStr = "调度状态";
                    }
                    else if (example.status == "PROCESSING")
                    {
                        item.StatusStr = "正在处理中";
                    }
                    else if (example.status == "RESPONSE_TIMEOUT")
                    {
                        if (item.OperateType != 4)
                        {
                            item.Status    = 2;
                            item.StatusStr = "超时失败";
                            item.OverTime  = DateTime.Parse(example.resolve_time);
                            item.Remark    = example.error_msg;
                        }
                    }

                    if (type == 0)
                    {
                        if (item.Remark == null)
                        {
                            item.Remark = "";
                        }
                        List <DbParameter> parTask = new List <DbParameter>();
                        parTask.Add(DbFactory.CreateDbParameter("@Status", item.Status));
                        parTask.Add(DbFactory.CreateDbParameter("@StatusStr", item.StatusStr));
                        parTask.Add(DbFactory.CreateDbParameter("@OverTime", item.OverTime));
                        parTask.Add(DbFactory.CreateDbParameter("@TaskMark", item.TaskMark));
                        parTask.Add(DbFactory.CreateDbParameter("@Remark", item.Remark));
                        parTask.Add(DbFactory.CreateDbParameter("@Number", item.Number));

                        StringBuilder sql = new StringBuilder("update Am_Task set Status=@Status,StatusStr=@StatusStr,OverTime=@OverTime,TaskMark=@TaskMark,Remark=@Remark  where Number=@Number  and Status = 0");
                        if (database.ExecuteBySql(sql, parTask.ToArray()) > 0)
                        {
                            if (item.OperateType == 4 && item.Status == 1)
                            {
                                var ammodel = database.FindEntity <Am_Ammeter>(item.AmmeterNumber);
                                //给余额加钱
                                var userModel = database.FindEntity <Ho_PartnerUser>(ammodel.UY_Number);
                                userModel.Money += item.Money;
                                userModel.Modify(userModel.Number);
                                database.Update(userModel);
                                //记录余额日志
                                var modeldetail = new Am_MoneyDetail()
                                {
                                    CreateTime     = DateTime.Now,
                                    CreateUserId   = item.U_Number,
                                    CreateUserName = item.UserName,
                                    CurrMoney      = userModel.Money + item.Money, //变动后余额
                                    Money          = item.Money,
                                    OperateType    = 4,
                                    OperateTypeStr = "电表充值",
                                    UserName       = userModel.Account,
                                    U_Name         = userModel.Name,
                                    U_Number       = userModel.Number,
                                    Number         = CommonHelper.GetGuid,
                                    Remark         = ""
                                };
                                database.Insert(modeldetail); //记录日志
                                                              //分账

                                List <DbParameter> parfisrt = new List <DbParameter>();
                                parfisrt.Add(DbFactory.CreateDbParameter("@U_Number", item.U_Number));

                                var    taskList = database.FindCount <Am_Task>(" and Status = 1 and OperateType = 4  and U_Number=@U_Number ", parfisrt.ToArray());
                                var    config   = database.FindList <Fx_WebConfig>().FirstOrDefault();
                                double fmoney   = 0;
                                double money    = 0;//1:1押金返还金额
                                if (taskList == 1)
                                {
                                    //首次充值
                                    fmoney = (item.Money.Value - config.AmDeposit.Value) * (1 - config.ChargeFee.Value);
                                }
                                else
                                {
                                    fmoney = item.Money.Value * (1 - config.ChargeFee.Value);
                                }
                                PayToPerson pay = new BusinessCard.Web.Code.PayToPerson();
                                try
                                {
                                    log.Error(fmoney.ToString("0.00"));
                                    var user = database.FindEntity <Ho_PartnerUser>(ammodel.UY_Number);
                                    if (user.FreezeMoney > 0) //首先要有押金
                                    {
                                        money = item.Money.Value * config.ChargeFee.Value;
                                        //如果返还的金额大于
                                        if (money > user.FreezeMoney)
                                        {
                                            money = user.FreezeMoney.Value;
                                        }
                                        fmoney += money;
                                    }

                                    PayToPersonModel m = pay.EnterprisePay(item.Number.Replace("-", ""), userModel.OpenId, decimal.Parse(fmoney.ToString("0.00")), userModel.Name, item.U_Name + ",电费缴费");
                                    log.Error(m.return_msg);
                                    if (m.result_code == "SUCCESS")//分成功
                                    {
                                        userModel.Money       -= item.Money;
                                        userModel.FreezeMoney -= money;
                                        userModel.Modify(userModel.Number);
                                        database.Update(userModel); //扣掉余额


                                        //添加押金返还记录
                                        var recordModel = new Am_AmDepositDetail()
                                        {
                                            CreateTime = DateTime.Now,
                                            CurrMoney  = user.FreezeMoney,
                                            Mark       = "押金1:1返还",
                                            Money      = money,
                                            UserName   = userModel.Account,
                                            U_Name     = userModel.Name,
                                            U_Number   = userModel.Number
                                        };
                                        recordModel.Create();
                                        database.Insert(recordModel); //添加返还记录


                                        //记录余额日志
                                        var modeldetail1 = new Am_MoneyDetail()
                                        {
                                            CreateTime     = DateTime.Now,
                                            CreateUserId   = item.U_Number,
                                            CreateUserName = item.UserName,
                                            CurrMoney      = userModel.Money - item.Money, //变动后余额
                                            Money          = -item.Money,
                                            OperateType    = 6,
                                            OperateTypeStr = "分账",
                                            UserName       = userModel.Account,
                                            U_Name         = userModel.Name,
                                            U_Number       = userModel.Number,
                                            Number         = CommonHelper.GetGuid,
                                            Remark         = ""
                                        };
                                        database.Insert(modeldetail1); //记录日志

                                        //记录分账信息
                                        var payToUser = new Am_PayToUserMoneyDetails()
                                        {
                                            CreateTime     = DateTime.Now,
                                            F_UName        = userModel.Name,
                                            Number         = CommonHelper.GetGuid,
                                            F_UserName     = userModel.Account,
                                            F_UserNumber   = userModel.Number,
                                            Money          = fmoney,
                                            MoneyFree      = money,
                                            ObjectNumber   = item.Number,
                                            OpenId         = userModel.OpenId,
                                            OperateType    = 1,
                                            OperateTypeStr = "电费充值",
                                            Remark         = "",
                                            TaskNumber     = "",
                                            TotalMoney     = item.Money,
                                            UName          = item.U_Name,
                                            UserName       = item.UserName,
                                            UserNumber     = item.U_Number
                                        };

                                        database.Insert <Am_PayToUserMoneyDetails>(payToUser);
                                    }
                                    else
                                    {
                                        log.Error(m.result_code);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    log.Error(ex.Message);
                                }
                            }
                        }
                    }
                    else
                    {
                        var bTask = Mapper <Am_BackstageTask, Am_Task>(item);
                        database.Update <Am_BackstageTask>(bTask);
                    }


                    if (item.Status > 0 && item.Status < 4)
                    {
                        AmmeterHandle(example, item);
                    }
                    if (item.Status == 2 && item.OperateType == 4)
                    {
                        List <DbParameter> par = new List <DbParameter>();
                        par.Add(DbFactory.CreateDbParameter("@Number", item.U_Number));
                        par.Add(DbFactory.CreateDbParameter("@Status", "3"));
                        var user = database.FindEntityByWhere <Ho_PartnerUser>(" and Number =@Number and Status=@Status ", par.ToArray());
                        if (user != null && user.Number != null)
                        {
                            user.Money = user.Money + item.Money;
                            database.Update <Ho_PartnerUser>(user);
                            var moneyDetail = new Am_MoneyDetail
                            {
                                Number         = CommonHelper.GetGuid,
                                CreateTime     = DateTime.Now,
                                CreateUserId   = user.Number,
                                CreateUserName = user.Name,
                                CurrMoney      = user.Money,
                                Money          = item.Money,
                                OperateType    = 6,
                                OperateTypeStr = "电费充值退款",
                                Remark         = "",
                                UserName       = user.Account,
                                U_Number       = user.Number
                            };
                            database.Insert <Am_MoneyDetail>(moneyDetail);
                            List <DbParameter> par1 = new List <DbParameter>();
                            par1.Add(DbFactory.CreateDbParameter("@Number", item.AmmeterNumber));
                            var ammeter = database.FindEntityByWhere <Am_Ammeter>(" and Number =@Number ", par1.ToArray());
                            //发送微信通知租户缴费失败
                            SendMessage(ammeter.Number, user.Number, ammeter.CurrMoney.Value.ToString("0.00"), "失败", item.Money.Value.ToString("0.00"), item.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:dd"));
                        }
                    }
                    if (item.Status > 0 && item.Status < 4)
                    {
                        return(Content("SUCCESS"));
                    }
                }
            }
            return(View());
        }
Esempio n. 2
0
        /// <summary>
        /// 更改提现状态
        /// </summary>
        /// <returns></returns>
        public ActionResult PayToBank(string KeyValue, int Status, string StatusStr)
        {
            IDatabase     database    = DataFactory.Database();
            DbTransaction isOpenTrans = database.BeginTrans();

            try
            {
                Am_UserGetMoneyToBank entity = repositoryfactory.Repository().FindEntity(KeyValue);
                if (entity == null || string.IsNullOrEmpty(entity.Number))
                {
                    return(Content(new JsonMessage {
                        Success = false, Code = "-1", Message = "数据异常"
                    }.ToString()));
                }
                if (entity.Status != 0)
                {
                    return(Content(new JsonMessage {
                        Success = false, Code = "-1", Message = "提现状态不正常"
                    }.ToString()));
                }
                entity.Modify(KeyValue);
                entity.Status    = Status;
                entity.StatusStr = StatusStr;
                entity.PayTime   = DateTime.Now;

                int IsOk = database.Update(entity, isOpenTrans); //更新提现状态
                Base_SysLogBll.Instance.WriteLog(KeyValue, OperationType.Update, IsOk > 0 ? "成功" : "失败", "提现操作");
                //更新用户信息表的押金金额
                var usermodel = database.FindEntity <Ho_PartnerUser>(entity.U_Number);
                if (usermodel == null || string.IsNullOrEmpty(usermodel.Number))
                {
                    database.Rollback();
                    return(Content(new JsonMessage {
                        Success = false, Code = "-1", Message = "数据异常"
                    }.ToString()));
                }
                if (Status == 9) //退还
                {
                    usermodel.Money += entity.Money;
                    usermodel.Modify(usermodel.Number);
                    database.Update(usermodel, isOpenTrans); //更新用户信息表
                                                             //添加押金返还记录1
                    var recordModel = new Am_MoneyDetail()
                    {
                        CreateTime     = DateTime.Now,
                        CurrMoney      = usermodel.Money,
                        CreateUserId   = ManageProvider.Provider.Current().UserId,
                        CreateUserName = ManageProvider.Provider.Current().UserName,
                        OperateType    = 6,
                        OperateTypeStr = "提现取消",
                        Money          = entity.Money,
                        UserName       = entity.UserName,
                        U_Name         = entity.U_Name,
                        U_Number       = entity.U_Number
                    };
                    recordModel.Create();
                    database.Insert(recordModel, isOpenTrans); //添加返还记录1
                }
                else //提现成功
                {
                    if (usermodel.FreezeMoney > 0) //首先要有押金
                    {
                        var money = entity.BankCharge;
                        //如果返还的金额大于
                        if (entity.BankCharge > usermodel.FreezeMoney)
                        {
                            money = usermodel.FreezeMoney;
                        }
                        usermodel.FreezeMoney -= money; //扣除手续费1:1返还
                        usermodel.Money       += money;
                        usermodel.Modify(usermodel.Number);
                        database.Update(usermodel, isOpenTrans); //更新用户信息表
                                                                 //添加押金返还记录
                        var recordModel = new Am_AmDepositDetail()
                        {
                            CreateTime = DateTime.Now,
                            CurrMoney  = usermodel.FreezeMoney,
                            Mark       = "押金1:1返还",
                            Money      = money,
                            UserName   = entity.UserName,
                            U_Name     = entity.U_Name,
                            U_Number   = entity.U_Number
                        };
                        recordModel.Create();
                        database.Insert(recordModel, isOpenTrans); //添加返还记录
                    }
                }
                database.Commit();
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = "操作成功"
                }.ToString()));
            }
            catch (Exception ex)
            {
                database.Rollback();
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 3
0
        public ActionResult WepayWebNotify()
        {
            //var _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
            WePayReturnModel payResult = new WePayReturnModel();
            WePay            _wePay    = new WePay();
            var result = _wePay.VerifyNotify(Request, out payResult);

            // _logger.Info("resultXml:" + payResult.RequestForm);


            if (result)
            {
                List <DbParameter> parameter = new List <DbParameter>();
                parameter.Add(DbFactory.CreateDbParameter("@OrderNumber", payResult.OutTradeNo));
                parameter.Add(DbFactory.CreateDbParameter("@STATUS", "0"));
                var order = database.FindEntityByWhere <Am_Charge>(" and OrderNumber=@OrderNumber and STATUS=@STATUS ", parameter.ToArray());
                if (order != null && order.Number != null)
                {
                    if (payResult.TotalFee == Decimal.Parse(order.Money.ToString()))
                    {
                        //var orderCommand = new Commands.TradeCenter.UpdateOrderStatusCommand(order.OrderId, 1);
                        //var status = await _commandService.SendAsync(orderCommand);
                        //if (status.Status == ECommon.IO.AsyncTaskStatus.Success)
                        //{
                        //    return Content(payResult.ReturnXml);
                        //}
                        if (order.ChargeType == 1) //余额充值
                        {
                            List <DbParameter> par = new List <DbParameter>();
                            par.Add(DbFactory.CreateDbParameter("@Number", order.U_Number));
                            var accout = database.FindEntityByWhere <Ho_PartnerUser>(" and Number=@Number", par.ToArray());
                            if (accout != null && accout.Number != null)
                            {
                                order.OutNumber = payResult.TradeNo;
                                order.STATUS    = 1;
                                order.StatusStr = "充值成功";
                                order.SucTime   = DateTime.Now;
                                database.Update <Am_Charge>(order);

                                accout.Money = accout.Money + order.Money;
                                var status = database.Update <Ho_PartnerUser>(accout);
                                if (status > 0)
                                {
                                    var moneyDetail = new Am_MoneyDetail
                                    {
                                        Number         = CommonHelper.GetGuid,
                                        CreateTime     = DateTime.Now,
                                        CreateUserId   = order.U_Number,
                                        CreateUserName = order.UserName,
                                        CurrMoney      = accout.Money,
                                        Money          = order.Money,
                                        OperateType    = 1,
                                        OperateTypeStr = "微信充值",
                                        Remark         = "",
                                        UserName       = order.UserName,
                                        U_Number       = order.U_Number
                                    };
                                    database.Insert <Am_MoneyDetail>(moneyDetail);

                                    return(Content(payResult.ReturnXml));
                                }
                            }
                        }
                        else if (order.ChargeType == 2) //电费缴费
                        {
                            order.OutNumber = payResult.TradeNo;
                            order.STATUS    = 1;
                            order.StatusStr = "充值成功";
                            order.SucTime   = DateTime.Now;
                            database.Update <Am_Charge>(order);

                            List <DbParameter> par = new List <DbParameter>();
                            par.Add(DbFactory.CreateDbParameter("@Number", order.AmmeterNumber));
                            var ammeter = database.FindEntityByWhere <Am_Ammeter>(" and Number=@Number", par.ToArray());
                            var item    = CommonClass.AmmeterApi.AmmeterRecharge(ammeter.Collector_Code, ammeter.AM_Code, ammeter.Acount_Id.Value, ammeter.Count.Value, int.Parse(order.Money.ToString()));
                            if (item.suc)
                            {
                                var task = new Am_Task
                                {
                                    AmmeterCode     = ammeter.AM_Code,
                                    AmmeterNumber   = ammeter.Number,
                                    Number          = item.opr_id,
                                    CollectorCode   = ammeter.Collector_Code,
                                    CollectorNumber = ammeter.Collector_Number,
                                    CreateTime      = DateTime.Now,
                                    OperateType     = 4,
                                    OperateTypeStr  = "微信充值",
                                    OrderNumber     = order.OrderNumber,
                                    OverTime        = DateTime.Now,
                                    Remark          = "",
                                    Status          = 0,
                                    StatusStr       = "队列中",
                                    TaskMark        = "",
                                    UserName        = order.UserName,
                                    U_Name          = order.U_Name,
                                    U_Number        = order.U_Number,
                                    Money           = order.Money
                                };
                                database.Insert <Am_Task>(task);
                            }
                            return(Content(payResult.ReturnXml));
                        }
                        else if (order.ChargeType == 3)  //账单支付
                        {
                            order.OutNumber = payResult.TradeNo;
                            order.STATUS    = 1;
                            order.StatusStr = "缴费成功";
                            order.SucTime   = DateTime.Now;
                            database.Update <Am_Charge>(order);

                            List <DbParameter> par = new List <DbParameter>();
                            par.Add(DbFactory.CreateDbParameter("@Number", order.ObjectNumber));
                            par.Add(DbFactory.CreateDbParameter("@Status", "1"));
                            var bill = database.FindEntityByWhere <Am_Bill>(" and Number=@Number and Status=@Status ", par.ToArray());

                            if (bill != null && bill.Number != null)
                            {
                                bill.Status    = 2;
                                bill.StatusStr = "已支付";
                                bill.PayTime   = DateTime.Now;

                                List <DbParameter> parBill = new List <DbParameter>();
                                parBill.Add(DbFactory.CreateDbParameter("@Number", bill.Number));
                                parBill.Add(DbFactory.CreateDbParameter("@Status", bill.Status));
                                parBill.Add(DbFactory.CreateDbParameter("@StatusStr", bill.StatusStr));
                                parBill.Add(DbFactory.CreateDbParameter("@PayTime", bill.PayTime));

                                StringBuilder sql = new StringBuilder("update Am_Bill set Status=@Status,PayTime=@PayTime,StatusStr=@StatusStr where Number=@Number  and Status = 1");

                                if (database.ExecuteBySql(sql, parBill.ToArray()) > 0)
                                {
                                    //押金
                                    UserDeposit(bill);

                                    var ammodel = database.FindEntity <Am_Ammeter>(bill.AmmeterNumber);
                                    //给余额加钱
                                    var userModel = database.FindEntity <Ho_PartnerUser>(ammodel.UY_Number);
                                    userModel.Money += bill.Money;
                                    userModel.Modify(userModel.Number);
                                    database.Update(userModel);
                                    //记录余额日志
                                    var modeldetail = new Am_MoneyDetail()
                                    {
                                        CreateTime     = DateTime.Now,
                                        CreateUserId   = userModel.Number,
                                        CreateUserName = userModel.Account,
                                        CurrMoney      = userModel.Money + bill.Money, //变动后余额
                                        Money          = bill.Money,
                                        OperateType    = 4,
                                        OperateTypeStr = "账单缴费",
                                        UserName       = userModel.Account,
                                        U_Name         = userModel.Name,
                                        U_Number       = userModel.Number,
                                        Number         = CommonHelper.GetGuid,
                                        Remark         = ""
                                    };
                                    database.Insert(modeldetail); //记录日志
                                                                  //分账
                                    var    config = database.FindList <Fx_WebConfig>().FirstOrDefault();
                                    double fmoney = 0;
                                    double money  = 0;//1:1押金返还金额
                                    fmoney = bill.Money.Value * (1 - config.ChargeFee.Value);
                                    PayToPerson pay = new BusinessCard.Web.Code.PayToPerson();
                                    try
                                    {
                                        var user = database.FindEntity <Ho_PartnerUser>(ammodel.UY_Number);
                                        if (user.FreezeMoney > 0) //首先要有押金
                                        {
                                            money = bill.Money.Value * config.ChargeFee.Value;
                                            //如果返还的金额大于
                                            if (money > user.FreezeMoney)
                                            {
                                                money = user.FreezeMoney.Value;
                                            }
                                            fmoney += money;
                                        }

                                        PayToPersonModel m = pay.EnterprisePay(bill.Number.Replace("-", ""), userModel.OpenId, decimal.Parse(fmoney.ToString("0.00")), userModel.Name, bill.T_U_Name + ",账单支付");
                                        if (m.result_code == "SUCCESS")//分成功
                                        {
                                            userModel.Money       -= bill.Money;
                                            userModel.FreezeMoney -= money;
                                            userModel.Modify(userModel.Number);
                                            database.Update(userModel); //扣掉余额


                                            //添加押金返还记录
                                            var recordModel = new Am_AmDepositDetail()
                                            {
                                                CreateTime = DateTime.Now,
                                                CurrMoney  = user.FreezeMoney,
                                                Mark       = "押金1:1返还",
                                                Money      = money,
                                                UserName   = userModel.Account,
                                                U_Name     = userModel.Name,
                                                U_Number   = userModel.Number
                                            };
                                            recordModel.Create();
                                            database.Insert(recordModel); //添加返还记录


                                            //记录余额日志
                                            var modeldetail1 = new Am_MoneyDetail()
                                            {
                                                CreateTime     = DateTime.Now,
                                                CreateUserId   = userModel.Number,
                                                CreateUserName = userModel.Account,
                                                CurrMoney      = userModel.Money - bill.Money, //变动后余额
                                                Money          = -bill.Money,
                                                OperateType    = 6,
                                                OperateTypeStr = "分账",
                                                UserName       = userModel.Account,
                                                U_Name         = userModel.Name,
                                                U_Number       = userModel.Number,
                                                Number         = CommonHelper.GetGuid,
                                                Remark         = ""
                                            };
                                            database.Insert(modeldetail1); //记录日志

                                            //记录分账信息
                                            var payToUser = new Am_PayToUserMoneyDetails()
                                            {
                                                CreateTime     = DateTime.Now,
                                                F_UName        = userModel.Name,
                                                Number         = CommonHelper.GetGuid,
                                                F_UserName     = userModel.Account,
                                                F_UserNumber   = userModel.Number,
                                                Money          = fmoney,
                                                MoneyFree      = money,
                                                ObjectNumber   = bill.Number,
                                                OpenId         = userModel.OpenId,
                                                OperateType    = 1,
                                                OperateTypeStr = "账单缴费",
                                                Remark         = "",
                                                TaskNumber     = "",
                                                TotalMoney     = bill.Money,
                                                UName          = bill.T_U_Name,
                                                UserName       = bill.T_UserName,
                                                UserNumber     = bill.T_U_Number
                                            };

                                            database.Insert <Am_PayToUserMoneyDetails>(payToUser);
                                        }
                                        else
                                        {
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }
                                return(Content(payResult.ReturnXml));
                            }
                            //发送微信通知
                        }
                    }
                }
            }
            return(Content(BuildWepayReturnXml("FAIL", "")));
        }