first commit

This commit is contained in:
Your Name
2026-01-19 14:19:22 +08:00
commit fe2d9c1868
4777 changed files with 665503 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model;
use app\common\service\FileService;
use think\Model;
/**
* 基础模型
* Class BaseModel
* @package app\common\model
*/
class BaseModel extends Model
{
/**
* @notes 公共处理图片,补全路径
* @param $value
* @return string
* @author 张无忌
* @date 2021/9/10 11:02
*/
public function getImageAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 公共图片处理,去除图片域名
* @param $value
* @return mixed|string
* @author 张无忌
* @date 2021/9/10 11:04
*/
public function setImageAttr($value)
{
return trim($value) ? FileService::setFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model;
class Config extends BaseModel
{
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model;
use app\common\enum\CrontabEnum;
use think\model\concern\SoftDelete;
/**
* 定时任务模型
* Class Crontab
* @package app\common\model
*/
class Crontab extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $name = 'dev_crontab';
/**
* @notes 类型获取器
* @param $value
* @return string
* @author 段誉
* @date 2022/3/29 12:05
*/
public function getTypeDescAttr($value)
{
$desc = [
CrontabEnum::CRONTAB => '定时任务',
CrontabEnum::DAEMON => '守护进程',
];
return $desc[$value] ?? '';
}
/**
* @notes 状态获取器
* @param $value
* @return string
* @author 段誉
* @date 2022/3/29 12:06
*/
public function getStatusDescAttr($value)
{
$desc = [
CrontabEnum::START => '运行',
CrontabEnum::STOP => '停止',
CrontabEnum::ERROR => '错误',
];
return $desc[$value] ?? '';
}
/**
* @notes 最后执行时间获取器
* @param $value
* @return string
* @author 段誉
* @date 2022/3/29 12:06
*/
public function getLastTimeAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\common\model;
class OperationLog extends BaseModel
{
}

View File

@@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\article;
use app\common\enum\YesNoEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 资讯管理模型
* Class Article
* @package app\common\model\article;
*/
class Article extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 获取分类名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getCateNameAttr($value, $data)
{
return ArticleCate::where('id', $data['cid'])->value('name');
}
/**
* @notes 浏览量
* @param $value
* @param $data
* @return mixed
* @author 段誉
* @date 2022/9/15 11:33
*/
public function getClickAttr($value, $data)
{
return $data['click_actual'] + $data['click_virtual'];
}
/**
* @notes 设置图片域名
* @param $value
* @param $data
* @return array|string|string[]|null
* @author 段誉
* @date 2022/9/28 10:17
*/
public function getContentAttr($value, $data)
{
return get_file_domain($value);
}
/**
* @notes 清除图片域名
* @param $value
* @param $data
* @return array|string|string[]
* @author 段誉
* @date 2022/9/28 10:17
*/
public function setContentAttr($value, $data)
{
return clear_file_domain($value);
}
/**
* @notes 获取文章详情
* @param $id
* @return array
* @author 段誉
* @date 2022/10/20 15:23
*/
public static function getArticleDetailArr(int $id)
{
$article = Article::where(['id' => $id, 'is_show' => YesNoEnum::YES])
->findOrEmpty();
if ($article->isEmpty()) {
return [];
}
// 增加点击量
$article->click_actual += 1;
$article->save();
return $article->append(['click'])
->hidden(['click_virtual', 'click_actual'])
->toArray();
}
}

View File

@@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\article;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 资讯分类管理模型
* Class ArticleCate
* @package app\common\model\article;
*/
class ArticleCate extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 关联文章
* @return \think\model\relation\HasMany
* @author 段誉
* @date 2022/10/19 16:59
*/
public function article()
{
return $this->hasMany(Article::class, 'cid', 'id');
}
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/9/15 11:25
*/
public function getIsShowDescAttr($value, $data)
{
return $data['is_show'] ? '启用' : '停用';
}
/**
* @notes 文章数量
* @param $value
* @param $data
* @return int
* @author 段誉
* @date 2022/9/15 11:32
*/
public function getArticleCountAttr($value, $data)
{
return Article::where(['cid' => $data['id']])->count('id');
}
}

View File

@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\article;
use app\common\enum\YesNoEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 资讯收藏
* Class ArticleCollect
* @package app\common\model\article
*/
class ArticleCollect extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 是否已收藏文章
* @param $userId
* @param $articleId
* @return bool (true=已收藏, false=未收藏)
* @author 段誉
* @date 2022/10/20 15:13
*/
public static function isCollectArticle($userId, $articleId)
{
$collect = ArticleCollect::where([
'user_id' => $userId,
'article_id' => $articleId,
'status' => YesNoEnum::YES
])->findOrEmpty();
return !$collect->isEmpty();
}
}

View File

