StoreExtract.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\store\finance;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. use app\model\store\SystemStore;
  15. use think\Model;
  16. /**
  17. * 门店列表
  18. * Class SystemStore
  19. * @package app\model\store
  20. */
  21. class StoreExtract extends BaseModel
  22. {
  23. use ModelTrait;
  24. /**
  25. * 数据表主键
  26. * @var string
  27. */
  28. protected $pk = 'id';
  29. /**
  30. * 模型名称
  31. * @var string
  32. */
  33. protected $name = 'store_extract';
  34. /**
  35. * 状态
  36. * @var string[]
  37. */
  38. protected static $status = [
  39. -1 => '未通过',
  40. 0 => '审核中',
  41. 1 => '已提现'
  42. ];
  43. /**
  44. * 门店一对一关联
  45. * @return \think\model\relation\HasOne
  46. */
  47. public function store()
  48. {
  49. return $this->hasOne(SystemStore::class, 'id', 'store_id')->hidden(['bank_code,bank_address', 'alipay_account', 'alipay_qrcode_url', 'wechat', 'wechat_qrcode_url']);
  50. }
  51. /**
  52. * 门店id搜索器
  53. * @param $query
  54. * @param $value
  55. */
  56. public function searchStoreIdAttr($query, $value)
  57. {
  58. if ($value !== '') {
  59. $query->where('store_id', $value);
  60. }
  61. }
  62. /**
  63. * 提现方式
  64. * @param Model $query
  65. * @param $value
  66. */
  67. public function searchExtractTypeAttr($query, $value)
  68. {
  69. if ($value != '') $query->where('extract_type', $value);
  70. }
  71. /**
  72. * 审核状态
  73. * @param Model $query
  74. * @param $value
  75. */
  76. public function searchStatusAttr($query, $value)
  77. {
  78. if ($value !== '') {
  79. $query->where('status', $value);
  80. }
  81. }
  82. /**
  83. * 转账状态
  84. * @param Model $query
  85. * @param $value
  86. */
  87. public function searchPayStatusAttr($query, $value)
  88. {
  89. if ($value !== '') {
  90. $query->where('pay_status', $value);
  91. }
  92. }
  93. /**
  94. * 状态驳回
  95. * @param Model $query
  96. * @param $value
  97. */
  98. public function searchNotStatusAttr($query, $value)
  99. {
  100. if ($value !== '') {
  101. $query->where('status', '<>', $value);
  102. }
  103. }
  104. }