private Action <IWeChatMsg, string> GenernateWeChatProccesor(IWeChatMsg weChatMsg) { switch (weChatMsg.Event) { case WeChatEventTypes.user_get_card: return(this.UserGetCardProccesor); } return(null); }
public static RegisterCardCoupon Convert(this IWeChatMsg message, string appid) { var getcard = message as GetCardCouponWeChatMsg; Guard.ArgumentNotNull(getcard, "getcard"); return(new RegisterCardCoupon() { AppId = appid, ActiveTime = DateTime.UtcNow.ToUnixStampDateTime(), CardId = getcard.CardId, Event = getcard.Event, FriendOpenId = getcard.FriendUserName, IsGiveByFriend = getcard.IsGiveByFriend, IsRestoreMemberCard = getcard.IsRestoreMemberCard, MsgType = getcard.MsgType, OpenId = getcard.FromUserName, UnionId = getcard.UnionId, UserCode = getcard.UserCardCode }); }
private void UserGetCardProccesor(IWeChatMsg message, string appid) { this.wxUserService.RegisterCardCoupon(message.Convert(appid)); }