/// <summary> /// 关联领奖人和推荐人 /// </summary> /// <returns></returns> public string BindRecommender() { string content = string.Empty; var respData = new Default.LowerRespData(); string reqContent = Request["ReqContent"]; Loggers.Debug(new DebugLogInfo() { Message = string.Format("getItemList: {0}", reqContent) }); try { //解析请求字符串 var reqObj = reqContent.DeserializeJSONTo <BindRecommenderReqData>(); //判断客户ID是否传递 if (!string.IsNullOrEmpty(reqObj.common.customerId)) { customerId = reqObj.common.customerId; } var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); var vipBLL = new VipBLL(loggingSessionInfo); var vip = vipBLL.GetVipDetailByVipID(reqObj.common.userId); //更新推荐人openId if (reqObj.special.Recommender != null && reqObj.special.Recommender != "") { string vipID = GetVipIDByOpenID(loggingSessionInfo, reqObj.special.Recommender); if ((vip.HigherVipID == null || vip.HigherVipID == "") && reqObj.common.userId != vipID) { vip.HigherVipID = vipID; vipBLL.Update(vip); //查看推荐人成功推荐人数,满足条件给奖励 CouponBLL couponService = new CouponBLL(loggingSessionInfo); //TODO:added by zhangwei20141009,保存上下线记录 couponService.UpdateVipRecommandTrace(reqObj.common.userId, vipID); couponService.RecommenderPrize(vipID, null); } } } catch (Exception ex) { respData.code = "103"; respData.description = ex.Message; } content = respData.ToJSON(); return(content); }
/// <summary> /// 获取Vip信息 /// </summary> public string GetVipInfoById() { var service = new VipBLL(CurrentUserInfo); VipEntity obj = new VipEntity(); string content = string.Empty; string key = string.Empty; if (Request("vip_id") != null && Request("vip_id") != string.Empty) { key = Request("vip_id").ToString().Trim(); } obj = service.GetVipDetailByVipID(key); var jsonData = new JsonData(); jsonData.totalCount = obj == null ? "0" : "1"; jsonData.data = obj; content = jsonData.ToJSON(); return(content); }
/// <summary> /// (基金赎回)2201 /// </summary> /// <param name="dt">当前时间</param> /// <param name="pLogisticsinfo">交易号</param> /// <returns></returns> private ReceiveRansomMessage AssertRanson(LoggingSessionInfo pLoggingSessionInfo, string customerID, string userID, string detailID, DateTime dt) { //获取用户信息 VipBLL vbll = new VipBLL(pLoggingSessionInfo); VipEntity vip = vbll.GetVipDetailByVipID(userID); if (vip == null) { throw new Exception("该用户不存在!"); } //交易号 string logisticsinfo = m_logisticsinfo; //客户协议号 //string assignbuyer = GetClientAgreementNo(pLoggingSessionInfo, userID, customerID); string assignbuyer = vip.VipCode; ReceiveRansomMessage pEnity = new ReceiveRansomMessage(); pEnity.MerchantID = HuaAnConfigurationAppSitting.MerchantID; pEnity.Merchantdate = dt.ToString("yyyyMMdd"); pEnity.Logisticsinfo = logisticsinfo; // 交易号 pEnity.Assignbuyer = assignbuyer; //客户协议号 :客户协议号唯一的标识世联的用户和华安用户之前的绑定关系。备注:一个用户只能绑定一次,所以一个用户只能有一个协议号 pEnity.Assbuyername = vip.VipName; pEnity.Assbuyermobile = vip.Phone; pEnity.Fee = "0"; //用于回调更新 &=>& pEnity.Commonreturn = "mappingID=" + 1000 + "&prePaymentID=" + 100; //回调url pEnity.PageURL = string.Format(HuaAnConfigurationAppSitting.CallBackPageUrl, "RansomCallBack"); pEnity.Memo = ""; pEnity.RetURL = ""; return(pEnity); }
protected override GrantCouponRD ProcessRequest(DTO.Base.APIRequest <GrantCouponRP> pRequest) { var rd = new GrantCouponRD();//返回值 var param = pRequest.Parameters; VipCouponMappingBLL bllVipCoupon = new VipCouponMappingBLL(this.CurrentUserInfo); try { var customerBasicSettingBLL = new CustomerBasicSettingBLL(this.CurrentUserInfo); var ResultList = customerBasicSettingBLL.GetBusinessBasisConfigInfo(CurrentUserInfo.ClientID); rd.CustomerName = ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerShortName")) == null ? "" : ResultList.FirstOrDefault(m => m.SettingCode.Equals("CustomerShortName")).SettingValue; //引导二维码 rd.FollowUrl = ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideLinkUrl")) == null ? "" : ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideLinkUrl")).SettingValue; //引导链接 rd.GuideQRCode = ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideQRCode")) == null ? "" : ResultList.FirstOrDefault(m => m.SettingCode.Equals("GuideQRCode")).SettingValue; //引导二维码 if (bllVipCoupon.HadBeGranted(param.CouponId, param.Giver) == 0) { rd.IsAccept = 1; rd.IsSuccess = false; rd.Message = "手慢一步,优惠券已被高人领走!"; return(rd); } CouponBLL bll = new CouponBLL(this.CurrentUserInfo); DataSet ds = bll.GetCouponDetail(pRequest.Parameters.CouponId, ""); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["Status"].ToString() == "2") { if (bllVipCoupon.GrantCoupon(param.Giver, pRequest.UserID, param.CouponId) > 0) { CouponGrantLogBLL bllCouponGrantLog = new CouponGrantLogBLL(this.CurrentUserInfo); bllCouponGrantLog.Create(new CouponGrantLogEntity() { CouponId = param.CouponId, FromVipId = param.Giver, ToVipId = pRequest.UserID, CouponGrantLogId = Guid.NewGuid() }); VipBLL bllVip = new VipBLL(this.CurrentUserInfo); var vipInfo = bllVip.GetVipDetailByVipID(param.Giver); rd.IsSuccess = true; rd.Message = vipInfo.VipName + "赠送你一张" + ds.Tables[0].Rows[0]["CouponName"] + "的优惠券"; rd.IsAccept = 0; } else { rd.IsAccept = 1; rd.IsSuccess = false; rd.Message = "领取失败"; } } else { rd.IsAccept = 1; rd.IsSuccess = false; rd.Message = "优惠券已被使用"; } } catch (Exception ex) { rd.IsAccept = 0; rd.IsSuccess = false; rd.Message = ex.Message.ToString(); throw; } return(rd); }
/// <summary> /// 基金购买 /// </summary> /// <param name="reqContent"></param> /// <returns></returns> public void BuyFund() { DateTime dt = DateTime.Now; string orderNO = HuaAnFactory.GenerateSeqNO(); var loggingSessionInfo = Default.GetBSLoggingSession(m_customerID, m_userID); WXHouseDetailBLL wxhdbll = new WXHouseDetailBLL(loggingSessionInfo); WXHouseDetailEntity wxhde = wxhdbll.GetDetailByID(m_customerID, m_detailID); if (wxhde == null) { throw new Exception("没有找到该楼盘信息。"); } string realPay = wxhde.RealPay.ToString(); //产生订单号 TUnitExpandBLL TUeBll = new TUnitExpandBLL(loggingSessionInfo); // string seqNO = TUeBll.GetUnitOrderNo(loggingSessionInfo, "ed7d227564b54778a4cffb7335a8b078"); string seqNO = HuaAnFactory.GenerateSeqNO(); //1判断会员楼盘明细映射是否存在记录 WXHouseVipMappingBLL bll = new WXHouseVipMappingBLL(loggingSessionInfo); DataSet ds = bll.VerifWXHouseVipMapping(m_userID, m_detailID, m_customerID); Guid mappingID = Guid.NewGuid(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //1.1存在 mappingID = new Guid(ds.Tables[0].Rows[0]["MappingID"].ToString()); } else { //1.2不存在 //插入会员楼盘明细映射表 WXHouseVipMappingEntity WXHvmEntity = new WXHouseVipMappingEntity(); WXHvmEntity.MappingID = mappingID; WXHvmEntity.DetailID = new Guid(m_detailID); WXHvmEntity.CustomerID = m_customerID; WXHvmEntity.VIPID = m_userID; //WXHvmEntity.HouseSaleNo = "";//预售号码 WXHvmEntity.ReserveNo = orderNO; //WXHvmEntity.HoseMessage = "";//房子描述信息 WXHvmEntity.HoseState = 0; WXHvmEntity.IsBuyHose = (int)PayHouseStateEnum.Unknown; WXHvmEntity.IsBuyFund = 1; WXHvmEntity.IsRedeem = (int)FundStateEnum.Unknown; bll.Create(WXHvmEntity); } //1.3插入交易手续费表 Guid feeID = Guid.NewGuid(); WXHouseTradeFeeEntity WXHtfEntity = new WXHouseTradeFeeEntity(); WXHtfEntity.FeeID = feeID; WXHtfEntity.TradeType = 0; WXHtfEntity.FeeType = 0; WXHtfEntity.Fee = 0; WXHtfEntity.CustomerID = m_customerID; WXHouseTradeFeeBLL WXHtfBll = new WXHouseTradeFeeBLL(loggingSessionInfo); WXHtfBll.Create(WXHtfEntity); ////1.4插入预付款订单 //WXHousePrePaymentEntity WXHppEntity = new WXHousePrePaymentEntity(); //Guid prePaymentID = Guid.NewGuid(); //WXHppEntity.PrePaymentID = prePaymentID; //WXHppEntity.FeeID = feeID; //WXHppEntity.MappingID = mappingID; //WXHppEntity.OrderNo = orderNO; //WXHppEntity.RealPay = Convert.ToDecimal(realPay); //WXHppEntity.OrderDate = dt.ToString(); //WXHppEntity.CustomerID = m_customerID; //WXHousePrePaymentBLL WXHppBll = new WXHousePrePaymentBLL(loggingSessionInfo); //WXHppBll.Create(WXHppEntity); //创建会员客户协议号映射 //CreateClientAgreementNO(rp, loggingSessionInfo); //处理调用华安请求From表单对象 Receive.ReceiveBuyMessage pEnity = new Receive.ReceiveBuyMessage(); pEnity.MerchantID = HuaAnConfigurationAppSitting.MerchantID; pEnity.Merchantdate = dt.ToString("yyyyMMdd"); pEnity.Totalamt = Convert.ToDecimal(realPay); VipBLL vbll = new VipBLL(loggingSessionInfo); VipEntity ve = vbll.GetVipDetailByVipID(m_userID); pEnity.Assignbuyer = ve.VipCode; pEnity.Assbuyername = ve.VipName; pEnity.Assbuyermobile = ve.Phone; pEnity.Fee = "0"; //用于回调更新 string strCommon = "CustomerID=" + m_customerID; strCommon += "|UserID=" + m_userID; strCommon += "|HouseDetailID=" + m_detailID; strCommon += "|MappingID=" + mappingID.ToString(); // strCommon += "|PrePaymentID=" + prePaymentID.ToString(); strCommon += "|ToPageURL=http://o2oapi.aladingyidong.com/ApplicationInterface/Project/HuaAn/HuaAnCallBack.aspx?action=BuyCallBack"; pEnity.Commonreturn = strCommon; //回调url pEnity.RetURL = ""; pEnity.PageURL = string.Format(HuaAnConfigurationAppSitting.CallBackPageUrl, "BuyCallBack"); //pEnity.PageURL = "http://o2oapi.aladingyidong.com/ApplicationInterface/Project/HuaAn/HuaAnCallBack.aspx?action=BuyCallBack"; pEnity.Memo = ""; //请求表单对象 var fromList = new HuaAnFactory().FormRequestContent(dt, Utility.GetRequsetXml(pEnity), HuaAnConfigurationAppSitting.Buy, orderNO); var rdData = new PayEntityRD(); rdData.FormData = fromList; //华安url rdData.Url = HuaAnConfigurationAppSitting.ReservationPurchaseUrl; //请求表单对象 Model = new HuaAnFactory().FormRequestContent(dt, Utility.GetRequsetXml(pEnity), HuaAnConfigurationAppSitting.Buy, seqNO); }