Compare commits
4 Commits
c0ce0f6a64
...
aed840ade4
Author | SHA1 | Date | |
---|---|---|---|
aed840ade4 | |||
731175604d | |||
d9246471d8 | |||
29fdc36e15 |
22
.vscode/launch.json
vendored
Normal file
22
.vscode/launch.json
vendored
Normal 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
@ -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{
|
||||||
|
@ -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
|
||||||
|
@ -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 != "" {
|
||||||
|
@ -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 {
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@ 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:头像"`
|
||||||
|
@ -10,6 +10,8 @@ func migration() {
|
|||||||
err := DB.AutoMigrate(
|
err := DB.AutoMigrate(
|
||||||
&ChatMedia{},
|
&ChatMedia{},
|
||||||
&ChatRecord{},
|
&ChatRecord{},
|
||||||
|
&ChatUser{},
|
||||||
|
&ChatAutoReplyRuler{},
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user