Capital.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\api\model\dealer;
  3. use app\common\model\dealer\Capital as CapitalModel;
  4. /**
  5. * 分销商资金明细模型
  6. * Class Apply
  7. * @package app\api\model\dealer
  8. */
  9. class Capital extends CapitalModel
  10. {
  11. /**
  12. * 隐藏字段
  13. * @var array
  14. */
  15. protected $hidden = [
  16. // 'create_time',
  17. 'update_time',
  18. ];
  19. protected $types = [
  20. 1=>'佣金结算',
  21. 2=>'平级佣金',
  22. 3=>'推荐佣金',
  23. 4=>'直推订单佣金',
  24. 5=>'间推订单佣金',
  25. 99=>'其他',
  26. ];
  27. /**
  28. * 获取分销商提现明细
  29. * @param $user_id
  30. * @param int $apply_status
  31. * @return \think\Paginator
  32. * @throws \think\exception\DbException
  33. */
  34. public function getList($user_id, $apply_status = -1)
  35. {
  36. $types = $this->types;
  37. $this->where('user_id', '=', $user_id);
  38. $apply_status > -1 && $this->where('status', '=', $apply_status);
  39. return $this->order(['create_time' => 'desc'])
  40. ->paginate(15, false, [
  41. 'query' => \request()->request()
  42. ])->each(function($item, $k) use($types){
  43. $item['type_name'] = isset($types[$item['type']])? $types[$item['type']] : '未知';
  44. });
  45. }
  46. }