Merge branch 'master' into dev

This commit is contained in:
wenjianzhang authored and GitHub committed 2020-04-01 15:05:17 +08:00
commit cbfe9af070
16 files changed
+85 -2684

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
+4 -5
View File
@@ -1,9 +1,8 @@
# go-admin
<a href="https://github.com/wenjianzhang/go-admin/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
</a>
![build](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg) ![license](https://img.shields.io/github/license/mashape/apistatus.svg)
English | [简体中文](./README.zh-CN.md)
##### Gin + Vue + Element UI based scaffolding for front and back separation management system
@@ -102,7 +101,7 @@ First start instructions
git clone https://github.com/wenjianzhang/go-admin.git
# Enter working path
cd ./go-admin/src/go-admin
cd ./go-admin
# Build the project
go build
+36 -8
View File
@@ -1,12 +1,14 @@
# go-admin
<a href="https://github.com/wenjianzhang/go-admin/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
</a>
![build](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg) ![license](https://img.shields.io/github/license/mashape/apistatus.svg)
[English](./README.md) | 简体中文
##### 基于Gin + Vue + Element UI的前后端分离权限管理系统脚手架
##### 基于Gin + Vue + Element UI的前后端分离权限管理系统
系统初始化极度简单,只需要配置文件中,修改数据库连接,系统启动后会自动初始化数据库信息以及必须的基础数据
## ✨ 特性
@@ -25,6 +27,10 @@
- 配置文件简单的模型映射,快速能够得到想要的配置
- 代码生成工具(即将push,demo已经发布可以体验了)
- 表单构建工具(即将push,demo已经发布可以体验了)
- TODO: 单元测试
@@ -40,6 +46,8 @@
8. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
9. 登录日志:系统登录日志记录查询包含登录异常。
10. 系统接口:根据业务代码自动生成相关的api接口文档。
11. 代码生成:根据数据表结构生成对应的增删改查相对应业务,全部可视化编程。
12. 表单构建:自定义页面样式,拖拉拽实现页面布局。
## 配置详情
@@ -78,7 +86,8 @@ settings:
port: 3306
# 数据库用户名
username: root
redis:
# redis 可忽略
redis:
# redis链接地址
addr: 0.0.0.0:6379
# db
@@ -101,7 +110,7 @@ settings:
git clone https://github.com/wenjianzhang/go-admin.git
# 进入工作路径
cd ./go-admin/src/go-admin
cd ./go-admin
# 编译项目
go build
@@ -170,6 +179,12 @@ env GOOS=linux GOARCH=amd64 go build main.go
## 版本
### 2020-04 新功能预告
1. 代码生成器
2. 代码优化
3. 已知bug修复
#### 2020-03-15 新功能及优化
1. 添加用户头像上传
@@ -179,6 +194,21 @@ env GOOS=linux GOARCH=amd64 go build main.go
看到好多体验的朋友验证码错误,所以调整了对比度,方便大家体验!
## 互动
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/go-admin/master/demo/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/go-admin/master/demo/qq.png" width="200px"></td>
</tr>
<tr>
<td>微信</td>
<td>QQ</td>
</tr>
</table>
<a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=1affb445445bd442312fcad9a927007db74a0cd4380bbc08a6c97d2691744869"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流" title="go-admin技术交流"></a>
## 🤝 特别感谢
[chengxiao](https://github.com/chengxiao)
@@ -189,5 +219,3 @@ env GOOS=linux GOARCH=amd64 go build main.go
[MIT](https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md)
Copyright (c) 2020 wenjianzhang
qq技术交流群: 74520518
+4 -4
View File
@@ -136,7 +136,7 @@ CREATE TABLE `sys_loginlog` (
`loginTime` datetime DEFAULT NULL COMMENT '登录时间',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` datetime DEFAULT NULL COMMENT '更新者',
`update_by` varchar(255) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(255) DEFAULT NULL COMMENT '书签',
`is_del` char(2) DEFAULT NULL,
@@ -193,7 +193,7 @@ CREATE TABLE `sys_operlog` (
`jsonResult` varchar(255) DEFAULT NULL COMMENT '返回参数',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` datetime DEFAULT NULL COMMENT '更新者',
`update_by` varchar(255) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(255) DEFAULT NULL COMMENT '书签',
`user_agent` varchar(255) DEFAULT NULL,
@@ -211,7 +211,7 @@ CREATE TABLE `sys_post` (
`update_time` datetime DEFAULT NULL COMMENT '最后修改时间',
`is_del` int(1) DEFAULT '0' COMMENT '是否删除',
`create_by` varchar(255) DEFAULT NULL,
`update_by` datetime DEFAULT NULL,
`update_by` varchar(255) DEFAULT NULL,
`dataScope` varchar(255) DEFAULT NULL,
`params` varchar(255) DEFAULT NULL,
PRIMARY KEY (`postId`) USING BTREE
@@ -227,7 +227,7 @@ CREATE TABLE `sys_role` (
`flag` varchar(255) DEFAULT NULL,
`create_by` varchar(255) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`update_by` datetime DEFAULT NULL,
`update_by` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`data_scope` varchar(255) DEFAULT NULL,
+2 -2
View File
@@ -3,7 +3,7 @@ settings:
env: dev
envmsg: "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!\U0001F600\U0001F600\U0001F600"
host: 0.0.0.0
isinit: false
isinit: true
jwtsecret: 123abc
logpath: temp/logs/log.log
name: go-admin
@@ -21,4 +21,4 @@ settings:
addr: 0.0.0.0:6379
db: 0
password: password
readtimeout: 50
readtimeout: 50
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

+1
View File
@@ -184,6 +184,7 @@ func (e *SysUser) Encrypt() (err error) {
//添加
func (e SysUser) Insert() (id int64, err error) {
e.CreateTime = utils.GetCurrntTime()
e.UpdateTime = utils.GetCurrntTime()
if err = e.Encrypt(); err != nil {
return
}
-2458
View File
File diff suppressed because it is too large. Load diff
-28
View File
@@ -1,28 +0,0 @@
package test
import (
"fmt"
"go-admin/models"
"testing"
)
func TestBackendUserEncrypt(t *testing.T) {
u := models.BackendUser{"chengxiao", "Cheng",
"Xiao", "admin", "master", "weiyi1314", "cheng8984@gmail.com"}
u.Encrypt()
//ValidePassword("weiyi")
fmt.Println(u)
}
//func ValidePassword(password string) bool {
// rightpass := "$2a$10$J6O9GuMikIuFuo4t4X28X.hjwVevCkotvW4.4z3BH4WAkG49dqhyi"
// err := bcrypt.CompareHashAndPassword([]byte(rightpass), []byte(password))
// if err != nil {
// fmt.Println("pw wrong")
// return false
// } else {
// fmt.Println("pw ok")
// return true
// }
//}
-179
View File
@@ -1,179 +0,0 @@
package test
import (
"errors"
"fmt"
"math/rand"
"strconv"
"strings"
"testing"
"time"
)
func TestMapWithFuncValue(t *testing.T) {
m := map[int]func(op int) int{}
m[1] = func(op int) int { return op }
m[2] = func(op int) int { return op * op }
m[3] = func(op int) int { return op * op * op }
t.Log(m[1](2), m[2](2), m[3](2))
}
func TestMapForSet(t *testing.T) {
mySet := map[int]bool{}
mySet[1] = true
n := 1
if mySet[n] {
t.Logf("%d is existing", n)
} else {
t.Logf("%d is not existing", n)
}
mySet[3] = true
t.Log(len(mySet))
delete(mySet, 1)
if mySet[n] {
t.Logf("%d is existing", n)
} else {
t.Logf("%d is not existing", n)
}
}
func TestStringToRune(t *testing.T) {
s := "中华人民共和国"
for _, c := range s {
t.Logf("%[1]c %[1]d", c)
}
}
func TestStringFn(t *testing.T) {
s := "A,B,C"
parts := strings.Split(s, ",")
for _, part := range parts {
t.Log(part)
}
t.Log(strings.Join(parts, "-"))
}
func TestConv(t *testing.T) {
s := strconv.Itoa(10)
t.Log("str" + s)
if i, err := strconv.Atoi("10"); err == nil {
t.Log(10 + i)
}
}
func returnMultiValues() (int, int) {
return rand.Intn(10), rand.Intn(20)
}
func timeSpent(inner func(op int) int) func(op int) int {
return func(n int) int {
start := time.Now()
ret := inner(n)
fmt.Print("time spent:", time.Since(start).Seconds())
return ret
}
}
func slowF(op int) int {
time.Sleep(time.Second * 1)
return op
}
func TestFn(t *testing.T) {
a, _ := returnMultiValues()
t.Log(a)
tsSf := timeSpent(slowF)
t.Log(tsSf(10))
}
type Programmer interface {
WriteHelloWorld() string
}
type JavaProgrammer struct {
}
func (g *JavaProgrammer) WriteHelloWorld() string {
return "System.IO.Input.Write(\"Hello World!\")"
}
type GoProgrammer struct {
}
func (g *GoProgrammer) WriteHelloWorld() string {
return "fmt.Print(\"Hello World!\")"
}
func TestClient(t *testing.T) {
var p Programmer
var j Programmer
p = new(GoProgrammer)
t.Log(p.WriteHelloWorld())
j = new(JavaProgrammer)
t.Log(j.WriteHelloWorld())
}
var LessThanTwoError = errors.New("n should be not less than 2")
var LargerThenHuandredError = errors.New("n should be not larger than 100")
func GetFibonacci(n int) ([]int, error) {
if n < 2 {
return nil, LessThanTwoError
}
if n > 100 {
return nil, LargerThenHuandredError
}
fibList := []int{1, 1}
for i := 2; i < n; i++ {
fibList = append(fibList, fibList[i-2]+fibList[i-1])
}
return fibList, nil
}
func TestGetFibonacci(t *testing.T) {
if v, err := GetFibonacci(5); err != nil {
if err == LessThanTwoError {
t.Log("It is less.")
}
t.Error(err)
} else {
t.Log(v)
}
}
func service() string {
time.Sleep(time.Millisecond * 50)
return "Done" + time.Now().String()
}
func otherTask() {
fmt.Println("working on something else--" + time.Now().String())
time.Sleep(time.Millisecond * 100)
fmt.Println("Task is done---------------" + time.Now().String())
}
func TestService(t *testing.T) {
fmt.Println(service())
otherTask()
}
func AsyncService() chan string {
retCh := make(chan string, 1)
go func() {
ret := service()
fmt.Println("returned result.--------" + time.Now().String())
retCh <- ret
fmt.Println("service exited.---------" + time.Now().String())
}()
return retCh
}
func TestAsynService(t *testing.T) {
retCh := AsyncService()
otherTask()
fmt.Println(<-retCh)
time.Sleep(time.Second * 1)
}