示例#1
0
        /// <summary>
        /// 课程基本设置
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditOpenConfig(HttpContext context)
        {
            string Creater = context.Request["Creater"];

            if (string.IsNullOrWhiteSpace(Creater))
            {
                resp.Status = (int)APIErrCode.PrimaryKeyIncomplete;
                resp.Msg    = "创建人不能为空";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bllUserExpand.ExistUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID))
            {
                bllUserExpand.UpdateUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater);
            }
            else
            {
                bllUserExpand.AddUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater);
            }

            string OpenClassNotice = context.Request["OpenClassNotice"];

            if (!string.IsNullOrWhiteSpace(OpenClassNotice))
            {
                BLLKeyValueData bllKeyValueData = new BLLKeyValueData();

                KeyVauleDataInfo value = new KeyVauleDataInfo();
                value.DataType     = "OpenClassNotice";
                value.DataKey      = "0";
                value.DataValue    = OpenClassNotice;
                value.Creater      = this.currentUserInfo.UserID;
                value.WebsiteOwner = bll.WebsiteOwner;
                value.CreateTime   = DateTime.Now;
                bllKeyValueData.PutDataValue(value);
            }

            resp.Status = 1;
            resp.Msg    = "修改完成";
            return(Common.JSONHelper.ObjectToJson(resp));
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(Request.InputStream);
                try
                {
                    xmlDoc.Save(string.Format("C:\\WXPay\\Notify{0}.xml", DateTime.Now.ToString("yyyyMMddHHmmssfff")));
                }
                catch (Exception)
                {
                }
                //全部参数
                Dictionary <string, string> parametersAll = new Dictionary <string, string>();
                foreach (XmlElement item in xmlDoc.DocumentElement.ChildNodes)
                {
                    string key   = item.Name;
                    string value = item.InnerText;
                    if ((!string.IsNullOrEmpty(key)) && (!string.IsNullOrEmpty(value)))
                    {
                        parametersAll.Add(key, value);
                    }
                }

                parametersAll = (from entry in parametersAll
                                 orderby entry.Key ascending
                                 select entry).ToDictionary(pair => pair.Key, pair => pair.Value);//全部参数排序

                BllOrder bllOrder = new BllOrder();
                BLLJIMP.Model.OrderPay orderPay = bllOrder.GetOrderPay(parametersAll["out_trade_no"], "", bllOrder.WebsiteOwner);

                BllPay    bllPay    = new BllPay();
                PayConfig payConfig = bllPay.GetPayConfig();
                if (bllPay.VerifySignatureWx(parametersAll, payConfig.WXPartnerKey))//验证签名
                {
                    if (orderPay == null)
                    {
                        Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                        return;
                    }

                    if (orderPay.Status == 1)
                    {
                        Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
                        return;
                    }
                    orderPay.Status = 1;
                    if (bllOrder.Update(orderPay))
                    {
                        BLLUser bllUser = new BLLUser();
                        if (orderPay.Type == "1")
                        {
                            int score = 0;
                            int.TryParse(orderPay.Ex1, out score);
                            BLLKeyValueData bllKeyValueData  = new BLLKeyValueData();
                            string          ScoreDispalyName = bllKeyValueData.GetDataVaule("ScoreDispalyName", "1", bllKeyValueData.WebsiteOwner);

                            string msg = "消费" + orderPay.Total_Fee + "元,充值" + score + ScoreDispalyName;
                            if (bllUser.AddUserScoreDetail(orderPay.UserId, EnumStringHelper.ToString(ScoreDefineType.Recharge), bllUser.WebsiteOwner, score, msg))
                            {
                                Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
                            }
                            else
                            {
                                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                            }
                            //BLLSystemNotice bllSystemNotice = new BLLSystemNotice();
                            //bllSystemNotice.SendNotice(BLLSystemNotice.NoticeType.SystemMessage, null, null, orderPay.UserId, msg);
                        }
                        else if (orderPay.Type == "2")
                        {
                            string invoiceMsg;
                            if (orderPay.Ex1 == "1")
                            {
                                invoiceMsg = "带发票,";
                            }
                            else
                            {
                                invoiceMsg = "无发票,";
                            }

                            string msg = "充值VIP," + invoiceMsg + "消费" + orderPay.Total_Fee.ToString() + "元";


                            BLLKeyValueData bllKeyValueData = new BLLKeyValueData();
                            string          VIPDatelong     = bllKeyValueData.GetDataVaule("VIPDatelong", "1", bllKeyValueData.WebsiteOwner);
                            if (string.IsNullOrWhiteSpace(VIPDatelong))
                            {
                                VIPDatelong = "12";
                            }
                            int datelong = Convert.ToInt32(VIPDatelong);

                            BLLUserExpand bllUserExpand = new BLLUserExpand();
                            UserExpand    userVip       = bllUserExpand.GetUserExpand(BLLJIMP.Enums.UserExpandType.UserIsVip, orderPay.UserId);
                            string        userVipEndDate;
                            if (userVip == null || DateTime.Parse(userVip.DataValue) < DateTime.Now)
                            {
                                userVipEndDate = DateTime.Now.AddMonths(datelong).ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                userVipEndDate = DateTime.Parse(userVip.DataValue).AddMonths(datelong).ToString("yyyy-MM-dd");
                            }
                            bllUserExpand.UpdateUserExpand(BLLJIMP.Enums.UserExpandType.UserIsVip, orderPay.UserId, userVipEndDate);

                            //更新用户字段
                            UserScoreDetailsInfo scoreModel = new UserScoreDetailsInfo();
                            scoreModel.AddNote   = msg;
                            scoreModel.AddTime   = DateTime.Now;
                            scoreModel.Score     = 0;
                            scoreModel.UserID    = orderPay.UserId;
                            scoreModel.ScoreType = "RechargeVIP";
                            UserInfo currUser = bllUser.GetUserInfo(orderPay.UserId);
                            scoreModel.TotalScore   = currUser.TotalScore;
                            scoreModel.WebSiteOwner = currUser.WebsiteOwner;
                            if (bllUser.Add(scoreModel))
                            {
                                BLLSystemNotice bllSystemNotice = new BLLSystemNotice();
                                bllSystemNotice.SendNotice(BLLSystemNotice.NoticeType.SystemMessage, null, null, orderPay.UserId, msg);

                                Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
                            }
                            else
                            {
                                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                            }
                        }

                        return;
                    }
                    else
                    {
                        Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                        return;
                    }
                }
                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
            }
            catch (Exception)
            {
                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
            }
        }
