Files
dafuweng-saiadmin6.x/server/app/channel/model/manage/ChannelManage.php

115 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\channel\model\manage;
use plugin\saiadmin\app\model\system\SystemUser;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 渠道模型
*
* channel_manage 渠道
* @property $id ID
* @property $name 名称
* @property $title 标题
* @property $status 状态
* @property $admin_id 管理员
* @property $department_id 所属部门ID关联sa_system_dept
* @property $game_url 游戏地址
* @property $image 图标
* @property $agent 代理agent
* @property $ip_white IP白名单
* @property $total_recharge 总充值
* @property $total_withdrawal 总提现
* @property $total_profit 总盈利
* @property $player_count 玩家数量
* @property $create_time 创建时间
* @property $update_time 更新时间
*/
class ChannelManage extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
/**
* 数据库表名称
* @var string
*/
protected $table = 'channel_manage';
/**
* 属性转换
*/
protected function casts(): array
{
return array_merge(parent::casts(), [
]);
}
/**
* 名称 搜索
*/
public function searchNameAttr($query, $value)
{
$query->where('name', 'like', '%'.$value.'%');
}
/**
* 标题 搜索
*/
public function searchTitleAttr($query, $value)
{
$query->where('title', 'like', '%'.$value.'%');
}
/**
* 部门 搜索
*/
public function searchDepartmentIdAttr($query, $value)
{
if ($value !== '' && $value !== null) {
$query->where('department_id', $value);
}
}
/**
* 总充值 搜索
*/
public function searchTotalRechargeAttr($query, $value)
{
$query->where('total_recharge', '>=', $value);
}
/**
* 总提现 搜索
*/
public function searchTotalWithdrawalAttr($query, $value)
{
$query->where('total_withdrawal', '>=', $value);
}
/**
* 总盈利 搜索
*/
public function searchTotalProfitAttr($query, $value)
{
$query->where('total_profit', '>=', $value);
}
/**
* 管理员
* 关联模型 systemUser
*/
public function admin(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(SystemUser::class, 'admin_id', 'id');
}
}