Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_test",
"go_library",
)
go_test(
name = "go_default_test",
srcs = ["unicom_test.go"],
embed = [":go_default_library"],
rundir = ".",
tags = ["automanaged"],
deps = [
"//app/job/main/app-wall/conf:go_default_library",
"//app/job/main/app-wall/model/unicom:go_default_library",
"//vendor/github.com/smartystreets/goconvey/convey:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = [
"api.go",
"cache.go",
"dao.go",
],
importpath = "go-common/app/job/main/app-wall/dao/unicom",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/job/main/app-wall/conf:go_default_library",
"//app/job/main/app-wall/model:go_default_library",
"//app/job/main/app-wall/model/unicom:go_default_library",
"//library/cache/memcache:go_default_library",
"//library/database/sql:go_default_library",
"//library/ecode:go_default_library",
"//library/log:go_default_library",
"//library/net/http/blademaster:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,183 @@
package unicom
import (
"bytes"
"context"
"crypto/md5"
"encoding/base64"
"encoding/hex"
"encoding/json"
"net/http"
"net/url"
"sort"
"strconv"
"strings"
"time"
"go-common/app/job/main/app-wall/model"
"go-common/app/job/main/app-wall/model/unicom"
"go-common/library/ecode"
"go-common/library/log"
httpx "go-common/library/net/http/blademaster"
)
const (
// unicom
_unicomUser = "000012"
_unicomPass = "1pibH5e1BN4V"
_unicomAppKey = "com.aop.app.bilibili"
_unicomMethodQryFlowChange = "com.ssp.method.outqryflowchange"
_unicomSecurity = "DVniSMVU6Z3cCIG3vbOn4Fqbof+QJ/6etD+lpa4M4clgj/Dv6XT0syTR8Xgu5nVzKuzro8eiTUzHy/QAzGjp+A=="
// url
_unicomFlowExchangeURL = "/openservlet"
_unicomIPURL = "/web/statistics/subsystem_2/query_ip.php"
)
// FlowQry unicom phone qryflowchange
func (d *Dao) FlowQry(c context.Context, phone int, requestNo int64, outorderid, orderid string, ts time.Time) (orderstatus, msg string, err error) {
param := url.Values{}
param.Set("appkey", _unicomAppKey)
param.Set("apptx", strconv.FormatInt(requestNo, 10))
param.Set("method", _unicomMethodQryFlowChange)
param.Set("orderid", orderid)
param.Set("outorderid", outorderid)
param.Set("timestamp", ts.Format("2006-01-02 15:04:05"))
param.Set("usernumber", strconv.Itoa(phone))
urlVal := d.urlParams(param)
urlVal = urlVal + "&" + d.sign(urlVal)
var res struct {
Code string `json:"respcode"`
Orderstatus string `json:"orderstatus"`
Failurtype string `json:"failurtype"`
Msg string `json:"respdesc"`
}
if err = d.unicomHTTPGet(c, d.unicomFlowExchangeURL+"?"+urlVal, nil, &res); err != nil {
log.Error("unicom flowQry url(%v) error(%v)", d.unicomFlowExchangeURL+"?"+urlVal, err)
return
}
b, _ := json.Marshal(&res)
log.Info("unicom flowQry url(%v) response(%s)", d.unicomFlowExchangeURL+"?"+urlVal, b)
msg = res.Msg
if res.Code != "0000" {
err = ecode.String(res.Code)
log.Error("unicom flowQry url(%v) code(%v) msg(%v)", d.unicomFlowExchangeURL+"?"+urlVal, res.Code, res.Msg)
return
}
orderstatus = res.Orderstatus
return
}
// UnicomIP unicom ip orders
func (d *Dao) UnicomIP(c context.Context, now time.Time) (unicomIPs []*unicom.UnicomIP, err error) {
params := url.Values{}
params.Set("user", _unicomUser)
tick := strconv.FormatInt(now.Unix(), 10)
params.Set("tick", tick)
mh := md5.Sum([]byte(_unicomUser + tick + _unicomPass))
var (
key string
)
if key = hex.EncodeToString(mh[:]); len(key) > 16 {
key = key[:16]
}
params.Set("key", key)
var res struct {
Code int `json:"code"`
LastUpdateTime int64 `json:"last_update_time"`
Desc []struct {
StartIP string `json:"start_ip"`
Length string `json:"length"`
} `json:"desc"`
}
if err = d.unicomHTTPPost(c, d.unicomIPURL, params, &res); err != nil {
log.Error("unicom ip order url(%s) error(%v)", d.unicomIPURL+"?"+params.Encode(), err)
return
}
if res.Code != 0 {
err = ecode.Int(res.Code)
log.Error("unicom ip order url(%s) res code (%d)", d.unicomIPURL+"?"+params.Encode(), res.Code)
return
}
b, _ := json.Marshal(&res)
log.Info("unicom ip url(%s) response(%s)", d.unicomIPURL+"?"+params.Encode(), b)
for _, uip := range res.Desc {
uiplen, _ := strconv.Atoi(uip.Length)
if uiplen < 1 {
log.Error("unicom ip length 0")
continue
}
ipEndInt := model.InetAtoN(uip.StartIP) + uint32((uiplen - 1))
ipEnd := model.InetNtoA(ipEndInt)
unicomIP := &unicom.UnicomIP{}
unicomIP.UnicomIPStrToint(uip.StartIP, ipEnd)
unicomIPs = append(unicomIPs, unicomIP)
}
return
}
// unicomHTTPGet http get
func (d *Dao) unicomHTTPGet(c context.Context, urlStr string, params url.Values, res interface{}) (err error) {
return d.wallHTTP(c, d.uclient, http.MethodGet, urlStr, params, res)
}
// unicomHTTPPost http post
func (d *Dao) unicomHTTPPost(c context.Context, urlStr string, params url.Values, res interface{}) (err error) {
return d.wallHTTP(c, d.uclient, http.MethodPost, urlStr, params, res)
}
// wallHTTP http
func (d *Dao) wallHTTP(c context.Context, client *httpx.Client, method, urlStr string, params url.Values, res interface{}) (err error) {
var (
req *http.Request
)
ru := urlStr
if params != nil {
ru = urlStr + "?" + params.Encode()
}
switch method {
case http.MethodGet:
req, err = http.NewRequest(http.MethodGet, ru, nil)
default:
req, err = http.NewRequest(http.MethodPost, urlStr, strings.NewReader(params.Encode()))
}
if err != nil {
log.Error("unicom_http.NewRequest url(%s) error(%v)", urlStr+"?"+params.Encode(), err)
return
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("X-BACKEND-BILI-REAL-IP", "")
return client.Do(c, req, &res)
}
func (d *Dao) urlParams(v url.Values) string {
if v == nil {
return ""
}
var buf bytes.Buffer
keys := make([]string, 0, len(v))
for k := range v {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
vs := v[k]
prefix := k + "="
for _, v := range vs {
if buf.Len() > 0 {
buf.WriteByte('&')
}
buf.WriteString(prefix)
buf.WriteString(v)
}
}
return buf.String()
}
func (d *Dao) sign(params string) string {
str := strings.Replace(params, "&", "$", -1)
str2 := strings.Replace(str, "=", "$", -1)
mh := md5.Sum([]byte(_unicomSecurity + "$" + str2 + "$" + _unicomSecurity))
signparam := url.Values{}
signparam.Set("sign", base64.StdEncoding.EncodeToString(mh[:]))
return signparam.Encode()
}

View File

@@ -0,0 +1,248 @@
package unicom
import (
"context"
"fmt"
"time"
"go-common/app/job/main/app-wall/model/unicom"
"go-common/library/cache/memcache"
"go-common/library/log"
)
const (
_prefix = "unicoms_user_%v"
_userbindkey = "unicoms_user_bind_%d"
_userbindreceive = "unicom_pack_receives_%d"
_userflowkey = "unicom_user_flow_%v"
_userflowlistkey = "unicom_user_flow_list"
)
func keyUserBind(mid int64) string {
return fmt.Sprintf(_userbindkey, mid)
}
func keyUserBindReceive(mid int64) string {
return fmt.Sprintf(_userbindreceive, mid)
}
func keyUnicom(usermob string) string {
return fmt.Sprintf(_prefix, usermob)
}
func keyUserFlow(key string) string {
return fmt.Sprintf(_userflowkey, key)
}
// UserBindCache user bind cache
func (d *Dao) UserBindCache(c context.Context, mid int64) (ub *unicom.UserBind, err error) {
var (
key = keyUserBind(mid)
conn = d.mc.Get(c)
r *memcache.Item
)
defer conn.Close()
if r, err = conn.Get(key); err != nil {
if err != memcache.ErrNotFound {
log.Error("UserBindCache error(%v) or mid(%v)", err, mid)
}
return
}
if err = conn.Scan(r, &ub); err != nil {
log.Error("r.Scan(%s) error(%v)", r.Value, err)
}
return
}
// AddUserBindCache add user user bind cache
func (d *Dao) AddUserBindCache(c context.Context, mid int64, ub *unicom.UserBind) (err error) {
var (
key = keyUserBind(mid)
conn = d.mc.Get(c)
)
if err = conn.Set(&memcache.Item{Key: key, Object: ub, Flags: memcache.FlagJSON, Expiration: 0}); err != nil {
log.Error("AddUserBindCache d.mc.Set(%s,%v) error(%v)", key, ub, err)
}
conn.Close()
return
}
// DeleteUserBindCache delete user bind cache
func (d *Dao) DeleteUserBindCache(c context.Context, mid int64) (err error) {
var (
key = keyUserBind(mid)
conn = d.mc.Get(c)
)
defer conn.Close()
if err = conn.Delete(key); err != nil {
if err == memcache.ErrNotFound {
err = nil
return
}
log.Error("DeleteUserBindCache MemchDB.Delete(%s) error(%v)", key, err)
return
}
return
}
// UserPackReceiveCache user pack cache
func (d *Dao) UserPackReceiveCache(c context.Context, mid int64) (count int, err error) {
var (
key = keyUserBindReceive(mid)
conn = d.mc.Get(c)
r *memcache.Item
)
defer conn.Close()
if r, err = conn.Get(key); err != nil {
if err == memcache.ErrNotFound {
err = nil
return
}
log.Error("UserBindCache MemchDB.Get(%s) error(%v)", key, err)
return
}
if err = conn.Scan(r, &count); err != nil {
log.Error("r.Scan(%s) error(%v)", r.Value, err)
}
return
}
// AddUserPackReceiveCache add user pack cache
func (d *Dao) AddUserPackReceiveCache(c context.Context, mid int64, count int, now time.Time) (err error) {
var (
key = keyUserBindReceive(mid)
conn = d.mc.Get(c)
currenttimeSec = int32((now.Hour() * 60 * 60) + (now.Minute() * 60) + now.Second())
overtime int32
)
if overtime = d.expire - currenttimeSec; overtime < 1 {
overtime = d.expire
}
log.Info("AddUserPackReceiveCache mid(%d) overtime(%d)", mid, overtime)
if err = conn.Set(&memcache.Item{Key: key, Object: count, Flags: memcache.FlagJSON, Expiration: overtime}); err != nil {
log.Error("AddUserPackReceiveCache d.mc.Set(%s,%v) error(%v)", key, count, err)
}
conn.Close()
return
}
// DeleteUserPackReceiveCache delete user pack cache
func (d *Dao) DeleteUserPackReceiveCache(c context.Context, mid int64) (err error) {
var (
key = keyUserBindReceive(mid)
conn = d.mc.Get(c)
)
defer conn.Close()
if err = conn.Delete(key); err != nil {
if err == memcache.ErrNotFound {
err = nil
return
}
log.Error("DeleteUserPackReceiveCache MemchDB.Delete(%s) error(%v)", key, err)
return
}
return
}
// UnicomCache
func (d *Dao) UnicomCache(c context.Context, usermob string) (u []*unicom.Unicom, err error) {
var (
key = keyUnicom(usermob)
conn = d.mc.Get(c)
r *memcache.Item
)
defer conn.Close()
if r, err = conn.Get(key); err != nil {
log.Error("unicomCache MemchDB.Get(%s) error(%v)", key, err)
return
}
if err = conn.Scan(r, &u); err != nil {
log.Error("r.Scan(%s) error(%v)", r.Value, err)
}
return
}
//UserFlowCache unicom flow cache
func (d *Dao) UserFlowCache(c context.Context, keyStr string) (err error) {
var (
key = keyUserFlow(keyStr)
conn = d.mc.Get(c)
r *memcache.Item
res struct{}
)
defer conn.Close()
if r, err = conn.Get(key); err != nil {
log.Error("UserFlowCache MemchDB.Get(%s) error(%v)", key, err)
return
}
if err = conn.Scan(r, &res); err != nil {
log.Error("r.Scan(%s) error(%v)", r.Value, err)
}
return
}
// AddUserFlowCache add user pack cache
func (d *Dao) AddUserFlowCache(c context.Context, keyStr string) (err error) {
var (
key = keyUserFlow(keyStr)
conn = d.mc.Get(c)
)
if err = conn.Set(&memcache.Item{Key: key, Object: struct{}{}, Flags: memcache.FlagJSON, Expiration: d.flowKeyExpired}); err != nil {
log.Error("AddUserPackCache d.mc.Set(%s) error(%v)", key, err)
}
conn.Close()
return
}
// DeleteUserPackCache delete user pack cache
func (d *Dao) DeleteUserFlowCache(c context.Context, keyStr string) (err error) {
var (
key = keyUserFlow(keyStr)
conn = d.mc.Get(c)
)
defer conn.Close()
if err = conn.Delete(key); err != nil {
if err == memcache.ErrNotFound {
err = nil
return
}
log.Error("DeleteUserFlowCache MemchDB.Delete(%s) error(%v)", key, err)
return
}
return
}
//UserFlowListCache unicom flow cache
func (d *Dao) UserFlowListCache(c context.Context) (res map[string]*unicom.UnicomUserFlow, err error) {
var (
key = _userflowlistkey
conn = d.mc.Get(c)
r *memcache.Item
)
defer conn.Close()
if r, err = conn.Get(key); err != nil {
if err == memcache.ErrNotFound {
err = nil
return
}
log.Error("UserFlowListCache MemchDB.Get(%s) error(%v)", key, err)
return
}
if err = conn.Scan(r, &res); err != nil {
log.Error("r.Scan(%s) error(%v)", r.Value, err)
}
return
}
// AddUserFlowListCache add user pack cache
func (d *Dao) AddUserFlowListCache(c context.Context, list map[string]*unicom.UnicomUserFlow) (err error) {
var (
key = _userflowlistkey
conn = d.mc.Get(c)
)
if err = conn.Set(&memcache.Item{Key: key, Object: list, Flags: memcache.FlagJSON, Expiration: d.flowKeyExpired}); err != nil {
log.Error("AddUserFlowListCache d.mc.Set(%s,%v) error(%v)", key, list, err)
}
conn.Close()
return
}

View File

@@ -0,0 +1,207 @@
package unicom
import (
"context"
"database/sql"
"time"
"go-common/app/job/main/app-wall/conf"
"go-common/app/job/main/app-wall/model/unicom"
"go-common/library/cache/memcache"
xsql "go-common/library/database/sql"
"go-common/library/log"
httpx "go-common/library/net/http/blademaster"
)
const (
// unicom integral change
_upUserIntegralSQL = `UPDATE unicom_user_bind SET integral=?,flow=?,monthlytime=? WHERE mid=? AND state=1`
_orderUserSyncSQL = `SELECT usermob,spid,type,ordertime,endtime FROM unicom_order WHERE usermob=? AND type=0 ORDER BY type DESC`
_bindAllSQL = `SELECT mid,usermob,monthlytime FROM unicom_user_bind WHERE state=1 LIMIT ?,?`
_userBindSQL = `SELECT usermob,phone,mid,state,integral,flow,monthlytime FROM unicom_user_bind WHERE state=1 AND mid=?`
// update unicom ip
_inUnicomIPSyncSQL = `INSERT IGNORE INTO unicom_ip (ipbegion,ipend,isopen,ctime,mtime) VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE
ipbegion=?,ipend=?,isopen=?,mtime=?`
_upUnicomIPSQL = `UPDATE unicom_ip SET isopen=?,mtime=? WHERE ipbegion=? AND ipend=?`
_ipSyncSQL = `SELECT ipbegion,ipend FROM unicom_ip WHERE isopen=1`
_inUserPackLogSQL = `INSERT INTO unicom_user_packs_log (phone,usermob,mid,request_no,ptype,integral,pdesc) VALUES (?,?,?,?,?,?,?)`
_inUserIntegralLogSQL = `INSERT INTO unicom_user_integral_log (phone,mid,unicom_desc,ptype,integral,flow,pdesc) VALUES (?,?,?,?,?,?,?)`
)
type Dao struct {
db *xsql.DB
uclient *httpx.Client
// memcache
mc *memcache.Pool
flowKeyExpired int32
expire int32
// unicom integral change
upUserIntegralSQL *xsql.Stmt
orderUserSyncSQL *xsql.Stmt
bindAllSQL *xsql.Stmt
userBindSQL *xsql.Stmt
ipSyncSQL *xsql.Stmt
inUserPackLogSQL *xsql.Stmt
inUserIntegralLogSQL *xsql.Stmt
// unicom url
unicomFlowExchangeURL string
unicomIPURL string
}
func New(c *conf.Config) (d *Dao) {
d = &Dao{
db: xsql.NewMySQL(c.MySQL.Show),
uclient: httpx.NewClient(conf.Conf.HTTPUnicom),
// memcache
mc: memcache.NewPool(c.Memcache.Operator.Config),
expire: int32(time.Duration(c.Unicom.PackKeyExpired) / time.Second),
flowKeyExpired: int32(time.Duration(c.Unicom.KeyExpired) / time.Second),
// unicom url
unicomFlowExchangeURL: c.Host.UnicomFlow + _unicomFlowExchangeURL,
unicomIPURL: c.Host.Unicom + _unicomIPURL,
}
// unicom integral change
d.upUserIntegralSQL = d.db.Prepared(_upUserIntegralSQL)
d.orderUserSyncSQL = d.db.Prepared(_orderUserSyncSQL)
d.bindAllSQL = d.db.Prepared(_bindAllSQL)
d.userBindSQL = d.db.Prepared(_userBindSQL)
d.ipSyncSQL = d.db.Prepared(_ipSyncSQL)
d.inUserPackLogSQL = d.db.Prepared(_inUserPackLogSQL)
d.inUserIntegralLogSQL = d.db.Prepared(_inUserIntegralLogSQL)
return
}
// UpUserIntegral update unicom user integral
func (d *Dao) UpUserIntegral(ctx context.Context, ub *unicom.UserBind) (row int64, err error) {
res, err := d.upUserIntegralSQL.Exec(ctx, ub.Integral, ub.Flow, ub.Monthly, ub.Mid)
if err != nil {
log.Error("update user integral sql error(%v)", err)
return 0, err
}
return res.RowsAffected()
}
// OrdersUserFlow select user OrdersSync
func (d *Dao) OrdersUserFlow(ctx context.Context, usermob string) (res []*unicom.Unicom, err error) {
rows, err := d.orderUserSyncSQL.Query(ctx, usermob)
if err != nil {
log.Error("query error (%v)", err)
return
}
defer rows.Close()
for rows.Next() {
u := &unicom.Unicom{}
if err = rows.Scan(&u.Usermob, &u.Spid, &u.TypeInt, &u.Ordertime, &u.Endtime); err != nil {
log.Error("OrdersUserFlow row.Scan err (%v)", err)
return
}
res = append(res, u)
}
return
}
//BindAll select bind all mid state 1
func (d *Dao) BindAll(ctx context.Context, start, end int) (res []*unicom.UserBind, err error) {
rows, err := d.bindAllSQL.Query(ctx, start, end)
if err != nil {
log.Error("query error (%v)", err)
return
}
defer rows.Close()
for rows.Next() {
u := &unicom.UserBind{}
if err = rows.Scan(&u.Mid, &u.Usermob, &u.Monthly); err != nil {
log.Error("BindAll rows.Scan error(%v)", err)
return
}
res = append(res, u)
}
return
}
// UserBind unicom select user bind
func (d *Dao) UserBind(ctx context.Context, mid int64) (res *unicom.UserBind, err error) {
row := d.userBindSQL.QueryRow(ctx, mid)
if row == nil {
log.Error("userBindSQL is null")
return
}
res = &unicom.UserBind{}
if err = row.Scan(&res.Usermob, &res.Phone, &res.Mid, &res.State, &res.Integral, &res.Flow, &res.Monthly); err != nil {
if err == sql.ErrNoRows {
err = nil
} else {
log.Error("userBindSQL row.Scan error(%v)", err)
}
res = nil
return
}
return
}
// InUnicomIPSync insert or update unicom_ip
func (d *Dao) InUnicomIPSync(tx *xsql.Tx, u *unicom.UnicomIP, now time.Time) (row int64, err error) {
res, err := tx.Exec(_inUnicomIPSyncSQL, u.Ipbegin, u.Ipend, 1, now, now,
u.Ipbegin, u.Ipend, 1, now)
if err != nil {
log.Error("tx.inUnicomIPSyncSQL.Exec error(%v)", err)
return 0, err
}
return res.RowsAffected()
}
// UpUnicomIP update unicom_ip state
func (d *Dao) UpUnicomIP(tx *xsql.Tx, ipstart, ipend, state int, now time.Time) (row int64, err error) {
res, err := tx.Exec(_upUnicomIPSQL, state, now, ipstart, ipend)
if err != nil {
log.Error("tx.upUnicomIPSQL.Exec error(%v)", err)
return 0, err
}
return res.RowsAffected()
}
// IPSync select all ipSync
func (d *Dao) IPSync(ctx context.Context) (res []*unicom.UnicomIP, err error) {
rows, err := d.ipSyncSQL.Query(ctx)
if err != nil {
log.Error("query error (%v)", err)
return
}
defer rows.Close()
res = []*unicom.UnicomIP{}
for rows.Next() {
u := &unicom.UnicomIP{}
if err = rows.Scan(&u.Ipbegin, &u.Ipend); err != nil {
log.Error("rows.Scan error(%v)", err)
return
}
u.UnicomIPChange()
res = append(res, u)
}
return
}
// InUserPackLog insert unicom user pack log
func (d *Dao) InUserPackLog(ctx context.Context, u *unicom.UserPackLog) (row int64, err error) {
res, err := d.inUserPackLogSQL.Exec(ctx, u.Phone, u.Usermob, u.Mid, u.RequestNo, u.Type, u.Integral, u.Desc)
if err != nil {
log.Error("insert user pack log integral sql error(%v)", err)
return 0, err
}
return res.RowsAffected()
}
// InUserIntegralLog insert unicom user add integral and flow log
func (d *Dao) InUserIntegralLog(ctx context.Context, u *unicom.UserIntegralLog) (row int64, err error) {
res, err := d.inUserIntegralLogSQL.Exec(ctx, u.Phone, u.Mid, u.UnicomDesc, u.Type, u.Integral, u.Flow, u.Desc)
if err != nil {
log.Error("insert user add integral and flow sql error(%v)", err)
return 0, err
}
return res.RowsAffected()
}
// BeginTran begin a transacition
func (d *Dao) BeginTran(ctx context.Context) (tx *xsql.Tx, err error) {
return d.db.Begin(ctx)
}

View File

@@ -0,0 +1,108 @@
package unicom
import (
"context"
"flag"
"path/filepath"
"testing"
"time"
"go-common/app/job/main/app-wall/conf"
"go-common/app/job/main/app-wall/model/unicom"
. "github.com/smartystreets/goconvey/convey"
)
var (
d *Dao
)
func ctx() context.Context {
return context.Background()
}
func init() {
dir, _ := filepath.Abs("../../cmd/app-wall-job-test.toml")
flag.Set("conf", dir)
conf.Init()
d = New(conf.Conf)
time.Sleep(time.Second)
}
func TestUpUserIntegral(t *testing.T) {
Convey("UpUserIntegral", t, func() {
res, err := d.UpUserIntegral(ctx(), &unicom.UserBind{})
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestOrdersUserFlow(t *testing.T) {
Convey("OrdersUserFlow", t, func() {
res, err := d.OrdersUserFlow(ctx(), "")
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestBindAll(t *testing.T) {
Convey("BindAll", t, func() {
res, err := d.BindAll(ctx(), 1, 1)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestUserBind(t *testing.T) {
Convey("UserBind", t, func() {
res, err := d.UserBind(ctx(), 1)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestIPSync(t *testing.T) {
Convey("IPSync", t, func() {
res, err := d.IPSync(ctx())
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestInUserPackLog(t *testing.T) {
Convey("InUserPackLog", t, func() {
res, err := d.InUserPackLog(ctx(), nil)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestInUserIntegralLog(t *testing.T) {
Convey("InUserIntegralLog", t, func() {
res, err := d.InUserIntegralLog(ctx(), nil)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestUserBindCache(t *testing.T) {
Convey("UserBindCache", t, func() {
res, err := d.UserBindCache(ctx(), 1)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestAddUserBindCache(t *testing.T) {
Convey("AddUserBindCache", t, func() {
err := d.AddUserBindCache(ctx(), 1, nil)
So(err, ShouldBeNil)
})
}
func TestDeleteUserPackReceiveCache(t *testing.T) {
Convey("DeleteUserPackReceiveCache", t, func() {
err := d.DeleteUserPackReceiveCache(ctx(), 1)
So(err, ShouldBeNil)
})
}