C# 微信開發-----微信會員卡(二)
阿新 • • 發佈:2018-12-24
主要說說如何使用微信的啟用會員卡
如圖:
點選啟用會員卡時,要跳轉到如下的圖片:
要實現這個功能,首先我們在建立會員卡後就操作如下程式碼
#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