diff --git a/libs/im/im.go b/libs/im/im.go index fe99c30..427bab6 100644 --- a/libs/im/im.go +++ b/libs/im/im.go @@ -5,43 +5,9 @@ import ( "errors" "fmt" "github.com/kirinlabs/HttpRequest" - "github.com/tencentyun/tls-sig-api-v2-golang/tencentyun" "hudongzhuanjia/utils" ) -var ( - //SdkAppid = 1400345581 - //SdkAppKey = "e3d095ce8253fe18109d6c1ad068907978cac0a428fbad181d8958631b78e930" - - SdkAppKey = "9683fc9d2e50857f33c7ef5431942458f2dbc7042ba526f87042092afb646331" - SdkAppid = 1400337419 - TxImHostV4 = "https://console.tim.qq.com/v4" -) - -type NoticeStatus int - -const NoticeLiveRedPackStart NoticeStatus = 256 // 通知直播用户红包开始了 -const NoticeLiveRedPackEnd NoticeStatus = 257 // 通知直播用户红包结束了 -const NoticeLiveRedPackGet NoticeStatus = 258 // 某人摇中红包 -const NoticeShakeRedPackStart NoticeStatus = 259 // 通知摇红包开始了 -const NoticeShakeRedPackEnd NoticeStatus = 260 // 通知摇红包结束了 - -type CommonResult struct { - ActionStatus string `json:"ActionStatus"` - ErrorCode int `json:"ErrorCode"` - ErrorInfo string `json:"ErrorInfo"` -} - -type AccountImportParam struct { - Identifier string `json:"Identifier"` - Nick string `json:"Nick"` - FaceUrl string `json:"FaceUrl"` -} - -func GenSig(identifier string) (string, error) { - return tencentyun.GenSig(SdkAppid, SdkAppKey, identifier, 86400000) -} - func AccountImport(identifier, nickname, faceurl string) (string, error) { //sign, err := tencentyun.GenSig(SdkAppid, SdkAppKey, "admin", 86400*180) sig, err := GenSig("admin") diff --git a/libs/im/status.go b/libs/im/status.go new file mode 100644 index 0000000..5bf4268 --- /dev/null +++ b/libs/im/status.go @@ -0,0 +1,10 @@ +package im + +// 定义一些通知或者数据状态 +type NoticeStatus int + +const NoticeLiveRedPackStart NoticeStatus = 256 // 通知直播用户红包开始了 +const NoticeLiveRedPackEnd NoticeStatus = 257 // 通知直播用户红包结束了 +const NoticeLiveRedPackGet NoticeStatus = 258 // 某人摇中红包 +const NoticeShakeRedPackStart NoticeStatus = 259 // 通知摇红包开始了 +const NoticeShakeRedPackEnd NoticeStatus = 260 // 通知摇红包结束了 diff --git a/libs/im/struct.go b/libs/im/struct.go new file mode 100644 index 0000000..5214df1 --- /dev/null +++ b/libs/im/struct.go @@ -0,0 +1,28 @@ +package im + +import "github.com/tencentyun/tls-sig-api-v2-golang/tencentyun" + +var ( + //SdkAppid = 1400345581 + //SdkAppKey = "e3d095ce8253fe18109d6c1ad068907978cac0a428fbad181d8958631b78e930" + + SdkAppKey = "9683fc9d2e50857f33c7ef5431942458f2dbc7042ba526f87042092afb646331" + SdkAppid = 1400337419 + TxImHostV4 = "https://console.tim.qq.com/v4" +) + +type CommonResult struct { + ActionStatus string `json:"ActionStatus"` + ErrorCode int `json:"ErrorCode"` + ErrorInfo string `json:"ErrorInfo"` +} + +type AccountImportParam struct { + Identifier string `json:"Identifier"` + Nick string `json:"Nick"` + FaceUrl string `json:"FaceUrl"` +} + +func GenSig(identifier string) (string, error) { + return tencentyun.GenSig(SdkAppid, SdkAppKey, identifier, 86400000) +}