55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
|
|
namespace Yunshop\UseStaff\models;
|
|
|
|
use app\common\models\BaseModel;
|
|
use app\common\models\Member;
|
|
|
|
class UseStaffSalary extends BaseModel{
|
|
|
|
public $table = 'yz_use_staff_salary';
|
|
public $casts =[
|
|
'created_at' => 'datetime'
|
|
];
|
|
/**
|
|
* Common: 获取打款记录列表
|
|
* Author: wu-hui
|
|
* Time: 2023/10/09 14:50
|
|
* @param $pageSize
|
|
* @param $search
|
|
* @param string[] $field
|
|
* @return array
|
|
*/
|
|
public function getList($pageSize,$search,$field = ['*']){
|
|
// 条件生成
|
|
$where = [];
|
|
if($search['uid']) $where[] = ['uid','=',$search['uid']];
|
|
if((int)$search['attach_state'] > 0) $where[] = ['attach_state','=',$search['attach_state']];
|
|
// 列表获取
|
|
$list = self::uniacid()
|
|
->select($field)
|
|
->where($where)
|
|
->with([
|
|
'member' => function($query){
|
|
$query->select(['uid','nickname','realname','avatar']);
|
|
},
|
|
])
|
|
->orderBy('created_at','DESC')
|
|
->orderBy('id','DESC')
|
|
->paginate($pageSize);
|
|
|
|
return $list ? $list->toArray() : [];
|
|
}
|
|
|
|
|
|
/**
|
|
* Common: 一对一关联 用户信息
|
|
* Author: wu-hui
|
|
* Time: 2023/10/09 13:40
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
|
*/
|
|
public function member(){
|
|
return $this->hasOne(Member::class,'uid','uid');
|
|
}
|
|
} |