Files
dafuweng-saiadmin6.x/server/plugin/saiadmin/app/model/system/SystemDept.php
zhenhui dd264b1e97 1.将部门修改为渠道,并且所有dice_表关联渠道表
2.将所有配置表,记录表设置关联渠道
3.优化后台页面设置
2026-05-19 09:49:02 +08:00

62 lines
1.7 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: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\think\BaseModel;
/**
* 渠道模型
*
* sa_system_dept 渠道表
*
* @property $id 编号
* @property $parent_id 父级ID扁平渠道固定为0
* @property $name 渠道名称
* @property $code 渠道编码
* @property $leader_id 渠道负责人ID
* @property $level 祖级列表,格式: 0,1,5,
* @property $sort 排序,数字越小越靠前
* @property $status 状态: 1启用, 0禁用
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemDept extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
protected $table = 'sa_system_dept';
/**
* 权限范围(扁平渠道,仅本渠道)
*/
public function scopeAuth($query, $value)
{
if (is_array($value) && isset($value['id']) && (int) $value['id'] > 0) {
$query->where('id', $value['id']);
return;
}
if (is_numeric($value) && (int) $value > 0) {
$query->where('id', (int) $value);
}
}
/**
* 渠道负责人
*/
public function leader()
{
return $this->hasOne(SystemUser::class, 'id', 'leader_id');
}
}