Compare commits

...

4 Commits

Author SHA1 Message Date
aed840ade4 fix: update 2025-06-14 17:13:29 +08:00
731175604d feat: update 2025-06-14 14:38:46 +08:00
d9246471d8 Update migration.go 2025-06-13 10:46:45 +08:00
29fdc36e15 Update asChatRecordLogic.go 2025-06-12 20:00:16 +08:00
9 changed files with 2142 additions and 455 deletions

22
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "auto",
"env": {
"GOPATH":"C:\\Users\\lenovo\\go",// go env GOPATH
"GOOS":"windows" //
},
"cwd": "${workspaceFolder}\\cmd",//
"program": "${workspaceFolder}\\cmd\\app.go", //"${workspaceFolder}\\cmd\\app.go"
"args":[],// ["-env" , 'prod']
// "console": "integratedTerminal" //使fmt.Scanf
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -964,6 +964,8 @@ message GetChatUserListRequest2{
string where=3; string where=3;
string name=4; string name=4;
repeated int64 userIdIn=5; repeated int64 userIdIn=5;
string account=6;
repeated int32 roleIn=7;
} }
message ChatUser2{ message ChatUser2{
int64 userId=1; int64 userId=1;
@ -986,8 +988,8 @@ message ChatAutoReplyRulerData{
int64 deletedAt = 4; // int64 deletedAt = 4; //
string title = 5; // string title = 5; //
string ruler = 6; // string ruler = 6; //
int32 rulerStatus = 7; //: 1= 2= int32 status = 7; //: 1= 2=
string response =8; //
} }
message CreateChatAutoReplyRulerResp{ message CreateChatAutoReplyRulerResp{

View File

@ -8,6 +8,7 @@ package dao
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/fonchain_enterprise/micro-account/api/accountFiee" "github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/common/db" "github.com/fonchain_enterprise/micro-account/pkg/common/db"
"github.com/fonchain_enterprise/micro-account/pkg/m" "github.com/fonchain_enterprise/micro-account/pkg/m"
@ -243,11 +244,7 @@ func (chatDao) GetChatMediaList(info *accountFiee.GetChatMediaListRequest) (resp
// 批量查询ChatMedia // 批量查询ChatMedia
func (chatDao) GetChatUserList(req *accountFiee.GetChatUserListRequest2) (resp []*accountFiee.ChatUser2, total int64, err error) { func (chatDao) GetChatUserList(req *accountFiee.GetChatUserListRequest2) (resp []*accountFiee.ChatUser2, total int64, err error) {
var dbQuery = model.DB.Table(`(SELECT su.id user_id,su.mgmt_artist_uid artist_uid,CASE WHEN su.is_real_name=0 THEN icu.name ELSE rn.name END name,icu.head_img avatar var dbQuery = model.DB.Model(&model.User{})
FROM sys_user su
LEFT JOIN real_name rn ON rn.id = su.real_name_id AND rn.deleted_at =0
LEFT JOIN in_circle_user icu ON icu.user_id=su.id AND icu.deleted_at =0
WHERE su.deleted_at = 0) as t`)
if req.Where != "" { if req.Where != "" {
dbQuery = dbQuery.Where(req.Where) dbQuery = dbQuery.Where(req.Where)
} }
@ -257,6 +254,12 @@ WHERE su.deleted_at = 0) as t`)
if req.Name != "" { if req.Name != "" {
dbQuery = dbQuery.Where(fmt.Sprintf("name like '%%%v%%'", req.Name)) dbQuery = dbQuery.Where(fmt.Sprintf("name like '%%%v%%'", req.Name))
} }
if req.Account != "" {
dbQuery = dbQuery.Where(fmt.Sprintf("account like '%%%v%%'", req.Name))
}
if req.RoleIn != nil {
dbQuery = dbQuery.Where("role in (?)", req.RoleIn)
}
//数据查询 //数据查询
dbQuery.Count(&total) dbQuery.Count(&total)
err = dbQuery.Scopes(db.Pagination(req.Page, req.PageSize)).Find(&resp).Error err = dbQuery.Scopes(db.Pagination(req.Page, req.PageSize)).Find(&resp).Error

View File

@ -53,8 +53,8 @@ func (chatAutoReplyRulerDao) UpdateChatAutoReplyRuler(data *model.ChatAutoReplyR
if data.Ruler != "" { if data.Ruler != "" {
thisData.Ruler = data.Ruler thisData.Ruler = data.Ruler
} }
if data.RulerStatus != 0 { if data.Status != 0 {
thisData.RulerStatus = data.RulerStatus thisData.Status = data.Status
} }
if err = model.DB.Updates(&thisData).Error; err != nil { if err = model.DB.Updates(&thisData).Error; err != nil {
@ -105,8 +105,8 @@ func (chatAutoReplyRulerDao) GetChatAutoReplyRulerList(info *accountFiee.GetChat
if info.Query.Ruler != "" { if info.Query.Ruler != "" {
dbQuery = dbQuery.Where("ruler =?", info.Query.Ruler) dbQuery = dbQuery.Where("ruler =?", info.Query.Ruler)
} }
if info.Query.RulerStatus != 0 { if info.Query.Status != 0 {
dbQuery = dbQuery.Where("ruler_status = ?", info.Query.RulerStatus) dbQuery = dbQuery.Where("status = ?", info.Query.Status)
} }
} }
if info.Where != "" { if info.Where != "" {

View File

@ -8,6 +8,7 @@ package dao
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/fonchain_enterprise/micro-account/api/accountFiee" "github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/common/db" "github.com/fonchain_enterprise/micro-account/pkg/common/db"
"github.com/fonchain_enterprise/micro-account/pkg/m" "github.com/fonchain_enterprise/micro-account/pkg/m"
@ -102,7 +103,7 @@ func (chatUserDao) GetChatUserById(id int) (res model.ChatUser, err error) {
// 批量查询聊天用户 // 批量查询聊天用户
func (chatUserDao) GetChatUserList(info *accountFiee.GetChatUserListRequest) (resp []model.ChatUser, total int64, err error) { func (chatUserDao) GetChatUserList(info *accountFiee.GetChatUserListRequest) (resp []model.ChatUser, total int64, err error) {
var dbQuery = model.DB.Model(&model.ChatUser{}) var dbQuery = model.DB.Model(&model.ChatUser{}).Debug()
if info.Query != nil { if info.Query != nil {
if info.Query.ID != 0 { if info.Query.ID != 0 {

View File

@ -9,7 +9,6 @@ import (
"github.com/fonchain_enterprise/micro-account/pkg/dao" "github.com/fonchain_enterprise/micro-account/pkg/dao"
"github.com/fonchain_enterprise/micro-account/pkg/model" "github.com/fonchain_enterprise/micro-account/pkg/model"
"github.com/jinzhu/copier" "github.com/jinzhu/copier"
"time"
) )
type AsChatLogic struct{} type AsChatLogic struct{}
@ -131,14 +130,14 @@ func (AsChatLogic) RegisterWaiter(request *accountFiee.RegisterWaiterRequest) (r
UserId: 0, UserId: 0,
} }
var waiterUserInfo = model.ChatUser{ var waiterUserInfo = model.ChatUser{
OriginId: request.OirginId, OriginId: request.OriginId,
Account: request.Account, Account: request.Account,
Role: 2, Role: 2,
NickName: request.NickName, NickName: request.NickName,
Origin: request.Oirgin, Origin: request.Origin,
Avatar: request.Avatar, Avatar: request.Avatar,
} }
err = dao.UserDao.CreateUser(&waiterUserInfo) err = dao.ChatUserDao.CreateChatUser(&waiterUserInfo)
if err != nil { if err != nil {
return return
} }

View File

@ -52,9 +52,10 @@ func (c ChatRecord) ChatMedia() string {
type ChatAutoReplyRuler struct { type ChatAutoReplyRuler struct {
Model Model
Title string `gorm:"column:title;comment:标题"` Title string `gorm:"column:title;comment:标题"`
Ruler string `gorm:"column:ruler;type:varchar(2000);comment:规则内容"` Ruler string `gorm:"column:ruler;type:varchar(2000);comment:规则内容"`
RulerStatus int32 `gorm:"column:ruler_status;comment:规则状态: 1=启用 2=禁用"` Status int32 `gorm:"column:status;default:1;comment:启用状态: 1=启用 2=禁用"`
Response string `gorm:"column:response;varchar(2000);comment:回复内容"`
} }
func (c ChatRecord) AutoChatRuler() string { func (c ChatRecord) AutoChatRuler() string {
@ -65,7 +66,7 @@ type ChatUser struct {
Model Model
NickName string `gorm:"column:nick_name;comment:昵称"` NickName string `gorm:"column:nick_name;comment:昵称"`
Account string `gorm:"column:account;comment:账号"` Account string `gorm:"column:account;comment:账号"`
Role int32 `gorm:"column:role;default:1;comment:聊天角色 1=用户 2=客服"` Role int32 `gorm:"column:role;default:1;comment:聊天角色 1=用户 2=客服 3=客服机器人"`
Origin string `gorm:"column:origin;default:'fiee';comment:数据来源"` Origin string `gorm:"column:origin;default:'fiee';comment:数据来源"`
OriginId int64 `gorm:"column:origin_id;comment:数据来源对应的用户ID"` OriginId int64 `gorm:"column:origin_id;comment:数据来源对应的用户ID"`
Avatar string `gorm:"column:avatar;comment:头像"` Avatar string `gorm:"column:avatar;comment:头像"`

View File

@ -10,6 +10,8 @@ func migration() {
err := DB.AutoMigrate( err := DB.AutoMigrate(
&ChatMedia{}, &ChatMedia{},
&ChatRecord{}, &ChatRecord{},
&ChatUser{},
&ChatAutoReplyRuler{},
) )
if err != nil { if err != nil {