mirror of https://gitee.com/answerdev/answer.git
Merge branch 'main' into feat/backyard-search
This commit is contained in:
commit
81083af8ea
|
@ -18,12 +18,10 @@ To learn more about the project, visit [answer.dev](https://answer.dev).
|
|||
|
||||
## Quick start
|
||||
|
||||
### Running with docker-compose
|
||||
### Running with docker
|
||||
|
||||
```bash
|
||||
mkdir answer && cd answer
|
||||
wget https://raw.githubusercontent.com/answerdev/answer/main/docker-compose.yaml
|
||||
docker-compose up
|
||||
docker run -d -p 9080:80 -v $PWD/answer-data/data:/data --name answer answerdev/answer:latest
|
||||
```
|
||||
|
||||
For more information you can see [INSTALL.md](./INSTALL.md)
|
||||
|
|
|
@ -18,12 +18,10 @@
|
|||
|
||||
## 快速开始
|
||||
|
||||
### 使用 docker-compose 快速搭建
|
||||
### 使用 docker 快速搭建
|
||||
|
||||
```bash
|
||||
mkdir answer && cd answer
|
||||
wget https://raw.githubusercontent.com/answerdev/answer/main/docker-compose.yaml
|
||||
docker-compose up
|
||||
docker run -d -p 9080:80 -v $PWD/answer-data/data:/data --name answer answerdev/answer:latest
|
||||
```
|
||||
|
||||
其他安装配置细节请参考 [INSTALL.md](./INSTALL.md)
|
||||
|
|
|
@ -3,8 +3,8 @@ server:
|
|||
addr: 0.0.0.0:80
|
||||
data:
|
||||
database:
|
||||
driver: "mysql"
|
||||
connection: root:root@tcp(db:3306)/answer
|
||||
driver: "sqlite3"
|
||||
connection: "/data/sqlite3/answer.db"
|
||||
cache:
|
||||
file_path: "/data/cache/cache.db"
|
||||
i18n:
|
||||
|
|
|
@ -37,6 +37,13 @@ func NewDB(debug bool, dataConf *Database) (*xorm.Engine, error) {
|
|||
if dataConf.Driver == "" {
|
||||
dataConf.Driver = string(schemas.MYSQL)
|
||||
}
|
||||
if dataConf.Driver == string(schemas.SQLITE) {
|
||||
dbFileDir := filepath.Dir(dataConf.Connection)
|
||||
log.Debugf("try to create database directory %s", dbFileDir)
|
||||
if err := dir.CreateDirIfNotExist(dbFileDir); err != nil {
|
||||
log.Errorf("create database dir failed: %s", err)
|
||||
}
|
||||
}
|
||||
engine, err := xorm.NewEngine(dataConf.Driver, dataConf.Connection)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -98,6 +98,7 @@ func (us *UserBackyardService) GetUserPage(ctx context.Context, req *schema.GetU
|
|||
|
||||
resp := make([]*schema.GetUserPageResp, 0)
|
||||
for _, u := range users {
|
||||
avatar := schema.FormatAvatarInfo(u.Avatar)
|
||||
t := &schema.GetUserPageResp{
|
||||
UserID: u.ID,
|
||||
CreatedAt: u.CreatedAt.Unix(),
|
||||
|
@ -105,7 +106,7 @@ func (us *UserBackyardService) GetUserPage(ctx context.Context, req *schema.GetU
|
|||
EMail: u.EMail,
|
||||
Rank: u.Rank,
|
||||
DisplayName: u.DisplayName,
|
||||
Avatar: u.Avatar,
|
||||
Avatar: avatar,
|
||||
}
|
||||
if u.Status == entity.UserStatusDeleted {
|
||||
t.Status = schema.UserDeleted
|
||||
|
|
|
@ -492,7 +492,7 @@ func (us *UserService) encryptPassword(ctx context.Context, Pass string) (string
|
|||
|
||||
// UserChangeEmailSendCode user change email verification
|
||||
func (us *UserService) UserChangeEmailSendCode(ctx context.Context, req *schema.UserChangeEmailSendCodeReq) error {
|
||||
_, exist, err := us.userRepo.GetByUserID(ctx, req.UserID)
|
||||
userInfo, exist, err := us.userRepo.GetByUserID(ctx, req.UserID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -513,8 +513,13 @@ func (us *UserService) UserChangeEmailSendCode(ctx context.Context, req *schema.
|
|||
UserID: req.UserID,
|
||||
}
|
||||
code := uuid.NewString()
|
||||
var title, body string
|
||||
verifyEmailUrl := fmt.Sprintf("%s/users/confirm-new-email?code=%s", us.serviceConfig.WebHost, code)
|
||||
title, body, err := us.emailService.ChangeEmailTemplate(ctx, verifyEmailUrl)
|
||||
if userInfo.MailStatus == entity.EmailStatusToBeVerified {
|
||||
title, body, err = us.emailService.RegisterTemplate(ctx, verifyEmailUrl)
|
||||
} else {
|
||||
title, body, err = us.emailService.ChangeEmailTemplate(ctx, verifyEmailUrl)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue