/// <summary> /// 排序 /// </summary> void SortActivity() { refActList.Clear(); foreach (ActivityListRef refdata in ConfigMng.Instance.GetActivityList().Values) { ActivityDataInfo data = GameCenter.activityMng.GetActivityDataInfo(refdata.id); refActList.Add(data); } refActList.Sort(GameCenter.activityMng.SortActivity); for (int i = 0; i < refActList.Count; i++) { dic[(int)refActList[i].ID] = ConfigMng.Instance.GetActivityListRef((int)refActList[i].ID); } }
/// <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)); }
void OnClickGame(GameObject games) { ActivityDataInfo SerData = UIEventListener.Get(games).parameter as ActivityDataInfo; if (SerData.State == ActivityState.NOTATTHE && SerData.UpDateTime > 0) { GameCenter.messageMng.AddClientMsg(173); return; } if (SerData.Buttontype.Count > 1) { GameCenter.activityMng.OpenStartSeleteActivity(SerData.ID); } else { ActivityButtonRef refdata = ConfigMng.Instance.GetActivityButtonRef(SerData.Buttontype[0]); GameCenter.activityMng.GoActivityButtonFunc(refdata, (int)SerData.ID); } }
/// <summary> /// 批量设置交易完成状态 /// </summary> /// <param name="context"></param> /// <returns></returns> private string UpdateDealStatus(HttpContext context) { string activityId = context.Request["ActivityID"]; string uId = context.Request["UID"]; string[] ids = uId.Split(','); ActivityDataInfo model = new ActivityDataInfo(); foreach (var item in ids) { model = bllActivity.GetActivityDataInfo(activityId, int.Parse(item)); if (model.Status == 1) { continue; } model.Status = 1; if (!bllActivity.Update(model)) { continue; } else { WXMallOrderInfo orderInfo = bllMall.GetOrderInfo(model.OrderId); if (orderInfo != null) { orderInfo.Status = "交易成功"; orderInfo.DistributionStatus = 2; string msg = ""; if (bllDis.Transfers(orderInfo, out msg)) { orderInfo.DistributionStatus = 3; } bllMall.Update(orderInfo); } } } resp.Status = 1; return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 手动添加报名数据 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Add(HttpContext context) { string autoIds = context.Request["Ids"]; string activityId = context.Request["ActivityID"]; int successCount = 0; foreach (var autoId in autoIds.Split(',')) { UserInfo userInfo = bllUser.GetUserInfoByAutoID(int.Parse(autoId)); if (bllActivity.GetCount <ActivityDataInfo>(string.Format(" ActivityID={0} And IsDelete=0 And UserId='{1}'", activityId, userInfo.UserID)) > 0) { resp.Msg = string.Format("{0}已经报过名了,不需要重复报名", userInfo.TrueName); return(Common.JSONHelper.ObjectToJson(resp)); } ActivityDataInfo model = new ActivityDataInfo(); var newActivityUId = 1001; var lastActivityDataInfo = bllActivity.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityId)); if (lastActivityDataInfo != null) { newActivityUId = lastActivityDataInfo.UID + 1; } model.ActivityID = activityId; model.UID = newActivityUId; model.InsertDate = DateTime.Now; model.WebsiteOwner = bllActivity.WebsiteOwner; model.SpreadUserID = "system"; #region 自动补充信息 model.WeixinOpenID = userInfo.WXOpenId; model.UserId = userInfo.UserID; if (!string.IsNullOrEmpty(userInfo.TrueName)) { model.Name = userInfo.TrueName; } else { model.Name = "系统添加"; } if (!string.IsNullOrEmpty(userInfo.Phone)) { model.Phone = userInfo.Phone; } if (string.IsNullOrEmpty(model.Phone)) { resp.Msg = string.Format("手机号不能为空"); return(Common.JSONHelper.ObjectToJson(resp)); } var fieldMappingList = bllActivity.GetActivityFieldMappingList(activityId); Type type = model.GetType(); if (!string.IsNullOrEmpty(userInfo.Company)) { if (fieldMappingList.Where(p => p.MappingName.Contains("公司")).Count() > 0) { PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("公司")).First().ExFieldIndex.ToString()); propertyInfo.SetValue(model, userInfo.Company, null); } } if (!string.IsNullOrEmpty(userInfo.Postion)) { if (fieldMappingList.Where(p => p.MappingName.Contains("职位")).Count() > 0) { PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("职位")).First().ExFieldIndex.ToString()); propertyInfo.SetValue(model, userInfo.Postion, null); } } if (!string.IsNullOrEmpty(userInfo.Email)) { if (fieldMappingList.Where(p => p.MappingName.Contains("邮箱")).Count() > 0) { PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("邮箱")).First().ExFieldIndex.ToString()); propertyInfo.SetValue(model, userInfo.Email, null); } } #endregion if (bllActivity.Add(model)) { successCount++; resp.Status = 1; } else { resp.Msg = "添加失败"; return(Common.JSONHelper.ObjectToJson(resp)); } } resp.ExInt = successCount; return(Common.JSONHelper.ObjectToJson(resp)); }
protected void Page_Load(object sender, EventArgs e) { activityid = Request["activityid"]; Name = Request["name"]; Uid = Request["Uid"]; jid = Request["jid"]; CurrentUserInfo = bllUser.GetCurrentUserInfo(); ActivityDataInfo activityData = bllJuactivity.Get <ActivityDataInfo>(string.Format(" ActivityID='{0}' And (WeixinOpenID='{1}' Or UserId='{2}') Order By InsertDate DESC", activityid, CurrentUserInfo.WXOpenId, CurrentUserInfo.UserID)); ActivityConfig = bllJuactivity.Get <BLLJIMP.Model.ActivityConfig>(string.Format("WebsiteOwner='{0}'", bllUser.WebsiteOwner)); if (CurrentUserInfo.UserID != activityData.UserId) { Response.Write("无权查看"); Response.End(); } string[] showFields = new string[] { };//显示字段 if (ActivityConfig != null) { showFields = ActivityConfig.RegisterCode.Split(','); } else { ActivityConfig = new BLLJIMP.Model.ActivityConfig(); } Name = activityData == null ? Request["name"] : activityData.Name; Uid = activityData == null ? Request["Uid"] : activityData.UID.ToString(); foreach (string item in showFields)//文本型签到 { if (!string.IsNullOrEmpty(item)) { switch (item) { case "0": CodeStr = activityid + Uid; Code += " " + CodeStr; break; case "1": Code += " " + activityData.Name; break; case "2": Code += " " + activityData.Phone; break; case "3": Code += " " + activityData.ActivityID; break; } } }//文本型签到 if (ActivityConfig.QCodeType.Equals(1))//二维码签到 { Code = string.Format("http://{0}/App/Cation/Wap/SignInV1.aspx?activityid={1}&uid={2}", Request.Url.Host, activityData.ActivityID, Uid); } CodeStr = activityid + Uid; juActivityInfo = bllJuactivity.Get <JuActivityInfo>(string.Format(" SignUpActivityID='{0}'", activityid)); if (juActivityInfo != null) { txtTitle.Text = juActivityInfo.ActivityName; txtStartDate.Text = (juActivityInfo.ActivityEndDate != null ? "开始时间: " : "") + string.Format("{0:f}", juActivityInfo.ActivityStartDate); if (juActivityInfo.ActivityEndDate != null) { txtEndDate.Text = "结束时间: " + string.Format("{0:f}", juActivityInfo.ActivityEndDate); } else { txtEndDate.Visible = false; } txtAddress.Text = juActivityInfo.ActivityAddress; } WXSignInInfo signInfo = bllJuactivity.Get <WXSignInInfo>(string.Format(" JuActivityID='{0}' And SignInUserID='{1}'", juActivityInfo.JuActivityID, CurrentUserInfo.UserID)); if (activityData.PaymentStatus == 1 && (string.IsNullOrEmpty(activityData.ToUserId)) && (string.IsNullOrEmpty(activityData.FromUserId))) { if (signInfo == null) { ShowDonation = true; } } if (signInfo != null) { IsSignIn = true;//已签到 } if (!string.IsNullOrEmpty(activityData.ToUserId)) { ReceiveUserInfo = bllUser.GetUserInfo(activityData.ToUserId); ReceiveUserInfo.TrueName = bllUser.GetUserDispalyName(ReceiveUserInfo); } if (!string.IsNullOrEmpty(activityData.FromUserId)) { FromUserInfo = bllUser.GetUserInfo(activityData.FromUserId); FromUserInfo.TrueName = bllUser.GetUserDispalyName(FromUserInfo); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string activityId = context.Request["activity_id"]; if (string.IsNullOrEmpty(activityId)) { apiResp.code = 1; apiResp.msg = "activity_id 为必填项,请检查"; bll.ContextResponse(context, apiResp); return; } JuActivityInfo juInfo = bll.GetJuActivity(int.Parse(activityId), true); if (juInfo == null) { apiResp.code = 4; apiResp.msg = "活动不存在!"; bll.ContextResponse(context, apiResp); return; } #region 是否可以报名 if (juInfo.ActivityStatus.Equals(1)) { apiResp.code = 2; apiResp.msg = "活动已停止"; bll.ContextResponse(context, apiResp); return; } if (juInfo.MaxSignUpTotalCount > 0)//检查报名人数 { if (juInfo.SignUpTotalCount > (juInfo.MaxSignUpTotalCount - 1)) { apiResp.code = 3; apiResp.msg = "报名人数已满"; bll.ContextResponse(context, apiResp); return; } } if (juInfo.ActivityIntegral > 0) { if (CurrentUserInfo.TotalScore < juInfo.ActivityIntegral) { apiResp.code = 4; apiResp.msg = "您的积分不足"; bll.ContextResponse(context, apiResp); return; } } if (juInfo.GuaranteeCreditAcount > 0) { if (CurrentUserInfo.CreditAcount < juInfo.GuaranteeCreditAcount) { apiResp.code = 6; apiResp.msg = "您的信用金不足"; bll.ContextResponse(context, apiResp); return; } } #endregion dicPar = bll.GetRequestParameter(); //string weixinOpenID = null; string activityIdBySignUp = juInfo.SignUpActivityID; string spreadUserId = null; dicPar.TryGetValue("SpreadUserID", out spreadUserId); string strDistinctKeys = null;//检查重复的字段,多个字段用,分隔, //没有此参数默认用手机检查 dicPar.TryGetValue("DistinctKeys", out strDistinctKeys); string monitorPlanID = null; dicPar.TryGetValue("MonitorPlanID", out monitorPlanID); string name = null; dicPar.TryGetValue("Name", out name); string phone = null; dicPar.TryGetValue("Phone", out phone); ActivityInfo activity = bll.Get <ActivityInfo>(string.Format("ActivityID='{0}'", activityIdBySignUp)); #region IP限制 //获取用户IP; string userHostAddress = context.Request.UserHostAddress; var count = DataCache.GetCache(userHostAddress); if (count != null) { int newCount = int.Parse(count.ToString()) + 1; DataCache.SetCache(userHostAddress, newCount); int limitCount = 1000; if (activity != null) { limitCount = activity.LimitCount; } if (newCount >= limitCount) { apiResp.code = 5; apiResp.msg = "您的提交过于频繁,请稍后再试"; bll.ContextResponse(context, apiResp); return; } } else { DataCache.SetCache(userHostAddress, 1, DateTime.MaxValue, new TimeSpan(4, 0, 0)); } #endregion #region 活动权限验证 if (juInfo == null) { apiResp.code = 6; apiResp.msg = "活动不存在!"; bll.ContextResponse(context, apiResp); return; } if (juInfo.ActivityStatus.Equals(1)) { apiResp.code = 7; apiResp.msg = "活动已关闭!"; bll.ContextResponse(context, apiResp); return; } if (activity.IsDelete.Equals(1)) { apiResp.code = 8; apiResp.msg = "活动已删除!"; bll.ContextResponse(context, apiResp); return; } #endregion #region 判断必填项 if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(phone)) { apiResp.code = 9; apiResp.msg = "姓名和手机不能为空!"; bll.ContextResponse(context, apiResp); return; } if ((!phone.StartsWith("1")) || (!phone.Length.Equals(11))) { apiResp.code = 10; apiResp.msg = "手机号码无效!"; bll.ContextResponse(context, apiResp); return; } #endregion #region 检查自定义必填项 List <ActivityFieldMappingInfo> listRequiredField = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}' And FieldIsNull=1", activity.ActivityID)); if (listRequiredField.Count > 0) { foreach (var requiredField in listRequiredField) { if (string.IsNullOrEmpty(dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", requiredField.ExFieldIndex))).Value)) { apiResp.code = 11; apiResp.msg = string.Format(" {0} 必填", requiredField.MappingName); bll.ContextResponse(context, apiResp); return; } } } #endregion #region 检查数据格式 //检查数据格式 List <ActivityFieldMappingInfo> activityFieldMapping = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}'", activity.ActivityID)); foreach (var item in activityFieldMapping) { string value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value; if (string.IsNullOrWhiteSpace(value)) { continue; } //检查数据格式 if (item.FormatValiFunc == "email")//email检查 { if (!ZentCloud.Common.ValidatorHelper.EmailLogicJudge(value)) { apiResp.code = 12; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bll.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "url") //url检查 { System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址 System.Text.RegularExpressions.Match m = regUrl.Match(value); if (!m.Success) { apiResp.code = 13; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bll.ContextResponse(context, apiResp); return; } } } #endregion #region 检查是否已经报名 if (!string.IsNullOrEmpty(strDistinctKeys)) { if (!strDistinctKeys.Equals("none"))//自定义检查重复 { System.Text.StringBuilder sb = new System.Text.StringBuilder("1=1 "); string[] distinctKeys = strDistinctKeys.Split(','); foreach (var item in distinctKeys) { sb.AppendFormat("And {0}='{1}' ", item, dicPar.Single(p => p.Key.Equals(item)).Value); } sb.Append(" and IsDelete = 0 "); if (bll.GetCount <ActivityDataInfo>(sb.ToString()) > 0) { apiResp.code = 14; apiResp.msg = "重复的报名!"; bll.ContextResponse(context, apiResp); return; } } else//不检查重复 { } } else//默认检查 { if (bll.GetCount <ActivityDataInfo>(string.Format("ActivityID='{0}' And Phone='{1}' and IsDelete = 0 ", activityIdBySignUp, phone)) > 0) { apiResp.code = 15; apiResp.msg = "已经报过名了!"; bll.ContextResponse(context, apiResp); return; } } #endregion var newActivityUID = 1001; var lastActivityDataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityIdBySignUp)); if (lastActivityDataInfo != null) { newActivityUID = lastActivityDataInfo.UID + 1; } ActivityDataInfo model = bll.ConvertRequestToModel <ActivityDataInfo>(new ActivityDataInfo()); model.UID = newActivityUID; model.SpreadUserID = spreadUserId; model.ActivityID = activityIdBySignUp; if (juInfo.GuaranteeCreditAcount > 0) { if (model.GuaranteeCreditAcount < juInfo.GuaranteeCreditAcount) { apiResp.code = 18; apiResp.msg = string.Format("担保信用金不能少于{0}!", Convert.ToDouble(juInfo.GuaranteeCreditAcount)); bll.ContextResponse(context, apiResp); return; } } if (!string.IsNullOrEmpty(monitorPlanID)) { model.MonitorPlanID = int.Parse(monitorPlanID); } model.WebsiteOwner = bll.WebsiteOwner; model.UserId = CurrentUserInfo.UserID; model.WeixinOpenID = CurrentUserInfo.WXOpenId; if (context.Request["limit_userid_signupcount"] == "1")//限制每个登录账号只能报名一次 { if (bll.GetCount <ActivityDataInfo>(string.Format(" UserId='{0}' AND ActivityID={1} AND IsDelete=0 " , model.UserId, juInfo.SignUpActivityID)) > 0) { apiResp.code = 14; apiResp.msg = "重复的报名!"; bll.ContextResponse(context, apiResp); return; } } if (context.Request["limit_wxopenid_signupcount"] == "1")//限制每个微信只能报名一次 { if (bll.GetCount <ActivityDataInfo>(string.Format(" UserId='{0}' AND ActivityID={1} AND IsDelete=0 " , model.WeixinOpenID, juInfo.SignUpActivityID)) > 0) { apiResp.code = 14; apiResp.msg = "重复的报名!"; bll.ContextResponse(context, apiResp); return; } } model.ArticleType = juInfo.ArticleType; model.CategoryId = juInfo.CategoryId; if (bll.Add(model)) { bll.PlusNumericalCol("SignUpCount", juInfo.JuActivityID);//报名数+1 //发消息给发布约会的人 PubUser = bllUser.GetUserInfo(juInfo.UserID); if (PubUser != null && context.Request["notice_publisher"] == "1") { bllSystemNotice.SendSystemMessage("“" + bllUser.GetUserDispalyName(CurrentUserInfo) + "”报名您的约会", juInfo.ActivityName, BLLJIMP.BLLSystemNotice.NoticeType.AppointmentNotice, BLLJIMP.BLLSystemNotice.SendType.Personal, PubUser.UserID, juInfo.JuActivityID.ToString()); } //发消息给自己 if (CurrentUserInfo != null && context.Request["notice_signupuser"] == "1") { bllSystemNotice.SendSystemMessage("你报名了一个约会冻结" + Convert.ToDouble(model.GuaranteeCreditAcount) + "信用金", juInfo.ActivityName, BLLJIMP.BLLSystemNotice.NoticeType.FinancialNotice, BLLJIMP.BLLSystemNotice.SendType.Personal, CurrentUserInfo.UserID, juInfo.JuActivityID.ToString()); } apiResp.msg = "ok"; apiResp.code = 0; apiResp.status = true; #region 当ActivityIntegral>0 扣积分 if (juInfo.ActivityIntegral > 0)//扣积分 { CurrentUserInfo.TotalScore -= juInfo.ActivityIntegral; if (bll.Update(CurrentUserInfo, string.Format("TotalScore={0}", CurrentUserInfo.TotalScore), string.Format(" AutoID={0}", CurrentUserInfo.AutoID)) <= 0) { apiResp.code = 16; apiResp.msg = "扣除用户积分失败"; bll.ContextResponse(context, apiResp); return; } else { // BLLJIMP.Model.WBHScoreRecord scoreRecord = new BLLJIMP.Model.WBHScoreRecord(); scoreRecord.Nums = "b55"; scoreRecord.InsertDate = DateTime.Now; scoreRecord.WebsiteOwner = bll.WebsiteOwner; scoreRecord.UserId = CurrentUserInfo.UserID; scoreRecord.RecordType = "2"; scoreRecord.NameStr = "参加活动:" + juInfo.ActivityName; scoreRecord.ScoreNum = string.Format("-{0}", juInfo.ActivityIntegral); if (!bll.Add(scoreRecord)) { apiResp.code = 17; apiResp.msg = "插入积分记录失败"; bll.ContextResponse(context, apiResp); return; } } } #endregion #region 当ActivityIntegral>0 扣信用金 if (juInfo.GuaranteeCreditAcount > 0)//扣积分 { bllUser.AddUserCreditAcountDetails(CurrentUserInfo.UserID, "ApplyCost", bllUser.WebsiteOwner, 0 - model.GuaranteeCreditAcount , string.Format("报名【{0}】消耗{1}信用金", juInfo.ActivityName, Convert.ToDouble(model.GuaranteeCreditAcount))); } #endregion } else { apiResp.code = 1; apiResp.msg = "报名失败,请重试或联系管理员!"; } bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string activityId = context.Request["activity_id"]; if (string.IsNullOrEmpty(activityId)) { resp.errcode = 1; resp.errmsg = "activityid 参数为空,请检查"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } ActivityDataInfo activityInfo = bllTrueActivity.GetActivityDataInfo(activityId, bll.GetCurrUserID()); bool isEnroll = false; if (activityInfo == null) { isEnroll = true; } JuActivityInfo model = bll.GetJuActivity(int.Parse(activityId), true); bll.Update(model, string.Format("PV+=1"), string.Format(" JuActivityID={0}", model.JuActivityID)); RequestModel requestModel = new RequestModel(); requestModel.signfield = new List <signfield>(); requestModel.activity_id = model.JuActivityID; requestModel.activity_img_url = bll.GetImgUrl(model.ThumbnailsPath); requestModel.activity_name = model.ActivityName; requestModel.activity_address = model.ActivityAddress; requestModel.category_name = model.CategoryName; requestModel.activity_pv = model.PV; requestModel.activity_signcount = model.SignUpTotalCount; requestModel.activity_summary = model.Summary; requestModel.is_enroll = isEnroll; if (model.ActivityStartDate != null) { requestModel.activity_start_time = bll.GetTimeStamp((DateTime)model.ActivityStartDate); } if (model.IsHide == 1) { requestModel.activity_status = 1; } if ((model.MaxSignUpTotalCount > 0) && (model.SignUpTotalCount >= model.MaxSignUpTotalCount)) { requestModel.activity_status = 2; } requestModel.activity_content = model.ActivityDescription; if (model.ActivityDescription.Contains("/FileUpload/")) { requestModel.activity_content = model.ActivityDescription.Replace("/FileUpload/", string.Format("http://{0}/FileUpload/", context.Request.Url.Host)); } requestModel.activity_score = model.ActivityIntegral; requestModel.activity_commentcount = bllReview.GetReviewCount(BLLJIMP.Enums.ReviewTypeKey.ArticleComment, model.JuActivityID.ToString(), null); var fieldlist = bllTrueActivity.GetActivityFieldMappingList(model.SignUpActivityID); foreach (var item in fieldlist) { signfield signModel = new signfield(); signModel.key = item.MappingName; signModel.value = item.FieldName; signModel.isnull = item.FieldIsNull; requestModel.signfield.Add(signModel); } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(requestModel)); }
/// <summary> /// 接收活动转赠 /// </summary> /// <param name="context"></param> /// <returns></returns> private string ReceiveActivity(HttpContext context) { if (currentUserInfo==null) { resp.Msg = "请在微信中打开"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } string activityId = context.Request["ActivityId"];//活动ID string fromUserAutoId = context.Request["FromUserAutoId"];//赠送用户ID JuActivityInfo juActivityInfo = bllJuactivity.GetJuActivityByActivityID(activityId); //检查 if (juActivityInfo == null) { resp.Msg = "转赠活动不存在"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } UserInfo fromUserInfo = bllUser.GetUserInfoByAutoID(int.Parse(fromUserAutoId)); if (fromUserInfo == null) { resp.Msg = "转赠用户不存在"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } WXSignInInfo signInfo = bllActivity.Get<WXSignInInfo>(string.Format(" JuActivityID='{0}' And SignInUserID='{1}'", juActivityInfo.JuActivityID, fromUserInfo.UserID)); if (signInfo!=null) { resp.Msg = "不能接受此转赠"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } ActivityDataInfo dataInfo = bllActivity.Get<ActivityDataInfo>(string.Format(" ActivityID='{0}' And UserId='{1}' And IsDelete=0 And OrderId!='' And PaymentStatus=1", activityId, fromUserInfo.UserID)); if (dataInfo == null) { resp.Msg = " 不能接受此转赠"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } if (fromUserInfo.UserID==currentUserInfo.UserID) { resp.Msg = "不能接收自己的转赠"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } if (!string.IsNullOrEmpty(dataInfo.ToUserId)) { if (dataInfo.ToUserId == currentUserInfo.UserID) { resp.Msg = " 您已经接收过转赠"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } else { resp.Msg = " 此活动已经转赠过了"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } } ActivityDataInfo dataCurrentInfo = bllActivity.Get<ActivityDataInfo>(string.Format(" ActivityID='{0}' And UserId='{1}' And IsDelete=0", activityId,currentUserInfo.UserID)); if (dataCurrentInfo!=null) { resp.Msg = " 您已经报名过此活动,不能再接受转赠"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } WXMallOrderInfo fromUserOrderInfo = bllMall.GetOrderInfo(dataInfo.OrderId); ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction(); try { //订单 WXMallOrderInfo orderInfo = new WXMallOrderInfo();//订单表 orderInfo.Consignee = bllUser.GetUserDispalyName(currentUserInfo); orderInfo.InsertDate = DateTime.Now; orderInfo.OrderUserID = currentUserInfo.UserID; orderInfo.Phone = currentUserInfo.Phone; orderInfo.WebsiteOwner = bllMall.WebsiteOwner; orderInfo.OrderID = bllMall.GetGUID(BLLJIMP.TransacType.AddMallOrder); orderInfo.MyCouponCardId = fromUserOrderInfo.MyCouponCardId; orderInfo.UseScore = fromUserOrderInfo.UseScore; orderInfo.Status = "待发货"; orderInfo.ArticleCategoryType = "Mall"; orderInfo.OrderType = 4; orderInfo.Ex1 = juActivityInfo.ActivityName; orderInfo.Ex2 = orderInfo.Ex2; orderInfo.Ex3 = orderInfo.Ex3; orderInfo.OrderMemo = orderInfo.OrderMemo; orderInfo.TotalAmount = fromUserOrderInfo.TotalAmount; orderInfo.PaymentStatus = 1; orderInfo.PayTime = DateTime.Now; //订单 if (!bllMall.Add(orderInfo,tran)) { tran.Rollback(); resp.Msg = " 插入订单表失败"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } ActivityDataInfo newData = new ActivityDataInfo(); newData.ActivityID = dataInfo.ActivityID; newData.UserId = currentUserInfo.UserID; newData.WebsiteOwner = bllUser.WebsiteOwner; newData.OrderId =orderInfo.OrderID; newData.PaymentStatus = 1; newData.Name = bllUser.GetUserDispalyName(currentUserInfo); newData.Phone = currentUserInfo.Phone; newData.FromUserId = fromUserInfo.UserID; newData.InsertDate = DateTime.Now; newData.UID = bllJuactivity.Get<ActivityDataInfo>(string.Format(" ActivityID='{0}' Order By UID DESC",activityId)).UID + 1; if (!bllJuactivity.Add(newData, tran)) { tran.Rollback(); resp.Msg = " 插入报名表失败"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } dataInfo.ToUserId = currentUserInfo.UserID; if (!bllJuactivity.Update(dataInfo,tran)) { tran.Rollback(); resp.Msg = " 转赠失败"; return ZentCloud.Common.JSONHelper.ObjectToJson(resp); } string showName = "活动"; var config = bllActivity.Get<BLLJIMP.Model.ActivityConfig>(string.Format(" WebsiteOwner='{0}'", bllActivity.WebsiteOwner)); if (config!=null) { if (!string.IsNullOrEmpty(config.ShowName)) { showName = config.ShowName; } } bllWeixin.SendTemplateMessageNotifyComm(fromUserInfo, string.Format("{0}转赠通知",showName), string.Format(" {0}已接收你转赠的{1}{2}", bllUser.GetUserDispalyName(currentUserInfo),showName,juActivityInfo.ActivityName)); bllWeixin.SendTemplateMessageNotifyComm(currentUserInfo, string.Format("{0}接收通知",showName), string.Format(" 您已接收了{0}转赠的{1}{2}", bllUser.GetUserDispalyName(fromUserInfo), showName,juActivityInfo.ActivityName)); tran.Commit(); resp.Status = 1; resp.Msg = "ok"; } catch (Exception ex) { resp.Msg = ex.Message; tran.Rollback(); } return ZentCloud.Common.JSONHelper.ObjectToJson(resp); }
protected void Page_Load(object sender, EventArgs e) { try { if (!bll.IsLogin) { Response.Write("该活动不支持扫码签到,请联系管理员"); Response.End(); } //取得当前访问用户 //取得要签到的活动 //记录签到日志并入库 int juActivityID = Convert.ToInt32(Request["id"]); UserInfo currUser = bll.GetCurrentUserInfo(); //查询活动是否存在 juActivityInfo = bll.GetJuActivity(juActivityID); //if (juActivityInfo == null) //{ // juActivityInfo = bll.GetJuActivityByActivityID(juActivityID.ToString()); //} if (juActivityInfo == null) { Response.Write("对不起,您签到的活动不存在!"); Response.End(); } ActivityDataInfo dataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID={0} And IsDelete=0 And (WeixinOpenID='{1}' Or UserId='{2}')", juActivityInfo.SignUpActivityID, currUser.WXOpenId, currUser.UserID)); if (dataInfo == null) { //lbMsg.InnerText = "请先报名再签到"; NeedSignUp = true; return; } WXSignInInfo signInInfo = new WXSignInInfo(); signInInfo.SignInUserID = currUser.UserID; signInInfo.Name = dataInfo.Name; signInInfo.Phone = dataInfo.Phone; signInInfo.JuActivityID = juActivityID; signInInfo.SignInOpenID = currUser.WXOpenId; signInInfo.SignInTime = DateTime.Now; //判断是否已经签到过 if (this.bll.Exists(signInInfo, new List <string>() { "SignInUserID", "JuActivityID" })) { //lbMsg.InnerText = "您已经签过到了!"; // return; IsHaveSignIn = true; return; } if (this.bll.Add(signInInfo)) { bllUser.AddUserScoreDetail(currUser.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.SignIn), currUser.WebsiteOwner, null, null); //lbMsg.InnerText = "签到成功!"; IsSignInSuccess = true; } else { Response.Write("签到失败"); Response.End(); } } catch (Exception ex) { Response.Write(ex.Message); Response.End(); } }
void ShowMainItem() { if (itemSample == null) { return; } GameObject go = null; ActivityItemUI endLess = null; int i = 0; int minTime = 0; bool redPoint = false; foreach (ActivityListRef data in ConfigMng.Instance.GetActivityList().Values) { ActivityDataInfo SerData = GameCenter.activityMng.GetActivityDataInfo((int)data.ID); if (SerData == null) { continue; } int atime = SerData.InMainRedShow; ActivityState state = SerData.State; //Debug.Log("SetState = " + data.name + " /// ActivityState == " + state + " ----InMainRedShow---= " + atime + " === SerData.UpDateTime" + SerData.UpDateTime); if (atime < 0) { if (state == ActivityState.NOTATTHE) { int curTime = SerData.UpDateTime; atime = curTime - ActivityMng.ShowTime > 0 ? curTime - ActivityMng.ShowTime : 0; if (minTime == 0 && atime > 0) { minTime = atime; } if (atime < minTime && atime > 0) { minTime = atime; } } continue; } else { if (inItemList.Count <= i) { go = (GameObject)GameObject.Instantiate(itemSample); go.transform.parent = itemSample.transform.parent; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; endLess = go.GetComponent <ActivityItemUI>(); inItemList.Add(endLess); } else { go = inItemList[i].gameObject; endLess = inItemList[i]; } // go.name = "Activity_" + data.id; endLess.SetData = data; // endLess.SetMainWndItemTime(atime); if (state == ActivityState.ONGOING) { endLess.OnOverTime -= OnOverTime; endLess.OnOverTime += OnOverTime; if (data.ID != ActivityType.UNDERBOSS) { redPoint = true; } } UIEventListener.Get(go).onClick = OnClickGame; UIEventListener.Get(go).parameter = SerData; go.SetActive(true); i++; } } // itemSample.SetActive(i==0); for (; i < inItemList.Count; i++) { inItemList[i].OnOverTime -= OnOverTime; inItemList[i].gameObject.SetActive(false); } GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.ACTIVITY, redPoint); if (grid != null) { grid.repositionNow = true; } // Debug.Log("minTime +++ = "+minTime); if (minTime > 0) { CancelInvoke("ShowUpdate"); Invoke("ShowUpdate", (float)minTime); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; try { // UserInfo distributionOffLineCommendUser = null;//分销推荐人 //bool isDistributionOffLineApply = false;//是否线下分销申请 dicPar = bll.GetRequestParameter(); string weixinOpenID = null; //微信openid string activityId = null; //活动编号 dicPar.TryGetValue("ActivityID", out activityId); string spreadUserId = null; dicPar.TryGetValue("SpreadUserID", out spreadUserId);//推广用户的用户名 string shareUserId = string.Empty; dicPar.TryGetValue("ShareUserID", out shareUserId); string shareId = string.Empty; dicPar.TryGetValue("ShareID", out shareId); string strDistinctKeys = null; //检查重复的字段,多个字段用,分隔, //没有此参数默认用手机检查 dicPar.TryGetValue("DistinctKeys", out strDistinctKeys); string monitorPlanID = null; //监测任务ID dicPar.TryGetValue("MonitorPlanID", out monitorPlanID); string name = null; //姓名 dicPar.TryGetValue("Name", out name); string phone = null; //手机 dicPar.TryGetValue("Phone", out phone); string isSaveUserInfo = string.Empty; dicPar.TryGetValue("IsSaveUserInfo", out isSaveUserInfo); //activity = bll.Get<ActivityInfo>(string.Format("ActivityID='{0}'", activityId)); #region IP限制 //获取用户IP; string userHostAddress = context.Request.UserHostAddress; var count = DataCache.GetCache(userHostAddress); if (count != null) { int newCount = int.Parse(count.ToString()) + 1; DataCache.SetCache(userHostAddress, newCount); int limitCount = 1000; //if (activity != null) //{ // //limitCount = activity.LimitCount; //} if (newCount >= limitCount) { resp.Status = 14; resp.Msg = "您的提交过于频繁,请稍后再试"; goto outoff; } } else { DataCache.SetCache(userHostAddress, 1, DateTime.MaxValue, new TimeSpan(4, 0, 0)); } #endregion #region 判断必填项 if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(phone)) { resp.Status = 3; resp.Msg = "姓名和手机不能为空!"; goto outoff; } //if ((!Common.ValidatorHelper.PhoneNumLogicJudge(Phone))&&(!Phone.Equals("systemdefault")))//系统缺省手机号不检查 //{ // resp.Status = 5; // resp.Msg = "手机号码无效!"; // goto outoff; //} if (((!phone.StartsWith("1")) || (!phone.Length.Equals(11))) && (!phone.Equals("systemdefault")))//系统缺省手机号不检查 { resp.Status = 5; resp.Msg = "手机号码无效!"; goto outoff; } if (string.IsNullOrEmpty(activityId)) { resp.Status = 6; resp.Msg = "活动编号不能为空!"; goto outoff; } //手机注册的重复数据 UserInfo dicUser = bllUser.Get <UserInfo>(string.Format(" WebsiteOwner='{0}' AND Phone='{1}' AND WXOpenId is null ", bllUser.WebsiteOwner, phone)); if (dicUser != null) { dicUser.Phone3 = phone; dicUser.Phone = ""; bllUser.Update(dicUser); } #endregion #region 活动权限验证 //if (activity == null) //{ // resp.Status = 7; // resp.Msg = "活动编号不存在!"; // goto outoff; //} //if (activity.ActivityStatus.Equals(0)) //{ // resp.Status = 8; // resp.Msg = "活动已关闭!"; // goto outoff; //} //if (activity.IsDelete.Equals(1)) //{ // resp.Status = -1; // resp.Msg = "活动已删除!"; // goto outoff; //} #endregion #region 是否可以报名 if (bll.IsLogin) { currentUserInfo = bll.GetCurrentUserInfo(); if (!string.IsNullOrEmpty(currentUserInfo.WXOpenId)) { weixinOpenID = currentUserInfo.WXOpenId; } } juActivityInfo = bll.Get <JuActivityInfo>(string.Format("SignUpActivityID={0}", dicPar["ActivityID"])); if (juActivityInfo != null) { #region 活动已经停止 if (juActivityInfo.IsHide.Equals(1)) { resp.Status = 14; resp.Msg = "活动已停止"; goto outoff; } #endregion #region 检查报名人数 if (juActivityInfo.MaxSignUpTotalCount > 0)//检查报名人数 { if (juActivityInfo.SignUpTotalCount > (juActivityInfo.MaxSignUpTotalCount - 1)) { resp.Status = 15; resp.Msg = "报名人数已满"; goto outoff; } } #endregion #region 检查积分 if (juActivityInfo.ActivityIntegral > 0) { if (!bll.IsLogin) { resp.Status = 12; resp.Msg = "此活动必须登录才能报名"; goto outoff; } else { if (currentUserInfo.TotalScore < juActivityInfo.ActivityIntegral) { resp.Status = 13; resp.Msg = "您的积分不足,无法报名"; goto outoff; } } } #endregion #region 指定标签的用户可以报名 if (!string.IsNullOrEmpty(juActivityInfo.Tags)) { if (!bll.IsLogin) { resp.Status = 12; resp.Msg = "此活动必须登录才能报名"; goto outoff; } if (string.IsNullOrEmpty(currentUserInfo.TagName)) { resp.Status = 12; resp.Msg = "此活动只接受特定用户的报名"; goto outoff; } bool checkResult = false; foreach (string item in currentUserInfo.TagName.Split(',')) { if (juActivityInfo.Tags.Contains(item)) { checkResult = true; break; } } if (!checkResult) { resp.Status = 12; resp.Msg = "此活动只接受特定用户的报名"; goto outoff; } } #endregion } #endregion #region 检查自定义必填项 List <ActivityFieldMappingInfo> requiredFieldList = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}' And FieldIsNull=1", juActivityInfo.SignUpActivityID)); if (requiredFieldList.Count > 0) { foreach (var requiredField in requiredFieldList) { if (string.IsNullOrEmpty(dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", requiredField.ExFieldIndex))).Value)) { resp.Status = 11; resp.Msg = string.Format(" {0} 必填", requiredField.MappingName); goto outoff; } } } #endregion #region 检查数据格式 //检查数据格式 List <ActivityFieldMappingInfo> activityFieldMappingList = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}'", juActivityInfo.SignUpActivityID)); foreach (var item in activityFieldMappingList) { string value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value; if (string.IsNullOrWhiteSpace(value)) { continue; } //检查数据格式 if (item.FormatValiFunc == "email")//email检查 { if (!Common.ValidatorHelper.EmailLogicJudge(value)) { resp.Status = 12; resp.Msg = string.Format("{0}格式不正确", item.MappingName); goto outoff; } } if (item.FormatValiFunc == "url") //url检查 { System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址 System.Text.RegularExpressions.Match match = regUrl.Match(value); if (!match.Success) { resp.Status = 13; resp.Msg = string.Format("{0}格式不正确", item.MappingName); goto outoff; } } } #endregion #region 检查是否已经报名 //if (activityId != bllDis.GetDistributionOffLineApplyActivityID())//线下分销不检查 //{ if (!string.IsNullOrEmpty(strDistinctKeys)) { if (!strDistinctKeys.Equals("none"))//自定义检查重复 { System.Text.StringBuilder sbWhere = new System.Text.StringBuilder("1=1 "); string[] distinctKeys = strDistinctKeys.Split(','); foreach (var item in distinctKeys) { sbWhere.AppendFormat("And {0}='{1}' ", item, dicPar.Single(p => p.Key.Equals(item)).Value); } sbWhere.Append(" and IsDelete = 0 "); if (bll.GetCount <ActivityDataInfo>(sbWhere.ToString()) > 0) { resp.Status = 1; resp.Msg = "重复的报名!"; goto outoff; } } else//不检查重复 { } } else//默认检查 { if (bll.GetCount <ActivityDataInfo>(string.Format("ActivityID='{0}' And Phone='{1}' and IsDelete = 0 ", activityId, phone)) > 0) { resp.Status = 1; resp.Msg = "已经报过名了!"; goto outoff; } } //} #endregion //if (activityId == bllDis.GetDistributionOffLineApplyActivityID())//如果当前活动是分销 //{ // if (bll.GetCount<ActivityDataInfo>(string.Format("ActivityID='{0}' And UserId='{1}' and IsDelete = 0 ", activityId, currentUserInfo.UserID)) > 0) // { // bll.Update(new ActivityDataInfo(), string.Format("IsDelete=1"), string.Format(" ActivityID='{0}' And UserId='{1}'", activityId, currentUserInfo.UserID)); // } //} //#region 检查手机验证码 特殊化 ////if (ActivityID.Equals("186135")) ////{ //// string VerCode = HttpContext.Current.Session["SmsVerificationCode"] == null ? "" : HttpContext.Current.Session["SmsVerificationCode"].ToString(); //// if (string.IsNullOrEmpty(context.Request["SmsVerificationCode"])) //// { //// resp.Status = 12; //// resp.Msg = "请输入手机验证码"; //// goto outoff; //// } //// if (!context.Request["SmsVerificationCode"].ToString().Equals(VerCode)) //// { //// resp.Status = 13; //// resp.Msg = "手机验证码不正确"; //// goto outoff; //// } ////} //#endregion var newActivityUID = 1001; var lastActivityDataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityId)); if (lastActivityDataInfo != null) { newActivityUID = lastActivityDataInfo.UID + 1; } ActivityDataInfo model = bll.ConvertRequestToModel <ActivityDataInfo>(new ActivityDataInfo()); model.UID = newActivityUID; model.WeixinOpenID = weixinOpenID; model.SpreadUserID = spreadUserId; if (spreadUserId == currentUserInfo.UserID) { model.SpreadUserID = bll.WebsiteOwner; } if (!string.IsNullOrEmpty(monitorPlanID)) { model.MonitorPlanID = int.Parse(monitorPlanID); } model.ShareUserID = string.IsNullOrWhiteSpace(shareUserId) ? "" : shareUserId; model.ShareID = string.IsNullOrWhiteSpace(shareId) ? "" : shareId; model.WebsiteOwner = bll.WebsiteOwner; if (bll.IsLogin) { model.UserId = bll.GetCurrUserID(); } //保存分销推荐码 // model.DistributionOffLineRecommendCode = context.Request["DistributionOffLineRecommendCode"]; //if (!string.IsNullOrWhiteSpace(model.DistributionOffLineRecommendCode)) //{ // bool isTrueCode = false; // int userAutoId = 0; // if (int.TryParse(model.DistributionOffLineRecommendCode, out userAutoId)) // { // distributionOffLineCommendUser = bllUser.GetUserInfoByAutoID(userAutoId); // if (distributionOffLineCommendUser != null) // { // //是站点用户或者是当前站点的分销员才有效 // if (bll.WebsiteOwner.ToLower() == distributionOffLineCommendUser.UserID.ToLower()) // { // isTrueCode = true; // } // else if (distributionOffLineCommendUser.WebsiteOwner.ToLower() == bll.WebsiteOwner.ToLower() && !string.IsNullOrWhiteSpace(distributionOffLineCommendUser.DistributionOffLinePreUserId)) // { // isTrueCode = true; // } // } // } // if (!isTrueCode) // { // resp.Status = 1; // resp.Msg = "不是有效的推荐码"; // goto outoff; // } // else // { // isDistributionOffLineApply = true; // } // ToLog("isDistributionOffLineApply:" + isDistributionOffLineApply); //} if (bll.Add(model)) { try { //#region 业务分销员申请消息 ////发送模板消息跟系统微客服和他的上级 //ToLog("isDistributionOffLineApply:" + isDistributionOffLineApply); //if (isDistributionOffLineApply) //{ // ToLog("申请成为财富会员,发送消息给系统管理员"); // //发送消息给他上级 // //bllWeixin.SendTemplateMessageNotifyComm(distributionOffLineCommendUser.WXOpenId, "财富伙伴申请", string.Format("姓名:{0}\\n手机号:{1}", model.Name, model.Phone)); // //发送消息给系统管理员 // // WXKeFu kefuInfo = bllWeixin.GetDefaultKefu(); // //ToLog("客服实体:" + JSONHelper.ObjectToJson(kefuInfo)); // bllWeixin.SendTemplateMessageToKefu(string.Format("用户“{0}”申请成为财富会员", model.Name), string.Format("姓名:{0}\\n手机号:{1}", model.Name, model.Phone)); //} //#endregion #region 个人资料补足 if (bll.IsLogin) { //个人资料补足 bool isEdit = false; isSaveUserInfo = "1"; if (string.IsNullOrWhiteSpace(currentUserInfo.TrueName)) { isEdit = true; currentUserInfo.TrueName = model.Name; } if (string.IsNullOrWhiteSpace(currentUserInfo.Phone)) { isEdit = true; currentUserInfo.Phone = model.Phone; } List <BLLJIMP.Model.ActivityFieldMappingInfo> mapingList = this.bll.GetList <BLLJIMP.Model.ActivityFieldMappingInfo>(string.Format(" ActivityID = '{0}' ", model.ActivityID)); foreach (var item in mapingList) { string value = ""; if (item.MappingName.IndexOf("邮箱") > -1 || item.MappingName.IndexOf("邮件") > -1 || item.MappingName.ToLower().IndexOf("email") > -1) { isEdit = true; value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value; if (string.IsNullOrWhiteSpace(currentUserInfo.Email)) { currentUserInfo.Email = value; } continue; } if (item.MappingName.IndexOf("职位") > -1) { isEdit = true; value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value; if (string.IsNullOrWhiteSpace(currentUserInfo.Postion)) { currentUserInfo.Postion = value; } continue; } if (item.MappingName.IndexOf("公司") > -1) { isEdit = true; value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value; if (value.Length >= 255) { resp.Status = 3; resp.Msg = "公司名称过长!"; goto outoff; } if (string.IsNullOrWhiteSpace(currentUserInfo.Company)) { currentUserInfo.Company = value; } continue; } } if (isEdit) { this.bll.Update(new UserInfo(), string.Format(" TrueName='{0}',Phone='{1}',Email='{2}',Postion='{3}',Company='{4}' ", currentUserInfo.TrueName, currentUserInfo.Phone, currentUserInfo.Email, currentUserInfo.Postion, currentUserInfo.Company ), string.Format(" AutoID = {0} ", this.currentUserInfo.AutoID) ); } //if (isEdit && !string.IsNullOrWhiteSpace(isSaveUserInfo)) //{ // if (isSaveUserInfo == "1") // { // this.bll.Update(new UserInfo(), // string.Format(" TrueName='{0}',Phone='{1}',Email='{2}',Postion='{3}',Company='{4}' ", // currentUserInfo.TrueName, // currentUserInfo.Phone, // currentUserInfo.Email, // currentUserInfo.Postion, // currentUserInfo.Company // ), // string.Format(" AutoID = {0} ", this.currentUserInfo.AutoID) // ); // } //} //if (bll.IsLogin) //{ // var websiteInfo = bll.GetWebsiteInfoModelFromDataBase(); // if (websiteInfo.IsSynchronizationData != null) // { // if (websiteInfo.IsSynchronizationData.Value == 1) // { // bllUser.Update(currentUserInfo); // } // } //} } #endregion #region 检查是否向微信客服号发送通知信息 if (juActivityInfo != null) { //if (!string.IsNullOrEmpty(juActivityInfo.ActivityNoticeKeFuId)) //{ // WXKeFu keFuInfo = bll.Get<WXKeFu>(string.Format("AutoID={0}", juActivityInfo.ActivityNoticeKeFuId)); // if (keFuInfo != null) // { // #region 发送模板消息给客服 // if (juActivityInfo.ArticleType != "greetingcard") // { // bllWeixin.SendTemplateMessageNotifyComm(keFuInfo.WeiXinOpenID, string.Format("{0}有新的报名", juActivityInfo.ActivityName), string.Format("姓名:{0}\\n手机号:{1}", model.Name, model.Phone)); // } // #endregion // } //} #region 发送模板消息给客服 if (juActivityInfo.ArticleType != "greetingcard") { bllWeixin.SendTemplateMessageToKefu(string.Format("{0}有新的报名", juActivityInfo.ActivityName), string.Format("姓名:{0}\\n手机号:{1}", model.Name, model.Phone)); } #endregion juActivityInfo.SignUpCount = juActivityInfo.SignUpTotalCount + 1; bll.Update(juActivityInfo); } #endregion #region 更新转发表报名数量 MonitorLinkInfo linkModel = bll.Get <MonitorLinkInfo>(string.Format(" MonitorPlanID={0} AND LinkName='{1}' ", monitorPlanID, spreadUserId)); int signupCount = bll.GetCount <ActivityDataInfo>(string.Format("MonitorPlanID={0} And SpreadUserID='{1}' And IsDelete=0", int.Parse(monitorPlanID), spreadUserId)); if (linkModel != null) { linkModel.ActivitySignUpCount = signupCount; bll.Update(linkModel); } #endregion //#region 向报名人发送公众号模板消息-仅五步会有效 //if (bll.WebsiteOwner == "wubuhui") //{ // if (bllWeixin.IsLogin) // { // string accessToken = bllWeixin.GetAccessToken(); // if (accessToken != string.Empty) // { // BLLWeixin.TMSignupNotification notificaiton = new BLLWeixin.TMSignupNotification(); // notificaiton.Url = string.Format("http://{0}/WuBuHui/MyCenter/Index.aspx", System.Web.HttpContext.Current.Request.Url.Host); // notificaiton.TemplateId = "-eJq0w8PEFQRLnWXwqKn73zWvAah6nJxYHgEK3L4Pek"; // notificaiton.First = "恭喜您成功报名我们的活动"; // notificaiton.Keynote1 = juActivityInfo.ActivityName; // notificaiton.Keynote2 = juActivityInfo.ActivityStartDate.ToString(); // notificaiton.Keynote3 = juActivityInfo.ActivityAddress; // notificaiton.Remark = "欢迎您届时参加!"; // bllWeixin.SendTemplateMessage(accessToken, currentUserInfo.WXOpenId, notificaiton); // } // } //} //#endregion #region 发送模板消息给用户 if ((currentUserInfo != null)) { if (juActivityInfo.ArticleType != "greetingcard" && juActivityInfo.IsFee == 0) { bllWeixin.SendTemplateMessageNotifyComm(currentUserInfo, string.Format("您已成功报名{0}", juActivityInfo.ActivityName), string.Format("姓名:{0}\\n手机号:{1}", model.Name, model.Phone)); } if (juActivityInfo.IsFee == 1)//收费活动 { if (model.Amount > 0) { bllWeixin.SendTemplateMessageNotifyComm(currentUserInfo, string.Format("您已报名{0},该活动收费,请尽快完成支付。", juActivityInfo.ActivityName), ""); } } } #endregion #region 微转发自动成为线上分销员 if (!string.IsNullOrEmpty(model.SpreadUserID)) { if (bll.IsLogin) { try { WebsiteInfo websiteInfo = bll.GetWebsiteInfoModelFromDataBase(); if (websiteInfo.DistributionRelationBuildSpreadActivity == 1) { UserInfo recommentUserInfo = bllUser.GetUserInfo (spreadUserId); //ActivityInfo disActivityInfo = bll.GetActivityInfoByActivityID(bllDis.GetDistributionOffLineApplyActivityID()); //bllDis.AutoApply(currentUserInfo, activity, disActivityInfo, recommentUserInfo, model); if (bllUser.IsDistributionMember(recommentUserInfo) || (recommentUserInfo.UserID == websiteInfo.WebsiteOwner)) { bllDisOnLine.SetUserDistributionOwner(currentUserInfo.UserID, recommentUserInfo.UserID, currentUserInfo.WebsiteOwner); } } } catch (Exception ex) { ToLog(ex.ToString()); } } } #endregion juActivityInfo = bllJuactivity.GetJuActivityByActivityID(activityId); } catch (Exception) { } resp.Msg = "提交成功!"; //Dictionary<string, object> exObj = new Dictionary<string, object>(); //exObj.Add("Activity", Activity); //exObj.Add("ActivityData", model); //exObj.Add("ActivityFieldMapping", activityFieldMapping); //resp.ExObj = exObj; resp.ExInt = model.UID; if (juActivityInfo != null) { resp.ExStr = juActivityInfo.ActivitySignuptUrl; } // 推荐报名活动加积分 if (!string.IsNullOrEmpty(spreadUserId)) { if (spreadUserId != currentUserInfo.UserID) { UserInfo recommentUserInfo = bllUser.GetUserInfo(spreadUserId); bllUser.AddUserScoreDetail(recommentUserInfo.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.RecommendSignUpActivityAddScore), recommentUserInfo.WebsiteOwner, null, null); } } #region MyRegion if (!string.IsNullOrEmpty(context.Request["AutoSignIn"])) { if (context.Request["AutoSignIn"].ToString() == "1") { try { WXSignInInfo signInInfo = new WXSignInInfo(); signInInfo.SignInUserID = currentUserInfo.UserID; signInInfo.Name = model.Name; signInInfo.Phone = model.Phone; signInInfo.JuActivityID = juActivityInfo.JuActivityID; signInInfo.SignInOpenID = currentUserInfo.WXOpenId; signInInfo.SignInTime = DateTime.Now; //判断是否已经签到过 if (!bllJuactivity.Exists(signInInfo, new List <string>() { "SignInUserID", "JuActivityID" })) { if (bllJuactivity.Add(signInInfo)) { bllUser.AddUserScoreDetail(currentUserInfo.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.SignIn), currentUserInfo.WebsiteOwner, null, null); } } } catch (Exception) { } } } #endregion goto outoff; } else { resp.Status = 2; resp.Msg = "报名失败,请重试或联系管理员!"; goto outoff; } } catch (Exception ex) { //using (StreamWriter sw = new StreamWriter(@"C:\log.txt", true, System.Text.Encoding.GetEncoding("gb2312"))) //{ // sw.WriteLine(ex.Data); //} resp.Status = 10; resp.Msg = "报名失败:" + ex.ToString(); goto outoff; //日志记录 } outoff: context.Response.Write(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { try { Tolog("京东支付通知start"); var payConfig = bllPay.GetPayConfig(); byte[] byts = new byte[context.Request.InputStream.Length]; context.Request.InputStream.Read(byts, 0, byts.Length); string req = Encoding.UTF8.GetString(byts); Tolog("通知参数" + req); //var jdPubKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKE5N2xm3NIrXON8Zj19GNtLZ8xwEQ6uDIyrS3S03UhgBJMkGl4msfq4Xuxv6XUAN7oU1XhV3/xtabr9rXto4Ke3d6WwNbxwXnK5LSgsQc1BhT5NcXHXpGBdt7P8NMez5qGieOKqHGvT0qvjyYnYA29a8Z4wzNR7vAVHp36uD5RwIDAQAB"; //req = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><jdpay><version>V2.0</version><merchant>110226843002</merchant><result><code>000000</code><desc>success</desc></result><encrypt>MDIxZjNkNjI1YjU1NzQ4MWE5N2ExMTg3YjkxNmQ4NzkxYzQyMmFjZjM4YTM1MjZjY2JjNzM1ZDkxY2Q5ZDNmMTMzMGFjYTBkNTI0MzYzNjc3MTVhODI3OWUzZTAxMmY5ODEyOTVmNDNiNWY5MDZhZGJiYTcwYTYyOTFlYzVmYTU2Y2EyN2U1YzhkNzllMGE3ZTUyNDE4NWU4OWMxNjIwNDFkODcyYzJiZDA4ZWY4YWEyMmY5ZWUxNDk3YTg3MTI3YmU1NTMxNjc5NWJiOTlmN2ZmNGU1MTc1YWJhNjNkYjUzYWUwZDQzOTk4ZjIzMjBiYmVkNGJkMDcxOWUzOThjZjU1ODUwNzM4Y2RiNzM2Njc1N2U2ZTcxN2Q0N2ZiYTZmN2M1YzBiYzRmMjc4ZThiZDNhYTkxZTExNzBiYjg2ZDNjNmQ3OWUyZTBlYjUzZWNlZjFjODQ2MzdiN2E5MTQxN2Y3NmRhZmNkNDdiMzMwNjc1MGRhYjhiYzg0NTFkOWNiY2QyMDZhOTJiYzU2YTFiOWEwMjRmNTZhMWZhNTVhNjlmYTA1ZDFlMmI0YTI4MGE1YTU0N2NlMjc3ZWMwM2QyNWE4ODdlOTA0ZGM3YTY2MDViY2I1OTI5MDBlYWU4MGU0Mzc4MmEwOWY3ZjEwZTk5MGZkOGUzYTA4MzNkNGMyZGZkNWM3MDhkOGU4N2NhMmQyZGM1MDgwYzUyOTg3OGNkMzFhZWRkMTE1NDM5ZjExYTM2OGM2OGE4MGZjZTYyMjJkNzlmODcwNGYyNDMzMTYyZThhZTBkODM2ODBjYzg5ZGRjMWY3ZGVmYzQzYjc4MDZiMDNhMTBmZTc2YjI3MThjYjQ0YjQwZDkyY2E3OGUzYmYzZmFlNjBlOTI4OGU1ODVkNjBjMWZiNDBmMjFjNzVmNDkxYmRkYWFlNzQ0YjZkYmU1ODNkOWQ4OGYwN2EyMDViOWQ5MGNjMzViMTE3MDQ4NWVlNTdlN2Y5MTRhZDM3YzFlODY1NDFiZmQyNDg1MzhlZGZiNDNiZWZmZjY3YmE3NWQ5YjI0MzE4ZDMzMDE5NTE3YWM4ZTJiMDZhZWYyM2NhNjMwODc3MDhkNTdkZWI3MWVhMmY2MzA2ZDliZjBmZGFlNzQ3ODgzODg0ZjVhOWFkODIxYWM0NGQ1ZDlmMGRlNDhkMjBiYTJjYmQ4NTlkMmU3NDMxZDExZmRjMzkxMDU3ZmE3NGE0Yzg2OThkMmY0ZWQ1ZjE3MjIwOWQ1ZTBmZGIzZjFhNGYwOTllZWY5YzRiMWYyZDAxZjlhNzhlYWY5ZjU0YmIyZjczNmUxMjJkNWY2NzhlMDFmYjU0YjY3NWRlYTc1ZWZkNmMwNTJhZmY3ZGVhMGM5NjAyMWQwMGQyMjI2NzdhM2RlNDdhMTdkMWI4ZWQxYmEyYWZlZDg1ZjI4NDk2ZmI2MGVjOTc5OTc4MjgzZTEyNzY2ZmI1OWUzZjY1MWI4OTVlMmQ4OGNlNGRhODg0NzJiNTFiN2RmZDc5NzdkNDk4NTY0NGU4ZjBmNGZjMTM3MmUzMGNhMTUwOTFkNDFhODIzMjZiODU0YjMzNmI1N2EwZDVjMjZjOWNjMzBlMjFjZjNkMDA0NjQ4Zjk0NjQzZWRhOTU1MmIyZjJkYzZjNGJmOTU5MDIzNTBlODlmOTNhZDRhYmEyMzZiY2E1OWE4NzY5Mjc0ZTcwN2MyNGFjNGJmOTU5MDIzNTBlODlmNDNlZGE5NTUyYjJmMmRjNjU0MTNlZjYxZTNlODc4MDk3MmNiYjg3NTVjNmU1NWNlZDljNWU0ZDE5ZTRmZjJjZTAxNmJiMGIzYWFlOTdlYTQzYmM5NWVmMGU0ZjUyNzY4NDNlZGE5NTUyYjJmMmRjNmMyOWRiYWZkYTNjYzQ1M2E3ZGJhZWNjZWJmNGIxZmQ5MTMxMmRiMzliOTU2YzBmNmNiODMxMDQ1ZDBiYjM1ZTNmMzlmMGE0ODNiN2M3ODYyZjNjMTFiN2ZiODljNDNkMjE4NGFlNzU5M2JhMmQ2YTJkOWMwMmYxYTBlNTg2MzhkYzU0NzE0NjExNzkyNGU4ZjQ4NDgzMTAyNDY5OGRlNGZiMDVmNGQzNzE3NGMwOGI2NGU2NjkxMmU2NGY5M2I0YjNiMThmMzZiZmY0NTgwN2FjMDAxOWRlY2ZkYTcyOGFmNzIyZTQwNjhlMTViM2UwMmQzMmRiYjJkOTE2MmQzNWMzZWM2OGRkZjJjMjdmOTRhZGNmYzEzOTdlOWY0NjQwODFiYWU0Y2E3Y2NjZDY0NjQzNGFmZWU4ODExYWRiZTBlY2MwY2JlOThmNDliMDZkYjE2YjNjNTZhOTRiOGZkMDU=</encrypt></jdpay>"; //req = Regex.Replace(req, @"[\t\n\r]", "", RegexOptions.IgnoreCase); req = req.Replace("\r", "").Replace("\n", "").Replace("\t", ""); AsynNotifyResponse anyResponse = Payment.JDPay.XMLUtil.decryptResXml <AsynNotifyResponse>(Payment.JDPay.Config.JDPubKey, payConfig.JDPayDESKey, req); // System.Diagnostics.Debug.WriteLine("异步通知订单号:" + anyResponse.tradeNum + ",状态:" + anyResponse.status); Tolog("异步通知订单号:" + anyResponse.tradeNum + ",状态:" + anyResponse.status); var orderId = anyResponse.tradeNum; var orderInfo = bllMall.GetOrderInfo(orderId); if (orderInfo == null) { //context.Response.Write("订单未找到"); context.Response.StatusCode = 500; context.Response.Write(failStr); return; } if (orderInfo.PaymentStatus.Equals(1)) { //Tolog("已支付"); // context.Response.Write("订单已支付"); context.Response.StatusCode = 200; context.Response.Write(successStr); return; } if (anyResponse.status == "2") { orderInfo.PaymentType = 3; //支付成功 WXMallProductInfo tProductInfo = new WXMallProductInfo(); UserInfo orderUserInfo = bllUser.GetUserInfo(orderInfo.OrderUserID, orderInfo.WebsiteOwner);//下单用户信息 string hasOrderIDs = ""; int maxCount = 1; //Tolog("准备检查更新订单状态"); if (BLLJIMP.BLLMall.bookingList.Contains(orderInfo.ArticleCategoryType)) { //Tolog("预订类型"); #region 预约订单修改状态 orderInfo.PaymentStatus = 1; orderInfo.PayTime = DateTime.Now; orderInfo.Status = "预约成功"; #region 检查是否有预约成功的订单 List <WXMallOrderDetailsInfo> tDetailList = bllMall.GetOrderDetailsList(orderInfo.OrderID, null, orderInfo.ArticleCategoryType, null, null); List <WXMallOrderDetailsInfo> oDetailList = bllMall.GetOrderDetailsList(null, tDetailList[0].PID, orderInfo.ArticleCategoryType, tDetailList.Min(p => p.StartDate), tDetailList.Max(p => p.EndDate)); tProductInfo = bllMall.GetByKey <WXMallProductInfo>("PID", tDetailList[0].PID); maxCount = tProductInfo.Stock; List <string> hasOrderIDList = new List <string>(); foreach (var item in tDetailList) { List <WXMallOrderDetailsInfo> hasOrderDetailList = oDetailList.Where(p => !((item.StartDate >= p.EndDate && item.EndDate > p.EndDate) || (item.StartDate < p.StartDate && item.EndDate <= p.StartDate))).ToList(); if (hasOrderDetailList.Count >= maxCount) { hasOrderIDList.AddRange(hasOrderDetailList.Select(p => p.OrderID).Distinct()); } } hasOrderIDList = hasOrderIDList.Where(p => !p.Contains(orderInfo.OrderID)).ToList(); if (hasOrderIDList.Count > 0) { hasOrderIDList = hasOrderIDList.Distinct().ToList(); hasOrderIDs = MyStringHelper.ListToStr(hasOrderIDList, "'", ","); } #endregion 检查是否有预约成功的订单 #endregion 预约订单修改状态 } else { //Tolog("普通类型"); #region 原订单修改状态 orderInfo.PaymentStatus = 1; orderInfo.Status = "待发货"; orderInfo.PayTime = DateTime.Now; Tolog("更改状态start"); //if (bllMall.GetWebsiteInfoModelFromDataBase().IsDistributionMall.Equals(1)) //{ orderInfo.GroupBuyStatus = "0"; orderInfo.DistributionStatus = 1; #region 拼团订单 if (orderInfo.OrderType == 2) { try { if (!string.IsNullOrEmpty(orderInfo.GroupBuyParentOrderId)) { var parentOrderInfo = bllMall.GetOrderInfo(orderInfo.GroupBuyParentOrderId); if (bllMall.GetCount <WXMallOrderInfo>(string.Format("PaymentStatus=1 And GroupBuyParentOrderId='{0}' Or OrderId='{0}'", parentOrderInfo.OrderID)) >= parentOrderInfo.PeopleCount) { bllMall.Update(new WXMallOrderInfo(), string.Format("Status='已取消'"), string.Format(" GroupBuyParentOrderId='{0}' And PaymentStatus=0", parentOrderInfo.OrderID)); parentOrderInfo.GroupBuyStatus = "1"; bllMall.Update(parentOrderInfo); } } } catch (Exception) { } } #endregion #region 活动订单 if (orderInfo.OrderType == 4) { ActivityDataInfo data = bllMall.Get <ActivityDataInfo>(string.Format(" OrderId='{0}'", orderInfo.OrderID)); if (data != null) { bllMall.Update(data, string.Format(" PaymentStatus=1"), string.Format(" OrderId='{0}'", orderInfo.OrderID)); } } #endregion bllMall.Update(orderInfo, string.Format("PaymentStatus=1,Status='待发货',PayTime=GETDATE(),DistributionStatus=1"), string.Format("ParentOrderId='{0}'", orderInfo.OrderID)); //} #endregion 原订单修改状态 //orderInfo.PayTranNo = tradeNo; } bool result = false; if (BLLJIMP.BLLMall.bookingList.Contains(orderInfo.ArticleCategoryType)) { if (string.IsNullOrWhiteSpace(hasOrderIDs)) { hasOrderIDs = "'0'"; } result = bllMall.Update(new WXMallOrderInfo(), string.Format("PaymentStatus={0},PayTime=GetDate(),Status='{1}'", 1, "预约成功"), string.Format("OrderID='{0}' and WebsiteOwner='{4}' AND (select count(1) from [ZCJ_WXMallOrderInfo] where Status='{3}' and WebsiteOwner='{4}' and OrderID IN({1}))<{2}", orderInfo.OrderID, hasOrderIDs, maxCount, "预约成功", bllMall.WebsiteOwner) ) > 0; if (result) { // #region 交易成功加积分 //增加积分 (慧聚不需要) //if (orderInfo.TotalAmount > 0) //{ // ScoreConfig scoreConfig = bllScore.GetScoreConfig(); // int addScore = 0; // if (scoreConfig != null && scoreConfig.OrderAmount > 0 && scoreConfig.OrderScore > 0) // { // addScore = (int)(orderInfo.PayableAmount / (scoreConfig.OrderAmount / scoreConfig.OrderScore)); // } // if (addScore > 0) // { // if (bllUser.Update(new UserInfo(), // string.Format(" TotalScore+={0},HistoryTotalScore+={0}", addScore), // string.Format(" UserID='{0}'", orderInfo.OrderUserID)) > 0) // { // UserScoreDetailsInfo scoreRecord = new UserScoreDetailsInfo(); // scoreRecord.AddTime = DateTime.Now; // scoreRecord.Score = addScore; // scoreRecord.ScoreType = "OrderSuccess"; // scoreRecord.UserID = orderInfo.OrderUserID; // scoreRecord.AddNote = "预约-交易成功获得积分"; // bllMall.Add(scoreRecord); // } // } //} // #endregion #region 修改其他预约订单为预约失败 返还积分 if (BLLJIMP.BLLMall.bookingList.Contains(orderInfo.ArticleCategoryType) && !string.IsNullOrWhiteSpace(hasOrderIDs)) { int tempCount = 0; List <WXMallOrderInfo> tempList = bllMall.GetOrderList(0, 1, "", out tempCount, "预约成功", null, null, null, null, null, null, null, null, null, null, orderInfo.ArticleCategoryType, hasOrderIDs); tempCount = tempCount + 1; //加上当前订单的数量 if (tempCount >= maxCount) { tempList = bllMall.GetColOrderListInStatus("'待付款','待审核'", hasOrderIDs, "OrderID,OrderUserID,UseScore", bllMall.WebsiteOwner); if (tempList.Count > 0) { string stopOrderIds = MyStringHelper.ListToStr(tempList.Select(p => p.OrderID).ToList(), "'", ","); tempList = tempList.Where(p => p.UseScore > 0).ToList(); foreach (var item in tempList) { orderUserInfo.TotalScore += item.UseScore; if (bllUser.Update(new UserInfo(), string.Format(" TotalScore+={0}", item.UseScore), string.Format(" UserID='{0}'", item.OrderUserID)) > 0) { UserScoreDetailsInfo scoreRecord = new UserScoreDetailsInfo(); scoreRecord.AddTime = DateTime.Now; scoreRecord.Score = item.UseScore; scoreRecord.TotalScore = orderUserInfo.TotalScore; scoreRecord.ScoreType = "OrderCancel"; scoreRecord.UserID = item.OrderUserID; scoreRecord.RelationID = item.OrderID; scoreRecord.AddNote = "预约-订单失败返还积分"; scoreRecord.WebSiteOwner = item.WebsiteOwner; bllMall.Add(scoreRecord); } } bllMall.Update(new WXMallOrderInfo(), string.Format("Status='{0}'", "预约失败"), string.Format("OrderID In ({0}) and WebsiteOwner='{1}'", stopOrderIds, bllMall.WebsiteOwner)); } } //Tolog("更改修改其他预约为预约失败"); } #endregion } } else { result = bllMall.Update(orderInfo); } if (result) { Open.HongWareSDK.Client hongWareClient = new Open.HongWareSDK.Client(orderInfo.WebsiteOwner); //Tolog("更改状态true"); #region Efast同步 //判读当前站点是否需要同步到驿氪和efast if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncEfast, bllCommRelation.WebsiteOwner, "")) { try { Tolog("开始同步efast"); string outOrderId = string.Empty, msg = string.Empty; var syncResult = bllEfast.CreateOrder(orderInfo.OrderID, out outOrderId, out msg); if (syncResult) { orderInfo.OutOrderId = outOrderId; bllMall.Update(orderInfo); } Tolog(string.Format("efast订单同步结果:{0},订单号:{1},提示信息:{2}", syncResult, outOrderId, msg)); } catch (Exception ex) { Tolog("efast订单同步异常:" + ex.Message); } } #endregion #region 驿氪同步 if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, "")) { try { Tolog("开始同步驿氪"); //同步成功订单到驿氪 //UserInfo orderUserInfo = bllUser.GetUserInfo(orderInfo.OrderUserID); //if ((!string.IsNullOrEmpty(orderUserInfo.Ex1)) && (!string.IsNullOrEmpty(orderUserInfo.Ex2)) && (!string.IsNullOrEmpty(orderUserInfo.Phone))) //{ // client.BonusUpdate(orderUserInfo.Ex2, -(orderInfo.UseScore), "商城下单使用积分" + orderInfo.UseScore); //} var uploadOrderResult = yikeClient.OrderUpload(orderInfo); Tolog(string.Format("驿氪订单同步结果:{0}", Common.JSONHelper.ObjectToJson(uploadOrderResult))); } catch (Exception ex) { Tolog("驿氪订单同步异常:" + ex.Message); } } #endregion #region 付款加积分 try { bllUser.AddUserScoreDetail(orderInfo.OrderUserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.OrderPay), bllMall.WebsiteOwner, null, null); } catch (Exception) { } #endregion #region 消息通知 if (!BLLJIMP.BLLMall.bookingList.Contains(orderInfo.ArticleCategoryType)) { try { var productName = bllMall.GetOrderDetailsList(orderInfo.OrderID)[0].ProductName; string remark = ""; if (!string.IsNullOrEmpty(orderInfo.OrderMemo)) { remark = string.Format("客户留言:{0}", orderInfo.OrderMemo); } bllWeiXin.SendTemplateMessageToKefu("有新的订单", string.Format("订单号:{0}\\n订单金额:{1}元\\n收货人:{2}\\n电话:{3}\\n商品:{4}\\n{5}", orderInfo.OrderID, orderInfo.TotalAmount, orderInfo.Consignee, orderInfo.Phone, productName, remark)); if (orderInfo.OrderType != 4)//付费的活动不发消息 { if (orderInfo.WebsiteOwner != "jikuwifi") { string url = string.Format("http://{0}/customize/shop/?v=1.0&ngroute=/orderDetail/{1}#/orderDetail/{1}", context.Request.Url.Host, orderInfo.OrderID); bllWeiXin.SendTemplateMessageNotifyComm(orderUserInfo, "订单已成功支付,我们将尽快发货,请保持手机畅通等待物流送达!", string.Format("订单号:{0}\\n订单金额:{1}元\\n收货人:{2}\\n电话:{3}\\n商品:{4}...\\n查看详情", orderInfo.OrderID, orderInfo.TotalAmount, orderInfo.Consignee, orderInfo.Phone, productName), url); } } } catch (Exception) { } } else { try { bllWeiXin.SendTemplateMessageToKefu(orderInfo.Status, string.Format("预约:{2}\\n订单号:{0}\\n订单金额:{1}元\\n预约人:{3}\\n预约人手机:{4}", orderInfo.OrderID, orderInfo.TotalAmount, tProductInfo.PName, orderUserInfo.TrueName, orderUserInfo.Phone)); bllWeiXin.SendTemplateMessageNotifyComm(orderUserInfo, orderInfo.Status, string.Format("预约:{2}\\n订单号:{0}\\n订单金额:{1}元", orderInfo.OrderID, orderInfo.TotalAmount, tProductInfo.PName)); } catch (Exception) { } } #endregion WebsiteInfo websiteInfo = bllMall.Get <WebsiteInfo>(string.Format(" WebsiteOwner='{0}'", orderInfo.WebsiteOwner)); #region 分销相关 try { if (bllMenuPermission.CheckUserAndPmsKey(websiteInfo.WebsiteOwner, BLLPermission.Enums.PermissionSysKey.OnlineDistribution, websiteInfo.WebsiteOwner)) { if (string.IsNullOrWhiteSpace(orderUserInfo.DistributionOwner)) { if (websiteInfo.DistributionRelationBuildMallOrder == 1) { orderUserInfo.DistributionOwner = bllMall.WebsiteOwner; bllMall.Update(orderUserInfo); } } bllDis.AutoUpdateLevel(orderInfo); bllDis.TransfersEstimate(orderInfo); bllDis.SendMessageToUser(orderInfo); bllDis.UpdateDistributionSaleAmountUp(orderInfo); } } catch (Exception ex) { Tolog("设置分销员异常:" + ex.Message + " 用户id:" + orderUserInfo.UserID); } #endregion #region 宏巍通知 try { if (websiteInfo.IsUnionHongware == 1) { hongWareClient.OrderNotice(orderUserInfo.WXOpenId, orderInfo.OrderID); } } catch (Exception) { } #endregion bllCard.Give(orderInfo.TotalAmount, orderUserInfo); string v1ProductId = Common.ConfigHelper.GetConfigString("YGBV1ProductId"); string v2ProductId = Common.ConfigHelper.GetConfigString("YGBV2ProductId"); string v1CouponId = Common.ConfigHelper.GetConfigString("YGBV1CouponId"); string v2CouponId = Common.ConfigHelper.GetConfigString("YGBV2CouponId"); List <WXMallOrderDetailsInfo> orderDetailList = bllMall.GetOrderDetailsList(orderInfo.OrderID); foreach (var item in orderDetailList) { item.IsComplete = 1; bllMall.Update(item); #region 购买指定商品发送指定的优惠券 if (!string.IsNullOrEmpty(v1ProductId) && !string.IsNullOrEmpty(v1CouponId) && item.PID == v1ProductId) { bllCard.SendCardCouponsByCurrUserInfo(orderUserInfo, v1CouponId); } if (!string.IsNullOrEmpty(v2ProductId) && !string.IsNullOrEmpty(v2CouponId) && item.PID == v2ProductId) { bllCard.SendCardCouponsByCurrUserInfo(orderUserInfo, v2CouponId); } #endregion } //更新销量 bllMall.UpdateProductSaleCount(orderInfo); context.Response.StatusCode = 200; context.Response.Write(successStr); Tolog("支付成功" + orderInfo.OrderID); return; } else { Tolog("更改状态false"); context.Response.StatusCode = 500; context.Response.Write(failStr); return; } } } catch (Exception ex) { //error = "fail"; Tolog("京东支付异常:" + ex.ToString()); } context.Response.ContentType = "text/plain"; context.Response.StatusCode = 500; context.Response.Write(failStr); }
void RefreshActivity(Dictionary <int, ActivityListRef> _list) { //Debug.Log("刷新所有的活动提示"); if (actGo != null) { foreach (GameObject obj in actDic.Values) { if (obj != null) { obj.SetActive(false); } //Debug.Log("隐藏活动提示"); } if (itemGird != null) { itemGird.maxPerLine = _list.Count; } int i = 0; using (var e = _list.GetEnumerator()) { while (e.MoveNext()) { ActivityListRef _data = e.Current.Value; ActivityDataInfo info = GameCenter.activityMng.GetActivityDataInfo(_data.id); if (info != null && info.State == ActivityState.HASENDED) { continue; } //Debug.Log("_data name:" + _data.name + ",id:" + _data.id); GameObject go = null; if (!actDic.ContainsKey(i)) { go = Instantiate(actGo) as GameObject; actDic[i] = go; } else { go = actDic[i]; } go.transform.parent = actGo.transform.parent; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.SetActive(true); //Debug.Log("展示活动提示"); if (go != null && _data != null) { ActivityBtnUI activityBtnUI = go.GetComponent <ActivityBtnUI>(); if (activityBtnUI != null) { activityBtnUI.Refresh(_data); } UIEventListener.Get(go).onClick = delegate { if (GameCenter.activityMng.ActivityOnGoingList.ContainsKey(_data.id)) { GameCenter.activityMng.ActivityOnGoingList.Remove(_data.id); GameCenter.activityMng.haveTipDic[_data.id] = _data; } ActivityType type = (ActivityType)_data.id; if (type == ActivityType.UNDERBOSS) { BossChallengeWnd.OpenAndGoWndByType(BossChallengeWnd.ToggleType.UnderBoss); } else { GameCenter.activityMng.OpenStartSeleteActivity(type); } go.SetActive(false); }; } i++; } } if (itemGird != null) { itemGird.repositionNow = true; } } }
/// <summary> /// 是否通过报名 /// </summary> /// <param name="context"></param> /// <returns></returns> private string ActivityDataByIsPass(HttpContext context) { string activityId = context.Request["ActivityID"]; string uId = context.Request["UID"]; string remarks = context.Request["Remarks"]; int status = int.Parse(context.Request["Status"]); string[] ids = uId.Split(','); ActivityDataInfo model = new ActivityDataInfo(); foreach (var item in ids) { model = bllActivity.GetActivityDataInfo(activityId, int.Parse(item)); model.Status = status; model.Remarks = remarks; UserInfo commendUserInfo = bllUser.GetUserInfoByAutoID(int.Parse(model.DistributionOffLineRecommendCode)); if (commendUserInfo == null) { continue; } #region 审核通过 if (status == 1001)//审核通过 { UserInfo userInfo = bllUser.GetUserInfo(model.UserId); userInfo.TrueName = model.Name; if (string.IsNullOrEmpty(model.SpreadUserID))//不是微转发的才分配上级用户 { userInfo.DistributionOffLinePreUserId = commendUserInfo.UserID; } else//微转发直接成为分销员 { commendUserInfo = bllUser.GetUserInfo(model.SpreadUserID); userInfo.DistributionOffLinePreUserId = commendUserInfo.UserID; } if (bllUser.Update(userInfo)) { //申请通过向申请人和上级提醒通过申请 //申请人 //bllWeixin.SendTemplateMessageNotifyComm(userInfo.WXOpenId, "财富伙伴申请结果", "恭喜您已经通过审核!", string.Format("http://{0}/App/Distribution/m/index.aspx", context.Request.UserHostName)); if (string.IsNullOrEmpty(model.SpreadUserID))//不是微转发的才分配上级用户 { //上级 bllWeixin.SendTemplateMessageNotifyComm(commendUserInfo, string.Format("恭喜您的会员“{0}”申请财富会员成功", model.Name), "请提醒他关注公众号并帮助他熟悉系统操作吧。", string.Format("http://{0}/App/Distribution/m/index.aspx", context.Request.Url.Host)); } } //if (!string.IsNullOrEmpty(model.SpreadUserID))//不是微转发的才分配上级用户 //{ // model.Status = 4003; //} } #endregion #region 审核不通过 else if (status == 4001) { UserInfo userInfo = bllUser.GetUserInfo(model.UserId); //判断下,当他有下线的时候就不可以取消审核状态 if (bllDistributionOffLine.IsHaveLowerLevel(model.UserId)) { continue; } else { userInfo.DistributionOffLinePreUserId = ""; bllUser.Update(userInfo); } //申请通过向申请人和上级提醒通过申请 //申请人 //bllWeixin.SendTemplateMessageNotifyComm(userInfo.WXOpenId, "财富伙伴申请结果", string.Format("审核未通过!\\{0}", remarks)); //上级 bllWeixin.SendTemplateMessageNotifyComm(commendUserInfo, string.Format("很抱歉您的会员“{0}”申请财富会员失败", model.Name), string.Format(" 原因:{0}\\n您可提醒他满足要求后重新申请。", remarks), string.Format("http://{0}/App/Distribution/m/index.aspx", context.Request.Url.Host)); if (!string.IsNullOrEmpty(model.SpreadUserID)) { //微转发审核不通过,删除此记录 bllActivity.Delete(model, string.Format("ActivityID={0} And UID={1}", model.ActivityID, model.UID)); } } #endregion if (!bllActivity.Update(model)) { continue; } } resp.Status = 1; return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { string activity_id = context.Request["activity_id"]; string longitude = context.Request["longitude"]; string latitude = context.Request["latitude"]; if (string.IsNullOrWhiteSpace(longitude) || string.IsNullOrWhiteSpace(latitude)) { apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete; apiResp.msg = "请传入当前经纬度"; bll.ContextResponse(context, apiResp); return; } int total = 0; List <JuActivityInfo> list = bll.GetRangeUserList(1, 1, bll.WebsiteOwner, null, "Appointment", null, null, longitude, latitude , null, null, null, null, null, null, null, null, null, null , null, null, "99", null, null, out total, int.MaxValue, null, activity_id); if (list.Count == 0) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "约会没有找到"; bll.ContextResponse(context, apiResp); return; } UserInfo userTemp = bllUser.GetUserInfo(list[0].UserID); if (userTemp == null) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "发布人信息未找到"; bll.ContextResponse(context, apiResp); return; } ActivityDataInfo actData = bll.GetActivityDataByUserId(list[0].SignUpActivityID, null, CurrentUserInfo.UserID , bll.WebsiteOwner); List <ActivityDataInfo> listSignupData = new List <ActivityDataInfo>(); if (CurrentUserInfo.UserID == list[0].UserID) { listSignupData = bll.GetActivityDataListByUId(list[0].SignUpActivityID, bll.WebsiteOwner, "1"); } apiResp.status = true; apiResp.code = 0; apiResp.result = new { activity_id = list[0].JuActivityID, activity_name = list[0].ActivityName, activity_address = list[0].ActivityAddress, activity_summary = list[0].Summary, create_time = DateTimeHelper.DateTimeToUnixTimestamp(list[0].CreateDate), create_time_str = DateTimeHelper.DateTimeToString(list[0].CreateDate), activity_start_time = list[0].ActivityStartDate.HasValue ? DateTimeHelper.DateTimeToUnixTimestamp(list[0].ActivityStartDate.Value) : 0, activity_start_time_str = list[0].ActivityStartDate.HasValue ? DateTimeHelper.DateTimeToString(list[0].ActivityStartDate.Value) : "", activity_pv = list[0].PV, activity_commentcount = list[0].CommentCount, activity_signcount = list[0].SignUpCount, category_id = list[0].CategoryId, category_name = list[0].CategoryName, activity_ex1 = list[0].K1, activity_ex2 = list[0].K2, activity_ex3 = list[0].K3, activity_ex4 = list[0].K4, activity_ex5 = list[0].K5, activity_ex6 = list[0].K6, activity_ex7 = list[0].K7, activity_ex8 = list[0].K8, activity_ex9 = list[0].K9, activity_ex10 = list[0].K10, credit_acount = list[0].CreditAcount, guarantee_credit_acount = list[0].GuaranteeCreditAcount, publish_user = new { id = userTemp.AutoID, user_name = userTemp.UserID, nick_name = userTemp.WXNickname, gender = userTemp.Gender, birthday = DateTimeHelper.DateTimeToUnixTimestamp(userTemp.Birthday), birthday_str = DateTimeHelper.DateTimeToString(userTemp.Birthday), identification = userTemp.Ex5, avatar = userTemp.Avatar }, status = list[0].TStatus, isstop = (list[0].TStatus == 2 || list[0].TStatus == -1)?true:false, distance = list[0].Distance, isauthor = list[0].UserID == CurrentUserInfo.UserID ? true : false, issignup = actData == null?false:true, signup_user_status = actData == null? -99: actData.Status, need_signin = listSignupData.Count > 0? true: false, isfollow = bllCommRelation.ExistRelation(CommRelationType.FollowUser, list[0].UserID, CurrentUserInfo.UserID) }; //阅读数+1 list[0].PV++; bll.Update(list[0]); apiResp.msg = "查询完成"; bll.ContextResponse(context, apiResp); }
/// <summary> /// 活动排序 进行中--未开始--已结束 /// </summary> public int SortActivity(ActivityDataInfo info1, ActivityDataInfo info2) { int state1 = 0; int state2 = 0; switch (info1.State) { case ActivityState.ONGOING: state1 = 2; break; case ActivityState.NOTATTHE: state1 = 3; break; case ActivityState.HASENDED: state1 = 4; break; } if (CurSeleteType != ActivityType.NONE)//将选中的活动放在最前面 { if (CurSeleteType == info1.ID) { state1 = 1; } } switch (info2.State) { case ActivityState.ONGOING: state2 = 2; break; case ActivityState.NOTATTHE: state2 = 3; break; case ActivityState.HASENDED: state2 = 4; break; } if (CurSeleteType != ActivityType.NONE) { if (CurSeleteType == info2.ID) { state2 = 1; } } if (state1 > state2)//先按活动状态排序(进行中-未开始-已结束) { return(1); } if (state1 < state2) { return(-1); } if (info1.SortNum > info2.SortNum)//状态相同按ListNum排序 { return(1); } if (info1.SortNum < info2.SortNum) { return(-1); } return(0); }