In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the example analysis of the WeiXinConst class developed by C# Wechat. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
The official account information you need to use in the sending process is configured here, and the Url information you need to use does not need to be changed.
/ / Url and Json constants used by Wechat / public class WeiXinConst {# region Value Const / Wechat developer AppId / public const string AppId = "your AppId"; / Wechat developer Secret / public const string Secret = "you need Secret" / V2: the key Key used for encryption in the payment request can be used to verify the uniqueness of the merchant, corresponding to AppKey / public static string PaySignKey = "V2.PaySignKey" in the payment scenario; / V2: Tenpay signature key / V3: merchant payment key Key. Log in to the backend of Wechat merchants, go to the column "account Settings", "password Security", "API Security", "API key", and then go to set the API key. / public const string PartnerKey = "PartnerKey"; / merchant number / public const string PartnerId = "PartnerId"; / Baidu map Api Ak / public const string BaiduAk = "BaiduAk"; / / BaiduAk / used to verify whether the request comes from Wechat / public const string Token = "Token" / Certificate file path / public const string CertPath = @ "E:\ cert\ apiclient_cert.pem"; / Certificate file password (default is merchant number) / public const string CertPwd = "111" # endregion # region Url Const # region AccessTokenUrl / official account to obtain the Url of Access_Token (need Format 0.AppId 1.Secret) / private const string AccessToken_Url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"; / / official account to obtain Token Url / public static string WeiXin_AccessTokenUrl {get {return string.Format (AccessToken_Url, AppId, Secret) }} # endregion # region get user information Url / get user OpenIdUrl / private const string User_GetOpenIdUrl = "https://api.weixin.qq.com/sns/oauth3/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code";" according to Code / / obtaining the Url of a user's OpenId based on Code requires Format 0.code / public static string WeiXin_User_OpenIdUrl {get {return string.Format (User_GetOpenIdUrl, AppId, Secret, "{0}") }} / obtain basic user information according to OpenId Url (requires Format0.access_token 1.openid) / public const string WeiXin_User_GetInfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN";" # endregion # region OAuth3 Authorization Url / OAuth3 Authorization Url, which requires Format0.AppId 1.Uri 2.state / private const string OAuth3_Url = "https://open.weixin.qq.com/connect/oauth3/authorize?appid={0}&redirect_uri={1}&response_type=code&scope=snsapi_base&state={2}#wechat_redirect";" / OAuth3 authorizes Url, which requires Format 0.Uri 1.state / public static string WeiXin_User_OAuth3Url {get {return string.Format (OAuth3_Url, AppId, "{0}", "{1}") }} # endregion # region QrCode Url / Format 0 access_token / public const string WeiXin_Ticket_CreateUrl = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}";" is required to create a Ticket Url that acquires QrCode / to get the QR code image Url, you need Format 0.ticket / public const string WeiXin_QrCode_GetUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={0}"; # endregion # region Baidu inverse geocoding Url / latitude and longitude inverse geocoding Url requires Format 0.ak 1. Longitude 2. Latitude / private const string BaiduGeoCoding_ApiUrl = "http://api.map.baidu.com/geocoder/v2/?ak={0}&location={1},{2}&output=json&pois=0"; / Latitude / longitude inverse geocoding Url requires Format 0. Longitude 1. Latitude / public static string Baidu_GeoCoding_ApiUrl {get {return string.Format (BaiduGeoCoding_ApiUrl, BaiduAk, "{0}", "{1}") }} # endregion # region Menu Url / create menu Url requires Format 0.access_token / public const string WeiXin_Menu_CreateUrl = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}";" / Format 0.access_token / public const string WeiXin_Menu_GetUrl is required to get the menu Url = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token={0}";" / / delete menu Url requires Format 0.access_token / public const string WeiXin_Menu_DeleteUrl = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={0}";" # endregion # region to pay the relevant Url / generate prepaid bill Url, replace 0 access_token / public const string WeiXin_Pay_PrePayUrl = "https://api.weixin.qq.com/pay/genprepay?access_token={0}";" / order query Url, replace 0 access_token / public const string WeiXin_Pay_OrderQueryUrl = "https://api.weixin.qq.com/pay/orderquery?access_token={0}";" / shipping notification Url, need to replace 0 access_token / public const string WeiXin_Pay_DeliverNotifyUrl = "https://api.weixin.qq.com/pay/delivernotify?access_token={0}";" # region Unified payment related Url (V3 interface) / Unified prepaid Url / public const string WeiXin_Pay_UnifiedPrePayUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder"; / order query Url / public const string WeiXin_Pay_UnifiedOrderQueryUrl =" https://api.mch.weixin.qq.com/pay/orderquery"; / / refund request Url / public const string WeiXin_Pay_UnifiedOrderRefundUrl = "https://api.mch.weixin.qq.com/secapi/pay/refund"; # endregion # region Json Const / the Json string to be uploaded to get the Ticket required for the QR code (requires Format 0.scene_id) / scene_id scenario value: the maximum value for the ID permanent QR code is 100000 (the current parameter only supports 1m / 100000) public const string WeiXin_QrCodeTicket_Create_JsonString = "{\" Action_name\ ":\" QR_LIMIT_SCENE\ " \ "action_info\": {\ "scene\": {\ "scene_id\": {0} " # endregion} this is the end of the article on "sample Analysis of WeiXinConst classes developed by C# Wechat". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.