feat: 添加获取登录账户信息的功能,并更新相关数据结构和常量

This commit is contained in:
lixiangwuxian
2025-04-10 01:13:28 +08:00
parent 546f1abcd1
commit eba07290a9
5 changed files with 49 additions and 14 deletions

View File

@@ -104,15 +104,3 @@ func (am *actionManager) DrawbackMsg(msgId int32) error {
}
return nil
}
func (am *actionManager) GetGroupMemberList(groupId int64) ([]int64, error) {
askGroupMemberListPkg := model.GenGetGroupMemberListPkg(groupId)
askGroupMemberListPkgJson, err := json.Marshal(askGroupMemberListPkg)
if err != nil {
return nil, err
}
if err = am.botConn.WriteMessage(websocket.TextMessage, askGroupMemberListPkgJson); err != nil {
return nil, err
}
return nil, nil //todo
}

View File

@@ -56,3 +56,26 @@ func GetGroupList() ([]model.Group, error) {
return groupListResponse.Data, nil
}
func (am *actionManager) GetLoginAccountInfo() (*model.LoginAccountInfoResponse, error) {
fullURL := fmt.Sprintf("http://%s%s", config.ConfigManager.GetConfig().Management.NapcatHttpSrv, constants.GET_LOGIN_INFO)
response, err := http.Post(fullURL, "application/json", nil)
if err != nil {
return nil, err
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
return nil, err
}
var loginAccountInfoResponse model.LoginAccountInfoResponse
err = json.Unmarshal(body, &loginAccountInfoResponse)
if err != nil {
return nil, err
}
return &loginAccountInfoResponse, nil
}