yst.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. package model
  2. import (
  3. "strconv"
  4. "go-common/app/service/main/account/api"
  5. )
  6. // YstCreateOrderReq represents request of yst order creation.
  7. type YstCreateOrderReq struct {
  8. SeqNo string `json:"seqno" url:"seqno"`
  9. Source string `json:"source" url:"source"`
  10. ProductId string `json:"product_id" url:"product_id"`
  11. Price int32 `json:"price" url:"price"`
  12. Total int32 `json:"total" url:"total"`
  13. BuyNum int32 `json:"buy_num" url:"buy_num"`
  14. VideoType string `json:"video_type" url:"video_type"`
  15. PayType string `json:"pay_type" url:"pay_type"`
  16. PayWay string `json:"pay_way" url:"pay_way"`
  17. UserLogin string `json:"user_login" url:"user_login"`
  18. UserId string `json:"user_id" url:"user_id"`
  19. GUID string `json:"guid" url:"guid"`
  20. ClientIp string `json:"client_ip" url:"client_ip"`
  21. Sign string `json:"sign" url:"sign,omitempty"`
  22. LoginName string `json:"login_name" url:"login_name"`
  23. }
  24. // CopyFromPayOrder copies fields from pay order.
  25. func (y *YstCreateOrderReq) CopyFromPayOrder(po *PayOrder) {
  26. y.SeqNo = po.OrderNo
  27. y.Source = "snm_bilibili"
  28. y.ProductId = po.ProductId
  29. y.Price = po.Money
  30. y.Total = po.PaymentMoney
  31. y.BuyNum = po.Quantity
  32. if po.OrderType == 0 {
  33. y.VideoType = "fvod"
  34. }
  35. if po.OrderType == 1 {
  36. y.VideoType = "svod"
  37. }
  38. if po.PaymentType == PaymentTypeAliPay {
  39. y.PayType = YstPayTypeAliPay
  40. }
  41. if po.PaymentType == PaymentTypeWechat {
  42. y.PayType = YstPayTypeWechat
  43. }
  44. y.PayWay = YstPayWayQr
  45. }
  46. // CopyFromAccount copies fields from account info.
  47. func (y *YstCreateOrderReq) CopyFromAccount(account *api.Info) {
  48. y.LoginName = account.Name
  49. y.UserId = strconv.Itoa(int(account.Mid))
  50. }
  51. // YstCreateOrderReply represents response of yst order creation.
  52. type YstCreateOrderReply struct {
  53. SeqNo string `json:"seqno" url:"seqno"`
  54. TraceNo string `json:"traceno" url:"traceno"`
  55. PayWary string `json:"pay_wary" url:"pay_wary"`
  56. CodeUrl string `json:"code_url" url:"code_url"`
  57. ContractCode string `json:"contract_code" url:"contract_code"`
  58. Price int32 `json:"price" url:"price"`
  59. VideoType string `json:"video_type" url:"video_type"`
  60. PayParam string `json:"pay_param" url:"pay_param"`
  61. ResultCode string `json:"result_code" url:"result_code"`
  62. ResultMsg string `json:"result_msg" url:"result_msg"`
  63. Sign string `json:"sign"`
  64. }
  65. // YstPayCallbackReq represents request of pay callback.
  66. type YstPayCallbackReq struct {
  67. SeqNo string `json:"seqno" url:"seqno"`
  68. TraceNo string `json:"traceno" url:"traceno"`
  69. TradeState string `json:"trade_state" url:"trade_state"`
  70. ContractId string `json:"contract_id" url:"contract_id,omitempty"`
  71. Sign string `json:"sign" url:"sign"`
  72. }
  73. // YstPayCallbackReply represents response of pay callback.
  74. type YstPayCallbackReply struct {
  75. TraceNo string
  76. Result string
  77. Msg string
  78. }
  79. // PayInfo represents short pay details.
  80. type PayInfo struct {
  81. OrderNo string
  82. PaymentType string
  83. CodeUrl string
  84. PaymentMoney int32
  85. }
  86. // CopyFromPayOrder copies fields from pay order.
  87. func (p *PayInfo) CopyFromPayOrder(po *PayOrder) {
  88. p.OrderNo = po.OrderNo
  89. p.PaymentType = po.PaymentType
  90. p.PaymentMoney = po.PaymentMoney
  91. }
  92. // YstRenewOrderReq.
  93. type YstRenewOrderReq struct {
  94. SeqNo string `json:"seqno" url:"seqno"`
  95. Source string `json:"source" url:"source"`
  96. ProductId string `json:"product_id" url:"product_id"`
  97. Price int32 `json:"price" url:"price"`
  98. BuyNum int32 `json:"buy_num" url:"buy_num"`
  99. Total int32 `json:"total" url:"total"`
  100. VideoType string `json:"video_type" url:"video_type"`
  101. PayType string `json:"pay_type" url:"pay_type"`
  102. UserId string `json:"user_id" url:"user_id"`
  103. ContractId string `json:"contract_id" url:"contract_id"`
  104. Sandbox string `json:"sandbox" url:"sandbox"`
  105. ClientIp string `json:"client_ip" url:"client_ip"`
  106. Sign string `json:"sign"`
  107. }
  108. // YstRenewOrderReply.
  109. type YstRenewOrderReply struct {
  110. SeqNo string `json:"seqno" url:"seqno"`
  111. TraceNo string `json:"traceno" url:"traceno"`
  112. Price int32 `json:"price" url:"price"`
  113. VideoType string `json:"video_type" url:"video_type"`
  114. ResultCode string `json:"result_code" url:"result_code"`
  115. ResultMsg string `json:"result_msg" url:"result_msg"`
  116. Sign string `json:"sign" `
  117. }
  118. // YstOrderState.
  119. type YstOrderStateReq struct {
  120. SeqNo string `json:"seqno" url:"seqno"`
  121. TraceNo string `json:"traceno" url:"traceno"`
  122. Sign string `json:"sign" url:"sign"`
  123. }
  124. // YstOrderStateReply.
  125. type YstOrderStateReply struct {
  126. SeqNo string `json:"seqno" `
  127. TraceNo string `json:"traceno" `
  128. PayStatus string `json:"pay_status"`
  129. Result string `json:"result"`
  130. Msg string `json:"msg"`
  131. }
  132. // YstUserInfoReq.
  133. type YstUserInfoReq struct {
  134. Mid int32 `json:"mid" url:"mid"`
  135. Sign string `json:"sign" url:"sign,omitempty"`
  136. }
  137. // WxContractCallbackReq.
  138. type WxContractCallbackReq struct {
  139. ContractId string `json:"contract_id" url:"contract_id"`
  140. ContractCode string `json:"contract_code" url:"contract_code"`
  141. ChangeType string `json:"change_type" url:"contract_id"`
  142. ContractTerminationMode string `json:"contract_termination_mode" url:"contract_termination_mode,omitempty"`
  143. Sign string `json:"sign" url:"sign"`
  144. }
  145. // WxContractCallbackReply.
  146. type WxContractCallbackReply struct {
  147. ContractId string `json:"contract_id"`
  148. Result string `json:"result"`
  149. Msg string `json:"msg"`
  150. }