예제 #1
0
        /// <summary>
        /// 提现申请
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public dynamic AddInfo(dynamic info)
        {
            try
            {
                if (DateTime.Now.Day != 20)
                {
                    return(new { status = 1, message = "只能在每月20号申请提现!" });
                }
                Guid    currentUserId = Guid.Parse(UserAuth.Current.Id);
                Account accountItme   = dataAccess.Find <Account>(currentUserId);
                if (accountItme.WithdrawPwd != (info.withdrawpwd.ToString()))
                {
                    return(new { status = 1, message = "提现密码错误,请重试!" });
                }

                decimal withdrawMoney = decimal.Parse(info.money.ToString());
                if (accountItme.Amount < withdrawMoney)
                {
                    return(new { status = 1, message = "申请提现金额超出个人账户余额!" });
                }

                WithdrawRecord item = new WithdrawRecord();
                item.Id         = Guid.NewGuid();
                item.CreateTime = DateTime.Now;
                item.Status     = WithdrawStatus.已申请;
                item.Money      = withdrawMoney;
                item.UserId     = currentUserId;

                accountItme.Amount -= withdrawMoney;
                dataAccess.Add <WithdrawRecord>(item);
                dataAccess.SaveChanges();
                return(new { status = 0, message = "提现申请已提交!" });
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteLog(this.GetType(), ex.Message);
                return(new { status = 1, message = ex.Message });
            }
        }
예제 #2
0
        public virtual async Task RenderListAsync(WithdrawRecord page, int pageIndex = 1)
        {
            try
            {
                var rows     = 20;
                var gteTime  = Convert.ToDateTime(page.DpStartTime.Text);
                var lteTime  = Convert.ToDateTime(page.DpEndTime.Text);
                var status   = (EnumWithdrawStatus)Convert.ToInt32(((ComboBoxItem)page.CmbStatus.SelectedValue).Tag.ToString());
                var response = await _onMainHostRequestPlugins.WithdrawRecordListAsync(new Application.Model.WithdrwaRecordGetRequest()
                {
                    Page        = pageIndex,
                    Rows        = rows,
                    Status      = status,
                    Types       = EnumAccountType.User,
                    GteTime     = gteTime,
                    LteTime     = lteTime,
                    AccessToken = AccountCache.Persist.AccessToken
                });

                if (response != null && response.Code == Application.Enums.ApiCodeEnums.ERROR_NOLOGIN)
                {
                    _onTipRender.ExecuteTip(page.BodyPanel, "登陆失效,请退出重新登陆");
                    _onRedirectRender.RedirectLogin();
                    return;
                }

                var resp = response.Data;
                #region 数据绑定

                _onControlRender.ThreadExecuteUI(() =>
                {
                    _onControlRender.BindFrameworkElement(page.DataGridOrderList, resp?.Data?.ToList() ?? null);

                    if ((resp.Data.Count()) <= 0)
                    {
                        page.SpPager.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        page.SpPager.Visibility = Visibility.Visible;
                    }

                    var sump                    = Convert.ToInt32(resp.TotalCount) % rows;
                    var totalPage               = Convert.ToInt32(resp?.TotalCount ?? 0) / rows + (sump > 0 ? 1 : 0);
                    page.labTotalPage.Content   = $"/{totalPage}";
                    page.labCurrentPage.Content = $"{pageIndex}";

                    page.labPrePage.Tag        = $"{pageIndex - 1}";
                    page.labPrePage.IsEnabled  = pageIndex > 1;
                    page.labNextPage.Tag       = $"{pageIndex + 1}";
                    page.labNextPage.IsEnabled = (pageIndex + 1) <= totalPage;
                    page.txbJumb.Tag           = totalPage;
                });
                #endregion
            }
            catch (Exception ex)
            {
                TextHelper.Error("RenderList 异常", ex);
                _onTipRender.ExecuteTip(page.BodyPanel, "查询异常[0001]");
            }
        }