DengBiao 1 anno fa
parent
commit
4b2a1e2fa7
15 ha cambiato i file con 493 aggiunte e 65 eliminazioni
  1. +48
    -0
      app/db/db_cloud_issuance_user_robot.go
  2. +3
    -2
      app/db/dbs_map.go
  3. +26
    -0
      app/db/model/cloud_issuance_user_robot.go
  4. +11
    -0
      app/svc/svc_gim.go
  5. +82
    -0
      app/utils/cloud_issuance/api.go
  6. +23
    -0
      app/utils/md5.go
  7. +124
    -0
      consume/cloud_issuance_async_mlogin.go
  8. +25
    -5
      consume/dou_shen_user_register_for_my_my_fans.go
  9. +24
    -15
      consume/dou_shen_user_register_for_my_my_recommender.go
  10. +46
    -18
      consume/dou_shen_user_register_for_official_consume.go
  11. +23
    -15
      consume/dou_shen_user_register_for_operation_center.go
  12. +2
    -1
      consume/init.go
  13. +10
    -0
      consume/md/consume_key.go
  14. +20
    -0
      consume/md/md_cloud_issuance.go
  15. +26
    -9
      etc/cfg.yml

+ 48
- 0
app/db/db_cloud_issuance_user_robot.go Vedi File

@@ -0,0 +1,48 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"xorm.io/xorm"
)

type CloudIssuanceUserRobotDb struct {
Db *xorm.Engine `json:"db"`
Uid int `json:"uid"`
}

func (cloudIssuanceUserRobotDb *CloudIssuanceUserRobotDb) Set(db *xorm.Engine, uid int) { // set方法
cloudIssuanceUserRobotDb.Db = db
cloudIssuanceUserRobotDb.Uid = uid
}

