附近小店
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Readme.md 65 KiB

3 månader sedan
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992
  1. # ![title](title.png)
  2. ## `注意` ⚠️
  3. - [v1 版本入口](https://github.com/medivhzhan/weapp/tree/v1)
  4. - 新版本暂时不包含支付相关内容, 已有很多优秀的支付相关模块;
  5. - 为了保证大家及时用上新功能,已发布 v2 版本,请大家使用经过`线上测试` ✅ 的接口。
  6. - 未完成的接口将在经过线上测试后在新版本中提供给大家。
  7. - 大部分接口需要去线上测试。最近一直比较忙,有条件的朋友可以帮忙一起测试,我代表所有使用者谢谢你: )
  8. - 欢迎大家一起完善 :)
  9. ## 获取代码
  10. ```sh
  11. go get -u github.com/medivhzhan/weapp/v2
  12. ```
  13. ## `目录`
  14. > 文档按照[小程序服务端官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/)排版,方便您一一对照查找相关内容。
  15. ✅: 代表已经通过线上测试
  16. ⚠️: 代表还没有或者未完成
  17. - [登录](#登录)
  18. - [code2Session](#code2Session) ✅
  19. - [用户信息](#用户信息)
  20. - [getPaidUnionId](#getPaidUnionId) ✅
  21. - [接口调用凭证](#接口调用凭证)
  22. - [getAccessToken](#getAccessToken) ✅
  23. - [数据分析](#数据分析)
  24. - [访问留存](#访问留存)
  25. - [getDailyRetain](#getDailyRetain) ✅
  26. - [getWeeklyRetain](#getWeeklyRetain) ✅
  27. - [getMonthlyRetain](#getMonthlyRetain) ✅
  28. - [getDailySummary](#getDailySummary) ✅
  29. - [访问趋势](#访问趋势)
  30. - [getDailyVisitTrend](#getDailyVisitTrend) ✅
  31. - [getWeeklyVisitTrend](#getWeeklyVisitTrend) ✅
  32. - [getMonthlyVisitTrend](#getMonthlyVisitTrend) ✅
  33. - [getUserPortrait](#getUserPortrait) ✅
  34. - [getVisitDistribution](#getVisitDistribution) ✅
  35. - [getVisitPage](#getVisitPage) ✅
  36. - [客服消息](#客服消息)
  37. - [getTempMedia](#getTempMedia) ✅
  38. - [sendCustomerServiceMessage](#sendCustomerServiceMessage) ✅
  39. - [setTyping](#setTyping) ✅
  40. - [uploadTempMedia](#uploadTempMedia) ✅
  41. - [统一服务消息](#统一服务消息)
  42. - [sendUniformMessage](#sendUniformMessage) ✅
  43. - [动态消息](#动态消息)
  44. - [createActivityId](#createActivityId)
  45. - [setUpdatableMsg](#setUpdatableMsg)
  46. - [插件管理](#插件管理)
  47. - [applyPlugin](#applyPlugin)
  48. - [getPluginDevApplyList](#getPluginDevApplyList)
  49. - [getPluginList](#getPluginList)
  50. - [setDevPluginApplyStatus](#setDevPluginApplyStatus)
  51. - [unbindPlugin](#unbindPlugin)
  52. - [附近的小程序](#附近的小程序)
  53. - [addNearbyPoi](#addNearbyPoi)
  54. - [deleteNearbyPoi](#deleteNearbyPoi)
  55. - [getNearbyPoiList](#getNearbyPoiList)
  56. - [setNearbyPoiShowStatus](#setNearbyPoiShowStatus)
  57. - [小程序码](#小程序码) ✅
  58. - [createQRCode](#createQRCode) ✅
  59. - [get](#get) ✅
  60. - [getUnlimited](#getUnlimited) ✅
  61. - [内容安全](#内容安全)
  62. - [imgSecCheck](#imgSecCheck) ✅
  63. - [mediaCheckAsync](#mediaCheckAsync)✅
  64. - [msgSecCheck](#msgSecCheck) ✅
  65. - [图像处理](#图像处理)
  66. - [aiCrop](#aiCrop) ✅
  67. - [scanQRCode](#scanQRCode) ✅
  68. - [superResolution](#superResolution)
  69. - [及时配送](#及时配送) ⚠️
  70. - [小程序使用](#小程序使用)
  71. - [abnormalConfirm](#abnormalConfirm)
  72. - [addDeliveryOrder](#addDeliveryOrder)
  73. - [addDeliveryTip](#addDeliveryTip)
  74. - [cancelDeliveryOrder](#cancelDeliveryOrder)
  75. - [getAllImmediateDelivery](#getAllImmediateDelivery)
  76. - [getBindAccount](#getBindAccount)
  77. - [getDeliveryOrder](#getDeliveryOrder)
  78. - [mockUpdateDeliveryOrder](#mockUpdateDeliveryOrder)
  79. - [onDeliveryOrderStatus](#onDeliveryOrderStatus)
  80. - [preAddDeliveryOrder](#preAddDeliveryOrder)
  81. - [preCancelDeliveryOrder](#preCancelDeliveryOrder)
  82. - [reDeliveryOrder](#reDeliveryOrder)
  83. - [服务提供方使用](#服务提供方使用)
  84. - [updateDeliveryOrder](#updateDeliveryOrder)
  85. - [onAgentPosQuery](#onAgentPosQuery)
  86. - [onAuthInfoGet](#onAuthInfoGet)
  87. - [onCancelAuth](#onCancelAuth)
  88. - [onDeliveryOrderAdd](#onDeliveryOrderAdd)
  89. - [onDeliveryOrderAddTips](#onDeliveryOrderAddTips)
  90. - [onDeliveryOrderCancel](#onDeliveryOrderCancel)
  91. - [onDeliveryOrderConfirmReturn](#onDeliveryOrderConfirmReturn)
  92. - [onDeliveryOrderPreAdd](#onDeliveryOrderPreAdd)
  93. - [onDeliveryOrderPreCancel](#onDeliveryOrderPreCancel)
  94. - [onDeliveryOrderQuery](#onDeliveryOrderQuery)
  95. - [onDeliveryOrderReAdd](#onDeliveryOrderReAdd)
  96. - [onPreAuthCodeGet](#onPreAuthCodeGet)
  97. - [onRiderScoreSet](#onRiderScoreSet)
  98. - [物流助手](#物流助手) ⚠️
  99. - [小程序使用](#小程序使用)
  100. - [addExpressOrder](#addExpressOrder)
  101. - [cancelExpressOrder](#cancelExpressOrder)
  102. - [getAllDelivery](#getAllDelivery)
  103. - [getExpressOrder](#getExpressOrder)
  104. - [getExpressPath](#getExpressPath)
  105. - [getExpressPrinter](#getExpressPrinter)
  106. - [getExpressQuota](#getExpressQuota)
  107. - [onExpressPathUpdate](#onExpressPathUpdate)
  108. - [testUpdateExpressOrder](#testUpdateExpressOrder)
  109. - [updateExpressPrinter](#updateExpressPrinter)
  110. - [服务提供方使用](#服务提供方使用)
  111. - [getExpressContact](#getExpressContact)
  112. - [onAddExpressOrder](#onAddExpressOrder)
  113. - [onCancelExpressOrder](#onCancelExpressOrder)
  114. - [onCheckExpressBusiness](#onCheckExpressBusiness)
  115. - [onGetExpressQuota](#onGetExpressQuota)
  116. - [previewExpressTemplate](#previewExpressTemplate)
  117. - [updateExpressBusiness](#updateExpressBusiness)
  118. - [updateExpressPath](#updateExpressPath)
  119. - [OCR](#OCR)
  120. - [bankcard](#bankcard) ✅
  121. - [businessLicense](#businessLicense) ✅
  122. - [driverLicense](#driverLicense) ✅
  123. - [idcard](#idcard) ✅
  124. - [printedText](#printedText) ✅
  125. - [vehicleLicense](#vehicleLicense) ✅
  126. - [运维中心](#运维中心) ⚠️
  127. - [realTimeLogSearch](#realTimeLogSearch)
  128. - [小程序搜索](#小程序搜索) ⚠️
  129. - [siteSearch](#siteSearch)
  130. - [submitPages](#submitPages)
  131. - [生物认证](#生物认证)
  132. - [verifySignature](#verifySignature)
  133. - [订阅消息](#订阅消息) ✅
  134. - [addTemplate](#addTemplate) ✅
  135. - [deleteTemplate](#deleteTemplate) ✅
  136. - [getCategory](#getCategory) ✅
  137. - [getPubTemplateKeyWordsById](#getPubTemplateKeyWordsById)✅
  138. - [getPubTemplateTitleList](#getPubTemplateTitleList) ✅
  139. - [getTemplateList](#getTemplateList) ✅
  140. - [sendSubscribeMessage](#sendSubscribeMessage) ✅
  141. - [解密](#解密)
  142. - [解密手机号码](#解密手机号码) ✅
  143. - [解密分享内容](#解密分享内容)
  144. - [解密用户信息](#解密用户信息) ✅
  145. - [解密微信运动](#解密微信运动)
  146. - [人脸识别](#人脸识别)
  147. ---
  148. ## 登录
  149. ### code2Session
  150. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html)
  151. ```go
  152. import "github.com/medivhzhan/weapp/v2"
  153. res, err := weapp.Login("appid", "secret", "code")
  154. if err != nil {
  155. // 处理一般错误信息
  156. return
  157. }
  158. if err := res.GetResponseError(); err !=nil {
  159. // 处理微信返回错误信息
  160. return
  161. }
  162. fmt.Printf("返回结果: %#v", res)
  163. ```
  164. ---
  165. ## 用户信息
  166. ### getPaidUnionId
  167. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPaidUnionId.html)
  168. ```go
  169. import "github.com/medivhzhan/weapp/v2"
  170. res, err := weapp.GetPaidUnionID("access-token", "open-id", "transaction-id")
  171. // 或者
  172. res, err := weapp.GetPaidUnionIDWithMCH("access-token", "open-id", "out-trade-number", "mch-id")
  173. if err != nil {
  174. // 处理一般错误信息
  175. return
  176. }
  177. if err := res.GetResponseError(); err !=nil {
  178. // 处理微信返回错误信息
  179. return
  180. }
  181. fmt.Printf("返回结果: %#v", res)
  182. ```
  183. ---
  184. ## 接口调用凭证
  185. ### getAccessToken
  186. > 调用次数有限制 请注意缓存
  187. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)
  188. ```go
  189. import "github.com/medivhzhan/weapp/v2"
  190. res, err := weapp.GetAccessToken("appid", "secret")
  191. if err != nil {
  192. // 处理一般错误信息
  193. return
  194. }
  195. if err := res.GetResponseError(); err !=nil {
  196. // 处理微信返回错误信息
  197. return
  198. }
  199. fmt.Printf("返回结果: %#v", res)
  200. ```
  201. ---
  202. ## 数据分析
  203. ### 访问留存
  204. #### getDailyRetain
  205. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getDailyRetain.html)
  206. ```go
  207. import "github.com/medivhzhan/weapp/v2"
  208. res, err := weapp.GetDailyRetain("access-token", "begin-date", "end-date")
  209. if err != nil {
  210. // 处理一般错误信息
  211. return
  212. }
  213. if err := res.GetResponseError(); err !=nil {
  214. // 处理微信返回错误信息
  215. return
  216. }
  217. fmt.Printf("返回结果: %#v", res)
  218. ```
  219. #### getWeeklyRetain
  220. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getWeeklyRetain.html)
  221. ```go
  222. import "github.com/medivhzhan/weapp/v2"
  223. res, err := weapp.GetWeeklyRetain("access-token", "begin-date", "end-date")
  224. if err != nil {
  225. // 处理一般错误信息
  226. return
  227. }
  228. if err := res.GetResponseError(); err !=nil {
  229. // 处理微信返回错误信息
  230. return
  231. }
  232. fmt.Printf("返回结果: %#v", res)
  233. ```
  234. #### getMonthlyRetain
  235. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getMonthlyRetain.html)
  236. ```go
  237. import "github.com/medivhzhan/weapp/v2"
  238. res, err := weapp.GetMonthlyRetain("access-token", "begin-date", "end-date")
  239. if err != nil {
  240. // 处理一般错误信息
  241. return
  242. }
  243. if err := res.GetResponseError(); err !=nil {
  244. // 处理微信返回错误信息
  245. return
  246. }
  247. fmt.Printf("返回结果: %#v", res)
  248. ```
  249. ### getDailySummary
  250. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getDailySummary.html)
  251. ```go
  252. import "github.com/medivhzhan/weapp/v2"
  253. res, err := weapp.GetDailySummary("access-token", "begin-date", "end-date")
  254. if err != nil {
  255. // 处理一般错误信息
  256. return
  257. }
  258. if err := res.GetResponseError(); err !=nil {
  259. // 处理微信返回错误信息
  260. return
  261. }
  262. fmt.Printf("返回结果: %#v", res)
  263. ```
  264. ### 访问趋势
  265. #### getDailyVisitTrend
  266. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-trend/analysis.getDailyVisitTrend.html)
  267. ```go
  268. import "github.com/medivhzhan/weapp/v2"
  269. res, err := weapp.GetDailyVisitTrend("access-token", "begin-date", "end-date")
  270. if err != nil {
  271. // 处理一般错误信息
  272. return
  273. }
  274. if err := res.GetResponseError(); err !=nil {
  275. // 处理微信返回错误信息
  276. return
  277. }
  278. fmt.Printf("返回结果: %#v", res)
  279. ```
  280. #### getWeeklyVisitTrend
  281. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-trend/analysis.getWeeklyVisitTrend.html)
  282. ```go
  283. import "github.com/medivhzhan/weapp/v2"
  284. res, err := weapp.GetWeeklyVisitTrend("access-token", "begin-date", "end-date")
  285. if err != nil {
  286. // 处理一般错误信息
  287. return
  288. }
  289. if err := res.GetResponseError(); err !=nil {
  290. // 处理微信返回错误信息
  291. return
  292. }
  293. fmt.Printf("返回结果: %#v", res)
  294. ```
  295. #### getMonthlyVisitTrend
  296. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-trend/analysis.getMonthlyVisitTrend.html)
  297. ```go
  298. import "github.com/medivhzhan/weapp/v2"
  299. res, err := weapp.GetMonthlyVisitTrend("access-token", "begin-date", "end-date")
  300. if err != nil {
  301. // 处理一般错误信息
  302. return
  303. }
  304. if err := res.GetResponseError(); err !=nil {
  305. // 处理微信返回错误信息
  306. return
  307. }
  308. fmt.Printf("返回结果: %#v", res)
  309. ```
  310. ### getUserPortrait
  311. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getUserPortrait.html)
  312. ```go
  313. import "github.com/medivhzhan/weapp/v2"
  314. res, err := weapp.GetUserPortrait("access-token", "begin-date", "end-date")
  315. if err != nil {
  316. // 处理一般错误信息
  317. return
  318. }
  319. if err := res.GetResponseError(); err !=nil {
  320. // 处理微信返回错误信息
  321. return
  322. }
  323. fmt.Printf("返回结果: %#v", res)
  324. ```
  325. ### getVisitDistribution
  326. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getVisitDistribution.html)
  327. ```go
  328. import "github.com/medivhzhan/weapp/v2"
  329. res, err := weapp.GetVisitDistribution("access-token", "begin-date", "end-date")
  330. if err != nil {
  331. // 处理一般错误信息
  332. return
  333. }
  334. if err := res.GetResponseError(); err !=nil {
  335. // 处理微信返回错误信息
  336. return
  337. }
  338. fmt.Printf("返回结果: %#v", res)
  339. ```
  340. ### getVisitPage
  341. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getVisitPage.html)
  342. ```go
  343. import "github.com/medivhzhan/weapp/v2"
  344. res, err := weapp.GetVisitPage("access-token", "begin-date", "end-date")
  345. if err != nil {
  346. // 处理一般错误信息
  347. return
  348. }
  349. if err := res.GetResponseError(); err !=nil {
  350. // 处理微信返回错误信息
  351. return
  352. }
  353. fmt.Printf("返回结果: %#v", res)
  354. ```
  355. ---
  356. ## 客服消息
  357. ### getTempMedia
  358. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.getTempMedia.html)
  359. ```go
  360. import "github.com/medivhzhan/weapp/v2"
  361. resp, res, err := weapp.GetTempMedia("access-token", "media-id")
  362. if err != nil {
  363. // 处理一般错误信息
  364. return
  365. }
  366. defer resp.Close()
  367. if err := res.GetResponseError(); err !=nil {
  368. // 处理微信返回错误信息
  369. return
  370. }
  371. fmt.Printf("返回结果: %#v", res)
  372. ```
  373. ### sendCustomerServiceMessage
  374. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.send.html)
  375. ```go
  376. import "github.com/medivhzhan/weapp/v2"
  377. // 接收并处理异步结果
  378. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  379. if err != nil {
  380. // 处理微信返回错误信息
  381. return
  382. }
  383. // 文本消息
  384. srv.OnCustomerServiceTextMessage(func(msg *weapp.TextMessageResult) *weapp.TransferCustomerMessage {
  385. reply := weapp.CSMsgText{
  386. Content: "content",
  387. }
  388. res, err := reply.SendTo("open-id", "access-token")
  389. if err != nil {
  390. // 处理一般错误信息
  391. return nil
  392. }
  393. if err := res.GetResponseError(); err !=nil {
  394. // 处理微信返回错误信息
  395. return nil
  396. }
  397. return nil
  398. })
  399. // 图片消息
  400. srv.OnCustomerServiceImageMessage(func(msg *weapp.TextMessageResult) *weapp.TransferCustomerMessage {
  401. reply := weapp.CSMsgImage{
  402. MediaID: "media-id",
  403. }
  404. res, err := reply.SendTo("open-id", "access-token")
  405. if err != nil {
  406. // 处理一般错误信息
  407. return nil
  408. }
  409. if err := res.GetResponseError(); err !=nil {
  410. // 处理微信返回错误信息
  411. return nil
  412. }
  413. return nil
  414. })
  415. // 小程序卡片消息
  416. srv.OnCustomerServiceCardMessage(func(msg *weapp.TextMessageResult) *weapp.TransferCustomerMessage {
  417. reply := weapp.CSMsgMPCard{
  418. Title: "title",
  419. PagePath: "page-path",
  420. ThumbMediaID: "thumb-media-id",
  421. }
  422. res, err := reply.SendTo("open-id", "access-token")
  423. if err != nil {
  424. // 处理一般错误信息
  425. return nil
  426. }
  427. if err := res.GetResponseError(); err !=nil {
  428. // 处理微信返回错误信息
  429. return nil
  430. }
  431. return nil
  432. })
  433. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  434. // 处理微信返回错误信息
  435. return
  436. }
  437. ```
  438. ### setTyping
  439. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.setTyping.html)
  440. ```go
  441. import "github.com/medivhzhan/weapp/v2"
  442. res, err := weapp.SetTyping("access-token", "open-id", weapp.SetTypingCommandTyping)
  443. if err != nil {
  444. // 处理一般错误信息
  445. return
  446. }
  447. if err := res.GetResponseError(); err !=nil {
  448. // 处理微信返回错误信息
  449. return
  450. }
  451. fmt.Printf("返回结果: %#v", res)
  452. ```
  453. ### uploadTempMedia
  454. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.uploadTempMedia.html)
  455. ```go
  456. import "github.com/medivhzhan/weapp/v2"
  457. res, err := weapp.UploadTempMedia("access-token", weapp.TempMediaTypeImage, "media-filename")
  458. if err != nil {
  459. // 处理一般错误信息
  460. return
  461. }
  462. if err := res.GetResponseError(); err !=nil {
  463. // 处理微信返回错误信息
  464. return
  465. }
  466. fmt.Printf("返回结果: %#v", res)
  467. ```
  468. ---
  469. ## 统一服务消息
  470. ### sendUniformMessage
  471. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/uniform-message/uniformMessage.send.html)
  472. ```go
  473. import "github.com/medivhzhan/weapp/v2"
  474. sender := weapp.UniformMsgSender{
  475. ToUser: "open-id",
  476. UniformWeappTmpMsg: weapp.UniformWeappTmpMsg{
  477. TemplateID: "template-id",
  478. Page: "page",
  479. FormID: "form-id",
  480. Data: weapp.UniformMsgData{
  481. "keyword": {Value: "value"},
  482. },
  483. EmphasisKeyword: "keyword.DATA",
  484. },
  485. UniformMpTmpMsg: weapp.UniformMpTmpMsg{
  486. AppID: "app-id",
  487. TemplateID: "template-id",
  488. URL: "url",
  489. Miniprogram: weapp.UniformMsgMiniprogram{"miniprogram-app-id", "page-path"},
  490. Data: weapp.UniformMsgData{
  491. "keyword": {"value", "color"},
  492. },
  493. },
  494. }
  495. res, err := sender.Send("access-token")
  496. if err != nil {
  497. // 处理一般错误信息
  498. return
  499. }
  500. if err := res.GetResponseError(); err !=nil {
  501. // 处理微信返回错误信息
  502. return
  503. }
  504. fmt.Printf("返回结果: %#v", res)
  505. ```
  506. ---
  507. ## 动态消息
  508. ### createActivityId
  509. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html)
  510. ```go
  511. import "github.com/medivhzhan/weapp/v2"
  512. res, err := weapp.CreateActivityId("access-token")
  513. if err != nil {
  514. // 处理一般错误信息
  515. return
  516. }
  517. if err := res.GetResponseError(); err !=nil {
  518. // 处理微信返回错误信息
  519. return
  520. }
  521. fmt.Printf("返回结果: %#v", res)
  522. ```
  523. ### setUpdatableMsg
  524. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.setUpdatableMsg.html)
  525. ```go
  526. import "github.com/medivhzhan/weapp/v2"
  527. setter := weapp.UpdatableMsgSetter{
  528. "activity-id",
  529. UpdatableMsgJoining,
  530. UpdatableMsgTempInfo{
  531. []UpdatableMsgParameter{
  532. {UpdatableMsgParamMemberCount, "parameter-value-number"},
  533. {UpdatableMsgParamRoomLimit, "parameter-value-number"},
  534. },
  535. },
  536. }
  537. res, err := setter.Set("access-token")
  538. if err != nil {
  539. // 处理一般错误信息
  540. return
  541. }
  542. if err := res.GetResponseError(); err !=nil {
  543. // 处理微信返回错误信息
  544. return
  545. }
  546. fmt.Printf("返回结果: %#v", res)
  547. ```
  548. ---
  549. ## 插件管理
  550. ### applyPlugin
  551. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.applyPlugin.html)
  552. ```go
  553. import "github.com/medivhzhan/weapp/v2"
  554. res, err := weapp.ApplyPlugin("access-token", "plugin-app-id", "reason")
  555. if err != nil {
  556. // 处理一般错误信息
  557. return
  558. }
  559. if err := res.GetResponseError(); err !=nil {
  560. // 处理微信返回错误信息
  561. return
  562. }
  563. fmt.Printf("返回结果: %#v", res)
  564. ```
  565. ### getPluginDevApplyList
  566. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.getPluginDevApplyList.html)
  567. ```go
  568. import "github.com/medivhzhan/weapp/v2"
  569. res, err := weapp.GetPluginDevApplyList("access-token", 1, 2)
  570. if err != nil {
  571. // 处理一般错误信息
  572. return
  573. }
  574. if err := res.GetResponseError(); err !=nil {
  575. // 处理微信返回错误信息
  576. return
  577. }
  578. fmt.Printf("返回结果: %#v", res)
  579. ```
  580. ### getPluginList
  581. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.getPluginList.html)
  582. ```go
  583. import "github.com/medivhzhan/weapp/v2"
  584. res, err := weapp.GetPluginList("access-token")
  585. if err != nil {
  586. // 处理一般错误信息
  587. return
  588. }
  589. if err := res.GetResponseError(); err !=nil {
  590. // 处理微信返回错误信息
  591. return
  592. }
  593. fmt.Printf("返回结果: %#v", res)
  594. ```
  595. ### setDevPluginApplyStatus
  596. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.setDevPluginApplyStatus.html)
  597. ```go
  598. import "github.com/medivhzhan/weapp/v2"
  599. res, err := weapp.SetDevPluginApplyStatus("access-token", "plugin-app-id", "reason", weapp.DevAgree)
  600. if err != nil {
  601. // 处理一般错误信息
  602. return
  603. }
  604. if err := res.GetResponseError(); err !=nil {
  605. // 处理微信返回错误信息
  606. return
  607. }
  608. fmt.Printf("返回结果: %#v", res)
  609. ```
  610. ### unbindPlugin
  611. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.unbindPlugin.html)
  612. ```go
  613. import "github.com/medivhzhan/weapp/v2"
  614. res, err := weapp.UnbindPlugin("access-token", "plugin-app-id")
  615. if err != nil {
  616. // 处理一般错误信息
  617. return
  618. }
  619. if err := res.GetResponseError(); err !=nil {
  620. // 处理微信返回错误信息
  621. return
  622. }
  623. fmt.Printf("返回结果: %#v", res)
  624. ```
  625. ---
  626. ## 附近的小程序
  627. ### addNearbyPoi
  628. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/nearby-poi/nearbyPoi.add.html)
  629. ```go
  630. import "github.com/medivhzhan/weapp/v2"
  631. poi := NearbyPoi{
  632. PicList: PicList{[]string{"first-picture-url", "second-picture-url", "third-picture-url"}},
  633. ServiceInfos: weapp.ServiceInfos{[]weapp.ServiceInfo{
  634. {1, 1, "name", "app-id", "path"},
  635. }},
  636. StoreName: "store-name",
  637. Hour: "11:11-12:12",
  638. Credential: "credential",
  639. Address: "address", // 地址 必填
  640. CompanyName: "company-name", // 主体名字 必填
  641. QualificationList: "qualification-list", // 证明材料 必填 如果company_name和该小程序主体不一致,需要填qualification_list,详细规则见附近的小程序使用指南-如何证明门店的经营主体跟公众号或小程序帐号主体相关http://kf.qq.com/faq/170401MbUnim17040122m2qY.html
  642. KFInfo: weapp.KFInfo{true, "kf-head-img", "kf-name"}, // 客服信息 选填,可自定义服务头像与昵称,具体填写字段见下方示例kf_info pic_list是字符串,内容是一个json!
  643. PoiID: "poi-id", // 如果创建新的门店,poi_id字段为空 如果更新门店,poi_id参数则填对应门店的poi_id 选填
  644. }
  645. res, err := poi.Add("access-token")
  646. if err != nil {
  647. // 处理一般错误信息
  648. return
  649. }
  650. if err := res.GetResponseError(); err !=nil {
  651. // 处理微信返回错误信息
  652. return
  653. }
  654. fmt.Printf("返回结果: %#v", res)
  655. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  656. if err != nil {
  657. // 处理微信返回错误信息
  658. return
  659. }
  660. srv.OnAddNearbyPoi(func(mix *weapp.AddNearbyPoiResult) {
  661. // 处理返回结果
  662. })
  663. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  664. // 处理微信返回错误信息
  665. return
  666. }
  667. ```
  668. ### deleteNearbyPoi
  669. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/nearby-poi/nearbyPoi.delete.html)
  670. ```go
  671. import "github.com/medivhzhan/weapp/v2"
  672. res, err := weapp.DeleteNearbyPoi("access-token", "poi-id")
  673. if err != nil {
  674. // 处理一般错误信息
  675. return
  676. }
  677. if err := res.GetResponseError(); err !=nil {
  678. // 处理微信返回错误信息
  679. return
  680. }
  681. fmt.Printf("返回结果: %#v", res)
  682. ```
  683. ### getNearbyPoiList
  684. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/nearby-poi/nearbyPoi.getList.html)
  685. ```go
  686. import "github.com/medivhzhan/weapp/v2"
  687. res, err := weapp.GetNearbyPoiList("access-token", 1, 10)
  688. if err != nil {
  689. // 处理一般错误信息
  690. return
  691. }
  692. if err := res.GetResponseError(); err !=nil {
  693. // 处理微信返回错误信息
  694. return
  695. }
  696. fmt.Printf("返回结果: %#v", res)
  697. ```
  698. ### setNearbyPoiShowStatus
  699. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/nearby-poi/nearbyPoi.setShowStatus.html)
  700. ```go
  701. import "github.com/medivhzhan/weapp/v2"
  702. res, err := weapp.SetNearbyPoiShowStatus("access-token", "poi-id", weapp.ShowNearbyPoi)
  703. // 或者
  704. res, err := weapp.SetNearbyPoiShowStatus("access-token", "poi-id", weapp.HideNearbyPoi)
  705. if err != nil {
  706. // 处理一般错误信息
  707. return
  708. }
  709. if err := res.GetResponseError(); err !=nil {
  710. // 处理微信返回错误信息
  711. return
  712. }
  713. fmt.Printf("返回结果: %#v", res)
  714. ```
  715. ---
  716. ## 小程序码
  717. ### createQRCode
  718. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html)
  719. ```go
  720. import (
  721. "ioutil"
  722. "github.com/medivhzhan/weapp/v2"
  723. )
  724. creator := weapp.QRCodeCreator{
  725. Path: "mock/path",
  726. Width: 430,
  727. }
  728. resp, res, err := creator.Create("access-token")
  729. if err != nil {
  730. // 处理一般错误信息
  731. return
  732. }
  733. if err := res.GetResponseError(); err !=nil {
  734. // 处理微信返回错误信息
  735. return
  736. }
  737. defer resp.Body.Close()
  738. content, err := ioutil.ReadAll(resp.Body)
  739. // 处理图片内容
  740. ```
  741. ### get
  742. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.get.html)
  743. ```go
  744. import (
  745. "ioutil"
  746. "github.com/medivhzhan/weapp/v2"
  747. )
  748. getter := weapp.QRCode{
  749. Path: "mock/path",
  750. Width: 430,
  751. AutoColor: true,
  752. LineColor: weapp.Color{"r", "g", "b"},
  753. IsHyaline: true,
  754. }
  755. resp, res, err := getter.Get("access-token")
  756. if err != nil {
  757. // 处理一般错误信息
  758. return
  759. }
  760. if err := res.GetResponseError(); err !=nil {
  761. // 处理微信返回错误信息
  762. return
  763. }
  764. defer resp.Body.Close()
  765. content, err := ioutil.ReadAll(resp.Body)
  766. // 处理图片内容
  767. ```
  768. ### getUnlimited
  769. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html)
  770. ```go
  771. import (
  772. "ioutil"
  773. "github.com/medivhzhan/weapp/v2"
  774. )
  775. getter := weapp.UnlimitedQRCode{
  776. Scene: "scene-data",
  777. Page: "mock/page",
  778. Width: 430,
  779. AutoColor: true,
  780. LineColor: weapp.Color{"r", "g", "b"},
  781. IsHyaline: true,
  782. }
  783. resp, res, err := getter.Get("access-token")
  784. if err != nil {
  785. // 处理一般错误信息
  786. return
  787. }
  788. if err := res.GetResponseError(); err !=nil {
  789. // 处理微信返回错误信息
  790. return
  791. }
  792. defer resp.Body.Close()
  793. content, err := ioutil.ReadAll(resp.Body)
  794. // 处理图片内容
  795. ```
  796. ---
  797. ## 内容安全
  798. ### imgSecCheck
  799. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.imgSecCheck.html)
  800. ```go
  801. import "github.com/medivhzhan/weapp/v2"
  802. res, err := weapp.IMGSecCheck("access-token", "local-filename")
  803. if err != nil {
  804. // 处理一般错误信息
  805. return
  806. }
  807. if err := res.GetResponseError(); err !=nil {
  808. // 处理微信返回错误信息
  809. return
  810. }
  811. fmt.Printf("返回结果: %#v", res)
  812. ```
  813. ### mediaCheckAsync
  814. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html)
  815. ```go
  816. import "github.com/medivhzhan/weapp/v2"
  817. res, err := weapp.MediaCheckAsync("access-token", "image-url", weapp.MediaTypeImage)
  818. if err != nil {
  819. // 处理一般错误信息
  820. return
  821. }
  822. if err := res.GetResponseError(); err !=nil {
  823. // 处理微信返回错误信息
  824. return
  825. }
  826. fmt.Printf("返回结果: %#v", res)
  827. // 接收并处理异步结果
  828. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  829. if err != nil {
  830. // 处理微信返回错误信息
  831. return
  832. }
  833. srv.OnMediaCheckAsync(func(mix *weapp.MediaCheckAsyncResult) {
  834. // 处理返回结果
  835. })
  836. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  837. // 处理微信返回错误信息
  838. return
  839. }
  840. ```
  841. ### msgSecCheck
  842. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.msgSecCheck.html)
  843. ```go
  844. import "github.com/medivhzhan/weapp/v2"
  845. res, err := weapp.MSGSecCheck("access-token", "message-content")
  846. if err != nil {
  847. // 处理一般错误信息
  848. return
  849. }
  850. if err := res.GetResponseError(); err !=nil {
  851. // 处理微信返回错误信息
  852. return
  853. }
  854. fmt.Printf("返回结果: %#v", res)
  855. ```
  856. ---
  857. ## 图像处理
  858. ### aiCrop
  859. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/img/img.aiCrop.html)
  860. ```go
  861. import "github.com/medivhzhan/weapp/v2"
  862. res, err := weapp.AICrop("access-token", "filename")
  863. // 或者
  864. res, err := weapp.AICropByURL("access-token", "url")
  865. if err != nil {
  866. // 处理一般错误信息
  867. return
  868. }
  869. if err := res.GetResponseError(); err !=nil {
  870. // 处理微信返回错误信息
  871. return
  872. }
  873. fmt.Printf("返回结果: %#v", res)
  874. ```
  875. ### scanQRCode
  876. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/img/img.scanQRCode.html)
  877. ```go
  878. import "github.com/medivhzhan/weapp/v2"
  879. res, err := weapp.ScanQRCode("access-token", "file-path")
  880. // 或者
  881. res, err := weapp.ScanQRCodeByURL("access-token", "qr-code-url")
  882. if err != nil {
  883. // 处理一般错误信息
  884. return
  885. }
  886. if err := res.GetResponseError(); err !=nil {
  887. // 处理微信返回错误信息
  888. return
  889. }
  890. fmt.Printf("返回结果: %#v", res)
  891. ```
  892. ### superResolution
  893. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/img/img.superresolution.html)
  894. ```go
  895. import "github.com/medivhzhan/weapp/v2"
  896. res, err := weapp.SuperResolution("access-token", "file-path")
  897. // 或者
  898. res, err := weapp.SuperResolutionByURL("access-token", "img-url")
  899. if err != nil {
  900. // 处理一般错误信息
  901. return
  902. }
  903. if err := res.GetResponseError(); err !=nil {
  904. // 处理微信返回错误信息
  905. return
  906. }
  907. fmt.Printf("返回结果: %#v", res)
  908. ```
  909. ---
  910. ## 及时配送
  911. ### 服务提供方使用
  912. #### updateDeliveryOrder
  913. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.updateOrder.html)
  914. ```go
  915. import "github.com/medivhzhan/weapp/v2"
  916. mocker := weapp.DeliveryOrderUpdater{
  917. // ...
  918. }
  919. res, err := mocker.Update("access-token")
  920. if err != nil {
  921. // 处理一般错误信息
  922. return
  923. }
  924. if err := res.GetResponseError(); err !=nil {
  925. // 处理微信返回错误信息
  926. return
  927. }
  928. fmt.Printf("返回结果: %#v", res)
  929. ```
  930. #### onAgentPosQuery
  931. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onAgentPosQuery.html)
  932. ```go
  933. import "github.com/medivhzhan/weapp/v2"
  934. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  935. if err != nil {
  936. // 处理微信返回错误信息
  937. return
  938. }
  939. srv.OnAgentPosQuery(func(mix *weapp.AgentPosQueryResult) *weapp.AgentPosQueryReturn {
  940. // 处理返回结果
  941. return &weapp.AgentPosQueryReturn{
  942. // ...
  943. }
  944. })
  945. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  946. // 处理微信返回错误信息
  947. return
  948. }
  949. ```
  950. #### onAuthInfoGet
  951. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onAuthInfoGet.html)
  952. ```go
  953. import "github.com/medivhzhan/weapp/v2"
  954. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  955. if err != nil {
  956. // 处理微信返回错误信息
  957. return
  958. }
  959. srv.OnAuthInfoGet(func(mix *weapp.AuthInfoGetResult) *weapp.AuthInfoGetReturn {
  960. // 处理返回结果
  961. return &weapp.AuthInfoGetReturn{
  962. // ...
  963. }
  964. })
  965. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  966. // 处理微信返回错误信息
  967. return
  968. }
  969. ```
  970. #### onCancelAuth
  971. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onCancelAuth.html)
  972. ```go
  973. import "github.com/medivhzhan/weapp/v2"
  974. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  975. if err != nil {
  976. // 处理微信返回错误信息
  977. return
  978. }
  979. srv.OnCancelAuth(func(mix *weapp.CancelAuthResult) *weapp.CancelAuthReturn {
  980. // 处理返回结果
  981. return &weapp.CancelAuthReturn{
  982. // ...
  983. }
  984. })
  985. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  986. // 处理微信返回错误信息
  987. return
  988. }
  989. ```
  990. #### onDeliveryOrderAdd
  991. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderAdd.html)
  992. ```go
  993. import "github.com/medivhzhan/weapp/v2"
  994. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  995. if err != nil {
  996. // 处理微信返回错误信息
  997. return
  998. }
  999. srv.OnDeliveryOrderAdd(func(mix *weapp.DeliveryOrderAddResult) *weapp.DeliveryOrderAddReturn {
  1000. // 处理返回结果
  1001. return &weapp.DeliveryOrderAddReturn{
  1002. // ...
  1003. }
  1004. })
  1005. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1006. // 处理微信返回错误信息
  1007. return
  1008. }
  1009. ```
  1010. #### onDeliveryOrderAddTips
  1011. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderAddTips.html)
  1012. ```go
  1013. import "github.com/medivhzhan/weapp/v2"
  1014. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1015. if err != nil {
  1016. // 处理微信返回错误信息
  1017. return
  1018. }
  1019. srv.OnDeliveryOrderAddTips(func(mix *weapp.DeliveryOrderAddTipsResult) *weapp.DeliveryOrderAddTipsReturn {
  1020. // 处理返回结果
  1021. return &weapp.DeliveryOrderAddTipsReturn{
  1022. // ...
  1023. }
  1024. })
  1025. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1026. // 处理微信返回错误信息
  1027. return
  1028. }
  1029. ```
  1030. #### onDeliveryOrderCancel
  1031. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderCancel.html)
  1032. ```go
  1033. import "github.com/medivhzhan/weapp/v2"
  1034. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1035. if err != nil {
  1036. // 处理微信返回错误信息
  1037. return
  1038. }
  1039. srv.OnDeliveryOrderCancel(func(mix *weapp.DeliveryOrderCancelResult) *weapp.DeliveryOrderCancelReturn {
  1040. // 处理返回结果
  1041. return &weapp.DeliveryOrderCancelReturn{
  1042. // ...
  1043. }
  1044. })
  1045. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1046. // 处理微信返回错误信息
  1047. return
  1048. }
  1049. ```
  1050. #### onDeliveryOrderConfirmReturn
  1051. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderConfirmReturn.html)
  1052. ```go
  1053. import "github.com/medivhzhan/weapp/v2"
  1054. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1055. if err != nil {
  1056. // 处理微信返回错误信息
  1057. return
  1058. }
  1059. srv.OnDeliveryOrderReturnConfirm(func(mix *weapp.DeliveryOrderReturnConfirmResult) *weapp.DeliveryOrderReturnConfirmReturn {
  1060. // 处理返回结果
  1061. return &weapp.DeliveryOrderReturnConfirmReturn{
  1062. // ...
  1063. }
  1064. })
  1065. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1066. // 处理微信返回错误信息
  1067. return
  1068. }
  1069. ```
  1070. #### onDeliveryOrderPreAdd
  1071. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderPreAdd.html)
  1072. ```go
  1073. import "github.com/medivhzhan/weapp/v2"
  1074. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1075. if err != nil {
  1076. // 处理微信返回错误信息
  1077. return
  1078. }
  1079. srv.OnDeliveryOrderPreAdd(func(mix *weapp.DeliveryOrderPreAddResult) *weapp.DeliveryOrderPreAddReturn {
  1080. // 处理返回结果
  1081. return &weapp.DeliveryOrderPreAddReturn{
  1082. // ...
  1083. }
  1084. })
  1085. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1086. // 处理微信返回错误信息
  1087. return
  1088. }
  1089. ```
  1090. #### onDeliveryOrderPreCancel
  1091. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderPreCancel.html)
  1092. ```go
  1093. import "github.com/medivhzhan/weapp/v2"
  1094. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1095. if err != nil {
  1096. // 处理微信返回错误信息
  1097. return
  1098. }
  1099. srv.OnDeliveryOrderPreCancel(func(mix *weapp.DeliveryOrderPreCancelResult) *weapp.DeliveryOrderPreCancelReturn {
  1100. // 处理返回结果
  1101. return &weapp.DeliveryOrderPreCancelReturn{
  1102. // ...
  1103. }
  1104. })
  1105. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1106. // 处理微信返回错误信息
  1107. return
  1108. }
  1109. ```
  1110. #### onDeliveryOrderQuery
  1111. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderQuery.html)
  1112. ```go
  1113. import "github.com/medivhzhan/weapp/v2"
  1114. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1115. if err != nil {
  1116. // 处理微信返回错误信息
  1117. return
  1118. }
  1119. srv.OnDeliveryOrderQuery(func(mix *weapp.DeliveryOrderQueryResult) *weapp.DeliveryOrderQueryReturn {
  1120. // 处理返回结果
  1121. return &weapp.DeliveryOrderQueryReturn{
  1122. // ...
  1123. }
  1124. })
  1125. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1126. // 处理微信返回错误信息
  1127. return
  1128. }
  1129. ```
  1130. #### onDeliveryOrderReAdd
  1131. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onOrderReAdd.html)
  1132. ```go
  1133. import "github.com/medivhzhan/weapp/v2"
  1134. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1135. if err != nil {
  1136. // 处理微信返回错误信息
  1137. return
  1138. }
  1139. srv.OnDeliveryOrderReadd(func(mix *weapp.DeliveryOrderReaddResult) *weapp.DeliveryOrderReaddReturn {
  1140. // 处理返回结果
  1141. return &weapp.DeliveryOrderReaddReturn{
  1142. // ...
  1143. }
  1144. })
  1145. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1146. // 处理微信返回错误信息
  1147. return
  1148. }
  1149. ```
  1150. #### onPreAuthCodeGet
  1151. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onPreAuthCodeGet.html)
  1152. ```go
  1153. import "github.com/medivhzhan/weapp/v2"
  1154. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1155. if err != nil {
  1156. // 处理微信返回错误信息
  1157. return
  1158. }
  1159. srv.OnPreAuthCodeGet(func(mix *weapp.PreAuthCodeGetResult) *weapp.PreAuthCodeGetReturn {
  1160. // 处理返回结果
  1161. return &weapp.PreAuthCodeGetReturn{
  1162. // ...
  1163. }
  1164. })
  1165. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1166. // 处理微信返回错误信息
  1167. return
  1168. }
  1169. ```
  1170. #### onRiderScoreSet
  1171. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-provider/immediateDelivery.onRiderScoreSet.html)
  1172. ```go
  1173. import "github.com/medivhzhan/weapp/v2"
  1174. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1175. if err != nil {
  1176. // 处理微信返回错误信息
  1177. return
  1178. }
  1179. srv.OnRiderScoreSet(func(mix *weapp.RiderScoreSetResult) *weapp.RiderScoreSetReturn {
  1180. // 处理返回结果
  1181. return &weapp.PreAuthCodeGetReturn{
  1182. // ...
  1183. }
  1184. })
  1185. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1186. // 处理微信返回错误信息
  1187. return
  1188. }
  1189. ```
  1190. ### 小程序使用
  1191. #### abnormalConfirm
  1192. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.abnormalConfirm.html)
  1193. ```go
  1194. import "github.com/medivhzhan/weapp/v2"
  1195. confirmer := weapp.AbnormalConfirmer{
  1196. ShopID: "123456",
  1197. ShopOrderID: "123456",
  1198. ShopNo: "shop_no_111",
  1199. WaybillID: "123456",
  1200. Remark: "remark",
  1201. DeliverySign: "123456",
  1202. }
  1203. res, err := confirmer.Confirm("access-token")
  1204. if err != nil {
  1205. // 处理一般错误信息
  1206. return
  1207. }
  1208. if err := res.GetResponseError(); err !=nil {
  1209. // 处理微信返回错误信息
  1210. return
  1211. }
  1212. fmt.Printf("返回结果: %#v", res)
  1213. ```
  1214. #### addDeliveryOrder
  1215. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addOrder.html)
  1216. ```go
  1217. import "github.com/medivhzhan/weapp/v2"
  1218. creator := weapp.DeliveryOrderCreator{
  1219. // ...
  1220. }
  1221. res, err := creator.Create("access-token")
  1222. if err != nil {
  1223. // 处理一般错误信息
  1224. return
  1225. }
  1226. if err := res.GetResponseError(); err !=nil {
  1227. // 处理微信返回错误信息
  1228. return
  1229. }
  1230. fmt.Printf("返回结果: %#v", res)
  1231. ```
  1232. #### addDeliveryTip
  1233. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addTip.html)
  1234. ```go
  1235. import "github.com/medivhzhan/weapp/v2"
  1236. adder := weapp.DeliveryTipAdder{
  1237. // ...
  1238. }
  1239. res, err := adder.Add("access-token")
  1240. if err != nil {
  1241. // 处理一般错误信息
  1242. return
  1243. }
  1244. if err := res.GetResponseError(); err !=nil {
  1245. // 处理微信返回错误信息
  1246. return
  1247. }
  1248. fmt.Printf("返回结果: %#v", res)
  1249. ```
  1250. #### cancelDeliveryOrder
  1251. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.cancelOrder.html)
  1252. ```go
  1253. import "github.com/medivhzhan/weapp/v2"
  1254. canceler := weapp.DeliveryOrderCanceler{
  1255. // ...
  1256. }
  1257. res, err := canceler.Cancel("access-token")
  1258. if err != nil {
  1259. // 处理一般错误信息
  1260. return
  1261. }
  1262. if err := res.GetResponseError(); err !=nil {
  1263. // 处理微信返回错误信息
  1264. return
  1265. }
  1266. fmt.Printf("返回结果: %#v", res)
  1267. ```
  1268. #### getAllImmediateDelivery
  1269. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getAllImmeDelivery.html)
  1270. ```go
  1271. import "github.com/medivhzhan/weapp/v2"
  1272. res, err := weapp.GetAllImmediateDelivery("access-token")
  1273. if err != nil {
  1274. // 处理一般错误信息
  1275. return
  1276. }
  1277. if err := res.GetResponseError(); err !=nil {
  1278. // 处理微信返回错误信息
  1279. return
  1280. }
  1281. fmt.Printf("返回结果: %#v", res)
  1282. ```
  1283. #### getBindAccount
  1284. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getBindAccount.html)
  1285. ```go
  1286. import "github.com/medivhzhan/weapp/v2"
  1287. res, err := weapp.GetBindAccount("access-token")
  1288. if err != nil {
  1289. // 处理一般错误信息
  1290. return
  1291. }
  1292. if err := res.GetResponseError(); err !=nil {
  1293. // 处理微信返回错误信息
  1294. return
  1295. }
  1296. fmt.Printf("返回结果: %#v", res)
  1297. ```
  1298. #### getDeliveryOrder
  1299. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getOrder.html)
  1300. ```go
  1301. import "github.com/medivhzhan/weapp/v2"
  1302. getter := weapp.DeliveryOrderGetter{
  1303. // ...
  1304. }
  1305. res, err := getter.Get("access-token")
  1306. if err != nil {
  1307. // 处理一般错误信息
  1308. return
  1309. }
  1310. if err := res.GetResponseError(); err !=nil {
  1311. // 处理微信返回错误信息
  1312. return
  1313. }
  1314. fmt.Printf("返回结果: %#v", res)
  1315. ```
  1316. #### mockUpdateDeliveryOrder
  1317. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.mockUpdateOrder.html)
  1318. ```go
  1319. import "github.com/medivhzhan/weapp/v2"
  1320. mocker := weapp.UpdateDeliveryOrderMocker{
  1321. // ...
  1322. }
  1323. res, err := mocker.Mock("access-token")
  1324. if err != nil {
  1325. // 处理一般错误信息
  1326. return
  1327. }
  1328. if err := res.GetResponseError(); err !=nil {
  1329. // 处理微信返回错误信息
  1330. return
  1331. }
  1332. fmt.Printf("返回结果: %#v", res)
  1333. ```
  1334. #### onDeliveryOrderStatus
  1335. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.onOrderStatus.html)
  1336. ```go
  1337. import "github.com/medivhzhan/weapp/v2"
  1338. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1339. if err != nil {
  1340. // 处理微信返回错误信息
  1341. return
  1342. }
  1343. srv.OnDeliveryOrderStatusUpdate(func(mix *weapp.DeliveryOrderStatusUpdateResult) *weapp.DeliveryOrderStatusUpdateReturn {
  1344. // 处理返回结果
  1345. return &weapp.DeliveryOrderStatusUpdateReturn{
  1346. // ...
  1347. }
  1348. })
  1349. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1350. // 处理微信返回错误信息
  1351. return
  1352. }
  1353. ```
  1354. #### preAddDeliveryOrder
  1355. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.preAddOrder.html)
  1356. ```go
  1357. import "github.com/medivhzhan/weapp/v2"
  1358. creator := weapp.DeliveryOrderCreator{
  1359. // ...
  1360. }
  1361. res, err := creator.Prepare("access-token")
  1362. if err != nil {
  1363. // 处理一般错误信息
  1364. return
  1365. }
  1366. if err := res.GetResponseError(); err !=nil {
  1367. // 处理微信返回错误信息
  1368. return
  1369. }
  1370. fmt.Printf("返回结果: %#v", res)
  1371. ```
  1372. #### preCancelDeliveryOrder
  1373. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.preCancelOrder.html)
  1374. ```go
  1375. import "github.com/medivhzhan/weapp/v2"
  1376. canceler := weapp.DeliveryOrderCanceler{
  1377. // ...
  1378. }
  1379. res, err := canceler.Prepare("access-token")
  1380. if err != nil {
  1381. // 处理一般错误信息
  1382. return
  1383. }
  1384. if err := res.GetResponseError(); err !=nil {
  1385. // 处理微信返回错误信息
  1386. return
  1387. }
  1388. fmt.Printf("返回结果: %#v", res)
  1389. ```
  1390. #### reDeliveryOrder
  1391. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.reOrder.html)
  1392. ```go
  1393. import "github.com/medivhzhan/weapp/v2"
  1394. creator := weapp.DeliveryOrderCreator{
  1395. // ...
  1396. }
  1397. res, err := creator.Recreate("access-token")
  1398. if err != nil {
  1399. // 处理一般错误信息
  1400. return
  1401. }
  1402. if err := res.GetResponseError(); err !=nil {
  1403. // 处理微信返回错误信息
  1404. return
  1405. }
  1406. fmt.Printf("返回结果: %#v", res)
  1407. ```
  1408. ---
  1409. ## 物流助手
  1410. ### 小程序使用
  1411. #### addExpressOrder
  1412. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.addOrder.html)
  1413. ```go
  1414. import "github.com/medivhzhan/weapp/v2"
  1415. creator := weapp.ExpressOrderCreator{
  1416. // ...
  1417. }
  1418. res, err := creator.Create("access-token")
  1419. if err != nil {
  1420. // 处理一般错误信息
  1421. return
  1422. }
  1423. if err := res.GetResponseError(); err !=nil {
  1424. // 处理微信返回错误信息
  1425. return
  1426. }
  1427. fmt.Printf("返回结果: %#v", res)
  1428. ```
  1429. #### cancelExpressOrder
  1430. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.cancelOrder.html)
  1431. ```go
  1432. import "github.com/medivhzhan/weapp/v2"
  1433. canceler := weapp.ExpressOrderCanceler{
  1434. // ...
  1435. }
  1436. res, err := canceler.cancel("access-token")
  1437. if err != nil {
  1438. // 处理一般错误信息
  1439. return
  1440. }
  1441. if err := res.GetResponseError(); err !=nil {
  1442. // 处理微信返回错误信息
  1443. return
  1444. }
  1445. fmt.Printf("返回结果: %#v", res)
  1446. ```
  1447. #### getAllDelivery
  1448. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getAllDelivery.html)
  1449. ```go
  1450. import "github.com/medivhzhan/weapp/v2"
  1451. res, err := weapp.getAllDelivery("access-token")
  1452. if err != nil {
  1453. // 处理一般错误信息
  1454. return
  1455. }
  1456. if err := res.GetResponseError(); err !=nil {
  1457. // 处理微信返回错误信息
  1458. return
  1459. }
  1460. fmt.Printf("返回结果: %#v", res)
  1461. ```
  1462. #### getExpressOrder
  1463. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getOrder.html)
  1464. ```go
  1465. import "github.com/medivhzhan/weapp/v2"
  1466. getter := weapp.ExpressOrderGetter{
  1467. // ...
  1468. }
  1469. res, err := getter.Get("access-token")
  1470. if err != nil {
  1471. // 处理一般错误信息
  1472. return
  1473. }
  1474. if err := res.GetResponseError(); err !=nil {
  1475. // 处理微信返回错误信息
  1476. return
  1477. }
  1478. fmt.Printf("返回结果: %#v", res)
  1479. ```
  1480. #### getExpressPath
  1481. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPath.html)
  1482. ```go
  1483. import "github.com/medivhzhan/weapp/v2"
  1484. getter := weapp.ExpressPathGetter{
  1485. // ...
  1486. }
  1487. res, err := getter.Get("access-token")
  1488. if err != nil {
  1489. // 处理一般错误信息
  1490. return
  1491. }
  1492. if err := res.GetResponseError(); err !=nil {
  1493. // 处理微信返回错误信息
  1494. return
  1495. }
  1496. fmt.Printf("返回结果: %#v", res)
  1497. ```
  1498. #### getExpressPrinter
  1499. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPrinter.html)
  1500. ```go
  1501. import "github.com/medivhzhan/weapp/v2"
  1502. res, err := weapp.GetPrinter("access-token")
  1503. if err != nil {
  1504. // 处理一般错误信息
  1505. return
  1506. }
  1507. if err := res.GetResponseError(); err !=nil {
  1508. // 处理微信返回错误信息
  1509. return
  1510. }
  1511. fmt.Printf("返回结果: %#v", res)
  1512. ```
  1513. #### getExpressQuota
  1514. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getQuota.html)
  1515. ```go
  1516. import "github.com/medivhzhan/weapp/v2"
  1517. getter := weapp.QuotaGetter{
  1518. // ...
  1519. }
  1520. res, err := getter.Get("access-token")
  1521. if err != nil {
  1522. // 处理一般错误信息
  1523. return
  1524. }
  1525. if err := res.GetResponseError(); err !=nil {
  1526. // 处理微信返回错误信息
  1527. return
  1528. }
  1529. fmt.Printf("返回结果: %#v", res)
  1530. ```
  1531. #### onExpressPathUpdate
  1532. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.onPathUpdate.html)
  1533. ```go
  1534. import "github.com/medivhzhan/weapp/v2"
  1535. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1536. if err != nil {
  1537. // 处理微信返回错误信息
  1538. return
  1539. }
  1540. srv.OnExpressPathUpdate(func(mix *weapp.ExpressPathUpdateResult) {
  1541. // 处理返回结果
  1542. })
  1543. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1544. // 处理微信返回错误信息
  1545. return
  1546. }
  1547. ```
  1548. #### testUpdateExpressOrder
  1549. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.testUpdateOrder.html)
  1550. ```go
  1551. import "github.com/medivhzhan/weapp/v2"
  1552. tester := weapp.UpdateExpressOrderTester{
  1553. // ...
  1554. }
  1555. res, err := tester.Test("access-token")
  1556. if err != nil {
  1557. // 处理一般错误信息
  1558. return
  1559. }
  1560. if err := res.GetResponseError(); err !=nil {
  1561. // 处理微信返回错误信息
  1562. return
  1563. }
  1564. fmt.Printf("返回结果: %#v", res)
  1565. ```
  1566. #### updateExpressPrinter
  1567. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.updatePrinter.html)
  1568. ```go
  1569. import "github.com/medivhzhan/weapp/v2"
  1570. updater := weapp.PrinterUpdater{
  1571. // ...
  1572. }
  1573. res, err := updater.Update("access-token")
  1574. if err != nil {
  1575. // 处理一般错误信息
  1576. return
  1577. }
  1578. if err := res.GetResponseError(); err !=nil {
  1579. // 处理微信返回错误信息
  1580. return
  1581. }
  1582. fmt.Printf("返回结果: %#v", res)
  1583. ```
  1584. ### 服务提供方使用
  1585. #### getExpressContact
  1586. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.getContact.html)
  1587. ```go
  1588. import "github.com/medivhzhan/weapp/v2"
  1589. res, err := weapp.GetContact("access-token", "token", "wat-bill-id")
  1590. if err != nil {
  1591. // 处理一般错误信息
  1592. return
  1593. }
  1594. if err := res.GetResponseError(); err !=nil {
  1595. // 处理微信返回错误信息
  1596. return
  1597. }
  1598. fmt.Printf("返回结果: %#v", res)
  1599. ```
  1600. #### onAddExpressOrder
  1601. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.onAddOrder.html)
  1602. ```go
  1603. import "github.com/medivhzhan/weapp/v2"
  1604. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1605. if err != nil {
  1606. // 处理微信返回错误信息
  1607. return
  1608. }
  1609. srv.OnAddExpressOrder(func(mix *weapp.AddExpressOrderResult) *weapp.AddExpressOrderReturn {
  1610. // 处理返回结果
  1611. return &weapp.AddExpressOrderReturn{
  1612. // ...
  1613. }
  1614. })
  1615. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1616. // 处理微信返回错误信息
  1617. return
  1618. }
  1619. ```
  1620. #### onCancelExpressOrder
  1621. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.onCancelOrder.html)
  1622. ```go
  1623. import "github.com/medivhzhan/weapp/v2"
  1624. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1625. if err != nil {
  1626. // 处理微信返回错误信息
  1627. return
  1628. }
  1629. srv.OnCancelExpressOrder(func(mix *weapp.CancelExpressOrderResult) *weapp.CancelExpressOrderReturn {
  1630. // 处理返回结果
  1631. return &weapp.CancelExpressOrderReturn{
  1632. // ...
  1633. }
  1634. })
  1635. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1636. // 处理微信返回错误信息
  1637. return
  1638. }
  1639. ```
  1640. #### onCheckExpressBusiness
  1641. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.onCheckBusiness.html)
  1642. ```go
  1643. import "github.com/medivhzhan/weapp/v2"
  1644. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1645. if err != nil {
  1646. // 处理微信返回错误信息
  1647. return
  1648. }
  1649. srv.OnCheckExpressBusiness(func(mix *weapp.CheckExpressBusinessResult) *weapp.CheckExpressBusinessReturn {
  1650. // 处理返回结果
  1651. return &weapp.CheckExpressBusinessReturn{
  1652. // ...
  1653. }
  1654. })
  1655. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1656. // 处理微信返回错误信息
  1657. return
  1658. }
  1659. ```
  1660. #### onGetExpressQuota
  1661. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.onGetQuota.html)
  1662. ```go
  1663. import "github.com/medivhzhan/weapp/v2"
  1664. srv, err := weapp.NewServer("app-id", "token", "aes-key", "mch-id", "api-key", true)
  1665. if err != nil {
  1666. // 处理微信返回错误信息
  1667. return
  1668. }
  1669. srv.OnGetExpressQuota(func(mix *weapp.GetExpressQuotaResult) *weapp.GetExpressQuotaReturn {
  1670. // 处理返回结果
  1671. return &weapp.GetExpressQuotaReturn{
  1672. // ...
  1673. }
  1674. })
  1675. if err := srv.Serve(http.ResponseWriter, *http.Request); err != nil {
  1676. // 处理微信返回错误信息
  1677. return
  1678. }
  1679. ```
  1680. #### previewExpressTemplate
  1681. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.previewTemplate.html)
  1682. ```go
  1683. import "github.com/medivhzhan/weapp/v2"
  1684. previewer := weapp.ExpressTemplatePreviewer{
  1685. // ...
  1686. }
  1687. res, err := previewer.Preview("access-token")
  1688. if err != nil {
  1689. // 处理一般错误信息
  1690. return
  1691. }
  1692. if err := res.GetResponseError(); err !=nil {
  1693. // 处理微信返回错误信息
  1694. return
  1695. }
  1696. fmt.Printf("返回结果: %#v", res)
  1697. ```
  1698. #### updateExpressBusiness
  1699. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.updateBusiness.html)
  1700. ```go
  1701. import "github.com/medivhzhan/weapp/v2"
  1702. updater := weapp.BusinessUpdater{
  1703. // ...
  1704. }
  1705. res, err := updater.Update("access-token")
  1706. if err != nil {
  1707. // 处理一般错误信息
  1708. return
  1709. }
  1710. if err := res.GetResponseError(); err !=nil {
  1711. // 处理微信返回错误信息
  1712. return
  1713. }
  1714. fmt.Printf("返回结果: %#v", res)
  1715. ```
  1716. #### updateExpressPath
  1717. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-provider/logistics.updatePath.html)
  1718. ```go
  1719. import "github.com/medivhzhan/weapp/v2"
  1720. updater := weapp.ExpressPathUpdater{
  1721. // ...
  1722. }
  1723. res, err := updater.Update("access-token")
  1724. if err != nil {
  1725. // 处理一般错误信息
  1726. return
  1727. }
  1728. if err := res.GetResponseError(); err !=nil {
  1729. // 处理微信返回错误信息
  1730. return
  1731. }
  1732. fmt.Printf("返回结果: %#v", res)
  1733. ```
  1734. ---
  1735. ## OCR
  1736. ### bankcard
  1737. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.bankcard.html)
  1738. ```go
  1739. import "github.com/medivhzhan/weapp/v2"
  1740. res, err := weapp.BankCard("access-token", "file-path", weapp.RecognizeModeScan)
  1741. // 或者
  1742. res, err := weapp.BankCardByURL("access-token", "card-url", weapp.RecognizeModePhoto)
  1743. if err != nil {
  1744. // 处理一般错误信息
  1745. return
  1746. }
  1747. if err := res.GetResponseError(); err !=nil {
  1748. // 处理微信返回错误信息
  1749. return
  1750. }
  1751. fmt.Printf("返回结果: %#v", res)
  1752. ```
  1753. ### businessLicense
  1754. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.businessLicense.html)
  1755. ```go
  1756. import "github.com/medivhzhan/weapp/v2"
  1757. res, err := weapp.BusinessLicense("access-token", "file-path")
  1758. // 或者
  1759. res, err := weapp.BusinessLicenseByURL("access-token", "card-url")
  1760. if err != nil {
  1761. // 处理一般错误信息
  1762. return
  1763. }
  1764. if err := res.GetResponseError(); err !=nil {
  1765. // 处理微信返回错误信息
  1766. return
  1767. }
  1768. fmt.Printf("返回结果: %#v", res)
  1769. ```
  1770. ### driverLicense
  1771. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.driverLicense.html)
  1772. ```go
  1773. import "github.com/medivhzhan/weapp/v2"
  1774. res, err := weapp.DriverLicense("access-token", "file-path")
  1775. // 或者
  1776. res, err := weapp.DriverLicenseByURL("access-token", "card-url")
  1777. if err != nil {
  1778. // 处理一般错误信息
  1779. return
  1780. }
  1781. if err := res.GetResponseError(); err !=nil {
  1782. // 处理微信返回错误信息
  1783. return
  1784. }
  1785. fmt.Printf("返回结果: %#v", res)
  1786. ```
  1787. ### idcard
  1788. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.idcard.html)
  1789. ```go
  1790. import "github.com/medivhzhan/weapp/v2"
  1791. res, err := weapp.IDCardByURL("access-token", "card-url", weapp.RecognizeModePhoto)
  1792. // 或者
  1793. res, err := weapp.IDCard("access-token", "file-path", weapp.RecognizeModeScan)
  1794. if err != nil {
  1795. // 处理一般错误信息
  1796. return
  1797. }
  1798. if err := res.GetResponseError(); err !=nil {
  1799. // 处理微信返回错误信息
  1800. return
  1801. }
  1802. fmt.Printf("返回结果: %#v", res)
  1803. ```
  1804. ### printedText
  1805. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.printedText.html)
  1806. ```go
  1807. import "github.com/medivhzhan/weapp/v2"
  1808. res, err := weapp.PrintedText("access-token", "file-path")
  1809. // 或者
  1810. res, err := weapp.PrintedTextByURL("access-token", "card-url")
  1811. if err != nil {
  1812. // 处理一般错误信息
  1813. return
  1814. }
  1815. if err := res.GetResponseError(); err !=nil {
  1816. // 处理微信返回错误信息
  1817. return
  1818. }
  1819. fmt.Printf("返回结果: %#v", res)
  1820. ```
  1821. ### vehicleLicense
  1822. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.vehicleLicense.html)
  1823. ```go
  1824. import "github.com/medivhzhan/weapp/v2"
  1825. res, err := weapp.VehicleLicense("access-token", "file-path", weapp.RecognizeModeScan)
  1826. // 或者
  1827. res, err := weapp.VehicleLicenseByURL("access-token", "card-url", weapp.RecognizeModePhoto)
  1828. if err != nil {
  1829. // 处理一般错误信息
  1830. return
  1831. }
  1832. if err := res.GetResponseError(); err !=nil {
  1833. // 处理微信返回错误信息
  1834. return
  1835. }
  1836. fmt.Printf("返回结果: %#v", res)
  1837. ```
  1838. ---
  1839. ## 小程序搜索
  1840. ### siteSearch
  1841. ### submitPages
  1842. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/search/search.submitPages.html)
  1843. ```go
  1844. import "github.com/medivhzhan/weapp/v2"
  1845. sender := weapp.SearchSubmitPages{
  1846. []weapp.SearchSubmitPage{
  1847. {
  1848. Path: "pages/index/index",
  1849. Query: "id=test",
  1850. },
  1851. },
  1852. }
  1853. res, err := sender.Send("access-token")
  1854. if err != nil {
  1855. // 处理一般错误信息
  1856. return
  1857. }
  1858. if err := res.GetResponseError(); err !=nil {
  1859. // 处理微信返回错误信息
  1860. return
  1861. }
  1862. fmt.Printf("返回结果: %#v", res)
  1863. ```
  1864. ---
  1865. ## 生物认证
  1866. ### verifySignature
  1867. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/soter/soter.verifySignature.html)
  1868. ```go
  1869. import "github.com/medivhzhan/weapp/v2"
  1870. res, err := weapp.VerifySignature("access-token", "open-id", "data", "signature")
  1871. if err != nil {
  1872. // 处理一般错误信息
  1873. return
  1874. }
  1875. if err := res.GetResponseError(); err !=nil {
  1876. // 处理微信返回错误信息
  1877. return
  1878. }
  1879. fmt.Printf("返回结果: %#v", res)
  1880. ```
  1881. ---
  1882. ## 订阅消息
  1883. ### addTemplate
  1884. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.addTemplate.html)
  1885. ```go
  1886. import "github.com/medivhzhan/weapp/v2"
  1887. // AddTemplate 组合模板并添加至帐号下的个人模板库
  1888. //
  1889. // token 微信 access_token
  1890. // tid 模板ID
  1891. // desc 服务场景描述,15个字以内
  1892. // keywordIDList 关键词 ID 列表
  1893. res, err := weapp.AddTemplate("access_token", "tid", "desc", []int32{1, 2, 3})
  1894. if err != nil {
  1895. // 处理一般错误信息
  1896. return
  1897. }
  1898. if err := res.GetResponseError(); err !=nil {
  1899. // 处理微信返回错误信息
  1900. return
  1901. }
  1902. fmt.Printf("返回结果: %#v", res)
  1903. ```
  1904. ### deleteTemplate
  1905. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.deleteTemplate.html)
  1906. ```go
  1907. import "github.com/medivhzhan/weapp/v2"
  1908. // DeleteTemplate 删除帐号下的某个模板
  1909. //
  1910. // token 微信 access_token
  1911. // pid 模板ID
  1912. res, err := weapp.DeleteTemplate("access_token", "pid")
  1913. if err != nil {
  1914. // 处理一般错误信息
  1915. return
  1916. }
  1917. if err := res.GetResponseError(); err !=nil {
  1918. // 处理微信返回错误信息
  1919. return
  1920. }
  1921. fmt.Printf("返回结果: %#v", res)
  1922. ```
  1923. ### getCategory
  1924. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getCategory.html)
  1925. ```go
  1926. import "github.com/medivhzhan/weapp/v2"
  1927. // GetTemplateCategory 删除帐号下的某个模板
  1928. //
  1929. // token 微信 access_token
  1930. res, err := weapp.GetTemplateCategory("access_token")
  1931. if err != nil {
  1932. // 处理一般错误信息
  1933. return
  1934. }
  1935. if err := res.GetResponseError(); err !=nil {
  1936. // 处理微信返回错误信息
  1937. return
  1938. }
  1939. fmt.Printf("返回结果: %#v", res)
  1940. ```
  1941. ### getPubTemplateKeyWordsById
  1942. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateKeyWordsById.html)
  1943. ```go
  1944. import "github.com/medivhzhan/weapp/v2"
  1945. // GetPubTemplateKeyWordsById 获取模板标题下的关键词列表
  1946. //
  1947. // token 微信 access_token
  1948. // tid 模板ID
  1949. res, err := weapp.GetPubTemplateKeyWordsById("access_token", "tid")
  1950. if err != nil {
  1951. // 处理一般错误信息
  1952. return
  1953. }
  1954. if err := res.GetResponseError(); err !=nil {
  1955. // 处理微信返回错误信息
  1956. return
  1957. }
  1958. fmt.Printf("返回结果: %#v", res)
  1959. ```
  1960. ### getPubTemplateTitleList
  1961. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateTitleList.html)
  1962. ```go
  1963. import "github.com/medivhzhan/weapp/v2"
  1964. // GetPubTemplateTitleList 获取帐号所属类目下的公共模板标题
  1965. //
  1966. // token 微信 access_token
  1967. // ids 类目 id,多个用逗号隔开
  1968. // start 用于分页,表示从 start 开始。从 0 开始计数。
  1969. // limit 用于分页,表示拉取 limit 条记录。最大为 30
  1970. res, err := weapp.GetPubTemplateTitleList("access_token", "1,2,3", 0, 10)
  1971. if err != nil {
  1972. // 处理一般错误信息
  1973. return
  1974. }
  1975. if err := res.GetResponseError(); err !=nil {
  1976. // 处理微信返回错误信息
  1977. return
  1978. }
  1979. fmt.Printf("返回结果: %#v", res)
  1980. ```
  1981. ### getTemplateList
  1982. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getTemplateList.html)
  1983. ```go
  1984. import "github.com/medivhzhan/weapp/v2"
  1985. // GetTemplateList 获取帐号下已存在的模板列表
  1986. //
  1987. // token 微信 access_token
  1988. res, err := weapp.GetTemplateList("access_token")
  1989. if err != nil {
  1990. // 处理一般错误信息
  1991. return
  1992. }
  1993. if err := res.GetResponseError(); err !=nil {
  1994. // 处理微信返回错误信息
  1995. return
  1996. }
  1997. fmt.Printf("返回结果: %#v", res)
  1998. ```
  1999. ### sendSubscribeMessage
  2000. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html)
  2001. ```go
  2002. import "github.com/medivhzhan/weapp/v2"
  2003. sender := weapp.SubscribeMessage{
  2004. ToUser: mpOpenID,
  2005. TemplateID: "template-id",
  2006. Page: "mock/page/path",
  2007. MiniprogramState: weapp.MiniprogramStateDeveloper, // 或者: "developer"
  2008. Data: weapp.SubscribeMessageData{
  2009. "first-key": {
  2010. Value: "value",
  2011. },
  2012. "second-key": {
  2013. Value: "value",
  2014. },
  2015. },
  2016. }
  2017. res, err := sender.Send("access-token")
  2018. if err != nil {
  2019. // 处理一般错误信息
  2020. return
  2021. }
  2022. if err := res.GetResponseError(); err !=nil {
  2023. // 处理微信返回错误信息
  2024. return
  2025. }
  2026. fmt.Printf("返回结果: %#v", res)
  2027. ```
  2028. ---
  2029. ## 解密
  2030. [官方文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)
  2031. > ⚠️ 前端应当先完成[登录](#登录)流程再调用获取加密数据的相关接口。
  2032. ### 解密手机号码
  2033. ```go
  2034. import "github.com/medivhzhan/weapp/v2"
  2035. res, err := weapp.DecryptMobile("session-key", "encrypted-data", "iv" )
  2036. if err != nil {
  2037. // 处理一般错误信息
  2038. return
  2039. }
  2040. fmt.Printf("返回结果: %#v", res)
  2041. ```
  2042. ### 解密分享内容
  2043. ```go
  2044. import "github.com/medivhzhan/weapp/v2"
  2045. res, err := weapp.DecryptShareInfo("session-key", "encrypted-data", "iv" )
  2046. if err != nil {
  2047. // 处理一般错误信息
  2048. return
  2049. }
  2050. fmt.Printf("返回结果: %#v", res)
  2051. ```
  2052. ### 解密用户信息
  2053. ```go
  2054. import "github.com/medivhzhan/weapp/v2"
  2055. res, err := weapp.DecryptUserInfo( "session-key", "raw-data", "encrypted-data", "signature", "iv")
  2056. if err != nil {
  2057. // 处理一般错误信息
  2058. return
  2059. }
  2060. fmt.Printf("返回结果: %#v", res)
  2061. ```
  2062. ### 解密微信运动
  2063. ```go
  2064. import "github.com/medivhzhan/weapp/v2"
  2065. res, err := weapp.DecryptRunData("session-key", "encrypted-data", "iv" )
  2066. if err != nil {
  2067. // 处理一般错误信息
  2068. return
  2069. }
  2070. fmt.Printf("返回结果: %#v", res)
  2071. ```
  2072. ---
  2073. ## 人脸识别
  2074. ```go
  2075. import "github.com/medivhzhan/weapp/v2"
  2076. // FaceIdentify 获取人脸识别结果
  2077. //
  2078. // token 微信 access_token
  2079. // key 小程序 verify_result
  2080. res, err := weapp.FaceIdentify("access_token", "verify_result")
  2081. if err != nil {
  2082. // 处理一般错误信息
  2083. return
  2084. }
  2085. if err := res.GetResponseError(); err !=nil {
  2086. // 处理微信返回错误信息
  2087. return
  2088. }
  2089. fmt.Printf("返回结果: %#v", res)
  2090. ```
  2091. ---