Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang_asynctask
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0875bfd3
authored
Mar 07, 2022
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
crm 监听数据库 同步公司 禁用启用 黑名单开启 关闭
parent
d453e732
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
app/service/crm/recv_com_user_scrvice.go
config/dev/config.toml
config/dev/db.toml
app/service/crm/recv_com_user_scrvice.go
View file @
0875bfd3
...
...
@@ -2,6 +2,7 @@ package crm
import
(
"encoding/json"
"fmt"
"github.com/ichunt2019/cfg/lib"
"github.com/ichunt2019/golang-rbmq-sl/utils/rabbitmq"
...
...
@@ -14,6 +15,8 @@ type comUser struct {
ComId
int64
`json:"com_id"`
UserId
int64
`json:"user_id"`
SaleId
int64
`json:"sale_id"`
IsDisable
int64
`json:"is_disable"`
IsBlacklist
int64
`json:"is_blacklist"`
}
...
...
@@ -30,13 +33,13 @@ func DispenseMsg(data string) (err error){
table
:=
gjson
.
Parse
(
data
)
.
Get
(
"table"
)
.
String
()
action_type
:=
gjson
.
Parse
(
data
)
.
Get
(
"type"
)
.
String
()
olddata
:=
gjson
.
Parse
(
data
)
.
Get
(
"old"
)
.
Map
()
//fmt.Println(database,
table,action_type,olddata)
fmt
.
Println
(
table
,
action_type
,
olddata
)
//需要关心的操作
action_type_slice
:=
[]
string
{
"update"
,
"insert"
}
//需要关心的字段
lie_invoice_company_field
:=
[]
string
{
"com_name"
,
"com_addr"
,
"com_tel"
,
"com_tax_registration"
,
"com_bank"
,
"com_bank_num"
,
"status"
}
lie_invoice_company_field
:=
[]
string
{
"com_name"
,
"com_addr"
,
"com_tel"
,
"com_tax_registration"
,
"com_bank"
,
"com_bank_num"
,
"status"
,
"company_category"
}
lie_invoice_com_user_field
:=
[]
string
{
"com_id"
,
"user_id"
,
"sale_id"
}
pushMsg
:=
comUser
{}
...
...
@@ -46,6 +49,22 @@ func DispenseMsg(data string) (err error){
if
len
(
olddata
)
>
0
{
//修改
for
field
,
_
:=
range
olddata
{
company_category
:=
gjson
.
Parse
(
data
)
.
Get
(
"data.company_category"
)
.
Int
()
//公司类别,1普通客户,2KA客户,3黑名单客户,4实体名单客户'
company_status
:=
gjson
.
Parse
(
data
)
.
Get
(
"data.status"
)
.
Int
()
//状态 0禁用 1审核通过 2待审核 3审核未通过
if
(
field
==
"company_category"
){
//黑名单
if
(
company_category
==
3
){
//加入黑名单
pushMsg
.
IsBlacklist
=
-
1
}
else
{
//解除黑名单
pushMsg
.
IsBlacklist
=
1
}
}
else
if
(
field
==
"status"
){
//更改状态 禁用 启用
if
(
company_status
==
0
){
//禁用
pushMsg
.
IsDisable
=
-
1
}
else
{
//解除禁用
pushMsg
.
IsDisable
=
1
}
}
if
php2go
.
InArray
(
field
,
lie_invoice_company_field
){
//分发
pushMsg
.
ComId
=
gjson
.
Parse
(
data
)
.
Get
(
"data.id"
)
.
Int
()
...
...
config/dev/config.toml
View file @
0875bfd3
...
...
@@ -24,10 +24,10 @@ dob = 1979-05-27T07:32:00Z # 日期时间是一等公民。为什么不呢?
[rabbitmq_crm_comuser_fenfa]
queue_name
=
"a-maxwell"
routing_key=
"
maxwell.lie_invoice_company
"
routing_key=
"
a-maxwell
"
exchange=
""
type=
"direct"
dns=
"amqp://guest:guest@192.168.
2.232
:5672/"
dns=
"amqp://guest:guest@192.168.
1.169
:5672/"
[rabbitmq_crm_comuser]
...
...
@@ -35,7 +35,7 @@ queue_name="crm_comusertoerp"
routing_key=
"crm_comusertoerp"
exchange=
""
type=
"direct"
dns=
"amqp://guest:guest@192.168.
2.23
2:5672/"
dns=
"amqp://guest:guest@192.168.
1.25
2:5672/"
[rabbitmq_crm_invoice_com_apply]
...
...
@@ -43,7 +43,7 @@ queue_name="crm_invoice_com_apply"
routing_key=
"crm_invoice_com_apply"
exchange=
""
type=
"direct"
dns=
"amqp://guest:guest@192.168.
2.23
2:5672/"
dns=
"amqp://guest:guest@192.168.
1.25
2:5672/"
[rabbitmq_ichunt_wechat_focus]
...
...
@@ -51,7 +51,7 @@ queue_name="szichunt_wechat_userinfo"
routing_key=
"szichunt_wechat_userinfo"
exchange=
""
type=
"direct"
dns=
"amqp://guest:guest@192.168.
2.23
2:5672/"
dns=
"amqp://guest:guest@192.168.
1.25
2:5672/"
[servers]
...
...
config/dev/db.toml
View file @
0875bfd3
...
...
@@ -2,7 +2,7 @@
ShowSQL
=
true
[crm]
data_source_name
=
"liexin_crm:liexin_crm#zsyM@tcp(192.168.1.23
5
:3306)/liexin_crm?charset=utf8&parseTime=true&loc=Asia%2FShanghai"
data_source_name
=
"liexin_crm:liexin_crm#zsyM@tcp(192.168.1.23
4
:3306)/liexin_crm?charset=utf8&parseTime=true&loc=Asia%2FShanghai"
max_open_conn
=
0
max_idle_conn
=
0
table_prefix
=
"lie_"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment