Files
anmo/server/app/coachapi/lists/WithdrawalLogLists.php
2025-08-19 14:16:51 +08:00

56 lines
1.4 KiB
PHP
Executable File

<?php
namespace app\coachapi\lists;
use app\common\model\withdraw\WithdrawApply;
/**
* 提现记录
* Class LogLists
* @package app\coachapi\lists
*/
class WithdrawalLogLists extends BaseCoachApiDataLists
{
public function setWhere(){
$where = [];
$where[] = ['source','=',1];
$where[] = ['relation_id','=',$this->coachId];
$where[] = ['apply_type','=',$this->params['type'] ?? 1];
$status = $this->params['status'] ?? '';
switch ($status){
case 1:
$where[] = ['status','=',1];
break;
case 2:
$where[] = ['status','=',4];
break;
case 3:
$where[] = ['status','in',[2,5]];
break;
case 4:
$where[] = ['status','in',[2,3,6]];
break;
}
return $where;
}
public function lists(): array
{
$lists = WithdrawApply::where($this->setWhere())
->field('id,status,money,create_time')
->append(['status_desc'])
->limit($this->limitOffset, $this->limitLength)
->order('id desc')
->select()
->toArray();
foreach ($lists as $key => $log){
$lists[$key]['desc'] = '提现';
}
return $lists;
}
public function count(): int
{
return WithdrawApply::where($this->setWhere())->count();
}
}