Example #1
0
        /// <summary>
        /// 设置跟随推荐接口
        /// 有 使用消息配置卡券(cardCellData) 和 使用消息配置URL(urlCellData) 两种方式
        /// 注意:cardCellData和urlCellData必须也只能选择一个,不可同时为空
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="cardId">卡券ID</param>
        /// <param name="cardCellData">使用消息配置卡券数据</param>
        /// <param name="urlCellData">使用消息配置URL数据</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static WxJsonResult RecommendSet(string accessTokenOrAppId, string cardId, CardCell cardCellData = null, UrlCell urlCellData = null, int timeOut = Config.TIME_OUT)
        {
            return ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var urlFormat = string.Format("https://api.weixin.qq.com/card/update?access_token={0}", accessToken.AsUrlData());

                var data = new
                {
                    card_id = cardId,
                    member_card = new
                    {
                        base_info = new
                        {
                            modify_msg_operation = new
                            {
                                card_cell = cardCellData,
                                url_cell = urlCellData
                            }
                        }
                    }
                };

                return CommonJsonSend.Send<WxJsonResult>(null, urlFormat, data, timeOut: timeOut);

            }, accessTokenOrAppId);
        }
 public Modify_Msg_Operation()
 {
     card_cell = new CardCell();
     url_cell = new UrlCell();
 }