Compare commits

..

No commits in common. "aed840ade41fabc8ef6f6ba4e246d6522101f79b" and "c0ce0f6a64474534506378439f9a7ed6cb4e73af" have entirely different histories.

9 changed files with 457 additions and 2144 deletions

22
.vscode/launch.json vendored
View File

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

View File

@ -8,7 +8,6 @@ package dao
import (
"errors"
"fmt"
"github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/common/db"
"github.com/fonchain_enterprise/micro-account/pkg/m"
@ -244,7 +243,11 @@ func (chatDao) GetChatMediaList(info *accountFiee.GetChatMediaListRequest) (resp
// 批量查询ChatMedia
func (chatDao) GetChatUserList(req *accountFiee.GetChatUserListRequest2) (resp []*accountFiee.ChatUser2, total int64, err error) {
var dbQuery = model.DB.Model(&model.User{})
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
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 != "" {
dbQuery = dbQuery.Where(req.Where)
}
@ -254,12 +257,6 @@ func (chatDao) GetChatUserList(req *accountFiee.GetChatUserListRequest2) (resp [
if 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)
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 != "" {
thisData.Ruler = data.Ruler
}
if data.Status != 0 {
thisData.Status = data.Status
if data.RulerStatus != 0 {
thisData.RulerStatus = data.RulerStatus
}
if err = model.DB.Updates(&thisData).Error; err != nil {
@ -105,8 +105,8 @@ func (chatAutoReplyRulerDao) GetChatAutoReplyRulerList(info *accountFiee.GetChat
if info.Query.Ruler != "" {
dbQuery = dbQuery.Where("ruler =?", info.Query.Ruler)
}
if info.Query.Status != 0 {
dbQuery = dbQuery.Where("status = ?", info.Query.Status)
if info.Query.RulerStatus != 0 {
dbQuery = dbQuery.Where("ruler_status = ?", info.Query.RulerStatus)
}
}
if info.Where != "" {

View File

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

View File

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

View File

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

View File

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