You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bjhedasx/app/distribution/model/DistributionCommissionWithd...

73 lines
1.9 KiB

<?php
namespace app\distribution\model;
use app\base\model\user\User;
use app\base\model\user\UserInfo;
use think\model\concern\SoftDelete;
class DistributionCommissionWithdraw extends Base
{
use SoftDelete;
protected $type = [
'check_time' => 'timestamp',
'arrival_time' => 'timestamp'
];
/**
* 获取审核状态文本
*/
public function getStatusTextAttr($value, $data){
$status_text = [
1 => '待审核',
2 => '已到账',
3 => '已拒绝',
];
return $status_text[$data['status']];
}
/**
* 获取提现方式文本
*/
public function getWithdrawTypeTextAttr($value, $data){
$withdraw_type_text = [
1 => '微信',
2 => '支付宝'
];
return $withdraw_type_text[$data['withdraw_type']];
}
/**
* 获取分页数据
* @date 2022-11-08
*/
public function listWithdrawWithPage($where, $page, $field = '*', $order = '')
{
// 排序
if (empty($order)) {
$order = 'id desc';
}
$data_list = $this->field($field)->where($where)->order($order)
->paginate(['list_rows' => 10, 'page' => $page], false)->each(function ($item, $key){
$item['status_text'] = $item->status_text;
$item['withdraw_type_text'] = $item->withdraw_type_text;
$item['show_create_time'] = date("Y.m.d H:i", $item->getData('create_time'));
unset($item['create_time']);
});
return $data_list;
}
/**
* 关联提现人信息
*/
public function userInfo()
{
return $this->hasOne(UserInfo::class,'user_id','user_id')->bind(['nick_name','head_img']);
}
public function userData()
{
return $this->hasOne(User::class,'id','user_id')->bind(['mobile_phone']);
}
}