fix🐛 :修复已知bug (#377)

This commit is contained in:
wenjianzhang authored and GitHub committed 2021-03-26 09:03:21 +08:00
commit a65930b35b
9 files changed
+143 -105

No files matched your search

+1
View File
@@ -21,3 +21,4 @@ cmd/migrate/migration/version-local/*
# go sum # go sum
go.sum go.sum
config/settings.deva.yml
+115 -89
View File
@@ -24,6 +24,10 @@
- Simple model mapping of configuration files to quickly get the desired configuration - Simple model mapping of configuration files to quickly get the desired configuration
- Form builder
- Multi command mode
- TODO: unit test - TODO: unit test
@@ -39,102 +43,89 @@
8. Operation log: system normal operation log record and query; system exception information log record and query. 8. Operation log: system normal operation log record and query; system exception information log record and query.
9. Login log: The system login log record query contains login exceptions. 9. Login log: The system login log record query contains login exceptions.
10. System interface: Automatically generate related api interface documents according to business code. 10. System interface: Automatically generate related api interface documents according to business code.
11. Multi command mode code generation: according to the data table structure to generate the corresponding business, all visual programming, basic business can be 0 code.
12. Form construction: Customize page style, drag and drop to achieve page layout.
13. Service monitoring: view the basic information of some servers.
## Configuration details ## 🗞 System architecture
1. Configuration file description <p align="center">
```yml <img src="https://gitee.com/mydearzwj/image/raw/d9f59ea603e3c8a3977491a1bfa8f122e1a80824/img/go-admin-system.png" width="936px" height="491px">
settings: </p>
application:
# Project launch environment
env: dev
# When env: demo, prompts for request operations other than GET
envmsg: "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!"
# Host IP or domain name, default 0.0.0.0
host: 0.0.0.0
# Whether to initialize the database structure and basic data; true: required; false: not required
isinit: false
# JWT encrypted string
jwtsecret: 123abc
# log storage path
logpath: temp/logs/log.log
# application name
name: go-admin
# application port
port: 8000
readtimeout: 1
writertimeout: 2
database:
# database name
database: dbname
# database type
dbtype: mysql
# database host
host: 127.0.0.1
# database password
password: password
# database port
port: 3306
# database username
username: root
redis:
# redis addresss
addr: 0.0.0.0:6379
# db
db: 0
# password
password: password
# read timeout
readtimeout: 50
```
2. file path go-admin/config/settings.yml ## 📦 Local development
### Create development directory
## 📦 evelopment
First start instructions
```bash ```bash
# Get the code mkdir goadmin
git clone https://github.com/wenjianzhang/go-admin.git cd goadmin
```
# Enter working path ### Get code
> Key points: two projects must be placed in the same folder;
```bash
# Get backend code
git clone https://github.com/go-admin-team/go-admin.git
# Get front end code
git clone https://github.com/go-admin-team/go-admin-ui.git
```
### Start up instructions
#### Server startup instructions
```bash
# Enter the go-admin backend project
cd ./go-admin cd ./go-admin
# Build the project # Compile project
go build go build
# Change setting # Configuration
vi ./config/setting.yml (Note: Change isinit and database connection) # file path go-admin/config/settings.yml
vi ./config/setting.yml
# 1. Database information in the configuration file # 1. Modifying database information in configuration file
# Note: the corresponding configuration data under settings.database # settings.database Corresponding configuration data under
# 2. Confirm database initialization parameters # 2. Confirm log path
# Note: If this is the first time settings.application.isinit is set, please set the current value to true, the system will automatically initialize the database structure and basic data information; ```
# 3. Confirm the log path
#### Initialize the database and start the service
```
# The first configuration needs to initialize the database resource information
./go-admin migrate -c config/settings.yml
# Start the project or debug with the IDE # Start the project, you can also debug with IDE
./go-admin ./go-admin server -c config/settings.yml -p 8000
# See also instructions in WIKI ```
#### Using docker to compile and start
```shell
# Compile image
docker build -t go-admin .
# Start the container. The first go admin is the container name and the second go admin is the image name
docker run --name go-admin -p 8000:8000 -d go-admin
``` ```
Document generation
#### Document generation
```bash ```bash
swag init go generate
``` ```
If there is no `swag` command go get installed #### Cross compiling
```bash
go get -u github.com/swaggo/swag/cmd/swag
```
Cross compilation
```bash ```bash
env GOOS=windows GOARCH=amd64 go build main.go env GOOS=windows GOARCH=amd64 go build main.go
@@ -143,11 +134,56 @@ env GOOS=windows GOARCH=amd64 go build main.go
env GOOS=linux GOARCH=amd64 go build main.go env GOOS=linux GOARCH=amd64 go build main.go
``` ```
### UI interactive terminal startup description
## 🔗 Online Demo ```bash
# Installation dependency
npm install
# It is recommended that you do not use cnpm to install dependencies directly. There will be all kinds of weird bugs. The problem of slow download speed of NPM can be solved by the following operations
npm install --registry=https://registry.npm.taobao.org
# Start the service
npm run dev
```
## 🎬 Online Demo
> admin / 123456 > admin / 123456
Demo address:[http://www.zhangwj.com](http://www.zhangwj.com/#/login) Demo:[http://www.go-admin.dev](http://www.go-admin.dev/#/login)
## 📨 Interaction
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq2.png" width="200px"></td>
</tr>
<tr>
<td>WeChat</td>
<td>This QQ group is full</td>
<td><a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=0f2bf59f5f2edec6a4550c364242c0641f870aa328e468c4ee4b7dbfb392627b"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流乙号" title="go-admin技术交流乙号"></a></td>
</tr>
</table>
## 💎 Member
<a href="https://github.com/wenjianzhang"> <img src="https://avatars.githubusercontent.com/u/3890175?s=460&u=20eac63daef81588fbac611da676b99859319251&v=4" width="80px"></a>
<a href="https://github.com/lwnmengjing"> <img src="https://avatars.githubusercontent.com/u/12806223?s=400&u=a89272dce50100b77b4c0d5c81c718bf78ebb580&v=4" width="80px"></a>
<a href="https://github.com/chengxiao"> <img src="https://avatars.githubusercontent.com/u/1379545?s=460&u=557da5503d0ac4a8628df6b4075b17853d5edcd9&v=4" width="80px"></a>
<a href="https://github.com/bing127"> <img src="https://avatars.githubusercontent.com/u/31166183?s=460&u=c085bff88df10bb7676c8c0351ba9dcd031d1fb3&v=4" width="80px"></a>
## JetBrains Open source certificate support
The go admin project has always been developed in the GoLand integrated development environment of JetBrains company, based on the * * free JetBrains open source license (s) * * genuine free license. I would like to express my thanks.
<a href="https://www.jetbrains.com/?from=kubeadm-ha" target="_blank"><img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/jetbrains/jetbrains-variant-4.png" width="250" align="middle"/></a>
## 🤝 Open source projects used ## 🤝 Open source projects used
@@ -169,20 +205,10 @@ Demo address:[http://www.zhangwj.com](http://www.zhangwj.com/#/login)
## Version
#### 2020-03-15 New Features and Optimization
1. Add user avatar upload
2. Add user password modification
3. Operation log page adjustment
4. Optimize captcha background color
I saw a lot of friends who experience the wrong verification code, so I adjusted the contrast for everyone to experience!
## 🤝 Thanks ## 🤝 Thanks
[chengxiao](https://github.com/chengxiao) 2. [chengxiao](https://github.com/chengxiao)
## License ## License
+1 -4
View File
@@ -182,10 +182,7 @@ docker run --name go-admin -p 8000:8000 -d go-admin
#### 文档生成 #### 文档生成
```bash ```bash
swag init go generate
# 如果没有swag命令 go get安装一下即可
go get -u github.com/swaggo/swag/cmd/swag
``` ```
#### 交叉编译 #### 交叉编译
+2 -5
View File
@@ -2,18 +2,15 @@ package models
import ( import (
"go-admin/common/models" "go-admin/common/models"
"time"
) )
type SysChinaAreaData struct { type SysChinaAreaData struct {
models.Model models.Model
models.ControlBy
PId string `json:"pId" gorm:"type:int(11);comment:上级编码"` PId string `json:"pId" gorm:"type:int(11);comment:上级编码"`
Name string `json:"name" gorm:"type:varchar(128);comment:名称"` Name string `json:"name" gorm:"type:varchar(128);comment:名称"`
CreateTime time.Time `json:"createTime" gorm:"type:timestamp;comment:CreateTime"` models.ControlBy
UpdateTime time.Time `json:"updateTime" gorm:"type:timestamp;comment:UpdateTime"` models.ModelTime
DeleteTime time.Time `json:"deleteTime" gorm:"type:timestamp;comment:DeleteTime"`
} }
func (SysChinaAreaData) TableName() string { func (SysChinaAreaData) TableName() string {
@@ -59,9 +59,6 @@ func (s *SysChinaAreaDataControl) Generate() (*models.SysChinaAreaData, error) {
Model: common.Model{Id: s.Id}, Model: common.Model{Id: s.Id},
PId: s.PId, PId: s.PId,
Name: s.Name, Name: s.Name,
CreateTime: s.CreateTime,
UpdateTime: s.UpdateTime,
DeleteTime: s.DeleteTime,
}, nil }, nil
} }
@@ -3,6 +3,7 @@ package version
import ( import (
"gorm.io/gorm" "gorm.io/gorm"
"runtime" "runtime"
"strings"
"go-admin/cmd/migrate/migration" "go-admin/cmd/migrate/migration"
common "go-admin/common/models" common "go-admin/common/models"
@@ -17,7 +18,7 @@ func _1615948084336Test(db *gorm.DB, version string) error {
return db.Transaction(func(tx *gorm.DB) error { return db.Transaction(func(tx *gorm.DB) error {
err := tx.Exec("alter table sys_config add is_frontend int default 1 null comment '是否前台参数' after config_type").Error err := tx.Exec("alter table sys_config add is_frontend int default 1 null comment '是否前台参数' after config_type").Error
if err != nil { if err != nil && !strings.Contains(err.Error(),"Duplicate column name 'is_frontend'") {
return err return err
} }
+8 -1
View File
@@ -1866,8 +1866,15 @@ var doc = `{
"definitions": { "definitions": {
"dto.PassWord": { "dto.PassWord": {
"type": "object", "type": "object",
"required": [
"newPassword",
"oldPassword"
],
"properties": { "properties": {
"password": { "newPassword": {
"type": "string"
},
"oldPassword": {
"type": "string" "type": "string"
} }
} }
+8 -1
View File
@@ -1849,8 +1849,15 @@
"definitions": { "definitions": {
"dto.PassWord": { "dto.PassWord": {
"type": "object", "type": "object",
"required": [
"newPassword",
"oldPassword"
],
"properties": { "properties": {
"password": { "newPassword": {
"type": "string"
},
"oldPassword": {
"type": "string" "type": "string"
} }
} }
+6 -1
View File
@@ -1,8 +1,13 @@
definitions: definitions:
dto.PassWord: dto.PassWord:
properties: properties:
password: newPassword:
type: string type: string
oldPassword:
type: string
required:
- newPassword
- oldPassword
type: object type: object
dto.SysDeptById: dto.SysDeptById:
properties: properties: