AccountLog.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. 'to_type',
  10. 'from_id',
  11. 'to_id',
  12. 'op',
  13. 'from_amount',
  14. 'to_amount',
  15. ];
  16. //交易行为定义
  17. const OP_CHARGE = 'CHARGE';
  18. const OP_SUPPORT = 'SUPPORT';
  19. const OP_WITHDRAW = 'WITHDRAW';
  20. //货币类型定义
  21. const TYPE_BALANCE = 1;
  22. const TYPE_COIN = 2;
  23. const TYPE_CASH = 3;
  24. //交易渠道定义
  25. const CHANNEL_PLATFORM = 'platform';
  26. const CHANNEL_ALIPAY = 'alipay';
  27. const CHANNEL_WECHATPAY = 'wechatpay';
  28. // //交易方向
  29. // const DIRECTION_INC = 1; //增加
  30. // const DIRECTION_DEC = 2; //减少
  31. //交易行为枚举
  32. private static $_op = [
  33. self::OP_CHARGE => '充值',
  34. self::OP_SUPPORT => '支持梦想',
  35. self::OP_WITHDRAW => '提现',
  36. ];
  37. //货币类型枚举
  38. private static $_type = [
  39. self::TYPE_BALANCE => '余额',
  40. self::TYPE_COIN => '梦想币',
  41. self::TYPE_CASH => '现金',
  42. ];
  43. //交易渠道枚举
  44. private static $_channels = [
  45. self::CHANNEL_PLATFORM => '平台内交易',
  46. self::CHANNEL_ALIPAY => '支付宝',
  47. self::CHANNEL_WECHATPAY => '微信支付',
  48. ];
  49. // // 交易流向
  50. // private static $_direction = [
  51. // self::DIRECTION_INC => '收入',
  52. // self::DIRECTION_DEC => '支出'
  53. // ];
  54. // 获取所有操作
  55. public static function getAllop() {
  56. return self::$_op;
  57. }
  58. // 获取所有类型
  59. public static function getAllType() {
  60. return self::$_type;
  61. }
  62. //获取所有渠道
  63. public static function getAllChannels() {
  64. return self::$_channels;
  65. }
  66. // 获取交易流向
  67. public static function getAllDirections() {
  68. return self::$_direction;
  69. }
  70. }