goapis

package module
v0.0.0-...-b4132e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 11 Imported by: 2

README

goapis

Go语言的一些第三方接口

Documentation

Index

Constants

View Source
const ERRSTR string = "error"

ERRSTR 错误代码字符串

Variables

This section is empty.

Functions

func BaiduCity

func BaiduCity(ak, remoteAddr string, lat, lng float64) (string, string, string)

BaiduCity 根据经纬度和IP地址,获取省份和城市

func BaiduLoc

func BaiduLoc(ak, city string) (float64, float64)

BaiduLoc 根据城市名称,解析经纬度

func PushNSQ

func PushNSQ(server, topic string, body interface{}) *nsq.Producer

PushNSQ 推送到NSQ消息队列中

func QQUserInfo

func QQUserInfo(appID, accessToken, openID string) map[string]interface{}

QQUserInfo 通过 QQ 接口,获取用户资料 @appID @accessToken @openID

func QiniuRatio

func QiniuRatio(qnURL, pic string) float64

QiniuRatio 获取七牛图像比例

func WechatJSCode

func WechatJSCode(jsCode, appID, secret string) map[string]interface{}

WechatJSCode 通过微信接口,用户CODE,获取open_id等数据 @jsCode @appID @secret

func WechatUserInfo

func WechatUserInfo(accessToken, openID string) map[string]interface{}

WechatUserInfo 通过微信接口,获取用户资料 @accessToken @openID https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID

func WeiboUserInfo

func WeiboUserInfo(accessToken, uid string) map[string]interface{}

WeiboUserInfo 获取微博用户数据 @accessToken @uid

Types

type DAO

type DAO struct {
	Session *mgo.Session
}

DAO 数据操作

func (*DAO) FindAll

func (db *DAO) FindAll(dbName, collName string, query bson.M, skip, limit int, sort []string) []bson.M

FindAll 查询操作

func (*DAO) FindAllSelector

func (db *DAO) FindAllSelector(dbName, collName string, query, selector bson.M, skip, limit int, sort []string) []bson.M

FindAllSelector 查询操作

func (*DAO) FindByGroup

func (db *DAO) FindByGroup(dbName, collName string, match, group, sort bson.M, skip, limit int) []bson.M

FindByGroup 聚合查询

func (*DAO) FindOne

func (db *DAO) FindOne(dbName, collName string, selector, query bson.M) bson.M

FindOne 查询一条数据

func (*DAO) IncDo

func (db *DAO) IncDo(dbName, collName string, selector, data bson.M) error

IncDo 增量操作

func (*DAO) InsertDo

func (db *DAO) InsertDo(dbName, collName string, data bson.M) (bson.ObjectId, error)

InsertDo 插入操作

func (*DAO) InsertDoID

func (db *DAO) InsertDoID(dbName, collName string, id bson.ObjectId, data bson.M) error

InsertDoID 插入操作,带有新的ID

func (*DAO) RemoveAll

func (db *DAO) RemoveAll(dbName, collName string, selector bson.M)

RemoveAll 删除数据

func (*DAO) RowsCount

func (db *DAO) RowsCount(dbName, collName string, query bson.M) int

RowsCount 查询记录数

func (*DAO) UpdateAllDo

func (db *DAO) UpdateAllDo(dbName, collName string, selector, data bson.M) (int, error)

UpdateAllDo 更新全部操作

func (*DAO) UpdateAllNoSet

func (db *DAO) UpdateAllNoSet(dbName, collName string, selector, data bson.M) (int, error)

UpdateAllNoSet 更新全部插入操作

func (*DAO) UpdateDo

func (db *DAO) UpdateDo(dbName, collName string, selector, data bson.M) error

UpdateDo 更新操作

func (*DAO) UpdateNoSet

func (db *DAO) UpdateNoSet(dbName, collName string, selector, data bson.M) error

UpdateNoSet 更新插入操作

func (*DAO) UpsertByID

func (db *DAO) UpsertByID(dbName, collName string, id interface{}, data bson.M) error

UpsertByID 更新插入操作

func (*DAO) UpsertDo

func (db *DAO) UpsertDo(dbName, collName string, selector, data bson.M) error

UpsertDo 更新插入操作

type Easemob

type Easemob struct {
	ID     string
	Secret string
}

Easemob 环信

func (*Easemob) EasemobNickModify

func (p *Easemob) EasemobNickModify(uid int64, nickName string) bool

EasemobNickModify 环信修改用户昵称 @userName @passwd @nickName @aToken

func (*Easemob) EasemobSignupSingle

func (p *Easemob) EasemobSignupSingle(uid int64, passwd, nickName string) bool

EasemobSignupSingle 环信注册单个用户 @uid @passwd @nickName

func (*Easemob) PushMessage

func (p *Easemob) PushMessage(reqURL, msg string, target map[string]string) (interface{}, error)

PushMessage 发送消息

type IPAddressInfo

type IPAddressInfo struct {
	Country     string `json:"country"`
	CountryCode string `json:"countryCode"`
	Region      string `json:"region"`
	RegionName  string `json:"regionName"`
	City        string `json:"city"`
	ISP         string `json:"isp"`
}

IPAddressInfo IP 地址信息

func IP2Adress

func IP2Adress(ip string) (IPAddressInfo, error)

IP2Adress IP地址转换为物理地址 ip-api.com http://ip-api.com/json/113.116.28.98?lang=zh-CN

type SlackUtil

type SlackUtil struct {
	Token string
}

SlackUtil Slack 接口

func (*SlackUtil) PostMessage

func (slack *SlackUtil) PostMessage(channelID, text string) error

PostMessage 发送消息给频道

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL