|
@ -1,34 +1,162 @@ |
|
|
package userrpc |
|
|
package userrpc |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"testing" |
|
|
|
|
|
|
|
|
"testing" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func Test_GetUserScore(t *testing.T) { |
|
|
func Test_GetUserScore(t *testing.T) { |
|
|
|
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
id := "2" |
|
|
|
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
id := "2" |
|
|
|
|
|
|
|
|
ret, err := GetUserScore(dbname, id) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
|
|
|
ret, err := GetUserScore(dbname, id) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func Test_GetUserRedEnvelope(t *testing.T) { |
|
|
func Test_GetUserRedEnvelope(t *testing.T) { |
|
|
|
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
id := "2" |
|
|
|
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
id := "2" |
|
|
|
|
|
|
|
|
ret, err := GetUserRedEnvelope(dbname, id) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
|
|
|
ret, err := GetUserRedEnvelope(dbname, id) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func Test_AddUserScore(t *testing.T) { |
|
|
func Test_AddUserScore(t *testing.T) { |
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
score := "20" |
|
|
|
|
|
|
|
|
ret, err := AddUserScore(dbname,userid,"20") |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
|
|
|
ret, err := AddUserScore(dbname, userid, score) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_UpdateUserScore(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
score := "20" |
|
|
|
|
|
used_score := "10" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := UpdateUserScore(dbname, userid, score, used_score) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_AddUserScoreLog(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
score := "20" |
|
|
|
|
|
before := "10" |
|
|
|
|
|
after := "30" |
|
|
|
|
|
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" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
upgrade := "20" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := AddUserUpgrade(dbname, userid, upgrade) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_UpdateUserUpgrade(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
upgrade := "20" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := UpdateUserUpgrade(dbname, userid, upgrade) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_AddUserUpgradeLog(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
upgrade := "20" |
|
|
|
|
|
before := "10" |
|
|
|
|
|
after := "30" |
|
|
|
|
|
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" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
money := "20" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := AddUserRedEnvelope(dbname, userid, money) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_UpdateUserRedEnvelope(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
money := "20" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := UpdateUserRedEnvelope(dbname, userid, money) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_AddUserRedEnvelopeLog(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
money := "20" |
|
|
|
|
|
before := "10" |
|
|
|
|
|
after := "30" |
|
|
|
|
|
Source := "task" |
|
|
|
|
|
SourceId := "" |
|
|
|
|
|
OrderSn := "" |
|
|
|
|
|
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" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
couponId := "20" |
|
|
|
|
|
expired_time := "" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := AddUserCoupon(dbname, userid, couponId, expired_time) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_UpdateUserCoupon(t *testing.T) { |
|
|
|
|
|
dbname := "shop_v2" |
|
|
|
|
|
userid := "2" |
|
|
|
|
|
couponId := "20" |
|
|
|
|
|
remark := "" |
|
|
|
|
|
orderSn := "" |
|
|
|
|
|
isUse := "" |
|
|
|
|
|
|
|
|
|
|
|
ret, err := UpdateUserCoupon(dbname, userid, couponId, remark, orderSn, isUse) |
|
|
|
|
|
t.Log(ret) |
|
|
|
|
|
t.Log(err) |
|
|
} |
|
|
} |