You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
731 B

package web
import (
"context"
"net/url"
"strconv"
"go-common/library/ecode"
"go-common/library/log"
)
const (
_opt = "1002"
_platform = "web"
)
// PushAll broadcast push all
func (d *Dao) PushAll(c context.Context, msg string, ip string) (err error) {
var res struct {
Code int `json:"code"`
}
params := url.Values{}
params.Set("operation", _opt)
params.Set("speed", strconv.Itoa(d.c.Rule.BroadFeed))
params.Set("platform", _platform)
params.Set("message", msg)
if err = d.http.Post(c, d.broadcastURL, ip, params, &res); err != nil {
log.Error("PushAll url(%s) error(%v)", d.broadcastURL+"?"+params.Encode(), err)
return
}
if res.Code != ecode.OK.Code() {
err = ecode.Int(res.Code)
}
return
}