fix: fixed conflicts

This commit is contained in:
RockYang 2023-07-10 10:11:17 +08:00
commit 00c520d066
64 changed files with 14 additions and 21 deletions

View File

@ -184,7 +184,7 @@ docker-compose up -d
### 2. 修改配置文档
先拷贝项目中的 `api/go/config.sample.toml` 配置文档,修改代理地址和管理员密码:
先拷贝项目中的 `api/config.sample.toml` 配置文档,修改代理地址和管理员密码:
如何修改请参考[修改配置文档](#2-修改配置文档)
@ -287,7 +287,7 @@ server {
3. 运行后端程序:
```shell
cd api/go
cd api
# 1. 先下载依赖
go mod tidy
# 2. 运行程序
@ -340,7 +340,7 @@ npm run build
你可以根据个人需求将项目打包成 windows/linux/darwin 平台项目。
```shell
cd api/go
cd api
# for all platforms
make all
# for linux only

View File

View File

@ -68,11 +68,18 @@ func (h *UserHandler) Register(c *gin.Context) {
// check if the username is exists
var item model.User
tx := h.db.Where("username = ?", data.Username).First(&item)
if tx.RowsAffected > 0 {
res := h.db.Where("username = ?", data.Username).First(&item)
if res.RowsAffected > 0 {
resp.ERROR(c, "用户名已存在")
return
}
res = h.db.Where("mobile = ?", data.Mobile).First(&item)
if res.RowsAffected > 0 {
resp.ERROR(c, "该手机号码以及被注册,请更换其他手机号")
return
}
// 默认订阅所有角色
var chatRoles []model.ChatRole
h.db.Find(&chatRoles)
@ -110,7 +117,7 @@ func (h *UserHandler) Register(c *gin.Context) {
} else {
user.Calls = config.UserInitCalls
}
res := h.db.Create(&user)
res = h.db.Create(&user)
if res.Error != nil {
resp.ERROR(c, "保存数据失败")
logger.Error(res.Error)

View File

@ -1,5 +0,0 @@
# chatgpt-plus-java
chatgpt-plus 后端 API Java 语言实现,待开发。

View File

@ -1,5 +0,0 @@
# chatgpt-plus-php
chatgpt-plus 后端 API PHP 语言实现,待开发。

View File

@ -1,5 +0,0 @@
# chatgpt-plus-python
chatgpt-plus 后端 API Python 语言实现,待开发。

View File

@ -25,6 +25,7 @@ func RandomNumber(bit int) int {
min := intPow(10, bit-1)
max := intPow(10, bit) - 1
rand.Seed(time.Now().UnixNano())
return rand.Intn(max-min+1) + min
}