@@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\enum\YesNoEnum;
use app\common\model\BaseModel;
use app\common\model\dept\Dept;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
class Admin extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $append = [
'role_id',
'dept_id',
'jobs_id',
];
/**
* @notes 关联角色id
* @param $value
* @param $data
* @return array
* @author 段誉
* @date 2022/11/25 15:00
*/
public function getRoleIdAttr($value, $data)
{
return AdminRole::where('admin_id', $data['id'])->column('role_id');
}
/**
* @notes 关联部门id
* @param $value
* @param $data
* @return array
* @author 段誉
* @date 2022/11/25 15:00
*/
public function getDeptIdAttr($value, $data)
{
return AdminDept::where('admin_id', $data['id'])->column('dept_id');
}
/**
* @notes 关联岗位id
* @param $value
* @param $data
* @return array
* @author 段誉
* @date 2022/11/25 15:01\
*/
public function getJobsIdAttr($value, $data)
{
return AdminJobs::where('admin_id', $data['id'])->column('jobs_id');
}
/**
* @notes 获取禁用状态
* @param $value
* @param $data
* @return string|string[]
* @author 令狐冲
* @date 2021/7/7 01:25
*/
public function getDisableDescAttr($value, $data)
{
return YesNoEnum::getDisableDesc($data['disable']);
}
/**
* @notes 最后登录时间获取器 - 格式化:年-月-日 时:分:秒
* @param $value
* @return string
* @author Tab
* @date 2021/7/13 11:35
*/
public function getLoginTimeAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
/**
* @notes 头像获取器 - 头像路径添加域名
* @param $value
* @return string
* @author Tab
* @date 2021/7/13 11:35
*/
public function getAvatarAttr($value)
{
return empty($value) ? FileService::getFileUrl(config('project.default_image.admin_avatar')) : FileService::getFileUrl(trim($value, '/'));
}
}

View File

@@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
class AdminDept extends BaseModel
{
/**
* @notes 删除用户关联部门
* @param $adminId
* @return bool
* @author 段誉
* @date 2022/11/25 14:14
*/
public static function delByUserId($adminId)
{
return self::where(['admin_id' => $adminId])->delete();
}
}

View File

@@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
class AdminJobs extends BaseModel
{
/**
* @notes 删除用户关联岗位
* @param $adminId
* @return bool
* @author 段誉
* @date 2022/11/25 14:14
*/
public static function delByUserId($adminId)
{
return self::where(['admin_id' => $adminId])->delete();
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
class AdminRole extends BaseModel
{
/**
* @notes 删除用户关联角色
* @param $adminId
* @return bool
* @author 段誉
* @date 2022/11/25 14:14
*/
public static function delByUserId($adminId)
{
return self::where(['admin_id' => $adminId])->delete();
}
}

View File

@@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
class AdminSession extends BaseModel
{
/**
* @notes 关联管理员表
* @return \think\model\relation\HasOne
* @author 令狐冲
* @date 2021/7/5 14:39
*/
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'admin_id')
->field('id,multipoint_login');
}
}

View File

@@ -0,0 +1,31 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
/**
* 系统菜单
* Class SystemMenu
* @package app\common\model\auth
*/
class SystemMenu extends BaseModel
{
}

View File

@@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 角色模型
* Class Role
* @package app\common\model
*/
class SystemRole extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $name = 'system_role';
/**
* @notes 角色与菜单关联关系
* @return \think\model\relation\HasMany
* @author 段誉
* @date 2022/7/6 11:16
*/
public function roleMenuIndex()
{
return $this->hasMany(SystemRoleMenu::class, 'role_id');
}
}

View File

@@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\auth;
use app\common\model\BaseModel;
/**
* 角色与菜单权限关系
* Class SystemRoleMenu
* @package app\common\model\auth
*/
class SystemRoleMenu extends BaseModel
{
}

View File

