Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            BLLJIMP.BLLDistributionOffLine bll = new BLLJIMP.BLLDistributionOffLine();
            BLLJIMP.BLLUser bllUser            = new BLLJIMP.BLLUser();

            int pageIndex  = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1; //页码
            int pageSize   = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10;  //页数
            int totalCount = 0;
            var sourceList = bll.QueryWithdrawCashList(pageIndex, pageSize, CurrentUserInfo.UserID, out totalCount, "", context.Request["type"]);
            var list       = from p in sourceList
                             select new
            {
                id     = p.AutoID,                       //申请编号
                amount = p.Amount,                       //金额
                status = ConvertStatus(p.Status),        //状态
                time   = bll.GetTimeStamp(p.InsertDate), //时间
                score  = p.Score
            };
            var data = new
            {
                totalcount = totalCount,
                list       = list
            };

            apiResp.status = true;
            apiResp.msg    = "ok";
            apiResp.result = data;
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            BLLJIMP.BLLDistributionOffLine bll = new BLLJIMP.BLLDistributionOffLine();
            BLLJIMP.BLLUser bllUser            = new BLLJIMP.BLLUser();

            int page = !string.IsNullOrEmpty(context.Request["page"]) ? int.Parse(context.Request["page"]) : 1;  //页码
            int rows = !string.IsNullOrEmpty(context.Request["rows"]) ? int.Parse(context.Request["rows"]) : 10; //页数

            string userId       = "";
            string keyword      = context.Request["keyword"];
            string websiteowner = bllUser.WebsiteOwner;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                BLLJIMP.Model.UserInfo u = bllUser.GetUserInfo(keyword, websiteowner);
                if (u != null)
                {
                    userId = u.UserID;
                }
                if (string.IsNullOrWhiteSpace(userId))
                {
                    u = bllUser.GetUserInfoByPhone(keyword, websiteowner);
                    if (u != null)
                    {
                        userId = u.UserID;
                    }
                }
                if (string.IsNullOrWhiteSpace(userId))
                {
                    List <BLLJIMP.Model.UserInfo> ul = bllUser.GetUsersByLikeName(keyword, websiteowner);
                    if (ul.Count > 1)
                    {
                        userId = ZentCloud.Common.MyStringHelper.ListToStr(ul.Select(p => p.UserID).ToList(), "'", ",");
                    }
                    else if (ul.Count == 1)
                    {
                        userId = ul[0].UserID;
                    }
                }

                if (string.IsNullOrWhiteSpace(userId))
                {
                    userId = "-999";
                }
            }
            int            total      = 0;
            var            sourceList = bll.QueryWithdrawCashList(page, rows, userId, out total, context.Request["status"], context.Request["type"]);
            List <dynamic> list       = new List <dynamic>();

            if (sourceList.Count > 0)
            {
                foreach (var p in sourceList)
                {
                    BLLJIMP.Model.UserInfo u = bllUser.GetUserInfo(p.UserId, websiteowner);
                    list.Add(new
                    {
                        id       = p.AutoID,
                        amount   = p.Amount,                       //金额
                        status   = ConvertStatus(p.Status),        //状态
                        time     = bll.GetTimeStamp(p.InsertDate), //时间
                        score    = p.Score,
                        username = u == null ? p.UserId : bllUser.GetUserDispalyName(u)
                    });
                }
            }
            apiResp.status = true;
            apiResp.code   = (int)APIErrCode.IsSuccess;
            apiResp.msg    = "ok";
            apiResp.result = new{
                totalcount = total,
                list       = list
            };

            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            BLLJIMP.BLLDistributionOffLine bll = new BLLJIMP.BLLDistributionOffLine();
            BllPay    bllPay     = new BllPay();
            BLLWeixin bllWeixin  = new BLLWeixin();
            string    ids        = context.Request["ids"];
            string    moduleName = "积分";

            if (!string.IsNullOrWhiteSpace(context.Request["module_name"]))
            {
                moduleName = context.Request["module_name"];
            }

            int total = 0;

            if (string.IsNullOrWhiteSpace(ids))
            {
                apiResp.msg  = "请选中申请";
                apiResp.code = (int)APIErrCode.IsNotFound;
                bll.ContextResponse(context, apiResp);
                return;
            }
            var sourceList = bll.QueryWithdrawCashList(1, int.MaxValue, null, out total, "0", context.Request["type"], ids);

            if (sourceList.Count == 0)
            {
                apiResp.msg  = "选中的申请无待审核申请";
                apiResp.code = (int)APIErrCode.IsNotFound;
                bll.ContextResponse(context, apiResp);
                return;
            }

            string websiteOwner = bll.WebsiteOwner;
            string ip           = System.Web.HttpContext.Current.Request.UserHostAddress;
            int    snum         = 0;

            foreach (var p in sourceList)
            {
                UserInfo pu = bllUser.GetUserInfo(p.UserId, websiteOwner);
                if (pu == null || string.IsNullOrWhiteSpace(pu.WXOpenId))
                {
                    apiResp.status = snum > 0;
                    apiResp.msg    = string.Format("编号:{0},审核出错,用户信息有误", p.AutoID);
                    apiResp.code   = (int)APIErrCode.OperateFail;
                    bll.ContextResponse(context, apiResp);
                    return;
                }
                //通知
                BLLJIMP.Model.SystemNotice notice = new BLLJIMP.Model.SystemNotice();
                notice.Ncontent     = string.Format("申请提现通过审核,编号:{0}", p.AutoID);
                notice.UserId       = currentUserInfo.UserID;
                notice.Receivers    = pu.UserID;
                notice.SendType     = 2;
                notice.Title        = "申请提现通过审核";
                notice.NoticeType   = 1;
                notice.WebsiteOwner = websiteOwner;
                notice.InsertTime   = DateTime.Now;

                BLLTransaction tran   = new BLLTransaction();
                bool           result = bll.Update(p, string.Format("Status=2,LastUpdateDate=getdate()"), string.Format("AutoID={0}", p.AutoID), tran) > 0;
                if (!result)
                {
                    tran.Rollback();
                    apiResp.status = snum > 0;
                    apiResp.msg    = string.Format("编号:{0},审核出错", p.AutoID);
                    apiResp.code   = snum > 0 ? (int)APIErrCode.IsSuccess : (int)APIErrCode.OperateFail;
                    bll.ContextResponse(context, apiResp);
                    return;
                }
                string msg = "";
                if (bllPay.WeixinTransfers(p.AutoID.ToString(), p.RealAmount, pu.WXOpenId, ip, out msg, "提现"))
                {
                    //发送微信模板消息
                    bllWeixin.SendTemplateMessageNotifyComm(pu, "您提现的佣金已经到账", string.Format("提现金额:{0}元。请查看微信钱包", p.RealAmount));
                    //发送微信模板消息

                    //发送通知
                    notice.SerialNum = bllUser.GetGUID(TransacType.SendSystemNotice);
                    bll.Add(notice);
                    //发送通知
                }
                else//打款失败
                {
                    tran.Rollback();
                    apiResp.status = snum > 0;
                    apiResp.msg    = string.Format("编号:{0},微信打款出错 : {1}", p.AutoID, msg);
                    apiResp.code   = snum > 0 ? (int)APIErrCode.IsSuccess : (int)APIErrCode.OperateFail;
                    bll.ContextResponse(context, apiResp);
                    return;
                }

                tran.Commit();
                snum++;
            }

            if (snum == 0)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "审核失败";
            }
            else
            {
                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = string.Format("审核完成");
            }
            bll.ContextResponse(context, apiResp);
        }