sqlite的api,便于内部使用
liuxiaolong
2019-06-24 97387b6eb3cfae3ed1d1d97b51fa618af20fbb68
add eventPush.go
1个文件已添加
45 ■■■■■ 已修改文件
eventPush.go 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eventPush.go
New file
@@ -0,0 +1,45 @@
package dbapi
import (
    "encoding/json"
    "fmt"
)
type EventPushApi struct {
}
func (api EventPushApi) Save(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/save"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
        return false,nil
    }
    var res Result
    if err = json.Unmarshal(body, &res); err != nil {
        fmt.Println(err)
        return false,nil
    }
    return res.Success,res.Data
}
func (api EventPushApi) FindByEventTopic(topic string,childType string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/findByEventTopic"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["topic"] = topic
    paramQuery["childType"] = childType
    body, err := client.DoGetRequest(url, paramQuery, nil)
    if err != nil {
        return false,nil
    }
    var res Result
    if err = json.Unmarshal(body, &res); err != nil {
        return false,nil
    }
    return true,res.Data
}