1234567891011121314151617181920212223242526272829303132 |
- package third
- import (
- "fmt"
- jsoniter "github.com/json-iterator/go"
- mhayaHttp "github.com/mhaya/extend/http"
- "github.com/mhaya/game/game_cluster/internal/data"
- )
- type GetIfChannelResp struct {
- Result struct {
- Status string `json:"status"`
- } `json:"result"`
- }
- func GetIfChannel(userID string) int32 {
- ret := data.SdkConfig.Get(3)
- params := map[string]string{}
- rs, _, err := mhayaHttp.GET(fmt.Sprintf("%v%v/getChatMember?chat_id=%v&user_id=%v", ret.Params.AppUrl, ret.Params.BotToken, ret.Params.ChatIDName, userID), params)
- if err != nil {
- return 0
- }
- var resp GetIfChannelResp
- err = jsoniter.Unmarshal(rs, &resp)
- if err != nil {
- return 0
- }
- if resp.Result.Status == "member" {
- return 1
- }
- return 0
- }
|