UserDrawcash.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\core\model;
  9. use think\Config;
  10. use think\Log;
  11. use think\Model;
  12. use tool\Common;
  13. class UserDrawcash extends Model
  14. {
  15. protected $resultSetType = 'collection';
  16. protected $updateTime = 'updateTime';
  17. protected $createTime = 'applyTime';
  18. protected $autoWriteTimestamp = true;
  19. const REACH_IMM = 'REACH_IMM';
  20. const REACH_HOUR2 = 'REACH_HOUR2';
  21. const REACH_DAY2 = 'REACH_DAY2';
  22. const REACHS = [
  23. self::REACH_IMM=>'即时到帐',
  24. self::REACH_HOUR2=>'两小时内到帐',
  25. self::REACH_DAY2=>'两天内到帐'
  26. ];
  27. const TYPE_BANK = 'TYPE_BANK';
  28. const TYPE_WXCHANGE = 'TYPE_WXCHANGE';
  29. const TYPES = [
  30. self::TYPE_BANK=>'提现到银行',
  31. self::TYPE_WXCHANGE=>'提现到零钱'
  32. ];
  33. const STATUS_OK = 1;
  34. const STATUS_SUBMIT = 2;
  35. const STATUS_ING = 3;
  36. const STATUS_REFUSE = 4;
  37. const STATUS_ERROR = 5;
  38. const STATUSS = [
  39. self::STATUS_OK=>'已到账',
  40. self::STATUS_SUBMIT=>'提交中',
  41. self::STATUS_ING=>'提现中',
  42. self::STATUS_REFUSE=>'已拒绝',
  43. self::STATUS_ERROR=>'失败'
  44. ];
  45. const BANK_TYPE_WXMCH = 'WXMCH';
  46. const BANK_TYPE_WXSERVICE = 'WXSERVICE';
  47. public function getDrawcashIDAttr($value, $data) {
  48. return $data['id'];
  49. }
  50. public function setMoneyAttr($value) {
  51. return $value * 100;
  52. }
  53. public function getMoneyAttr($value) {
  54. return Common::price2($value / 100);
  55. }
  56. public function getApplyTimeAttr($value)
  57. {
  58. return Common::timetodate($value, 4);
  59. }
  60. public function getResultTimeAttr($value)
  61. {
  62. return Common::timetodate($value, 4);
  63. }
  64. public function getReachTimeAttr($value)
  65. {
  66. return Common::timetodate($value, 4);
  67. }
  68. public function getTypeNameAttr($value, $data) {
  69. return self::TYPES[$data['type']];
  70. }
  71. public function getStatusTextAttr($value, $data) {
  72. return self::STATUSS[$data['status']];
  73. }
  74. public function getReachTextAttr($value, $data) {
  75. return self::REACHS[$data['reach']];
  76. }
  77. public function createAlias($id)
  78. {
  79. return 'DH' . Common::timetodate(THINK_START_TIME, 10) . sprintf("%08d", $id);
  80. }
  81. }