AccountLog.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class AccountLog extends Model
  5. {
  6. public $table = 'account_logs';
  7. protected $fillable = [
  8. 'from_type',
  9. 'from_name',
  10. 'to_type',
  11. 'from_id',
  12. 'to_id',
  13. 'to_name',
  14. 'op',
  15. 'from_amount',
  16. 'to_amount',
  17. 'transaction_id',
  18. 'avatar',
  19. 'channel',
  20. 'title',
  21. 'dream_id',
  22. 'note',
  23. ];
  24. //交易行为定义
  25. const OP_CHARGE = 'CHARGE';
  26. const OP_SUPPORT = 'SUPPORT';
  27. const OP_WITHDRAW = 'WITHDRAW';
  28. const OP_DREAM = 'DREAM';
  29. //货币类型定义
  30. const TYPE_BALANCE = 1;
  31. const TYPE_COIN = 2;
  32. const TYPE_CASH = 3;
  33. //交易渠道定义
  34. const CHANNEL_PLATFORM = 'platform';
  35. const CHANNEL_ALIPAY = 'alipay';
  36. const CHANNEL_WECHATPAY = 'wechatpay';
  37. // //交易方向
  38. // const DIRECTION_INC = 1; //增加
  39. // const DIRECTION_DEC = 2; //减少
  40. //交易行为枚举
  41. private static $_op = [
  42. self::OP_CHARGE => '充值',
  43. self::OP_SUPPORT => '支持梦想',
  44. self::OP_WITHDRAW => '提现',
  45. self::OP_DREAM => '梦想结束',
  46. ];
  47. //货币类型枚举
  48. private static $_type = [
  49. self::TYPE_BALANCE => '余额',
  50. self::TYPE_COIN => '梦想币',
  51. self::TYPE_CASH => '现金',
  52. ];
  53. //交易渠道枚举
  54. private static $_channels = [
  55. self::CHANNEL_PLATFORM => '平台内交易',
  56. self::CHANNEL_ALIPAY => '支付宝',
  57. self::CHANNEL_WECHATPAY => '微信支付',
  58. ];
  59. // // 交易流向
  60. // private static $_direction = [
  61. // self::DIRECTION_INC => '收入',
  62. // self::DIRECTION_DEC => '支出'
  63. // ];
  64. // 获取所有操作
  65. public static function getAllop() {
  66. return self::$_op;
  67. }
  68. // 获取所有类型
  69. public static function getAllType() {
  70. return self::$_type;
  71. }
  72. //获取所有渠道
  73. public static function getAllChannels() {
  74. return self::$_channels;
  75. }
  76. // 获取交易流向
  77. public static function getAllDirections() {
  78. return self::$_direction;
  79. }
  80. }