package ws_send_service import ( "github.com/kirinlabs/HttpRequest" ) var SendUrl = "https://api.ouxuanhudong.com:20182/PcClient/Connect/MessageCtl/Receive" // https://api.hudongzhuanjia.com:20182/PcClient/Connect/MessageCtl/Receive // func init() { // SendUrl = "http://127.0.0.1:20182/PcClient/Handle/MessageCtl/receive" // } type Message struct { Type string `json:"type"` Tag string `json:"tag"` Dest int64 `json:"dest"` RoomId string `json:"room_id"` Data map[string]interface{} `json:"data"` } // pc send upper wall func SendUpperWall(roomId string, tag string, dest int64, data map[string]interface{}) { m := Message{ Type: "upper_wall", Tag: tag, Dest: dest, RoomId: roomId, Data: data, } HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m)) } func SendShakeRedEnvelope(roomId string, tag string, dest int64, data map[string]interface{}) { m := Message{ Type: "shake_rb", Tag: tag, Dest: dest, RoomId: roomId, Data: data, } HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m)) } func SendBarrage(roomId string, tag string, dest int64, data map[string]interface{}) { m := Message{ Type: "barrage", Tag: tag, Dest: dest, RoomId: roomId, Data: data, } HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m)) } func SendSign(roomId string, tag string, dest int64, data map[string]interface{}) { m := Message{ Type: "sign_up", Tag: tag, Dest: dest, RoomId: roomId, Data: data, } HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m)) } func SendAuction(roomId string, tag string, dest int64, data map[string]interface{}) { m := Message{ Type: "auction", Tag: tag, RoomId: roomId, Dest: dest, Data: data, } HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m)) } // 可以设置通用的ws链接进行通信