Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                ZentCloud.BLLJIMP.Model.Project model = bll.ConvertRequestToModel <ZentCloud.BLLJIMP.Model.Project>(new ZentCloud.BLLJIMP.Model.Project());
                model.UserId       = CurrentUserInfo.UserID;
                model.WebsiteOwner = bll.WebsiteOwner;
                model.InsertDate   = DateTime.Now;
                model.Status       = "待审核";
                model.ProjectId    = int.Parse(bll.GetGUID(BLLJIMP.TransacType.CommAdd));
                model.ProjectType  = "DistributionOffLine";

                string msg = "";
                if (!bll.CheckProjectInfo(model, out msg))
                {
                    apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    apiResp.msg  = msg;
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                    return;
                }
                if (bll.Add(model))
                {
                    apiResp.status = true;
                    apiResp.msg    = "ok";
                    ZentCloud.BLLJIMP.Model.ProjectLog log = new ZentCloud.BLLJIMP.Model.ProjectLog();
                    log.InsertDate   = DateTime.Now;
                    log.ProjectId    = model.ProjectId;
                    log.ProjectName  = model.ProjectName;
                    log.Remark       = string.Format("提交了项目{0} 操作人:{1}", model.ProjectName, bllUser.GetUserDispalyName(CurrentUserInfo));
                    log.Status       = model.Status = model.Status;
                    log.UserId       = CurrentUserInfo.UserID;
                    log.WebsiteOwner = bll.WebsiteOwner;
                    bll.Add(log);

                    #region 给管理员发送消息
                    var currWebSiteUserInfo = bll.GetCurrWebSiteUserInfo();
                    if (!string.IsNullOrEmpty(currWebSiteUserInfo.WeiXinKeFuOpenId))
                    {
                        bllWeixin.SendTemplateMessageNotifyComm(currWebSiteUserInfo, string.Format("提交项目申请"), string.Format("用户:{0}\\n提交了项目{1}", CurrentUserInfo.TrueName, model.ProjectName));
                    }
                    #endregion
                }
                else
                {
                    apiResp.msg = "提交失败";
                }
            }
            catch (Exception ex)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = ex.Message;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                BLLJIMP.Model.Project model = bll.ConvertRequestToModel <BLLJIMP.Model.Project>(new BLLJIMP.Model.Project());
                model.UserId       = CurrentUserInfo.UserID;
                model.WebsiteOwner = bll.WebsiteOwner;
                model.InsertDate   = DateTime.Now;
                model.Status       = "待审核";
                model.ProjectId    = int.Parse(bll.GetGUID(BLLJIMP.TransacType.CommAdd));

                string msg = "";

                if (bll.Add(model))
                {
                    apiResp.status = true;
                    apiResp.msg    = "ok";
                    BLLJIMP.Model.ProjectLog log = new BLLJIMP.Model.ProjectLog();
                    log.InsertDate   = DateTime.Now;
                    log.ProjectId    = model.ProjectId;
                    log.ProjectName  = model.ProjectName;
                    log.Remark       = string.Format("提交了 {0} 操作人:{1}", model.ProjectName, bllUser.GetUserDispalyName(CurrentUserInfo));
                    log.Status       = model.Status = model.Status;
                    log.UserId       = CurrentUserInfo.UserID;
                    log.WebsiteOwner = bll.WebsiteOwner;
                    bll.Add(log);
                }
                else
                {
                    apiResp.msg = "提交失败";
                }
            }
            catch (Exception ex)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = ex.Message;
            }

            context.Response.Write(JsonConvert.SerializeObject(apiResp));
        }
Exemple #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);
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            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);
            string     websiteOwner = bll.WebsiteOwner;
            List <int> idList       = new List <int>();

            foreach (var p in sourceList)
            {
                UserInfo pu = bllUser.GetUserInfo(p.UserId, websiteOwner);

                //积分明细
                UserScoreDetailsInfo scoreModel = new UserScoreDetailsInfo();
                if (pu != null)
                {
                    scoreModel.AddNote      = string.Format("申请提现未通过审核,返还{0}{1},编号:{2}", p.Score, moduleName, p.AutoID);
                    scoreModel.AddTime      = DateTime.Now;
                    scoreModel.Score        = p.Score;
                    scoreModel.UserID       = p.UserId;
                    scoreModel.ScoreType    = "RefuseWithdrawCash";
                    scoreModel.TotalScore   = pu.TotalScore + p.Score;
                    scoreModel.WebSiteOwner = websiteOwner;
                }

                //通知
                BLLJIMP.Model.SystemNotice notice = new BLLJIMP.Model.SystemNotice();
                if (pu != null)
                {
                    notice.Ncontent     = scoreModel.AddNote;
                    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=3,LastUpdateDate=getdate()"), string.Format("AutoID={0}", p.AutoID), tran) > 0;
                if (!result)
                {
                    idList.Add(p.AutoID);
                    tran.Rollback();
                    continue;
                }
                if (pu != null)
                {
                    result = bll.Update(pu, string.Format("TotalScore=TotalScore+{0}", p.Score), string.Format("UserID='{0}' And WebsiteOwner='{1}'", pu.UserID, websiteOwner), tran) > 0;
                    if (!result)
                    {
                        idList.Add(p.AutoID);
                        tran.Rollback();
                        continue;
                    }

                    result = bll.Add(scoreModel, tran);
                    if (!result)
                    {
                        idList.Add(p.AutoID);
                        tran.Rollback();
                        continue;
                    }
                    notice.SerialNum = bllUser.GetGUID(TransacType.SendSystemNotice);
                    result           = bll.Add(notice, tran);
                    if (!result)
                    {
                        idList.Add(p.AutoID);
                        tran.Rollback();
                        continue;
                    }
                }
                tran.Commit();
            }

            apiResp.status = true;
            apiResp.code   = (int)APIErrCode.IsSuccess;
            if (idList.Count == 0)
            {
                apiResp.msg = "处理完成";
            }
            else
            {
                apiResp.msg = string.Format("处理完成,编号[{0}]处理失败", ZentCloud.Common.MyStringHelper.ListToStr(idList, "", ","));
            }
            bll.ContextResponse(context, apiResp);
        }