@@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\decorate;
use app\common\model\BaseModel;
/**
* 提示内容模型
* Class DecorateHint
* @package app\common\model\decorate
*/
class DecorateHint extends BaseModel
{
protected $name = 'decorate_hint';
/**
* @notes 设置图片域名
* @param $value
* @param $data
* @return array|string|string[]|null
* @author 段誉
* @date 2022/9/28 10:17
*/
public function getContentAttr($value, $data)
{
return get_file_domain($value);
}
/**
* @notes 清除图片域名
* @param $value
* @param $data
* @return array|string|string[]
* @author 段誉
* @date 2022/9/28 10:17
*/
public function setContentAttr($value, $data)
{
return clear_file_domain($value);
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\decorate;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 菜单按钮模型
* Class DecorateNav
* @package app\common\model\decorate
*/
class DecorateNav extends BaseModel
{
use SoftDelete;
protected $name = 'decorate_nav';
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\decorate;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 轮播图模型
* Class DecorateSwiper
* @package app\common\model\decorate
*/
class DecorateSwiper extends BaseModel
{
protected $name = 'decorate_swiper';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getImageAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\dept;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 部门模型
* Class Dept
* @package app\common\model\article
*/
class Dept extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/5/25 18:03
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}

View File

@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\dept;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 岗位模型
* Class Jobs
* @package app\common\model\dept
*/
class Jobs extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/5/25 18:03
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}

View File

@@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\dict;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 字典数据模型
* Class DictData
* @package app\common\model\dict
*/
class DictData extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/6/20 16:31
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}

View File

@@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\dict;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 字典类型模型
* Class DictType
* @package app\common\model\dict
*/
class DictType extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 状态描述
* @param $value
* @param $data
* @return string
* @author 段誉
* @date 2022/6/20 15:54
*/
public function getStatusDescAttr($value, $data)
{
return $data['status'] ? '正常' : '停用';
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\feedback;
use app\common\model\BaseModel;
/**
* 意见反馈类型模型
* Class FeedbackCate
* @package app\common\model\feedback
*/
class FeedbackCate extends BaseModel
{
protected $name = 'feedback_cate';
}

View File

@@ -0,0 +1,32 @@
<?php
namespace app\common\model\feedback;
use app\common\model\feedback\FeedbackCate;
use app\common\model\BaseModel;
/**
* 意见反馈记录模型
* Class FeedbackRecord
* @package app\common\model\feedback
*/
class FeedbackRecord extends BaseModel
{
protected $name = 'feedback_record';
/**
* @notes 获取分类名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getCateNameAttr($value, $data)
{
return FeedbackCate::where('id', $data['cid'])->value('name');
}
}

View File

@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\file;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class File extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\file;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class FileCate extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\finance;
use app\common\model\BaseModel;
use app\common\service\FileService;
use think\model\concern\SoftDelete;
use app\common\model\setting\RechargeMethod;
use app\common\model\user\{User,UserRelation,UserRelationAgent};
use app\common\model\dict\DictData;
/**
* 充值记录模型
* Class RechargeRecord
* @package app\common\model\finance
*/
class RechargeRecord extends BaseModel
{
use SoftDelete;
protected $name = 'recharge_record';
protected $deleteTime = 'delete_time';
/**
* @notes 获取方式名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getMethodAttr($value, $data)
{
return RechargeMethod::where('id', $data['method_id'])->findOrEmpty();
}
/**
* @notes 获取方式名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getMethodNameAttr($value, $data)
{
return RechargeMethod::where('id', $data['method_id'])->value('name');
}
/**
* @notes voucher域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getVoucherAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 充值状态
* @param $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 18:32
*/
public function getStatusTextAttr($value, $data)
{
return DictData::where(['value' => $data['status'],'type_value'=>'recharge_status'])->value('name');
}
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['user_id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['user_id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
$top_user = User::where('id', $top_relation['parent_id'])->findOrEmpty();
return [
'top_account' => $top_user['account'],
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
}

View File

@@ -0,0 +1,62 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\finance;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\model\user\{User,UserRelation,UserRelationAgent};
/**
* 资金明细模型
* Class UserFinance
* @package app\common\model\finance
*/
class UserFinance extends BaseModel
{
use SoftDelete;
protected $name = 'user_finance';
protected $deleteTime = 'delete_time';
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['user_id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['user_id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
$top_user = User::where('id', $top_relation['parent_id'])->findOrEmpty();
return [
'top_account' => $top_user['account'],
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace app\common\model\finance;
use app\common\model\user\{User};
use app\common\model\BaseModel;
/**
* 用户转账记录模型
* Class UserTransferRecord
* @package app\common\model\finance
*/
class UserTransferRecord extends BaseModel
{
protected $name = 'user_transfer_record';
/**
* @notes 转入转出用户详情
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getUsersInfoAttr($value, $data)
{
$field = 'mobile';
//转出用户
$userFrom = User::field($field)->where(['id' => $data['user_id_from']])->findOrEmpty();
//转入用户
$userTo = User::field($field)->where(['id' => $data['user_id_to']])->findOrEmpty();
return [
'user_from' => $userFrom['mobile'],
'user_to' => $userTo['mobile'],
];
}
}

View File

@@ -0,0 +1,120 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\finance;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\model\withdraw\WithdrawMethod;
use app\common\model\user\{User,UserRelation,UserRelationAgent};
use app\common\model\dict\DictData;
use app\common\service\{FileService};
/**
* 提现记录模型
* Class WithdrawRecord
* @package app\common\model\finance
*/
class WithdrawRecord extends BaseModel
{
use SoftDelete;
protected $name = 'withdraw_record';
protected $deleteTime = 'delete_time';
/**
* @notes 二维码域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getImgAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取方式名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getMethodNameAttr($value, $data)
{
return WithdrawMethod::where('id', $data['method_id'])->value('name');
}
/**
* @notes 获取实际金额
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getActAmountAttr($value, $data)
{
$record = WithdrawRecord::where(['id' => $data['id']])->findOrEmpty();
$method = WithdrawMethod::where(['id' => $record['method_id']])->findOrEmpty();
return round(($record['amount'] - $record['charge']) * $record['rate'] , $method['precision']);
}
/**
* @notes 提现状态
* @param $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 18:32
*/
public function getStatusTextAttr($value, $data)
{
return DictData::where(['value' => $data['status'],'type_value'=>'withdraw_status'])->value('name');
}
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['user_id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['user_id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
$top_user = User::where('id', $top_relation['parent_id'])->findOrEmpty();
return [
'top_account' => $top_user['account'],
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 商品模型
* Class Goods
* @package app\common\model\goods
*/
class Goods extends BaseModel
{
use SoftDelete;
protected $name = 'goods';
protected $deleteTime = 'delete_time';
/**
* @notes 获取分类名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getCateNameAttr($value, $data)
{
return GoodsCate::where('id', $data['cid'])->value('name');
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 商品分类模型
* Class GoodsCate
* @package app\common\model\goods
*/
class GoodsCate extends BaseModel
{
use SoftDelete;
protected $name = 'goods_cate';
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\goods;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 抢单记录模型
* Class GoodsRecord
* @package app\common\model\goods
*/
class GoodsRecord extends BaseModel
{
protected $name = 'goods_record';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getGoodsImageAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,92 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\item;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\model\member\{UserMember};
/**
* 项目模型
* Class Item
* @package app\common\model\item
*/
class Item extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 设置图片域名
* @param $value
* @param $data
* @return array|string|string[]|null
* @author 段誉
* @date 2022/9/28 10:17
*/
public function getContentAttr($value, $data)
{
return get_file_domain($value);
}
/**
* @notes 清除图片域名
* @param $value
* @param $data
* @return array|string|string[]
* @author 段誉
* @date 2022/9/28 10:17
*/
public function setContentAttr($value, $data)
{
return clear_file_domain($value);
}
/**
* @notes 获取分类名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getCateNameAttr($value, $data)
{
return ItemCate::where('id', $data['cid'])->value('name');
}
/**
* @notes 获取会员名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getVipNameAttr($value, $data)
{
//查询会员等级
$vip_name = '';
$userMember = UserMember::where(['id' => $data['member_id']])->findOrEmpty();
if (!$userMember->isEmpty()) {
$vip_name = $userMember['name'];
}
return $vip_name;
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\item;
use app\common\model\BaseModel;
/**
* 项目分类模型
* Class ItemCate
* @package app\common\model\item
*/
class ItemCate extends BaseModel
{
protected $name = 'item_cate';
}

View File

@@ -0,0 +1,50 @@
<?php
namespace app\common\model\item;
use app\common\model\BaseModel;
use app\common\model\user\{User,UserRelation,UserRelationAgent};
/**
* 项目记录模型
* Class ItemRecord
* @package app\common\model\item
*/
class ItemRecord extends BaseModel
{
protected $name = 'item_record';
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['user_id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['user_id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
$top_user = User::where('id', $top_relation['parent_id'])->findOrEmpty();
return [
'top_account' => $top_user['account'],
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace app\common\model\lh;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
/**
* 量化货币模型
* Class LhCoin
* @package app\common\model\lh
*/
class LhCoin extends BaseModel
{
use SoftDelete;
protected $name = 'lh_coin';
protected $deleteTime = 'delete_time';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getLogoAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace app\common\model\lh;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
/**
* 量化记录模型
* Class LhRecord
* @package app\common\model\lh
*/
class LhRecord extends BaseModel
{
use SoftDelete;
protected $name = 'lh_record';
protected $deleteTime = 'delete_time';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getLogoAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\mall;
use app\common\model\BaseModel;
/**
* 积分、抽奖奖品模型
* Class MallGoods
* @package app\common\model\mall
*/
class MallGoods extends BaseModel
{
protected $name = 'mall_goods';
}

View File

@@ -0,0 +1,31 @@
<?php
namespace app\common\model\mall;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 奖品记录模型
* Class MallGoodsRecord
* @package app\common\model\mall
*/
class MallGoodsRecord extends BaseModel
{
protected $name = 'mall_goods_record';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getMGoodsImageAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,94 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\member;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 会员等级模型
* Class UserMember
* @package app\common\model\member
*/
class UserMember extends BaseModel
{
protected $name = 'user_member';
/**
* @notes 设置图片域名
* @param $value
* @param $data
* @return array|string|string[]|null
* @author 段誉
* @date 2022/9/28 10:17
*/
public function getContentAttr($value, $data)
{
return get_file_domain($value);
}
/**
* @notes 清除图片域名
* @param $value
* @param $data
* @return array|string|string[]
* @author 段誉
* @date 2022/9/28 10:17
*/
public function setContentAttr($value, $data)
{
return clear_file_domain($value);
}
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getBgImgAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getLogoAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取所属名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getVipNameAttr($value, $data)
{
return UserMember::where('id', $data['level1_vip_id'])->value('name');
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\member;
use app\common\model\BaseModel;
/**
* 会员记录模型
* Class UserMemberRecord
* @package app\common\model\member
*/
class UserMemberRecord extends BaseModel
{
protected $name = 'user_member_record';
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\notice;
use app\common\model\BaseModel;
/**
* 邮件发送记录模型
* Class EmailRecord
* @package app\common\model\notice
*/
class EmailRecord extends BaseModel
{
protected $name = 'email_record';
}

View File

@@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | likeshop100%开源免费商用商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | 商业版本务必购买商业授权,以免引起法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | // +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
namespace app\common\model\notice;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 通知记录模型
* Class Notice
* @package app\common\model
*/
class NoticeRecord extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,120 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\notice;
use app\common\enum\DefaultEnum;
use app\common\enum\notice\NoticeEnum;
use app\common\model\BaseModel;
class NoticeSetting extends BaseModel
{
/**
* @notes 短信通知状态
* @param $value
* @param $data
* @return string|string[]
* @author ljj
* @date 2022/2/16 3:22 下午
*/
public function getSmsStatusDescAttr($value,$data)
{
if ($data['sms_notice']) {
$sms_text = json_decode($data['sms_notice'],true);
return DefaultEnum::getEnableDesc($sms_text['status']);
}else {
return '停用';
}
}
/**
* @notes 通知类型
* @param $value
* @param $data
* @return string|string[]
* @author ljj
* @date 2022/2/17 2:50 下午
*/
public function getTypeDescAttr($value,$data)
{
return NoticeEnum::getTypeDesc($data['type']);
}
/**
* @notes 接收者描述获取器
* @param $value
* @return string
* @author Tab
* @date 2021/8/18 16:42
*/
public function getRecipientDescAttr($value)
{
$desc = [
1 => '买家',
2 => '卖家',
];
return $desc[$value] ?? '';
}
/**
* @notes 系统通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:11
*/
public function getSystemNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
/**
* @notes 短信通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:12
*/
public function getSmsNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
/**
* @notes 公众号通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:13
*/
public function getOaNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
/**
* @notes 小程序通知获取器
* @param $value
* @return array|mixed
* @author Tab
* @date 2021/8/18 19:13
*/
public function getMnpNoticeAttr($value)
{
return empty($value) ? [] : json_decode($value, true);
}
}

View File

@@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\notice;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 短信记录模型
* Class SmsLog
* @package app\common\model
*/
class SmsLog extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\setting;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 语言包模型
* Class Language
* @package app\common\model\setting
*/
class Language extends BaseModel
{
use SoftDelete;
protected $name = 'language';
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\setting;
use app\common\model\BaseModel;
use app\common\enum\YesNoEnum;
use app\common\model\setting\{Language};
/**
* 语言包模型
* Class LanguagePag
* @package app\common\model\setting
*/
class LanguagePag extends BaseModel
{
protected $name = 'language_pag';
/**
* @notes 获取源语言
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getFromValueAttr($value, $data)
{
$language = Language::where(['is_show' => YesNoEnum::YES])->order(['sort' => 'desc', 'id' => 'desc'])->findOrEmpty();
return LanguagePag::where(['lang' => $language['symbol'],'type' => $data['type'],'name' => $data['name']])->value('value');
}
}

View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\setting;
use app\common\model\BaseModel;
/**
* 代码生成器-数据表信息模型
* Class OperationLog
* @package app\common\model\setting
*/
class OperationLog extends BaseModel
{
}

View File

@@ -0,0 +1,105 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\setting;
use app\common\model\BaseModel;
use app\common\service\FileService;
use think\model\concern\SoftDelete;
use app\common\model\member\{UserMember};
/**
* 充值方式模型
* Class RechargeMethod
* @package app\common\model\setting
*/
class RechargeMethod extends BaseModel
{
use SoftDelete;
protected $name = 'recharge_method';
protected $deleteTime = 'delete_time';
/**
* @notes logo域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getLogoAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 二维码域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getImgAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 二维码域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getQrcodeAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取所属名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getLangNameAttr($value, $data)
{
if($data['lang_id'] == 0){
return '通用';
}
return Language::where('id', $data['lang_id'])->value('name');
}
/**
* @notes 获取会员名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getVipNameAttr($value, $data)
{
//查询会员等级
$vip_name = '';
$userMember = UserMember::where(['id' => $data['member_id']])->findOrEmpty();
if (!$userMember->isEmpty()) {
$vip_name = $userMember['name'];
}
return $vip_name;
}
}

View File

@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\setting;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 轮播图模型
* Class DecorateSwiper
* @package app\common\model\setting
*/
class DecorateSwiper extends BaseModel
{
protected $name = 'decorateSwiper';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getImageAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\tools;
use app\common\model\BaseModel;
/**
* 代码生成器-数据表字段信息模型
* Class GenerateColumn
* @package app\common\model\tools
*/
class GenerateColumn extends BaseModel
{
/**
* @notes 关联table表
* @return \think\model\relation\BelongsTo
* @author 段誉
* @date 2022/6/15 18:59
*/
public function generateTable()
{
return $this->belongsTo(GenerateTable::class, 'id', 'table_id');
}
}

View File

@@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\tools;
use app\common\enum\GeneratorEnum;
use app\common\model\BaseModel;
/**
* 代码生成器-数据表信息模型
* Class GenerateTable
* @package app\common\model\tools
*/
class GenerateTable extends BaseModel
{
protected $json = ['menu', 'tree', 'relations', 'delete'];
protected $jsonAssoc = true;
/**
* @notes 关联数据表字段
* @return \think\model\relation\HasMany
* @author 段誉
* @date 2022/6/15 10:46
*/
public function tableColumn()
{
return $this->hasMany(GenerateColumn::class, 'table_id', 'id');
}
/**
* @notes 模板类型描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/6/14 11:25
*/
public function getTemplateTypeDescAttr($value, $data)
{
return GeneratorEnum::getTemplateTypeDesc($data['template_type']);
}
}

View File

@@ -0,0 +1,558 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\enum\user\UserEnum;
use app\common\model\BaseModel;
use app\common\model\user\{UserRelation,UserRelationAgent,UserInfo,UserGroup,UserGroupRecord,UserMineRecord};
use app\common\model\member\{UserMember};
use app\common\model\lh\{LhRecord};
use app\common\model\finance\{UserFinance};
use app\common\model\goods\{GoodsRecord};
use app\common\model\item\ItemRecord;
use app\common\service\{FileService,ConfigService,UtilsService};
use think\model\concern\SoftDelete;
/**
* 用户模型
* Class User
* @package app\common\model\user
*/
class User extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 关联用户授权模型
* @return \think\model\relation\HasOne
* @author 段誉
* @date 2022/9/22 16:03
*/
public function userAuth()
{
return $this->hasOne(UserAuth::class, 'user_id');
}
/**
* @notes 搜索器-用户信息
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:12
*/
public function searchKeywordAttr($query, $value, $data)
{
if ($value) {
$query->where('sn|account|mobile', 'like', '%' . $value . '%');
}
}
/**
* @notes 搜索器-注册来源
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:13
*/
public function searchChannelAttr($query, $value, $data)
{
if ($value) {
$query->where('channel', '=', $value);
}
}
/**
* @notes 搜索器-注册时间
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:13
*/
public function searchCreateTimeStartAttr($query, $value, $data)
{
if ($value) {
$query->where('create_time', '>=', strtotime($value));
}
}
/**
* @notes 搜索器-注册时间
* @param $query
* @param $value
* @param $data
* @author 段誉
* @date 2022/9/22 16:13
*/
public function searchCreateTimeEndAttr($query, $value, $data)
{
if ($value) {
$query->where('create_time', '<=', strtotime($value));
}
}
/**
* @notes 头像获取器 - 用于头像地址拼接域名
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getAvatarAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取器-性别描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/9/7 15:15
*/
public function getSexAttr($value, $data)
{
return UserEnum::getSexDesc($value);
}
/**
* @notes 登录时间
* @param $value
* @return string
* @author 段誉
* @date 2022/9/23 18:15
*/
public function getLoginTimeAttr($value)
{
return $value ? date('Y-m-d H:i:s', $value) : '';
}
/**
* @notes 生成用户编码
* @param string $prefix
* @param int $length
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/16 10:33
*/
public static function createUserSn($prefix = '', $length = 8)
{
$rand_str = '';
for ($i = 0; $i < $length; $i++) {
$rand_str .= mt_rand(0, 9);
}
$sn = $prefix . $rand_str;
if (User::where(['sn' => $sn])->find()) {
return self::createUserSn($prefix, $length);
}
return $sn;
}
/**
* @notes 获取团队人数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamNumAttr($value, $data)
{
$config = ConfigService::get('website', 'distribute');
$level = count($config);
return UserRelation::where(['parent_id' => $data['id']])->where("level <= $level")->count();
}
/**
* @notes 获取量化次数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getLhNumAttr($value, $data)
{
return LhRecord::where(['user_id' => $data['id']])->count();
}
/**
* @notes 获取今日量化次数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTodayLhNumAttr($value, $data)
{
// 获取今天0点的时间戳
$todayStart = strtotime(date('Y-m-d 00:00:00'));
return LhRecord::where(['user_id' => $data['id']])->where("create_time > $todayStart")->count();
}
/**
* @notes 获取投资次数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getItemNumAttr($value, $data)
{
return ItemRecord::where(['user_id' => $data['id']])->count();
}
/**
* @notes 获取挖矿情况
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getMineAttr($value, $data)
{
$start_time = strtotime(date('Y-m-d 00:00:00', time()));//0点
$end_time = time();
$today_income = UserMineRecord::where(['user_id' => $data['id']])->where(" create_time >= $start_time AND create_time <= $end_time ")->sum('amount');
$start_time = 0;
$total_income = UserMineRecord::where(['user_id' => $data['id']])->where(" create_time >= $start_time AND create_time <= $end_time ")->sum('amount');
return [
'total_income' => $total_income,
'today_income' => $today_income,
];
}
/**
* @notes 获取今日投资次数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTodayItemNumAttr($value, $data)
{
// 获取今天0点的时间戳
$todayStart = strtotime(date('Y-m-d 00:00:00'));
return ItemRecord::where(['user_id' => $data['id']])->where("create_time > $todayStart")->count();
}
/**
* @notes 获取团队总充值
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamRechargeAttr($value, $data)
{
$config = ConfigService::get('website', 'distribute');
$level = count($config);
$sum = UserRelation::alias('ur')
->join('user u', 'u.id = ur.user_id')
->where(['ur.parent_id' => $data['id']])
->where("ur.level <= $level AND u.total_recharge > 0")
->sum('u.total_recharge');
return $sum;
}
/**
* @notes 获取量化次数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getUnusedMoneyAttr($value, $data)
{
return UserFinance::where(['user_id' => $data['id'],'frozen' => 1])->sum('change_amount');
}
/**
* @notes 获取团队总提现
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamWithdrawAttr($value, $data)
{
$config = ConfigService::get('website', 'distribute');
$level = count($config);
$sum = UserRelation::alias('ur')
->join('user u', 'u.id = ur.user_id')
->where(['ur.parent_id' => $data['id']])
->where("ur.level <= $level AND u.total_withdraw > 0")
->sum('u.total_withdraw');
return $sum;
}
/**
* @notes 获取推广情况
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamReportAttr($value, $data)
{
$items = ConfigService::get('website', 'distribute');
foreach ($items as &$item) {
$level = $item['level'];
$item['num'] = UserRelation::where(['parent_id' => $data['id'],'level' => $level])->count();
$item['num_valid'] = UserRelation::alias('ur')
->join('user_member_record umr', 'ur.user_id = umr.user_id')
->where(['ur.parent_id' => $data['id'],'level' => $level])
->where("umr.member_id > 1")
->count();
}
return $items;
}
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
$top_user = User::where('id', $top_relation['parent_id'])->findOrEmpty();
return [
'top_account' => $top_user['account'],
'top_name' => $top_user['is_agent'] == 1 ? $top_user['agent_name']:'',
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getAgentTeamTopAttr($value, $data)
{
$top_relations = UserRelationAgent::where(['user_id' => $data['id']])->order('level desc')->select();
//只有一条数据的话即为代理直接下级超过一条数据则替换一代ID为代理二代ID
$top_relation = $top_relations[0];
if(count($top_relations) > 1){
$top_relation = $top_relations[1];
}
$prev_relation = UserRelationAgent::where(['user_id' => $data['id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
return [
'top_account' => User::where('id', $top_relation['parent_id'])->value('account'),
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
/**
* @notes 获取注册IP数量
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getRegisterIpNumAttr($value, $data)
{
return User::where(['register_ip' => $data['register_ip']])->count();
}
/**
* @notes 获取注册国家
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getRegisterCountryAttr($value, $data)
{
$country = "";
// if($data['register_isp'] == ''){
// if($data['register_ip'] != ''){
// $country = UtilsService::get_country_by_ip($data['register_ip'],1);
// if($country == ''){
// $country = UtilsService::get_country_by_ip($data['register_ip'],2);
// }
// if($country != ''){
// User::where(['id' => $data['id']])->update(['register_isp' => $country]);
// }
// }
// }else{
// $country = $data['register_isp'];
// }
return $country;
}
/**
* @notes 获取登录IP数量
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getLoginIpNumAttr($value, $data)
{
return User::where(['login_ip' => $data['login_ip']])->count();
}
/**
* @notes 订单数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getOrderNumAttr($value, $data)
{
return GoodsRecord::where(['user_id' => $data['id']])->count();
}
/**
* @notes 24小时订单数
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getOrderNum24Attr($value, $data)
{
$time24Hours = time() - 24 * 60 * 60;//24小时前
return GoodsRecord::where(['user_id' => $data['id']])->where("create_time > $time24Hours")->count();
}
/**
* @notes 会员等级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getVipNameAttr($value, $data)
{
//查询会员等级
$vip_name = '';
$member_id = UtilsService::get_user_member_id($data['id']);
$userMember = UserMember::where(['id' => $member_id])->findOrEmpty();
if (!$userMember->isEmpty()) {
$vip_name = $userMember['name'];
}
return $vip_name;
}
/**
* @notes 用户详情
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getUserInfoAttr($value, $data)
{
return UserInfo::where(['user_id' => $data['id']])->findOrEmpty();
}
/**
* @notes 用户分组
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getGroupNameAttr($value, $data)
{
$group_name = '未分组';
$record = UserGroupRecord::where(['user_id' => ($data['id'])])->findOrEmpty();
if (!$record->isEmpty()) {
$group_name = UserGroup::where('id', $record['group_id'])->value('name');
}
return $group_name;
}
}

View File

@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 用户授权表
* Class UserAuth
* @package app\common\model
*/
class UserAuth extends BaseModel
{
}

View File

@@ -0,0 +1,45 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
use app\common\model\user\{UserGroupRule,UserGroupRecord};
/**
* 用户分组模型
* Class UserGroup
* @package app\common\model\user
*/
class UserGroup extends BaseModel
{
protected $name = 'user_group';
/**
* @notes 规则数量
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getRuleNumAttr($value, $data)
{
return UserGroupRule::where(['group_id' => $data['id']])->count();
}
/**
* @notes 用户数量
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getUserNumAttr($value, $data)
{
return UserGroupRecord::where(['group_id' => $data['id']])->count();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 用户分组记录模型
* Class UserGroupRecord
* @package app\common\model\user
*/
class UserGroupRecord extends BaseModel
{
protected $name = 'user_group_record';
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 分组规则模型
* Class UserGroupRule
* @package app\common\model\user
*/
class UserGroupRule extends BaseModel
{
protected $name = 'user_group_rule';
}

View File

@@ -0,0 +1,55 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 用户信息模型
* Class UserInfo
* @package app\common\model\user
*/
class UserInfo extends BaseModel
{
protected $name = 'user_info';
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getCardImg1Attr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getCardImg2Attr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 图片域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getCardImg3Attr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 卡单规则模型
* Class UserKadan
* @package app\common\model\user
*/
class UserKadan extends BaseModel
{
protected $name = 'user_kadan';
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 用户操作模型
* Class UserLog
* @package app\common\model\user
*/
class UserLog extends BaseModel
{
protected $name = 'user_log';
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 挖矿记录模型
* Class UserMineRecord
* @package app\common\model\user
*/
class UserMineRecord extends BaseModel
{
protected $name = 'user_mine_record';
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 用户消息模型
* Class UserNotice
* @package app\common\model\user
*/
class UserNotice extends BaseModel
{
protected $name = 'user_notice';
}

View File

@@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
use app\common\model\user\{User,UserRelationAgent};
/**
* 用户关系模型
* Class UserRelation
* @package app\common\model\user
*/
class UserRelation extends BaseModel
{
protected $name = 'user_relation';
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['user_id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['user_id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
return [
'top_sn' => User::where('id', $top_relation['parent_id'])->value('sn'),
'prev_sn' => User::where('id', $prev_relation['parent_id'])->value('sn'),
'level' => $level
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 代理用户关系模型
* Class UserRelationAgent
* @package app\common\model\user
*/
class UserRelationAgent extends BaseModel
{
protected $name = 'user_relation_agent';
/**
* @notes 获取用户层级
* @param $value
* @param $data
* @return string
* @author BD
* @date 2024/02/22 10:54
*/
public function getTeamTopAttr($value, $data)
{
$top_relation = UserRelationAgent::where(['user_id' => $data['user_id']])->order('level desc')->findOrEmpty();
$prev_relation = UserRelationAgent::where(['user_id' => $data['user_id'],'level' => 1])->findOrEmpty();
$level = '';
if (!$top_relation->isEmpty()) {
$level = $top_relation['level'];
}
$top_user = User::where('id', $top_relation['parent_id'])->findOrEmpty();
return [
'top_account' => $top_user['account'],
'prev_account' => User::where('id', $prev_relation['parent_id'])->value('account'),
'level' => $level
];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 奖励记录模型
* Class UserRewardRecord
* @package app\common\model\user
*/
class UserRewardRecord extends BaseModel
{
protected $name = 'user_reward_record';
}

View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 用户登录token信息
* Class UserSession
* @package app\common\model\user
*/
class UserSession extends BaseModel
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* 签到记录模型
* Class UserSigninRecord
* @package app\common\model\user
*/
class UserSigninRecord extends BaseModel
{
protected $name = 'user_signin_record';
}

View File

@@ -0,0 +1,35 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
use app\common\model\user\{User};
use think\model\concern\SoftDelete;
/**
* 波场钱包模型
* Class UserTron
* @package app\common\model\user
*/
class UserTron extends BaseModel
{
use SoftDelete;
protected $name = 'user_tron';
protected $deleteTime = 'delete_time';
/**
* @notes 获取用户信息
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getUserInfoAttr($value, $data)
{
$user = User::field(['sn', 'account', 'mobile']) -> find($data['user_id']);
return $user;
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 用户优盾钱包模型
* Class UserUdun
* @package app\common\model\user
*/
class UserUdun extends BaseModel
{
use SoftDelete;
protected $name = 'user_udun';
protected $deleteTime = 'delete_time';
}

View File

@@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\withdraw;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
use app\common\model\setting\Language;
/**
* 可提现银行模型
* Class WithdrawBank
* @package app\common\model\withdraw
*/
class WithdrawBank extends BaseModel
{
use SoftDelete;
protected $name = 'withdraw_bank';
protected $deleteTime = 'delete_time';
/**
* @notes logo域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getLogoAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取所属名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getLangNameAttr($value, $data)
{
return Language::where('id', $data['lang_id'])->value('name');
}
}

View File

@@ -0,0 +1,63 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\withdraw;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
use app\common\model\setting\Language;
/**
* 提现方式模型
* Class WithdrawMethod
* @package app\common\model\withdraw
*/
class WithdrawMethod extends BaseModel
{
use SoftDelete;
protected $name = 'withdraw_method';
protected $deleteTime = 'delete_time';
/**
* @notes logo域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getLogoAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取所属名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getLangNameAttr($value, $data)
{
if($data['lang_id'] == 0){
return '通用';
}
return Language::where('id', $data['lang_id'])->value('name');
}
}

View File

@@ -0,0 +1,103 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\withdraw;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\service\FileService;
use app\common\model\setting\Language;
use app\common\model\withdraw\{WithdrawMethod,WithdrawBank};
/**
* 用户提现钱包模型
* Class WithdrawWallet
* @package app\common\model\withdraw
*/
class WithdrawWallet extends BaseModel
{
use SoftDelete;
protected $name = 'withdraw_wallet';
protected $deleteTime = 'delete_time';
/**
* @notes 二维码域名替换
* @param $value
* @return string
* @author Tab
* @date 2021/7/17 14:28
*/
public function getImgAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
/**
* @notes 获取方式名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getMethodNameAttr($value, $data)
{
return WithdrawMethod::where('id', $data['method_id'])->value('name');
}
/**
* @notes 获取手续费
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getMethodChargeAttr($value, $data)
{
return WithdrawMethod::where('id', $data['method_id'])->value('charge');
}
/**
* @notes 获取所属名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getLangNameAttr($value, $data)
{
if($data['lang_id'] == 0){
return '通用';
}
return Language::where('id', $data['lang_id'])->value('name');
}
/**
* @notes 获取银行名称
* @param $value
* @param $data
* @return string
* @author heshihu
* @date 2022/2/22 9:53
*/
public function getBankNameAttr($value, $data)
{
return WithdrawBank::where('id', $data['bank_id'])->value('name');
}
}