package userrpc
|
|
|
|
import (
|
|
"strconv"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func Test_GetUserScore(t *testing.T) {
|
|
|
|
dbname := "shop_v2_org"
|
|
id := "2"
|
|
|
|
ret, err := GetUserScore(dbname, id)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_GetUserRedEnvelope(t *testing.T) {
|
|
|
|
dbname := "shop_v2_org"
|
|
id := "2"
|
|
|
|
ret, err := GetUserRedEnvelope(dbname, id)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserScore(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
score := "20"
|
|
|
|
ret, err := AddUserScore(dbname, userid, score,"")
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_UpdateUserScore(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
score := "400"
|
|
used_score := "300"
|
|
|
|
ret, err := UpdateUserScore(dbname, userid, score, used_score)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserScoreLog(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
score := "100"
|
|
before := "500"
|
|
after := "400"
|
|
Source := "task"
|
|
SourceId := ""
|
|
OrderSn := ""
|
|
Target := ""
|
|
TargetId := ""
|
|
ProductThumb := ""
|
|
Memo := ""
|
|
|
|
ret, err := AddUserScoreLog(dbname, userid, score, before, after, Source, SourceId, OrderSn, Target, TargetId, ProductThumb, Memo)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserUpgrade(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "5"
|
|
upgrade := "100"
|
|
|
|
ret, err := AddUserUpgrade(dbname, userid, upgrade,"")
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_UpdateUserUpgrade(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "5"
|
|
upgrade := "100"
|
|
|
|
ret, err := UpdateUserUpgrade(dbname, userid, upgrade)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserUpgradeLog(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
upgrade := "20"
|
|
before := "11"
|
|
after := "31"
|
|
Source := "task"
|
|
Memo := ""
|
|
|
|
ret, err := AddUserUpgradeLog(dbname, userid, upgrade, before, after, Source, Memo)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserRedEnvelope(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "5"
|
|
money := "20"
|
|
|
|
ret, err := AddUserRedEnvelope(dbname, userid, money,"")
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_UpdateUserRedEnvelope(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
money := "40"
|
|
used_money := "1"
|
|
|
|
ret, err := UpdateUserRedEnvelope(dbname, userid, money, used_money)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserRedEnvelopeLog(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
money := "-1"
|
|
before := "41"
|
|
after := "40"
|
|
Source := "task"
|
|
SourceId := ""
|
|
OrderSn := "216304042479173922"
|
|
Target := ""
|
|
TargetId := ""
|
|
ProductThumb := ""
|
|
Memo := ""
|
|
|
|
ret, err := AddUserRedEnvelopeLog(dbname, userid, money, before, after, Source, SourceId, OrderSn, Target, TargetId, ProductThumb, Memo)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_AddUserCoupon(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
couponId := "6"
|
|
expired_time := "1634684122"
|
|
order_sn := ""
|
|
remark := "商品券"
|
|
|
|
ret, err := AddUserCoupon(dbname, userid, couponId, expired_time,order_sn,remark)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|
|
|
|
func Test_UpdateUserCoupon(t *testing.T) {
|
|
dbname := "shop_v2_org"
|
|
userid := "2"
|
|
couponId := "6"
|
|
remark := "下单使用优惠券"
|
|
orderSn := "12345678910"
|
|
isUse := "1"
|
|
usetime := strconv.Itoa(int(time.Now().Unix()))
|
|
|
|
ret, err := UpdateUserCoupon(dbname, userid, couponId, remark, orderSn, isUse,usetime)
|
|
t.Log(ret)
|
|
t.Log(err)
|
|
}
|