項目背景
隨著微信小程序的正式上線,我卻又做了個公眾號的開發。算起來這是我第三個微信公眾號的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/...