TapDBPayEvent.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace loyalsoft;
  3. require_once ROOTDIR . '/service_call/pay/Mo/OrderNotice.php';
  4. require_once ROOTDIR . '/util/tapdb/TapDB_config.php';
  5. class TapDBPayEventProperties {
  6. public $ip = "0.0.0.0"; // 可选。充值用户的IP
  7. public $order_id; // 可选。长度大于0并小于等于256。订单ID。
  8. public $amount; // 必需。大于0并小于等于100000000000。充值金额。单位分,即无论什么币种,都需要乘以100
  9. public $virtual_currency_amount = 0; //获赠虚拟币数量,必传,可为0
  10. public $currency_type = "CNY"; // 可选。货币类型。国际通行三字母表示法,为空时默认CNY。参考:人民币 CNY,美元 USD;欧元 EUR
  11. public $product = "0"; // 可选。长度大于0并小于等于256。商品名称
  12. public $payment = "alipay"; // 可选。长度大于0并小于等于256。充值渠道
  13. public $charge_amount;
  14. public $channel;
  15. /**
  16. * pay event 属性
  17. * @param \loyalsoft\pay\OrderNotice $order
  18. * @param string $payMent 支付渠道: "alipay/wxpay"
  19. */
  20. public function __construct($order, $payMent) {
  21. $this->amount = $order->amount; # 分转分.
  22. $this->charge_amount = $order->amount;
  23. $this->order_id = $order->cpOrderId;
  24. $this->currency_type = $order->currency;
  25. $this->payment = $payMent;
  26. $this->product = $order->dbOrder()->product_id; # 附加一下道具id
  27. $this->channel = $order->channel;
  28. }
  29. }
  30. /**
  31. * 支付事件
  32. * @author gwang
  33. */
  34. class TapDBPayEvent {
  35. /**
  36. * 充值事件的数据格式的构造函数
  37. * @param string $uid
  38. * @param \loyalsoft\pay\OrderNotice $order
  39. * @param string $payMent 支付渠道: alipay/wxpay
  40. */
  41. public function __construct($order, $payMent) {
  42. $this->client_id = TapDB_config::Ins()->gameClientId;
  43. $this->user_id = $order->uid;
  44. // $this->index = TapDB_config::Ins()->gameClientId;
  45. // $this->identify = $order->uid;
  46. $this->properties = new TapDBPayEventProperties($order, $payMent);
  47. }
  48. // public $module = "GameAnalysis"; // 固定参数
  49. public $name = "charge"; // 事件名,固定为 "charge"
  50. public $type = "track"; // 必须, 固定为 "track"
  51. // public $index = "APPID"; // 必需。注意APPID需要被替换成TapDB的appid
  52. // public $identify = "userId"; // 必需。用户ID。必须和SDK的setUser接口传递的userId一样,并且该用户已经通过SDK接口进行过推送
  53. public $client_id; // 必需。注意 ClientID 需要被替换成游戏的 ClientID
  54. public $user_id; // 必需。用户ID。必须和SDK的setUser接口传递的userId一样,并且该用户已经通过SDK接口进行过推送
  55. public $properties; // 充值属性值
  56. }