示例#1
0
        public ActionResult withdraw(decimal?cashNum)
        {
            ReturnJson root = null;

            var agentEntity = agentBll.GetEntityByOpenId(CurrentWxUser.OpenId);

            if (string.IsNullOrEmpty(agentEntity.alipay))
            {
                //401,跳转到修改个人信息
                root = new ReturnJson {
                    code = 401, msg = "支付宝账号为空"
                };
            }
            else
            {
                if (cashNum >= 100 && cashNum < agentEntity.profit)
                {
                    var withdrawLogList = withBLL.GetList("{\"agent_id\":\"" + agentEntity.Id + "\",\"status\":\"" + 0 + "\"}");
                    if (withdrawLogList.Count() > 0)
                    {
                        //401,跳转到修改个人信息
                        root = new ReturnJson {
                            code = 400, msg = "已经存在未审核的提现申请记录"
                        };
                    }
                    //创建提现日志表
                    WithdrawLogEntity entity = new WithdrawLogEntity()
                    {
                        agent_id   = agentEntity.Id,
                        agent_name = agentEntity.nickname,
                        amount     = cashNum,
                        status     = 0
                    };
                    withBLL.SaveForm(null, entity);

                    Wechat_AgentEntity wechat_AgentEntity = new Wechat_AgentEntity()
                    {
                        profit  = agentEntity.profit - cashNum, //佣金-
                        Cashout = cashNum,                      //提现中+
                    };
                    agentBll.SaveForm(agentEntity.Id, wechat_AgentEntity);

                    root = new ReturnJson {
                        code = 200, msg = "success"
                    };
                }
                else
                {
                    root = new ReturnJson {
                        code = 400, msg = "提现金额不符"
                    };
                }
            }

            return(Json(root));
        }
示例#2
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(int?keyValue, WithdrawLogEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#3
0
 public ActionResult SaveForm(int?keyValue, WithdrawLogEntity entity)
 {
     withdrawlogbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }