微信公眾號的后臺搭建源碼分享

項目背景

隨著微信小程序的正式上線,我卻又做了個公眾號的開發。算起來這是我第三個微信公眾號的web項目開發,但是每一次項目的架構都有挺大的變化。這一次,我也自己獨立封裝了一些微信公眾號必要的工具包,使得自己開發效率更高。另外,這次項目是與微信硬件有關系的(個人感覺都是業務上的關系),所以也拓展了一些邊緣學科的知識。不過..我可不想再玩這個了,有時間想做個小程序玩玩呢。

項目介紹

前臺采用的是react框架的單頁模式,后臺使用spring boot,后臺全部以restful接口的形式開發給前臺或者微信服務器調用,另外這些接口由另一個網關服務統一做權限開放和負載均衡,采用簡單的spring cloud模塊化組件。關于微服務的一些部署和相關介紹我會在接下來的博客中做介紹。

項目地址

我把微信部分留存下來了,業務邏輯處理等模塊去除。供大家參考討論。
spring-boot-wechat

項目README

Introduce

the project is based on spring boot,contain with wechat utils。

Structure

.
├── log
├── src
│   ├── main
│   │   ├── java
│   │   │   ├── com
│   │   │   │   └── senthink
│   │   │   │       └── www
│   │   │   │           ├── async       # async task
│   │   │   │           ├── common      # common utils
│   │   │   │           ├── config      # packaging config from bootstrap.yml
│   │   │   │           ├── convert     # [mapstruct](http://mapstruct.org/)
│   │   │   │           ├── dao         # IMapper
│   │   │   │           ├── domain
│   │   │   │           │   ├── dto     # Data Transfer Object(return to front)
│   │   │   │           │   ├── po      # persistant object(entity corresponding to sql)
│   │   │   │           │   │   └── wechat  # wechat entity like Article
│   │   │   │           │   └── vo      # view object (receive param from front)
│   │   │   │           ├── enums       # enums class
│   │   │   │           ├── exception   # global exception catcher
│   │   │   │           ├── filter      # filter to solve cross-domain access
│   │   │   │           ├── response    # return class packaging
│   │   │   │           ├── service     # Service
│   │   │   │           ├── util        # the same as common package
│   │   │   │           └── web         # Controller
│   │   │   │               └── notify  # receive message from wechat server
│   │   │   └── gatling                 # test utils
│   │   └── resources
│   │       ├── gatling
│   │       │   └── data
│   │       └── mapper                  # mybatis plus mapper
│   └── test
│       ├── java
│       │   └── com
│       │       └── senthink
│       │           └── www
│       └── scala
│           └── gatling
└── target

Reminder

If some error or warning happens when projects starting,it might be you missed dependency.Such as redis,mongo,etc.Please delete config about that or install the necessary software.

How to use

Start the project with RUN class DemoApplication.To test your interface on http://127.0.0.1:8010/wechatdemo/...

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • Spring Cloud為開發人員提供了快速構建分布式系統中一些常見模式的工具(例如配置管理,服務發現,斷路器,智...
    卡卡羅2017閱讀 134,869評論 18 139
  • Spring Boot 參考指南 介紹 轉載自:https://www.gitbook.com/book/qbgb...
    毛宇鵬閱讀 46,941評論 6 342
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 173,076評論 25 708
  • 看著封面上的老虎站在一只椅子上,我頓時感到十分害怕,不知這是為何?讀完后我終于明白了。 這本書主要...
    龍卷風暴閱讀 1,122評論 0 0
  • 風荷初露(外一首)—— 『我的思念』之東湖詩影印象五月,立夏降至,東湖的荷,此刻正迎風初長,只是,湖水卻幾近乾涸,...
    簡書_紅豆閱讀 1,490評論 8 37