示例#3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string       data = context.Request["data"];
            RequestModel requestModel;

            try
            {
                requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(context.Request["data"]);
            }
            catch (Exception)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "json格式错误,请检查";
                bllActivity.ContextResponse(context, apiResp);
                return;
            }
            if (string.IsNullOrEmpty(requestModel.activity_name))
            {
                apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                apiResp.msg  = "请输入名称";
                bllActivity.ContextResponse(context, apiResp);
                return;
            }
            if (requestModel.activity_start_time <= 0)
            {
                apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                apiResp.msg  = "请输入开始时间";
                bllActivity.ContextResponse(context, apiResp);
                return;
            }
            if (requestModel.credit_acount > 0 && CurrentUserInfo.CreditAcount < requestModel.credit_acount)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "信用金不足";
                bllActivity.ContextResponse(context, apiResp);
                return;
            }
            if (string.IsNullOrWhiteSpace(requestModel.user_longitude))
            {
                requestModel.user_longitude = CurrentUserInfo.LastLoginLongitude;
            }
            if (string.IsNullOrWhiteSpace(requestModel.user_latitude))
            {
                requestModel.user_latitude = CurrentUserInfo.LastLoginLatitude;
            }
            //string isReplaceN = context.Request["isReplaceN"];
            JuActivityInfo model = new JuActivityInfo();

            model.UserID            = bllUser.GetCurrentUserInfo().UserID;
            model.JuActivityID      = int.Parse(bllUser.GetGUID(BLLJIMP.TransacType.ActivityAdd));
            model.ActivityName      = requestModel.activity_name;
            model.ActivityStartDate = DateTimeHelper.UnixTimestampToDateTime(requestModel.activity_start_time);

            if (requestModel.activity_stop_time == 0)
            {
                BLLKeyValueData bllKeyValue = new BLLKeyValueData();
                string          hourStr     = bllKeyValue.GetDataDefVaule("StartToEndHourNum", "Appointment", "3");
                model.ActivityEndDate = model.ActivityStartDate.Value.AddHours(Convert.ToDouble(hourStr));
            }
            else
            {
                model.ActivityEndDate = DateTimeHelper.UnixTimestampToDateTime(requestModel.activity_stop_time);
            }
            model.ActivityAddress     = requestModel.activity_address;
            model.ActivityDescription = requestModel.activity_content;
            model.ThumbnailsPath      = requestModel.activity_img_url;
            model.IsHide = requestModel.activity_status;
            model.Sort   = requestModel.activity_sort;
            //model.IsFee = Convert.ToInt32(context.Request["IsFee"]);
            // model.ArticleTemplate = Convert.ToInt32(context.Request["ArticleTemplate"]);
            //model.TopImgPath = context.Request["TopImgPath"];

            //model.ActivityLecturer = context.Request["ActivityLecturer"];
            //model.ArticleTypeEx1 = context.Request["ArticleTypeEx1"];
            model.ActivityIntegral = requestModel.activity_score;
            //model.IsByWebsiteContent = Convert.ToInt32(context.Request["IsByWebsiteContent"]);
            model.LastUpdateDate = DateTime.Now;
            model.Summary        = requestModel.acitvity_summary;
            if (model.ActivityDescription != null)
            {
                model.ActivityDescription = model.ActivityDescription.Replace("\n", "<br />");
            }
            model.CreateDate = DateTime.Now;
            //model.IsSpread = Convert.ToInt32(context.Request["IsSpread"]);
            model.ArticleType = "Appointment";
            //model.ActivityNoticeKeFuId = context.Request["ActivityNoticeKeFuId"];
            model.CategoryId = requestModel.category_id.ToString();
            //model.IsShowPersonnelList = int.Parse(string.IsNullOrEmpty(context.Request["IsShowPersonnelList"]) ? "0" : context.Request["IsShowPersonnelList"]);
            //model.ShowPersonnelListType = int.Parse(string.IsNullOrEmpty(context.Request["ShowPersonnelListType"]) ? "0" : context.Request["ShowPersonnelListType"]);
            model.MaxSignUpTotalCount = requestModel.activity_max_signup_count;
            model.Tags                  = requestModel.activity_tags;
            model.K1                    = requestModel.activity_ex1;
            model.K2                    = requestModel.activity_ex2;
            model.K3                    = requestModel.activity_ex3;
            model.K4                    = requestModel.activity_ex4;
            model.K5                    = requestModel.activity_ex5;
            model.K6                    = requestModel.activity_ex6;
            model.K7                    = requestModel.activity_ex7;
            model.K8                    = requestModel.activity_ex8;
            model.K9                    = requestModel.activity_ex9;
            model.K10                   = requestModel.activity_ex10;
            model.ProvinceCode          = requestModel.province_code;
            model.Province              = requestModel.province;
            model.CityCode              = requestModel.city_code;
            model.City                  = requestModel.city;
            model.DistrictCode          = requestModel.district_code;
            model.District              = requestModel.district;
            model.RootCateId            = requestModel.rootcate_id;
            model.CreditAcount          = requestModel.credit_acount;
            model.GuaranteeCreditAcount = requestModel.guarantee_credit_acount;
            model.UserLongitude         = requestModel.user_longitude;
            model.UserLatitude          = requestModel.user_latitude;
            model.AccessLevel           = requestModel.activity_access_level;
            if (string.IsNullOrWhiteSpace(requestModel.limit_signup_pass_count))
            {
                model.LimitSignUpPassCount = 1;
            }
            else
            {
                model.LimitSignUpPassCount = Convert.ToInt32(requestModel.limit_signup_pass_count);
            }
            List <string> tagList = null;

            if (!string.IsNullOrWhiteSpace(model.Tags))
            {
                tagList = model.Tags.Split(',').ToList();
            }

            bllActivity.SetJuActivityContentTags(model.JuActivityID, tagList);

            model.PV            = requestModel.activity_pv;
            model.IsSignUpJubit = 1;
            model.WebsiteOwner  = bllActivity.WebsiteOwner;

            ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction();

            try
            {
                if (model.IsSignUpJubit == 1)
                {
                    //自动创建报名活动
                    ActivityInfo signUpActivityModel = new ActivityInfo();
                    signUpActivityModel.ActivityID          = bllActivity.GetGUID(ZentCloud.BLLJIMP.TransacType.ActivityAdd);
                    signUpActivityModel.UserID              = bllUser.GetCurrUserID();
                    signUpActivityModel.ActivityName        = model.ActivityName;
                    signUpActivityModel.ActivityDate        = model.ActivityStartDate;
                    signUpActivityModel.ActivityAddress     = model.ActivityAddress;
                    signUpActivityModel.ActivityWebsite     = model.ActivityWebsite;
                    signUpActivityModel.ActivityStatus      = requestModel.activity_status;
                    signUpActivityModel.LimitCount          = 100;
                    signUpActivityModel.ActivityDescription = string.Format("该任务为活动{0}自动创建", model.JuActivityID);
                    signUpActivityModel.WebsiteOwner        = model.WebsiteOwner;

                    //设置自动生成的ID
                    model.SignUpActivityID = signUpActivityModel.ActivityID;

                    if (!bllActivity.Add(signUpActivityModel, tran))
                    {
                        tran.Rollback();
                        apiResp.code = 1;
                        apiResp.msg  = "添加活动出错!";
                        bllActivity.ContextResponse(context, apiResp);
                        return;
                    }

                    //添加默认字段
                    //添加自定义字段
                    List <ActivityFieldMappingInfo> fieldData = new List <ActivityFieldMappingInfo>();

                    string FieldNameListStr = context.Request["FieldNameList"];

                    if (!string.IsNullOrEmpty(FieldNameListStr))
                    {
                        List <string> FieldNameList = FieldNameListStr.Split(',').ToList();
                        if (FieldNameList.Count <= 60)
                        {
                            for (int i = 0; i < FieldNameList.Count; i++)
                            {
                                fieldData.Add(new ActivityFieldMappingInfo()
                                {
                                    ActivityID     = model.SignUpActivityID,
                                    ExFieldIndex   = (i + 1),
                                    FieldIsDefauld = 0,
                                    FieldType      = 0,
                                    MappingName    = FieldNameList[i]
                                });
                            }
                        }
                        else
                        {
                            tran.Rollback();
                            apiResp.code = 1;
                            apiResp.msg  = "最多新增60个报名字段!";
                            bllActivity.ContextResponse(context, apiResp);
                            return;
                        }
                    }
                    else
                    {
                        fieldData = new List <ActivityFieldMappingInfo>()
                        {
                            new ActivityFieldMappingInfo()
                            {
                                ActivityID     = model.SignUpActivityID,
                                ExFieldIndex   = 1,
                                FieldIsDefauld = 0,
                                FieldType      = 0,
                                FormatValiFunc = "email",
                                MappingName    = "邮箱"
                            },
                            new ActivityFieldMappingInfo()
                            {
                                ActivityID     = model.SignUpActivityID,
                                ExFieldIndex   = 2,
                                FieldIsDefauld = 0,
                                FieldType      = 0,
                                MappingName    = "公司"
                            },
                            new ActivityFieldMappingInfo()
                            {
                                ActivityID     = model.SignUpActivityID,
                                ExFieldIndex   = 3,
                                FieldIsDefauld = 0,
                                FieldType      = 0,
                                MappingName    = "职位"
                            }
                        };
                    }
                    if (!bllActivity.AddList(fieldData))
                    {
                        tran.Rollback();
                        apiResp.code = 1;
                        apiResp.msg  = "添加报名字段失败!";
                        bllActivity.ContextResponse(context, apiResp);
                        return;
                    }
                    ;
                }
                #region 推广
                //自动创建推广活动
                MonitorPlan monitorPlanModel = new MonitorPlan();
                monitorPlanModel.MonitorPlanID = int.Parse(bllActivity.GetGUID(ZentCloud.BLLJIMP.TransacType.MonitorPlanID));
                monitorPlanModel.PlanName      = model.ActivityName;
                monitorPlanModel.PlanStatus    = "1";
                monitorPlanModel.UserID        = bllActivity.GetCurrUserID();
                monitorPlanModel.InsertDate    = DateTime.Now;
                monitorPlanModel.Remark        = "自动创建的监测任务";

                model.MonitorPlanID = monitorPlanModel.MonitorPlanID;
                #endregion

                if (bllActivity.Add(monitorPlanModel, tran) && bllActivity.Add(model, tran))
                {
                    tran.Commit();

                    if (CurrentUserInfo != null && context.Request["notice_publisher"] == "1")
                    {
                        bllSystemNotice.SendSystemMessage("你发起了一个新的约会消耗" + Convert.ToDouble(model.CreditAcount) + "信用金", model.ActivityName, BLLJIMP.BLLSystemNotice.NoticeType.FinancialNotice, BLLJIMP.BLLSystemNotice.SendType.Personal, CurrentUserInfo.UserID, model.JuActivityID.ToString());
                    }

                    try
                    {
                        bllUser.AddUserCreditAcountDetails(CurrentUserInfo.UserID, "PublishCost", bllUser.WebsiteOwner, 0 - model.CreditAcount
                                                           , string.Format("发布【{0}】消耗{1}信用金", model.ActivityName, Convert.ToDouble(model.CreditAcount)));
                    }
                    catch (Exception ex11)
                    {
                        apiResp.code = 1;
                        apiResp.msg  = "扣除信用金出错!";
                        bllActivity.ContextResponse(context, apiResp);
                        return;
                    }

                    apiResp.code   = (int)APIErrCode.IsSuccess;
                    apiResp.status = true;
                    apiResp.msg    = "发布完成";
                    //ExObj = model;
                    //ExStr = model.JuActivityIDHex;//将16进制ID传回去
                }
                else
                {
                    tran.Rollback();
                    apiResp.code = (int)APIErrCode.OperateFail;
                    apiResp.msg  = "发布出错!";
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "发布出错";
            }
            bllActivity.ContextResponse(context, apiResp);
        }