/// <summary> /// 市场活动购买 /// </summary> /// <param name="openID">用户微信ID</param> /// <param name="eventID">活动ID</param> /// <param name="productName">商品名称</param> /// <param name="purchaseAmount">购买金额</param> public void MarketEventPurchase(string openID, string eventID, string productName, string purchaseAmount) { //根据用户微信ID,获取VIPID IWhereCondition[] whereCondition = new IWhereCondition[] { new EqualsCondition() { FieldName = "WeiXinUserId", Value = openID } }; var vips = new VipBLL(this.CurrentUserInfo).Query(whereCondition, null); string vipID = string.Empty; if (vips.Length > 0) { vipID = vips.FirstOrDefault().VIPID; } //添加商品购买信息 MarketEventResponseEntity entity = new MarketEventResponseEntity() { ReponseID = this.NewGuid(), OpenID = openID, MarketEventID = eventID, VIPID = vipID, ProductName = productName, PurchaseAmount = ToDecimal(purchaseAmount), IsSales = 1 }; this.Create(entity); }
/// <summary> /// 市场活动响应 /// </summary> /// <param name="openID">用户微信ID</param> /// <param name="eventID">活动ID</param> public void MarketEventResponse(string openID, string eventID) { IWhereCondition[] whereCondition = new IWhereCondition[] { new EqualsCondition() { FieldName = "OpenID", Value = openID }, new EqualsCondition() { FieldName = "MarketEventID", Value = eventID } }; var responses = this.Query(whereCondition, null); //用户没有响应活动,添加活动响应信息 if (responses.Length == 0) { //根据用户微信ID,获取VIPID whereCondition = new IWhereCondition[] { new EqualsCondition() { FieldName = "WeiXinUserId", Value = openID } }; var vips = new VipBLL(this.CurrentUserInfo).Query(whereCondition, null); string vipID = string.Empty; if (vips.Length > 0) { vipID = vips.FirstOrDefault().VIPID; } MarketEventResponseEntity entity = new MarketEventResponseEntity() { ReponseID = this.NewGuid(), OpenID = openID, MarketEventID = eventID, VIPID = vipID }; this.Create(entity); } else { //更新活动响应信息 MarketEventResponseEntity entity = new MarketEventResponseEntity() { ReponseID = responses.FirstOrDefault().ReponseID, }; this.Update(entity, false); } }