order.go 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. package model
  2. import (
  3. "go-common/library/time"
  4. )
  5. // order status
  6. const (
  7. PAYING int8 = iota + 1
  8. SUCCESS
  9. FAILED
  10. Sign
  11. UnSign
  12. REFUNDING
  13. REFUNDED
  14. REFUNDFAIL
  15. CANCEL = 20
  16. )
  17. // order type
  18. const (
  19. General int8 = iota
  20. AutoRenew
  21. )
  22. // quick pay status
  23. const (
  24. QuickPaySuccess int8 = iota + 1
  25. QuickPayFailed
  26. )
  27. // pay way
  28. const (
  29. ALIPAY int8 = iota + 1
  30. WECHAT
  31. BCION
  32. BANK
  33. PAYPAL
  34. IOSPAY
  35. QPAY
  36. )
  37. // pay origin
  38. const (
  39. MobileOrigin int8 = iota + 1
  40. WebOrigin
  41. H5
  42. )
  43. // PayType pay type
  44. var PayType = map[int8]string{
  45. ALIPAY: "alipay",
  46. WECHAT: "wechat",
  47. BCION: "bp",
  48. BANK: "bank",
  49. PAYPAL: "paypal",
  50. IOSPAY: "iospay",
  51. QPAY: "qpay",
  52. }
  53. // PayTypeName pay name.
  54. var PayTypeName = map[string]int8{
  55. "alipay": ALIPAY,
  56. "wechat": WECHAT,
  57. "bp": BCION,
  58. "bank": BANK,
  59. "paypal": PAYPAL,
  60. "iospay": IOSPAY,
  61. }
  62. // AddPayOrderResp add pay order
  63. type AddPayOrderResp struct {
  64. OrderNo string `json:"order_no"`
  65. CashierURL string `json:"cashier_url"`
  66. QrcodeURL string `json:"qrcode_url"`
  67. }
  68. //PayBankResp pay bank resp
  69. type PayBankResp struct {
  70. BanckCode string `json:"bankCode"`
  71. Name string `json:"name"`
  72. Res string `json:"res"`
  73. }
  74. //PayAccountResp .
  75. type PayAccountResp struct {
  76. Mid int64 `json:"mid"`
  77. Brokerage float64 `json:"brokerage"`
  78. DefaultBp float64 `json:"default_bp"`
  79. }
  80. //APIPayOrderResp api pay resp.
  81. type APIPayOrderResp struct {
  82. SDK string `json:"sdk"`
  83. QrcodeURL string `json:"qrcode_url"`
  84. CashierURL string `json:"cashier_url"`
  85. RechargeOrderNo string `json:"recharge_order_no"`
  86. }
  87. // QucikPayResp quick pay token.
  88. type QucikPayResp struct {
  89. Token string `json:"token"`
  90. }
  91. // PayRetResp pay ret response.
  92. type PayRetResp struct {
  93. Status int8 `json:"status"`
  94. }
  95. // BuyVipResp buy vip resp.
  96. type BuyVipResp struct {
  97. Qrcode string `json:"qrcode"`
  98. CashierURL string `json:"cashier_url"`
  99. OrderNo string `json:"orderNo"`
  100. RechargeOrderNo string `json:"rechargeOrderNo"`
  101. PayPayOrderNo string `json:"payPayOrderNo"`
  102. PaySign string `json:"paySign"`
  103. Status int8 `json:"status"`
  104. ProductID string `json:"productId"`
  105. }
  106. //PayOrder pay order
  107. type PayOrder struct {
  108. ID int64 `json:"_"`
  109. OrderNo string `json:"order_no"`
  110. AppID int64 `json:"app_id"`
  111. Platform int8 `json:"platform"`
  112. OrderType int8 `json:"order_type"`
  113. AppSubID string `json:"app_sub_id"`
  114. Mid int64 `json:"mid"`
  115. ToMid int64 `json:"to_mid"`
  116. BuyMonths int16 `json:"buy_months"`
  117. Money float64 `json:"money"`
  118. RefundAmount float64 `json:"refund_amount"`
  119. Status int8 `json:"status"`
  120. PayType int8 `json:"pay_type"`
  121. RechargeBp float64 `json:"recharge_bp"`
  122. ThirdTradeNo string `json:"third_trade_no"`
  123. Ver int64 `json:"ver"`
  124. CouponMoney float64 `json:"coupon_money"`
  125. PaymentTime time.Time `json:"payment_time"`
  126. Ctime time.Time `json:"ctime"`
  127. Mtime time.Time `json:"mtime"`
  128. PID int64 `json:"p_id"`
  129. UserIP []byte `json:"-"`
  130. }
  131. //PayOrderResp pay order resp.
  132. type PayOrderResp struct {
  133. OrderNo string `json:"order_no"`
  134. BuyMonths int16 `json:"buy_months"`
  135. Money float64 `json:"money"`
  136. Status int8 `json:"status"`
  137. Remark string `json:"remark"`
  138. Ctime time.Time `json:"ctime"`
  139. }
  140. // Month def.
  141. type Month struct {
  142. ID int64 `json:"_"`
  143. Month int16 `json:"month"`
  144. MonthType int8 `json:"month_type"`
  145. Operator string `json:"operator"`
  146. Status int8 `json:"status"`
  147. Deleted int8 `json:"deleted"`
  148. Mtime time.Time `json:"mtime"`
  149. }
  150. // PriceMapping vip month map.
  151. type PriceMapping struct {
  152. ID int64 `json:"_"`
  153. MonthID int64 `json:"month_id"`
  154. MonthType int8 `json:"month_type"`
  155. Money float64 `json:"money"`
  156. Selected int8 `json:"selected"`
  157. FirstDiscountMoney float64 `json:"first_discount_money"`
  158. DiscountMoney float64 `json:"discount_money"`
  159. StartTime time.Time `json:"start_time"`
  160. EndTime time.Time `json:"end_time"`
  161. Remark string `json:"remark"`
  162. Operator string `json:"operator"`
  163. Mtime time.Time `json:"mtime"`
  164. }
  165. //PayPlatformOrder .
  166. type PayPlatformOrder struct {
  167. CustomerID string `json:"customerId"`
  168. DeviceType int8 `json:"deviceType"`
  169. OrderID string `json:"orderId"`
  170. OrderCreateTime string `json:"orderCreateTime"`
  171. OrderExpire int64 `json:"orderExpire"`
  172. NotifyURL string `json:"notifyUrl"`
  173. SignURL string `json:"signUrl"`
  174. ShowTitle string `json:"showTitle"`
  175. TraceID string `json:"traceId"`
  176. Timestamp string `json:"timestamp"`
  177. Version string `json:"version"`
  178. SignType string `json:"signType"`
  179. Sign string `json:"sign"`
  180. ProductID string `json:"productId"`
  181. PayAmount int32 `json:"payAmount"`
  182. PlanID int32 `json:"planId"`
  183. UID int64 `json:"uid"`
  184. DisplayAccount string `json:"displayAccount"`
  185. ServiceType int32 `json:"serviceType"`
  186. OriginalAmout int32 `json:"originalAmount"`
  187. }
  188. // OrderInfo order info.
  189. type OrderInfo struct {
  190. ID int64
  191. OrderNo string
  192. AppID int64
  193. OrderType int8
  194. Platform int8
  195. Mid int64
  196. ToMid int64
  197. BuyMonths int16
  198. Money float64
  199. RefundAmount float64
  200. Status int8
  201. PayType string
  202. RechargeBP float64
  203. ThirdTradeNo string
  204. PaymentTime time.Time
  205. Ver int64
  206. Ctime time.Time
  207. Mtime time.Time
  208. AppSubID string
  209. }
  210. //OrderMng .
  211. type OrderMng struct {
  212. Username string `json:"username"`
  213. Mid int64 `json:"mid"`
  214. IsAutoRenew int8 `json:"isAuto_renew"`
  215. ExpireDate string `json:"expire_date"`
  216. NextDedutionDate string `json:"next_dedution_date"`
  217. AutoRenewLoop string `json:"auto_renew_loop"`
  218. PriceTip string `json:"price_tip"`
  219. ChannelID int32 `json:"channel_id"`
  220. PayType string `json:"pay_type"`
  221. }
  222. // OrderMessage .
  223. type OrderMessage struct {
  224. LeftButton string `json:"left_button"`
  225. RightButton string `json:"right_button"`
  226. LeftButtonLink string `json:"left_button_link"`
  227. RightButtonLink string `json:"right_button_link"`
  228. Title string `json:"title"`
  229. Content string `json:"content"`
  230. }
  231. //VipUserDiscountHistory .
  232. type VipUserDiscountHistory struct {
  233. ID int64 `json:"id"`
  234. Mid int64 `json:"mid"`
  235. DiscountID int64 `json:"discount_id"`
  236. OrderNo string `json:"order_no"`
  237. Status int8 `json:"status"`
  238. }
  239. //PannelInfo .
  240. type PannelInfo struct {
  241. VipMonths []*VipMonthsPriceBo `json:"vipMonths"`
  242. PayTypes []*PayTypeBo `json:"payTypes"`
  243. BcoinTips string `json:"bcoinTips"`
  244. }
  245. //PayTypeBo .
  246. type PayTypeBo struct {
  247. Name string `json:"name"`
  248. Code string `json:"code"`
  249. Banks []*PayBankBo `json:"banks"`
  250. }
  251. //VipMonthsPriceBo .
  252. type VipMonthsPriceBo struct {
  253. ID int64 `json:"_"`
  254. Month int16 `json:"month"`
  255. DiscountRate string `json:"discount_rate"`
  256. MonthStr string `json:"month_str"`
  257. MonthID int64 `json:"month_id"`
  258. OrderType int8 `json:"order_type"`
  259. MonthType int8 `json:"month_type"`
  260. OriginalPrice float64 `json:"original_price"`
  261. Selected int8 `json:"selected"`
  262. FirstDiscountMoney float64 `json:"first_discount_money"`
  263. Price float64 `json:"price"`
  264. Remark string `json:"remark"`
  265. }
  266. //PayBankBo .
  267. type PayBankBo struct {
  268. Code string `json:"code"`
  269. Name string `json:"name"`
  270. Image string `json:"image"`
  271. }
  272. //VipPayOrderLog vip pay order log table
  273. type VipPayOrderLog struct {
  274. ID int64 `json:"id"`
  275. OrderNo string `json:"order_no"`
  276. RefundID string `json:"refund_id"`
  277. RefundAmount float64 `json:"refund_amount"`
  278. Mid int64 `json:"mid"`
  279. Status int8 `json:"status"`
  280. }
  281. //VipPayOrderOld vip pay order table
  282. type VipPayOrderOld struct {
  283. ID int64 `json:"id"`
  284. OrderNo string `json:"orderNo"`
  285. AppID int64 `json:"appId"`
  286. Platform int8 `json:"platform"`
  287. OrderType int8 `json:"orderType"`
  288. Mid int64 `json:"mid"`
  289. Bmid int64 `json:"bmid"`
  290. BuyMonths int16 `json:"buyMonths"`
  291. Money float64 `json:"money"`
  292. Status int8 `json:"status"`
  293. PayType int8 `json:"payType"`
  294. PaymentTime time.Time `json:"paymentTime"`
  295. Ver int64 `json:"ver"`
  296. AppSubID string `json:"appSubId"`
  297. PID int64 `json:"pid"`
  298. UserIP []byte `json:"user_ip"`
  299. }
  300. //VipOldPayOrder vip pay order table
  301. type VipOldPayOrder struct {
  302. ID int64
  303. OrderNo string
  304. AppID int64
  305. Platform int8
  306. OrderType int8
  307. Mid int64
  308. Bmid int64
  309. BuyMonths int16
  310. Money float64
  311. Status int8
  312. PaymentTime time.Time
  313. Ver int64
  314. AppSubID string
  315. CouponMoney float64
  316. PID int64 //套餐ID
  317. UserIP []byte
  318. }
  319. // VipOldRechargeOrder vip recharge order.
  320. type VipOldRechargeOrder struct {
  321. AppID int64
  322. PayMid int64
  323. OrderNo string
  324. RechargeBp float64
  325. PayOrderNO string
  326. Status int8
  327. Remark string
  328. Ver int64
  329. Ctime time.Time
  330. Bmid int64
  331. ThirdTradeNO string
  332. }