func (cloudIssuanceUserRobotDb *CloudIssuanceUserRobotDb) GetCloudIssuanceUserRobot() (m *model.CloudIssuanceUserRobot, err error) {
m = new(model.CloudIssuanceUserRobot)
has, err := cloudIssuanceUserRobotDb.Db.Where("uid = ?", cloudIssuanceUserRobotDb.Uid).
And("is_enabled = 0").Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (cloudIssuanceUserRobotDb *CloudIssuanceUserRobotDb) InsertCloudIssuanceUserRobot(m *model.CloudIssuanceUserRobot) (id int, err error) {
_, err = cloudIssuanceUserRobotDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
id = m.Id
return id, nil
}

func (cloudIssuanceUserRobotDb *CloudIssuanceUserRobotDb) SaveCloudIssuanceUserRobot(id interface{}, m *model.CloudIssuanceUserRobot, forceColums ...string) (affected int64, err error) {
if forceColums != nil {
affected, err = cloudIssuanceUserRobotDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = cloudIssuanceUserRobotDb.Db.Where("id=?", id).Update(m)
}
return
}

+ 3
- 2
app/db/dbs_map.go Vedi File

@@ -52,6 +52,7 @@ func InitMapDbs(c *cfg.DBCfg, prd bool) {
dbCfg.User = c.User
dbCfg.Psw = c.Psw
}
dbCfg.Host = "zhios123.rwlb.rds.aliyuncs.com:3306"
e, err = NewDB(&dbCfg)
if err != nil || e == nil {
logx.Warnf("db engine can't create, please check config, params[host:%s, user:%s, psw: %s, name: %s], err: %v", dbCfg.Host, dbCfg.User, dbCfg.Psw, dbCfg.Name, err)
@@ -91,8 +92,8 @@ func GetAllDatabaseDev() *[]model.DbMapping {
var err error
fmt.Println("cfg.Local is: ", cfg.Local)
if cfg.Local { // 本地调试 加快速度
fmt.Println("notice:LOCAL TEST, only masterId:** 123456 ** available!")
err = Db.Where("deleted_at != ? AND is_dev = '1' AND db_master_id=?", 1, 123456).Find(&m)
fmt.Println("notice:LOCAL TEST, only masterId:** 99813608 ** available!")
err = Db.Where("deleted_at != ? AND db_master_id=?", 1, 68823769).Find(&m)
} else {
err = Db.Where("deleted_at != ? AND is_dev = '1' ", 1).Find(&m)
}


+ 26
- 0
app/db/model/cloud_issuance_user_robot.go Vedi File

@@ -0,0 +1,26 @@
package model

import (
"time"
)

type CloudIssuanceUserRobot struct {
Id int `json:"id" xorm:"pk autoincr INT(11)"`
Uid int `json:"uid"`
RobotId int `json:"robot_id" xorm:"not null default 0 comment('机器人id') INT(11)"`
RobotType int `json:"robot_type" xorm:"not null default 4 comment('机器人类型(1 发单机器人 2转发机器人 3 返利机器人 4全能机器人 5小型机器人 6发圈机器人)') TINYINT(1)"`
RobotKind int `json:"robot_kind" xorm:"not null default 1 comment('机器人种类(1 独享机器人 2 共享机器人)') TINYINT(1)"`
WechatRobot string `json:"wechat_robot" xorm:"not null default '' comment('微信号') VARCHAR(255)"`
GroupNum int `json:"group_num" xorm:"not null default 5 comment('最大群数') TINYINT(3)"`
LoginStatus int `json:"login_status" xorm:"not null default 0 comment('登录状态(0:未登录 1:登录)') TINYINT(1)"`
EndTime string `json:"end_time" xorm:"not null default '' comment('到期时间') VARCHAR(255)"`
Remark string `json:"remark" xorm:"not null default '' comment('备注') VARCHAR(255)"`
WId string `json:"w_id" xorm:"not null default '' comment('机器人实例id') VARCHAR(255)"`
WcId string `json:"wc_id" xorm:"not null default '' comment('微信id') VARCHAR(255)"`
WcNickname string `json:"wc_nickname" xorm:"not null default '' comment('微信昵称') VARCHAR(255)"`
WcHeadUrl string `json:"wc_head_url" xorm:"not null default '' comment('微信头像') VARCHAR(255)"`
QrCodeUrl string `json:"qr_code_url" xorm:"not null default '' comment('登录二维码url') VARCHAR(255)"`
IsEnabled int `json:"is_enabled" xorm:"not null default 0 comment('机器人状态(0 正常 1暂停 2已过期)') TINYINT(1)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

+ 11
- 0
app/svc/svc_gim.go Vedi File

@@ -0,0 +1,11 @@
package svc

import (
"applet/app/db"
"github.com/gin-gonic/gin"
"xorm.io/xorm"
)

func SaveUser(c *gin.Context) *xorm.Engine {
return db.DBs[c.GetString("mid")]
}

+ 82
- 0
app/utils/cloud_issuance/api.go Vedi File

@@ -0,0 +1,82 @@
package tool

import (
"applet/app/utils"
"encoding/json"
"errors"
"fmt"
"sort"
"time"
)

type CurlResponse struct {
Status string `json:"status"`
Data interface{} `json:"data"`
Msg string `json:"msg"`
}

const (
RequestUrl = "http://router.itaokecms.com/api?app_key=%s&v=1.0&format=json&sign_method=md5&method=%s&timestamp=%s&domain=%s&client=%s&partner_id=%s&sign=%s"
AppKey = "1091808433"
AppSecret = "bed35c10-ecf1-2d06-477b-f821c227198b"
Domain = "hairuyi.com"
PartnerId = "top-sdk-php-20190618"
)

func SendPost(url string, args interface{}) (data CurlResponse, err error) {
post, err := utils.CurlPost(url, utils.Serialize(args), map[string]string{})
utils.FilePutContents("cloud_issuance_send", "resp"+string(post))
err = json.Unmarshal(post, &data)
if err != nil {
return
}
if data.Status != "0000" {
err = errors.New(data.Msg)
return
}
return data, err
}

func HttpBuild(methodName, clientIP string, params map[string]string) (httpUrl string) {
timestamp := utils.AnyToString(time.Now().Unix())
params["app_key"] = AppKey
params["v"] = "1.0"
params["format"] = "json"
params["sign_method"] = "md5"
params["method"] = methodName
params["timestamp"] = timestamp
params["domain"] = Domain
params["client"] = clientIP
params["partner_id"] = PartnerId
sign := httpBuildQuery(params, true)
sign = AppSecret + httpBuildQuery(params, true) + AppSecret
sign = utils.MD5ToUpper32(sign)
httpUrl = fmt.Sprintf(RequestUrl, AppKey, methodName, timestamp, Domain, clientIP, PartnerId, sign)
return
}

func httpBuildQuery(args map[string]string, sortAsc ...bool) string {
str := ""
if len(args) == 0 {
return str
}
if len(sortAsc) > 0 {
keys := make([]string, 0, len(args))
for k := range args {
keys = append(keys, k)
}
if sortAsc[0] {
sort.Strings(keys)
} else {
sort.Sort(sort.Reverse(sort.StringSlice(keys)))
}
for _, k := range keys {
str += k + args[k]
}
} else {
for k, v := range args {
str += k + v
}
}
return str
}

+ 23
- 0
app/utils/md5.go Vedi File

@@ -3,6 +3,9 @@ package utils
import (
"crypto/md5"
"encoding/hex"
"fmt"
"io"
"strings"
)

func Md5(str string) string {
@@ -10,3 +13,23 @@ func Md5(str string) string {
h.Write([]byte(str))
return hex.EncodeToString(h.Sum(nil))
}

/*
MD5ToUpper32 将字符串,转为32位md5加密,返回大写字母
*/
func MD5ToUpper32(str string) string {
w := md5.New()
io.WriteString(w, str) //将str写入到w中
md5Str := fmt.Sprintf("%x", w.Sum(nil)) //w.Sum(nil)将w的hash转成[]byte格式
return strings.ToUpper(md5Str)
}

/*
MD5ToLower32 将字符串,转为32位md5加密,返回小写字母
*/
func MD5ToLower32(str string) string {
w := md5.New()
io.WriteString(w, str) //将str写入到w中
md5Str := fmt.Sprintf("%x", w.Sum(nil)) //w.Sum(nil)将w的hash转成[]byte格式
return md5Str
}

+ 124
- 0
consume/cloud_issuance_async_mlogin.go Vedi File

@@ -0,0 +1,124 @@
package consume

import (
"applet/app/cfg"
"applet/app/db"
"applet/app/utils"
"applet/app/utils/cache"
tool "applet/app/utils/cloud_issuance"
"applet/app/utils/logx"
"applet/consume/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"encoding/json"
"errors"
"fmt"
"github.com/streadway/amqp"
"strconv"
"time"
)

func CloudIssuanceAsyncMLoginConsume(queue md.MqQueue) {
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>")
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
logx.Error(err)
return
}
defer ch.Release()
//2、取出数据进行消费
ch.Qos(1)
delivery := ch.Consume(queue.Name, false)

var res amqp.Delivery
var ok bool
for {
res, ok = <-delivery
if ok == true {
fmt.Println(">>>>>>>>>>>>>>>>CloudIssuanceAsyncMLoginConsume<<<<<<<<<<<<<<<<<<<<<<<<<")
//解析mq中queue的数据结构体
var msg *md.CloudIssuanceAsyncMLogin
err = json.Unmarshal(res.Body, &msg)
if err != nil {
panic(err)
}
go func() {
err := handleAsyncMLogin(msg.WId, msg.MasterId, msg.UserId, msg.RobotId)
if err != nil {
fmt.Println("<<<<<<<<<<<< handleAsyncMLogin err>>>>>>>>", err.Error())
}
}()
_ = res.Ack(true)
} else {
panic(errors.New("error getting message"))
}
}
fmt.Println("get msg done")
}

func handleAsyncMLogin(wId, masterId, userId string, robotId int) error {
var timeTotal = 0
for {
err, resp := robotAsyncMacLogin(md.RobotAsyncMacLoginRequest{
WId: wId,
RobotId: robotId,
})
if err == nil {
fmt.Println("success <<<<<<<", resp)
if cfg.Prd {
engine := db.DBs[masterId]
cloudIssuanceUserRobotDb := db.CloudIssuanceUserRobotDb{}
cloudIssuanceUserRobotDb.Set(engine, utils.StrToInt(userId))
robot, err := cloudIssuanceUserRobotDb.GetCloudIssuanceUserRobot()
if err != nil {
return err
}
if robot == nil {
return errors.New("未查询到机器人记录")
}
robot.WcId = resp.WcId
robot.WcNickname = resp.NickName
robot.WcHeadUrl = resp.HeadUrl
robot.LoginStatus = 1
_, err = cloudIssuanceUserRobotDb.SaveCloudIssuanceUserRobot(robot.Id, robot, "wc_id", "wc_nickname", "wc_head_url", "login_status")
if err != nil {
return err
}
} else {
//TODO::测试环境, 简化操作 通过redis 桥接
cache.SetEx(fmt.Sprintf("cloud_issuance_async_login_success:%s:%s", masterId, userId), utils.SerializeStr(resp), 60*5)
}
return nil
}

fmt.Println("err>>>>>>>>", err.Error())
if err != nil && err.Error() != "未登录" {
return err
}
//TODO::休眠5s
time.Sleep(time.Duration(5) * time.Second)
timeTotal += 5
if timeTotal >= 240 {
return errors.New("超时未登录")
}
}
}

func robotAsyncMacLogin(args md.RobotAsyncMacLoginRequest) (err error, result md.RobotAsyncMacLoginResponse) { // 同步登录状态
url := tool.HttpBuild("itaoke.robot.async.mlogin", "127.0.0.1", map[string]string{
"robot_id": strconv.Itoa(args.RobotId),
"wId": args.WId,
})
data, err := tool.SendPost(url, args)
if err != nil {
return
}
resByte, err := json.Marshal(data.Data)
if err != nil {
return
}
err = json.Unmarshal(resByte, &result)
if err != nil {
return
}
return
}

+ 25
- 5
consume/dou_shen_user_register_for_my_my_fans.go Vedi File

@@ -4,6 +4,7 @@ import (
"applet/app/cfg"
"applet/app/db"
db2 "applet/app/db/gim"
model2 "applet/app/db/gim/model"
"applet/app/db/model"
utils2 "applet/app/utils"
"applet/app/utils/logx"
@@ -15,6 +16,7 @@ import (
"errors"
"fmt"
"github.com/streadway/amqp"
"strconv"
"time"
)

@@ -78,7 +80,7 @@ func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error {
return err
}
if gimUser == nil {
time.Sleep(time.Duration(20) * time.Second)
time.Sleep(time.Duration(10) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
@@ -87,14 +89,32 @@ func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error {
return err
}
if gimUser == nil {
time.Sleep(time.Duration(30) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
user, err := db.UserFindByMobile(db.DBs[msg.MasterId], strconv.FormatInt(msg.Phone, 10))
if err != nil {
return err
}
userProfile, err := db.UserProfileFindByID(db.DBs[msg.MasterId], user.Uid)
if err != nil {
return err
}

gimUserId, err := db2.UserInsert(db.ImDb, &model2.User{
PhoneNumber: strconv.FormatInt(msg.Phone, 10),
Nickname: user.Nickname,
AvatarUrl: userProfile.AvatarUrl,
Sex: userProfile.Gender,
CreateTime: time.Now().Format("2006-01-02 15:04:05"),
UpdateTime: time.Now().Format("2006-01-02 15:04:05"),
MasterId: utils2.StrToInt64(msg.MasterId),
IsAutoAddedFriends: 0,
})
if err != nil {
return err
}
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "id",
"value": gimUserId,
})
if gimUser == nil {
return errors.New("用户暂未注册im系统")
}


+ 24
- 15
consume/dou_shen_user_register_for_my_my_recommender.go Vedi File

@@ -4,6 +4,7 @@ import (
"applet/app/cfg"
"applet/app/db"
db2 "applet/app/db/gim"
"applet/app/db/gim/model"
utils2 "applet/app/utils"
"applet/app/utils/logx"
utils "applet/app/utils/rpc"
@@ -76,27 +77,35 @@ func handleDouShenUserRegisterConsumeForMyRecommender(msgData []byte) error {
if err != nil {
return err
}

if gimUser == nil {
time.Sleep(time.Duration(20) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
user, err := db.UserFindByMobile(db.DBs[msg.MasterId], strconv.FormatInt(msg.Phone, 10))
if err != nil {
return err
}
userProfile, err := db.UserProfileFindByID(db.DBs[msg.MasterId], user.Uid)
if err != nil {
return err
}
gimUserId, err := db2.UserInsert(db.ImDb, &model.User{
PhoneNumber: strconv.FormatInt(msg.Phone, 10),
Nickname: user.Nickname,
AvatarUrl: userProfile.AvatarUrl,
Sex: userProfile.Gender,
CreateTime: time.Now().Format("2006-01-02 15:04:05"),
UpdateTime: time.Now().Format("2006-01-02 15:04:05"),
MasterId: utils2.StrToInt64(msg.MasterId),
IsAutoAddedFriends: 0,
})
if err != nil {
return err
}
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "id",
"value": gimUserId,
})
if gimUser == nil {
time.Sleep(time.Duration(30) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
})
if err != nil {
return err
}
if gimUser == nil {
return errors.New("用户暂未注册im系统")
}
return errors.New("用户暂未注册im系统")
}
}



+ 46
- 18
consume/dou_shen_user_register_for_official_consume.go Vedi File

@@ -4,6 +4,7 @@ import (
"applet/app/cfg"
"applet/app/db"
db2 "applet/app/db/gim"
model2 "applet/app/db/gim/model"
"applet/app/db/model"
utils2 "applet/app/utils"
"applet/app/utils/logx"
@@ -62,7 +63,7 @@ func DouShenUserRegisterConsumeForOfficial(queue md.MqQueue) {
}

func handleDouShenUserRegisterConsumeForOfficial(msgData []byte) error {
time.Sleep(time.Duration(10) * time.Second)
time.Sleep(time.Duration(1) * time.Second)
//1、解析mq中queue的数据结构体
var msg *md.DouShenUserRegisterMessageStructForOfficial
err := json.Unmarshal(msgData, &msg)
@@ -78,36 +79,63 @@ func handleDouShenUserRegisterConsumeForOfficial(msgData []byte) error {
return err
}
if gimUser == nil {
time.Sleep(time.Duration(20) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
user, err := db.UserFindByMobile(db.DBs[msg.MasterId], strconv.FormatInt(msg.Phone, 10))
if err != nil {
return err
}
userProfile, err := db.UserProfileFindByID(db.DBs[msg.MasterId], user.Uid)
if err != nil {
return err
}

gimUserId, err := db2.UserInsert(db.ImDb, &model2.User{
PhoneNumber: strconv.FormatInt(msg.Phone, 10),
Nickname: user.Nickname,
AvatarUrl: userProfile.AvatarUrl,
Sex: userProfile.Gender,
CreateTime: time.Now().Format("2006-01-02 15:04:05"),
UpdateTime: time.Now().Format("2006-01-02 15:04:05"),
MasterId: utils2.StrToInt64(msg.MasterId),
IsAutoAddedFriends: 0,
})
if err != nil {
return err
}
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "id",
"value": gimUserId,
})
if gimUser == nil {
time.Sleep(time.Duration(30) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
})
if err != nil {
return err
}
if gimUser == nil {
return errors.New("用户暂未注册im系统")
}
return errors.New("用户暂未注册im系统")
}
}

//2、查找是否有群
officialGroup, err := db.DouShenImGroupGetOneByParamsForOfficial(db.Db, 1)
//officialGroup, err := db.DouShenImGroupGetOneByParamsForOfficial(db.Db, 1)
var officialGroup *model.DouShenImGroup
officialGroups, err := db.DouShenImGroupFindByParams(db.Db, map[string]interface{}{
"key": "kind",
"value": 1,
})
if err != nil {
return err
}
for _, group := range *officialGroups {
//统计当前群有多少人
userGroups, err := db2.GroupUserFindByParams(db.ImDb, map[string]interface{}{
"key": "group_id",
"value": group.GroupId,
})
if err != nil {
return err
}
if len(*userGroups) < 500 {
officialGroup = &group
}
}

if officialGroup == nil {
groupName := "官方【1】群"
groupName := "官方【" + utils2.AnyToString(len(*officialGroups)+1) + "】群"
//3、创建群
resp, err := utils.GetLogicExtClient(cfg.ImLogicRpc.URL, cfg.ImLogicRpc.PORT).CreateGroup(utils.GetCtx("", strconv.FormatInt(gimUser.Id, 10), "0", msg.MasterId), &pb.CreateGroupReq{
Name: groupName,


+ 23
- 15
consume/dou_shen_user_register_for_operation_center.go Vedi File

@@ -4,6 +4,7 @@ import (
"applet/app/cfg"
"applet/app/db"
db2 "applet/app/db/gim"
"applet/app/db/gim/model"
"applet/app/svc"
utils2 "applet/app/utils"
"applet/app/utils/logx"
@@ -79,26 +80,33 @@ func handleDouShenUserRegisterConsumeForOperationCenter(msgData []byte) error {
}

if gimUser == nil {
time.Sleep(time.Duration(20) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
user, err := db.UserFindByMobile(db.DBs[msg.MasterId], strconv.FormatInt(msg.Phone, 10))
if err != nil {
return err
}
userProfile, err := db.UserProfileFindByID(db.DBs[msg.MasterId], user.Uid)
if err != nil {
return err
}
gimUserId, err := db2.UserInsert(db.ImDb, &model.User{
PhoneNumber: strconv.FormatInt(msg.Phone, 10),
Nickname: user.Nickname,
AvatarUrl: userProfile.AvatarUrl,
Sex: userProfile.Gender,
CreateTime: time.Now().Format("2006-01-02 15:04:05"),
UpdateTime: time.Now().Format("2006-01-02 15:04:05"),
MasterId: utils2.StrToInt64(msg.MasterId),
IsAutoAddedFriends: 0,
})
if err != nil {
return err
}
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "id",
"value": gimUserId,
})
if gimUser == nil {
time.Sleep(time.Duration(30) * time.Second)
gimUser, err := db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "phone_number",
"value": msg.Phone,
})
if err != nil {
return err
}
if gimUser == nil {
return errors.New("用户暂未注册im系统")
}
return errors.New("用户暂未注册im系统")
}
}



+ 2
- 1
consume/init.go Vedi File

@@ -20,7 +20,7 @@ func initConsumes() {
jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume
jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume
jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume
//jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial
jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial
//jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter
jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv
//jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender
@@ -32,6 +32,7 @@ func initConsumes() {
jobs[consumeMd.CanalMallOrdForYouMiShangFunName] = CanalMallOrdForYouMiShang
jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore

jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume
}

func Run() {


+ 10
- 0
consume/md/consume_key.go Vedi File

@@ -11,6 +11,15 @@ type MqQueue struct {
}

var RabbitMqQueueKeyList = []*MqQueue{
{
ExchangeName: "",
Name: "cloud_issuance_async_mlogin",
Type: SimpleQueueType,
IsPersistent: false,
RoutKey: "",
BindKey: "",
ConsumeFunName: "CloudIssuanceAsyncMLoginConsume",
},
{
ExchangeName: "canal.topic",
Name: "canal_order",
@@ -145,4 +154,5 @@ const (
ZhiosFastReturnOrderRefundFunName = "ZhiosFastReturnOrderRefund"
CanalMallOrdForYouMiShangFunName = "CanalMallOrdForYouMiShang"
YoumishangExchangeStoreFunName = "YoumishangExchangeStore"
CloudIssuanceAsyncMLoginFunName = "CloudIssuanceAsyncMLoginConsume"
)

+ 20
- 0
consume/md/md_cloud_issuance.go Vedi File

@@ -0,0 +1,20 @@
package md

type CloudIssuanceAsyncMLogin struct {
MasterId string `json:"master_id"` //站长id
WId string `json:"wId"` //实例id
RobotId int `json:"robot_id"` //机器人id
UserId string `json:"user_id"` //用户id
QrCodeUrl string `json:"qrCodeUrl"`
}

type RobotAsyncMacLoginRequest struct {
WId string `json:"wId"` //实例id
RobotId int `json:"robot_id"` //机器人id
}
type RobotAsyncMacLoginResponse struct {
WId string `json:"wId"` //实例id
WcId string `json:"wcId"` //微信id
NickName string `json:"nickName"` //微信昵称
HeadUrl string `json:"headUrl"` //微信头像
}

+ 26
- 9
etc/cfg.yml Vedi File

@@ -22,17 +22,17 @@ supply:
url: http://supply-chain-admin:5500

app_comm:
url: http://127.0.0.1:5003
url: http://api.zhiyingos.com

wxapplet_filepath:
url: '/etc/zyos-admin/wx_check_file'

# 连接官网数据库获取db mapping
db:
host: '119.23.182.117:3306'
host: 'zhios123.rwlb.rds.aliyuncs.com:3306'
name: 'zyos_website'
user: 'root'
psw: 'Fnuo123com@'
user: 'canal'
psw: 'canal'
show_log: true
max_lifetime: 30
max_open_conns: 100
@@ -41,10 +41,21 @@ db:

# 连接 big_data_screen 数据库
data_db:
host: '119.23.182.117:3306'
host: 'zhios123.rwlb.rds.aliyuncs.com:3306'
name: 'big_data_screen'
user: 'root'
psw: 'Fnuo123com@'
user: 'canal'
psw: 'canal'
show_log: true
max_lifetime: 30
max_open_conns: 100
max_idle_conns: 100
path: 'tmp/%s.log'

im_db:
host: 'zhios123.rwlb.rds.aliyuncs.com:3306'
name: 'gim'
user: 'canal'
psw: 'canal'
show_log: true
max_lifetime: 30
max_open_conns: 100
@@ -77,9 +88,15 @@ es:
user: 'elastic'
pwd: 'fnuo123'

# 监听RabbitMq队列名
mq_work_queue_name: 'pay_query_work_queue,pay_return_query_work_queue,test_work_queue'
# 测试环境的ip
rabbitMq_addr_test: 'amqp://admin:123456@119.23.182.117:5672/'
# 正式环境的ip
rabbitMq_addr: 'amqp://zhios:ZHIoscnfnuo123@116.62.62.35:5672/'

im_business_rpc:
url: im-rpc-business.zhiyingos.com
port: 8000

im_logic_rpc:
url: im-rpc-logic.zhiyingos.com
port: 8003

Caricamento…
Annulla
Salva