# <p align="center">营销系统后台API</p>

### 参与开发
[请参阅](https://tvd8jq9lqkp.feishu.cn/wiki/LNWVweZ64iY2UBkkTkZcezy0n5h?from=from_copylink)
* * *
### 主要工作
+ 后台接口API
* * *
### 规则说明
+ 路由前缀都为 __/admin__ 开始，路由规则全小写+下划线,例如：/admin/v1/demo_1
* * *
### 构建部署
+ 采用多阶段构建，以获得最小体积的容器镜像
````bash
cd /项目根目录 && make deploy folder=./configs_dev marketing=marketing_backend container_name=marketing_backend http_port=8090
````
* * *
### docker环境下开发
+ 一、[下载Docker Desktop安装程序](https://www.docker.com/products/docker-desktop)
+ 二、在项目根目录下执行命令
  ```shell
  docker build -f Dockerfile_win -t 镜像名称 .
  docker run --privileged -itd --name 容器名称 --restart=always -v ./:/src 镜像名称
  docker ps
  docker exec -it 容器名称 sh
  make init
  make all
  ```

### windows非docker开发
1 安装插件(配置goproxy,GOPROXY=https://goproxy.cn,direct)
```shell
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
go install github.com/google/wire/cmd/wire@latest
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest
go install gorm.io/gen/tools/gentool@latest
```
2生成相应rpo

命令：kratos proto client api/helloworld/v1/demo.proto

位置：api和internal下面的conf

3 wire生成依赖
cd cmd/server
wire

4 配置编译

![img_1.png](img.png)

5 生成service
kratos proto server api/helloworld/v1/demo.proto -t internal/service



