代码功能更新

This commit is contained in:
root
2025-05-18 07:29:01 +00:00
commit 12b03531c5
2083 changed files with 695218 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
* 后台菜单模型
*/
namespace app\model\admin;
use laytp\BaseModel;
use think\model\concern\SoftDelete;
class Menu extends BaseModel
{
use SoftDelete;
protected $name = 'admin_menu';
protected $append = [];
}
+16
View File
@@ -0,0 +1,16 @@
<?php
/**
* 角色模型
*/
namespace app\model\admin;
use laytp\BaseModel;
use think\model\concern\SoftDelete;
class Role extends BaseModel
{
use SoftDelete;
protected $name = 'admin_role';
}
+52
View File
@@ -0,0 +1,52 @@
<?php
/**
* 后台管理员表模型
*/
namespace app\model\admin;
use laytp\BaseModel;
use laytp\library\UploadDomain;
use think\model\concern\SoftDelete;
class User extends BaseModel
{
use SoftDelete;
//模型名
protected $name = 'admin_user';
//数组常量
public $const = [
'is_super_manager' => [
'2' => '否'
, '1' => '是',
],
'status' => [
'2' => '禁用'
, '1' => '正常',
],
];
public function avatarFile(){
return $this->belongsTo('app\model\Files','avatar','id');
}
// 定义默认头像
public function getAvatarFileAttr($value){
if(!$value){
return [
'id' => "",
'filename' => '默认头像',
'path' => UploadDomain::getDefaultAvatar(),
];
}else{
return $value;
}
}
public function roleIds()
{
return $this->hasMany(\app\model\admin\role\User::class, 'admin_user_id');
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
/**
* 后台操作日志模型
*/
namespace app\model\admin\action;
use laytp\BaseModel;
class Log extends BaseModel
{
//模型名
protected $name = 'admin_action_log';
//附加属性
protected $append = [];
//时间戳字段转换
//表名
//关联模型
public function adminUser(){
return $this->belongsTo('app\model\admin\User','admin_id','id');
}
//新增属性的方法
public function getCreateTimeIntAttr($value, $data)
{
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
/**
* Api请求日志模型
*/
namespace app\model\admin\balance;
use laytp\BaseModel;
class Log extends BaseModel
{
//模型名
protected $name = 'balance';
//附加属性
protected $append = [];
//时间戳字段转换
protected $type = [
'time' => 'timestamp:Y-m-d H:i:s',
];
//表名
//关联模型
//新增属性的方法
public function getCreateTimeIntAttr($value, $data)
{
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
/**
* 后台登录日志模型
*/
namespace app\model\admin\login;
use laytp\BaseModel;
class Log extends BaseModel
{
//模型名
protected $name = 'admin_login_log';
//附加属性
protected $append = [];
//时间戳字段转换
//表名
//关联模型
public function adminUser(){
return $this->belongsTo('app\model\admin\User','admin_id','id');
}
//新增属性的方法
public function getCreateTimeIntAttr($value, $data)
{
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
/**
* 菜单与角色关系模型
*/
namespace app\model\admin\menu;
use think\model\Pivot;
class Role extends Pivot
{
protected $name = 'admin_menu_role';
}
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* 角色与用户关系
*/
namespace app\model\admin\role;
use think\model\Pivot;
class User extends Pivot
{
protected $name = 'admin_role_user';
}