Example #1
0
        /// <summary>
        /// 删除
        /// </summary>
        private string Delete(HttpContext context)
        {
            string uids       = context.Request["ids"];
            string activityId = context.Request["ActivityID"];

            if (bllActivity.Update(new ActivityDataInfo(), " IsDelete = 1 ", string.Format("UID in({0}) And ActivityID='{1}'", uids, activityId)) > 0)
            {
                foreach (var uid in uids.Split(','))//积分返还
                {
                    ActivityDataInfo model          = bllActivity.GetActivityDataInfo(activityId, int.Parse(uid));
                    JuActivityInfo   juActivityInfo = bllJuActivity.GetJuActivityByActivityID(model.ActivityID);
                    if ((juActivityInfo != null) && (juActivityInfo.ActivityIntegral > 0))
                    {
                        UserInfo userInfo = bllUser.GetUserInfoByOpenId(model.WeixinOpenID);
                        if (userInfo != null)
                        {
                            userInfo.TotalScore += juActivityInfo.ActivityIntegral;
                            if (bllUser.Update(new UserInfo(), string.Format(" TotalScore={0}", userInfo.TotalScore), string.Format(" AutoID={0}", userInfo.AutoID)) > 0)
                            {
                                //积分记录
                                BLLJIMP.Model.WBHScoreRecord record = new BLLJIMP.Model.WBHScoreRecord()
                                {
                                    InsertDate   = DateTime.Now,
                                    ScoreNum     = "+" + juActivityInfo.ActivityIntegral.ToString(),
                                    WebsiteOwner = bllUser.WebsiteOwner,
                                    UserId       = userInfo.UserID,
                                    NameStr      = "取消参加" + juActivityInfo.ActivityName,
                                    Nums         = "b55",
                                    RecordType   = "2",
                                };
                                bllUser.Add(record);
                                //积分记录
                            }
                            else
                            {
                                resp.Msg = "返还用户积分失败";
                                return(Common.JSONHelper.ObjectToJson(resp));
                            }
                        }
                    }
                }
                resp.Status = 1;
                bllLog.Add(BLLJIMP.Enums.EnumLogType.Activity, BLLJIMP.Enums.EnumLogTypeAction.Delete, bllLog.GetCurrUserID(), "删除活动报名数据[报名id=" + uids + ",活动id=" + activityId + "]");
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
        public void ProcessRequest(HttpContext context)
        {
            if (!string.IsNullOrEmpty(CurrentUserInfo.DistributionOffLinePreUserId))
            {
                apiResp.msg = "您已经是分销员";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            string           activityId = bll.GetDistributionOffLineApplyActivityID();
            ActivityDataInfo model      = bllActivity.GetActivityDataInfo(activityId, CurrentUserInfo.UserID);

            if (model == null)
            {
                apiResp.msg = "您还未申请";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            if (model.Status != 4003)//不是微转发审核通过的不给继续操作
            {
                apiResp.msg = "审核未通过";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            UserInfo commendUserInfo = bllUser.GetUserInfoByAutoID(int.Parse(model.DistributionOffLineRecommendCode));

            if (commendUserInfo == null)
            {
                apiResp.msg = "推荐人不存在";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }

            CurrentUserInfo.DistributionOffLinePreUserId = commendUserInfo.UserID;
            CurrentUserInfo.TrueName = model.Name;
            if (bllUser.Update(CurrentUserInfo))
            {
                //申请通过向申请人和上级提醒通过申请
                bllWeixin.SendTemplateMessageNotifyComm(commendUserInfo, string.Format("恭喜您的会员“{0}”申请财富会员成功", model.Name), "请提醒他关注公众号并帮助他熟悉系统操作吧。", string.Format("http://{0}/App/Distribution/m/index.aspx", context.Request.Url.Host));

                apiResp.status = true;
                apiResp.msg    = "ok ";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }
            else
            {
                apiResp.msg = "操作失败";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                ToLog("已经进入——ApplyActivity");

                var userInfo = bll.GetCurrentUserInfo();
                ToLog("userInfo:" + JsonConvert.SerializeObject(userInfo));

                string activityId = bll.GetDistributionOffLineApplyActivityID();
                ToLog("activityId:" + activityId);

                ActivityDataInfo model = bllActivity.GetActivityDataInfo(activityId, bll.GetCurrUserID());

                bool isEnroll = model != null;               //是否报过名

                int                       apply_status  = 0; //0未申请  1待审核 2已通过 4001已拒绝 4002 微转发通过
                string                    remarks       = string.Empty;
                List <SignField>          signfieldList = new List <SignField>();
                List <ActivityDataRecord> applyRecord   = new List <ActivityDataRecord>();
                var                       fieldList     = bllActivity.GetActivityFieldMappingList(activityId).Where(p => p.IsHideInSubmitPage != "1");
                //检查当前是否已经是分销员
                if (!string.IsNullOrWhiteSpace(userInfo.DistributionOffLinePreUserId))
                {
                    apply_status = 2;
                }
                else
                {
                    if (isEnroll)
                    {
                        //判断是待审核还是审核不通过
                        if (model.Status == 4001)
                        {
                            apply_status = 4001;
                            remarks      = model.Remarks;
                        }
                        //else if (model.Status==0&&(!string.IsNullOrEmpty(model.SpreadUserID)))//微转发待审核
                        //{
                        //    apply_status = 4002;
                        //    remarks = string.Format("您已报名过 {0}分享的活动 {1},系统正在审核中,审核通过可以直接成为平台会员",model.K59,model.K60);
                        //}
                        //else if (model.Status == 4003)//微转发审核通过
                        //{
                        //    apply_status = 4003;
                        //    remarks = string.Format("您已报名过 {0}分享的活动 {1},可以直接成为平台会员", model.K59, model.K60);
                        //}
                        else
                        {
                            apply_status = 1;
                        }

                        Type type = model.GetType();
                        //数据记录
                        foreach (var item in fieldList)
                        {
                            ActivityDataRecord record = new ActivityDataRecord();
                            record.field = item.FieldName;
                            record.value = type.GetProperty(item.FieldName).GetValue(model, null).ToString();
                            applyRecord.Add(record);
                        }

                        //分销推荐id加上
                        applyRecord.Add(new ActivityDataRecord()
                        {
                            field = "DistributionOffLineRecommendCode",
                            value = model.DistributionOffLineRecommendCode,
                        });
                    }
                    else
                    {
                        apply_status = 0;
                    }
                    //如果未报过名,把活动字段信息返回

                    foreach (var item in fieldList)
                    {
                        SignField signModel = new SignField();
                        signModel.key    = item.MappingName;
                        signModel.value  = item.FieldName;
                        signModel.isnull = item.FieldIsNull;
                        signfieldList.Add(signModel);
                    }


                    //分销推荐id加上
                    signfieldList.Add(new SignField()
                    {
                        key    = "推荐码",
                        value  = "DistributionOffLineRecommendCode",
                        isnull = 0
                    });
                }

                apiResp.result = new
                {
                    activity_id  = activityId,
                    is_enroll    = isEnroll,
                    signfield    = signfieldList,
                    apply_record = applyRecord,
                    apply_status = apply_status,
                    remarks      = remarks
                };
                apiResp.status = true;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }
            catch (Exception ex)
            {
                ToLog("活动状态异常:" + ex.Message);
                throw ex;
            }
        }