C# 微信开发-----微信会员卡(二)

 

主要说说如何使用微信的激活会员卡

如图:

点击激活会员卡时,要跳转到如下的图片:

要实现这个功能,首先我们在创建会员卡后就操作如下代码

 #region 添加激活时的自定义字段
                                    string customFiled = "{";
                                    customFiled += "\"card_id\": \"" + cardId + "\",";//cardId是卡券的ID,请看我上一篇的文章
                                    customFiled += "\"required_form\": {";
                                    customFiled += "\"can_modify\": false,";
                                    customFiled += "\"common_field_id_list\": [\"USER_FORM_INFO_FLAG_MOBILE\"]";
                                    customFiled += "}";
                                    customFiled += "}";
                                    string customUrl = "https://api.weixin.qq.com/card/membercard/activateuserform/set?access_token=" + access_token;

                                    string resultCustom = PostWebRequest(customUrl, customFiled);
                                    resultCustom = "[" + resultCustom + "]";
                                    Newtonsoft.Json.Linq.JArray jsCustomArr = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(resultCustom);
                                    Newtonsoft.Json.Linq.JObject jsCustomObj = (Newtonsoft.Json.Linq.JObject)jsCustomArr[0];
                      //接受微信返回的数据
                                    #endregion

 

posted @ 2018-12-24 17:30  风琴~云淡  阅读(821)  评论(0编辑  收藏  举报