fix🐛 :修复已知bug (#377)
This commit is contained in:
11 files changed
+149
-111
No files matched your search
@@ -21,3 +21,4 @@ cmd/migrate/migration/version-local/*
|
||||
|
||||
# go sum
|
||||
go.sum
|
||||
config/settings.deva.yml
|
||||
+116
-90
@@ -23,6 +23,10 @@
|
||||
- GORM-based database storage that can expand many types of databases
|
||||
|
||||
- Simple model mapping of configuration files to quickly get the desired configuration
|
||||
|
||||
- Form builder
|
||||
|
||||
- Multi command mode
|
||||
|
||||
- TODO: unit test
|
||||
|
||||
@@ -39,102 +43,89 @@
|
||||
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.
|
||||
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
|
||||
```yml
|
||||
settings:
|
||||
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
|
||||
```
|
||||
<p align="center">
|
||||
<img src="https://gitee.com/mydearzwj/image/raw/d9f59ea603e3c8a3977491a1bfa8f122e1a80824/img/go-admin-system.png" width="936px" height="491px">
|
||||
</p>
|
||||
|
||||
2. file path go-admin/config/settings.yml
|
||||
## 📦 Local development
|
||||
|
||||
|
||||
## 📦 evelopment
|
||||
|
||||
|
||||
First start instructions
|
||||
### Create development directory
|
||||
|
||||
```bash
|
||||
# Get the code
|
||||
git clone https://github.com/wenjianzhang/go-admin.git
|
||||
mkdir goadmin
|
||||
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
|
||||
|
||||
# Build the project
|
||||
# Compile project
|
||||
go build
|
||||
|
||||
# Change setting
|
||||
vi ./config/setting.yml (Note: Change isinit and database connection)
|
||||
# Configuration
|
||||
# file path go-admin/config/settings.yml
|
||||
vi ./config/setting.yml
|
||||
|
||||
# 1. Database information in the configuration file
|
||||
# Note: the corresponding configuration data under settings.database
|
||||
# 2. Confirm database initialization parameters
|
||||
# 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
|
||||
# 1. Modifying database information in configuration file
|
||||
# settings.database Corresponding configuration data under
|
||||
# 2. Confirm 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
|
||||
./go-admin
|
||||
# Start the project, you can also debug with IDE
|
||||
./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
|
||||
swag init
|
||||
go generate
|
||||
```
|
||||
|
||||
If there is no `swag` command go get installed
|
||||
```bash
|
||||
go get -u github.com/swaggo/swag/cmd/swag
|
||||
```
|
||||
|
||||
|
||||
Cross compilation
|
||||
#### Cross compiling
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
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
|
||||
@@ -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
|
||||
[chengxiao](https://github.com/chengxiao)
|
||||
2. [chengxiao](https://github.com/chengxiao)
|
||||
|
||||
|
||||
|
||||
## License
|
||||
@@ -191,4 +217,4 @@ I saw a lot of friends who experience the wrong verification code, so I adjusted
|
||||
|
||||
Copyright (c) 2020 wenjianzhang
|
||||
|
||||
[中文]qq technical exchange group: 74520518
|
||||
[中文]qq technical exchange group: 74520518
|
||||
@@ -182,10 +182,7 @@ docker run --name go-admin -p 8000:8000 -d go-admin
|
||||
#### 文档生成
|
||||
|
||||
```bash
|
||||
swag init
|
||||
|
||||
# 如果没有swag命令 go get安装一下即可
|
||||
go get -u github.com/swaggo/swag/cmd/swag
|
||||
go generate
|
||||
```
|
||||
|
||||
#### 交叉编译
|
||||
|
||||
@@ -21,4 +21,4 @@ func InitMiddleware(r *gin.Engine) {
|
||||
r.Use(Secure)
|
||||
// 链路追踪
|
||||
//r.Use(middleware.Trace())
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,15 @@ package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysChinaAreaData struct {
|
||||
models.Model
|
||||
models.ControlBy
|
||||
|
||||
PId string `json:"pId" gorm:"type:int(11);comment:上级编码"`
|
||||
Name string `json:"name" gorm:"type:varchar(128);comment:名称"`
|
||||
CreateTime time.Time `json:"createTime" gorm:"type:timestamp;comment:CreateTime"`
|
||||
UpdateTime time.Time `json:"updateTime" gorm:"type:timestamp;comment:UpdateTime"`
|
||||
DeleteTime time.Time `json:"deleteTime" gorm:"type:timestamp;comment:DeleteTime"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysChinaAreaData) TableName() string {
|
||||
@@ -27,4 +24,4 @@ func (e *SysChinaAreaData) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysChinaAreaData) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
}
|
||||
@@ -59,9 +59,6 @@ func (s *SysChinaAreaDataControl) Generate() (*models.SysChinaAreaData, error) {
|
||||
Model: common.Model{Id: s.Id},
|
||||
PId: s.PId,
|
||||
Name: s.Name,
|
||||
CreateTime: s.CreateTime,
|
||||
UpdateTime: s.UpdateTime,
|
||||
DeleteTime: s.DeleteTime,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -98,4 +95,4 @@ func (s *SysChinaAreaDataById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysChinaAreaDataById) SetUpdateBy(id int) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package version
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
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 {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -25,4 +26,4 @@ func _1615948084336Test(db *gorm.DB, version string) error {
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -1866,8 +1866,15 @@ var doc = `{
|
||||
"definitions": {
|
||||
"dto.PassWord": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"newPassword",
|
||||
"oldPassword"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"newPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"oldPassword": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -1849,8 +1849,15 @@
|
||||
"definitions": {
|
||||
"dto.PassWord": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"newPassword",
|
||||
"oldPassword"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"newPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"oldPassword": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,8 +1,13 @@
|
||||
definitions:
|
||||
dto.PassWord:
|
||||
properties:
|
||||
password:
|
||||
newPassword:
|
||||
type: string
|
||||
oldPassword:
|
||||
type: string
|
||||
required:
|
||||
- newPassword
|
||||
- oldPassword
|
||||
type: object
|
||||
dto.SysDeptById:
|
||||
properties:
|
||||
|
||||
Reference in new issue
Block a user