🎨 逻辑修改,把依赖从写死改为配置

This commit is contained in:
李寻欢
2023-10-26 10:07:08 +08:00
parent 581faf974c
commit 8f15b58825
12 changed files with 179 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/go-resty/resty/v2"
"go-wechat/client"
"go-wechat/config"
"go-wechat/constant"
"go-wechat/entity"
"go-wechat/model"
@@ -27,7 +28,7 @@ func syncFriends() {
resp, err := hc.R().
SetHeader("Content-Type", "application/json;chartset=utf-8").
SetResult(&base).
Post("http://10.0.0.73:19088/api/getContactList")
Post(config.Conf.Wechat.GetURL("/api/getContactList"))
if err != nil {
log.Printf("获取好友列表失败: %s", err.Error())
return
@@ -105,7 +106,7 @@ func syncGroupUsers(tx *gorm.DB, gid string) {
SetHeader("Content-Type", "application/json;chartset=utf-8").
SetBody(string(pbs)).
SetResult(&baseResp).
Post("http://10.0.0.73:19088/api/getMemberFromChatRoom")
Post(config.Conf.Wechat.GetURL("/api/getMemberFromChatRoom"))
if err != nil {
log.Printf("获取群成员信息失败: %s", err.Error())
return
@@ -189,7 +190,7 @@ func getContactProfile(wxid string) (ent model.ContactProfile, err error) {
SetHeader("Content-Type", "application/json;chartset=utf-8").
SetBody(string(pbs)).
SetResult(&baseResp).
Post("http://10.0.0.73:19088/api/getContactProfile")
Post(config.Conf.Wechat.GetURL("/api/getContactProfile"))
if err != nil {
log.Printf("获取成员详情失败: %s", err.Error())
return