用户接口远程调用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
3.5 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package userrpc
  2. import (
  3. "strconv"
  4. "testing"
  5. "time"
  6. )
  7. func Test_GetUserScore(t *testing.T) {
  8. dbname := "shop_v2_org"
  9. id := "2"
  10. ret, err := GetUserScore(dbname, id)
  11. t.Log(ret)
  12. t.Log(err)
  13. }
  14. func Test_GetUserRedEnvelope(t *testing.T) {
  15. dbname := "shop_v2_org"
  16. id := "2"
  17. ret, err := GetUserRedEnvelope(dbname, id)
  18. t.Log(ret)
  19. t.Log(err)
  20. }
  21. func Test_AddUserScore(t *testing.T) {
  22. dbname := "shop_v2_org"
  23. userid := "2"
  24. score := "20"
  25. ret, err := AddUserScore(dbname, userid, score,"")
  26. t.Log(ret)
  27. t.Log(err)
  28. }
  29. func Test_UpdateUserScore(t *testing.T) {
  30. dbname := "shop_v2_org"
  31. userid := "2"
  32. score := "400"
  33. used_score := "300"
  34. ret, err := UpdateUserScore(dbname, userid, score, used_score)
  35. t.Log(ret)
  36. t.Log(err)
  37. }
  38. func Test_AddUserScoreLog(t *testing.T) {
  39. dbname := "shop_v2_org"
  40. userid := "2"
  41. score := "100"
  42. before := "500"
  43. after := "400"
  44. Source := "task"
  45. SourceId := ""
  46. OrderSn := ""
  47. Target := ""
  48. TargetId := ""
  49. ProductThumb := ""
  50. Memo := ""
  51. ret, err := AddUserScoreLog(dbname, userid, score, before, after, Source, SourceId, OrderSn, Target, TargetId, ProductThumb, Memo)
  52. t.Log(ret)
  53. t.Log(err)
  54. }
  55. func Test_AddUserUpgrade(t *testing.T) {
  56. dbname := "shop_v2_org"
  57. userid := "5"
  58. upgrade := "100"
  59. ret, err := AddUserUpgrade(dbname, userid, upgrade,"")
  60. t.Log(ret)
  61. t.Log(err)
  62. }
  63. func Test_UpdateUserUpgrade(t *testing.T) {
  64. dbname := "shop_v2_org"
  65. userid := "5"
  66. upgrade := "100"
  67. ret, err := UpdateUserUpgrade(dbname, userid, upgrade)
  68. t.Log(ret)
  69. t.Log(err)
  70. }
  71. func Test_AddUserUpgradeLog(t *testing.T) {
  72. dbname := "shop_v2_org"
  73. userid := "2"
  74. upgrade := "20"
  75. before := "11"
  76. after := "31"
  77. Source := "task"
  78. Memo := ""
  79. ret, err := AddUserUpgradeLog(dbname, userid, upgrade, before, after, Source, Memo)
  80. t.Log(ret)
  81. t.Log(err)
  82. }
  83. func Test_AddUserRedEnvelope(t *testing.T) {
  84. dbname := "shop_v2_org"
  85. userid := "5"
  86. money := "20"
  87. ret, err := AddUserRedEnvelope(dbname, userid, money,"")
  88. t.Log(ret)
  89. t.Log(err)
  90. }
  91. func Test_UpdateUserRedEnvelope(t *testing.T) {
  92. dbname := "shop_v2_org"
  93. userid := "2"
  94. money := "40"
  95. used_money := "1"
  96. ret, err := UpdateUserRedEnvelope(dbname, userid, money, used_money)
  97. t.Log(ret)
  98. t.Log(err)
  99. }
  100. func Test_AddUserRedEnvelopeLog(t *testing.T) {
  101. dbname := "shop_v2_org"
  102. userid := "2"
  103. money := "-1"
  104. before := "41"
  105. after := "40"
  106. Source := "task"
  107. SourceId := ""
  108. OrderSn := "216304042479173922"
  109. Target := ""
  110. TargetId := ""
  111. ProductThumb := ""
  112. Memo := ""
  113. ret, err := AddUserRedEnvelopeLog(dbname, userid, money, before, after, Source, SourceId, OrderSn, Target, TargetId, ProductThumb, Memo)
  114. t.Log(ret)
  115. t.Log(err)
  116. }
  117. func Test_AddUserCoupon(t *testing.T) {
  118. dbname := "shop_v2_org"
  119. userid := "2"
  120. couponId := "6"
  121. expired_time := "1634684122"
  122. order_sn := ""
  123. remark := "商品券"
  124. ret, err := AddUserCoupon(dbname, userid, couponId, expired_time,order_sn,remark)
  125. t.Log(ret)
  126. t.Log(err)
  127. }
  128. func Test_UpdateUserCoupon(t *testing.T) {
  129. dbname := "shop_v2_org"
  130. userid := "2"
  131. couponId := "6"
  132. remark := "下单使用优惠券"
  133. orderSn := "12345678910"
  134. isUse := "1"
  135. usetime := strconv.Itoa(int(time.Now().Unix()))
  136. ret, err := UpdateUserCoupon(dbname, userid, couponId, remark, orderSn, isUse,usetime)
  137. t.Log(ret)
  138. t.Log(err)
  139. }