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.
98 lines
2.4 KiB
98 lines
2.4 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\model\campus_pay;
|
|
|
|
use core\base\BaseModel;
|
|
use think\model\concern\SoftDelete;
|
|
use think\model\relation\HasMany;
|
|
use think\model\relation\HasOne;
|
|
|
|
use app\model\campus\Campus;
|
|
|
|
/**
|
|
* 账户及资金管理模型
|
|
* Class CampusPay
|
|
* @package app\model\campus_pay
|
|
*/
|
|
class CampusPay extends BaseModel
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
* 数据表主键
|
|
* @var string
|
|
*/
|
|
protected $pk = 'id';
|
|
|
|
/**
|
|
* 模型名称
|
|
* @var string
|
|
*/
|
|
protected $name = 'campus_pay';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 搜索器:账户及资金管理
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchIdAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where("id", $value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 搜索器:账户及资金管理校区
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchCampusIdAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where("campus_id", $value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 搜索器:账户及资金管理创建时间
|
|
* @param $value
|
|
* @param $data
|
|
*/
|
|
public function searchCreatedAtAttr($query, $value, $data)
|
|
{
|
|
$start = empty($value[0]) ? 0 : strtotime($value[0]);
|
|
$end = empty($value[1]) ? 0 : strtotime($value[1]);
|
|
if ($start > 0 && $end > 0) {
|
|
$query->where([["created_at", "between", [$start, $end]]]);
|
|
} else if ($start > 0 && $end == 0) {
|
|
$query->where([["created_at", ">=", $start]]);
|
|
} else if ($start == 0 && $end > 0) {
|
|
$query->where([["created_at", "<=", $end]]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function campus(){
|
|
return $this->hasOne(Campus::class, 'id', 'campus_id')->joinType('left')->withField('campus_name,id')->bind(['campus_id_name'=>'campus_name']);
|
|
}
|
|
|
|
}
|
|
|