Skip to content

DAOAtlas-official/Dao-collection

 
 

Repository files navigation

DAO atlas

技术栈

  • Go(Gin)
  • redis
  • mysql
  • vue(前端)

主要功能有:

  1. 文章发布和修改
  2. 文章回收站和撤回
  3. 文章分类
  4. 文章标签
  5. 网站信息自由设置
  6. 文章支持markdown
  7. ★ 网站静态文件可自由配置本地CDN
  8. ★ 可上传图片,可选择上传至服务器七牛两者同时
  9. 自由添加友链和管理友链顺序
  10. 采用githubissue功能作为评论系统,界面优美且方便其他用户留言和通知

how to run on local?

  • get vscode, clone this repo
  • install go, mysql, redis on local
  • run common/sql_dao_collection.sql on local mysql( usually with mysqlworkbench)
  • go run main.go
  • backend url
[GIN-debug] Listening and serving HTTP on :8081

most errors

./dev-server-run.sh
go: github.com/qiniu/x@v7.0.8+incompatible: reading github.com/qiniu/x/go.mod at revision v7.0.8: unknown revision v7.0.8
go list -m -json -versions github.com/qiniu/x@latest
add to .zshrc to download the go mod

# Enable the go modules feature
export GO111MODULE=on
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io

backpup scripts

o restart redis after an upgrade:
  brew services restart redis
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf

We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To restart mysql after an upgrade:
  brew services restart mysql
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql/bin/mysqld_safe --datadir=/usr/local/var/mysql

CREATE SCHEMA `dao` DEFAULT CHARACTER SET utf8 ;

原来的修改密码语句为 UPDATE user SET authentication_string = password('123456') WHERE User='root'; 在mysql8中会报错: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(‘123456’) WHERE User=‘root’’ at line 1`

正确sql语句: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码'; 提示修改成功,但不会自动退出mysql命令行。 下次登陆mysql使用新密码

Go语言使用Bcrypt实现加密或验证登录密码

Bcrypt 就是一款加密工具,它生成的密文是60位的,而且每次加密生成的值是不一样的。
MD5 加密后的值是32位的,且每次加密后的密文都是一样的。
保存密码,一般我们都推荐使用 Bcrypt 进行加密,而不使用 MD5.

Bcrypt 加密后的值举例:

# 比如加密 admin, 两次结果不一样,但都以 $2a 开头
$2a$10$cL3WHWi3/x96MII1pwm4NOMRESxbAHnImp.tV5AMIJCneIkp2IAF2
$2a$10$P1zZnMm8/KYVseSkkfh0T.i2cVwydZ5L/5rZEALWCo3f9TmVLmM9q

# 加密 123456:
$2a$10$wtJie2Wc93SqCCri5u/f4uZX7ATSSyMxlrCTEkPmNHLl9Oa0QdLim

Releases

No releases published

Packages

No packages published

Languages

  • Go 74.4%
  • JavaScript 21.5%
  • CSS 2.2%
  • HTML 1.8%
  • Shell 0.1%