no message

This commit is contained in:
hajimi
2026-06-11 12:15:29 +08:00
parent 10ebe39c30
commit 96efa1d905
5859 changed files with 815501 additions and 5 deletions
+50
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) : '';
}
}
+19
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
{
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace app\common\model;
use think\Model;
class CrawlErrorLog extends Model
{
protected $name = 'crawl_error_log';
protected $autoWriteTimestamp = false;
}
+80
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);
}
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace app\common\model;
class CrontabLog extends BaseModel
{
protected $name = 'dev_crontab_log';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_time';
protected $updateTime = false;
}
+20
View File
@@ -0,0 +1,20 @@
<?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 HotSearch extends BaseModel
{
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace app\common\model;
class OperationLog extends BaseModel
{
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace app\common\model;
class ShortLink extends BaseModel
{
protected $name = 'short_link';
/**
* @notes 生成唯一随机码
*/
public static function generateCode(int $length = 8): string
{
$chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789';
do {
$code = '';
for ($i = 0; $i < $length; $i++) {
$code .= $chars[random_int(0, strlen($chars) - 1)];
}
} while (self::where('code', $code)->findOrEmpty()->isExists());
return $code;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\common\model;
class ShortLinkLog extends BaseModel
{
protected $name = 'short_link_log';
/**
* @notes 从UA解析平台
*/
public static function parsePlatform(string $ua): string
{
$ua = strtolower($ua);
if (str_contains($ua, 'micromessenger'))
return 'wechat';
if (str_contains($ua, 'alipay'))
return 'alipay';
if (str_contains($ua, 'iphone') || str_contains($ua, 'ipad'))
return 'ios';
if (str_contains($ua, 'android'))
return 'android';
if (str_contains($ua, 'windows'))
return 'windows';
if (str_contains($ua, 'macintosh'))
return 'mac';
return 'other';
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace app\common\model;
/**
* 短信上传记录模型
* Class SmsLog
* @package app\common\model
*/
class SmsLog extends BaseModel
{
protected $name = 'sms_upload';
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiAnalysis extends BaseModel
{
// 分析类型
const TYPE_MATCH_PREDICT = 1;
const TYPE_ARTICLE_ANALYSIS = 2;
const TYPE_USER_CREDIBILITY = 3;
const TYPE_LOTTERY_ANALYSIS = 4;
const TYPE_POST_ANALYSIS = 5;
const TYPE_KB_RETRIEVAL = 6;
const TYPE_ASSISTANT_CHAT = 7;
// 状态
const STATUS_SUCCESS = 1;
const STATUS_FAILED = 2;
const STATUS_PROCESSING = 3;
/**
* 获取有效缓存
*/
public static function getCache(int $type, int $refId): ?array
{
$row = self::where('type', $type)
->where('ref_id', $refId)
->where('status', self::STATUS_SUCCESS)
->where('expire_time', '>', time())
->order('id', 'desc')
->findOrEmpty();
if ($row->isEmpty()) {
return null;
}
return $row->toArray();
}
}
@@ -0,0 +1,16 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiChatMessage extends BaseModel
{
protected $name = 'ai_chat_message';
public const ROLE_USER = 'user';
public const ROLE_ASSISTANT = 'assistant';
public const STATUS_SUCCESS = 1;
public const STATUS_FAILED = 2;
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiChatSession extends BaseModel
{
protected $name = 'ai_chat_session';
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiConfig extends BaseModel
{
public static function getVal(string $name, string $default = ''): string
{
$val = AiConfig::where('name', $name)->value('value');
return $val !== null ? $val : $default;
}
public static function setVal(string $name, string $value): void
{
$row = AiConfig::where('name', $name)->findOrEmpty();
if ($row->isEmpty()) {
AiConfig::create(['name' => $name, 'value' => $value]);
} else {
$row->value = $value;
$row->save();
}
}
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiKbChunk extends BaseModel
{
protected $name = 'ai_kb_chunk';
protected $json = ['embedding_json'];
protected $jsonAssoc = true;
}
@@ -0,0 +1,14 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiKbDocument extends BaseModel
{
protected $name = 'ai_kb_document';
protected $json = ['metadata_json'];
protected $jsonAssoc = true;
}
@@ -0,0 +1,17 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiKbQueryLog extends BaseModel
{
protected $name = 'ai_kb_query_log';
protected $json = ['filters_json', 'hit_docs_json'];
protected $jsonAssoc = true;
public const STATUS_SUCCESS = 1;
public const STATUS_FAILED = 2;
}
@@ -0,0 +1,19 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiKbSyncJob extends BaseModel
{
protected $name = 'ai_kb_sync_job';
public const STATUS_PENDING = 0;
public const STATUS_PROCESSING = 1;
public const STATUS_SUCCESS = 2;
public const STATUS_FAILED = 3;
public const ACTION_UPSERT = 'upsert';
public const ACTION_DELETE = 'delete';
public const ACTION_REBUILD = 'rebuild';
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
class AiLog extends BaseModel
{
}
+87
View File
@@ -0,0 +1,87 @@
<?php
namespace app\common\model\ai;
use app\common\model\BaseModel;
use app\common\model\user\User;
class AiUnlock extends BaseModel
{
/**
* 检查用户是否已解锁某场比赛
*/
public static function isUnlocked(int $userId, int $matchId): bool
{
return self::where('user_id', $userId)->where('match_id', $matchId)->count() > 0;
}
/**
* 解锁比赛(扣次数 + 写记录)
* @return array ['ok' => bool, 'msg' => string]
*/
public static function unlock(int $userId, int $matchId): array
{
// 已解锁则直接返回
if (self::isUnlocked($userId, $matchId)) {
return ['ok' => true, 'msg' => '已解锁'];
}
// 检查今日剩余次数
$user = User::findOrEmpty($userId);
if ($user->isEmpty()) {
return ['ok' => false, 'msg' => '用户不存在'];
}
// VIP用户不限次数
if ($user->is_vip && $user->vip_expire_time > time()) {
self::create([
'user_id' => $userId,
'match_id' => $matchId,
]);
return ['ok' => true, 'msg' => 'VIP解锁'];
}
// 重置每日次数(跨天时)
$today = date('Y-m-d');
if ($user->ai_free_date !== $today) {
$user->ai_free_count = 3;
$user->ai_free_date = $today;
$user->save();
}
if ($user->ai_free_count <= 0) {
return ['ok' => false, 'msg' => '今日免费次数已用完,升级VIP可无限使用'];
}
// 扣次数 + 写解锁记录
$user->ai_free_count = $user->ai_free_count - 1;
$user->save();
self::create([
'user_id' => $userId,
'match_id' => $matchId,
]);
return ['ok' => true, 'msg' => '解锁成功', 'remain' => $user->ai_free_count];
}
/**
* 获取用户今日剩余次数
*/
public static function getRemainCount(int $userId): int
{
$user = User::findOrEmpty($userId);
if ($user->isEmpty()) {
return 0;
}
// VIP不限
if ($user->is_vip && $user->vip_expire_time > time()) {
return 999;
}
$today = date('Y-m-d');
if ($user->ai_free_date !== $today) {
return 3;
}
return max(0, (int)$user->ai_free_count);
}
}
@@ -0,0 +1,62 @@
<?php
namespace app\common\model\app;
use app\common\model\BaseModel;
use app\common\service\FileService;
use think\model\concern\SoftDelete;
/**
* APP 版本管理模型
* Class AppVersion
* @package app\common\model\app
*/
class AppVersion extends BaseModel
{
use SoftDelete;
protected $name = 'app_version';
protected $deleteTime = 'delete_time';
/**
* 平台名称
*/
public function getPlatformTextAttr($value, $data): string
{
$map = [1 => 'Android', 2 => 'iOS'];
return $map[$data['platform']] ?? '';
}
/**
* 包类型名称
*/
public function getPackageTypeTextAttr($value, $data): string
{
$map = [1 => 'wgt热更', 2 => 'apk整包', 3 => 'ipa/AppStore'];
return $map[$data['package_type']] ?? '';
}
/**
* 升级类型名称
*/
public function getUpdateTypeTextAttr($value, $data): string
{
$map = [1 => '普通升级', 2 => '强制升级', 3 => '静默升级'];
return $map[$data['update_type']] ?? '';
}
/**
* 完整下载链接
*/
public function getDownloadUrlAttr($value): string
{
if (empty($value)) {
return '';
}
// 已是完整 URLhttp/https)直接返回
if (preg_match('/^https?:\/\//i', $value)) {
return $value;
}
return FileService::getFileUrl($value);
}
}
+138
View File
@@ -0,0 +1,138 @@
<?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 app\common\model\article\ArticleComment;
use think\model\concern\SoftDelete;
/**
* 资讯管理模型
* Class Article
* @package app\common\model\article;
*/
class Article extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
public static function hasPublishableContent(?string $content): bool
{
$raw = trim((string) $content);
if ($raw === '') {
return false;
}
$plain = trim(strip_tags($raw));
if (mb_strlen($plain) < 50) {
return false;
}
if (preg_match('/<(p|div|article|section|img|video|h1|h2|h3|h4|blockquote|li)\b/i', $raw)) {
return true;
}
return mb_strlen($plain) >= 200;
}
public function comments()
{
return $this->hasMany(ArticleComment::class, 'article_id', 'id');
}
/**
* @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::withCount(['comments' => 'comment_count'])
->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();
}
}
@@ -0,0 +1,14 @@
<?php
namespace app\common\model\article;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class ArticleAiCommentTask extends BaseModel
{
use SoftDelete;
protected $name = 'article_ai_comment_task';
protected $deleteTime = 'delete_time';
}
@@ -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');
}
}
@@ -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();
}
}
@@ -0,0 +1,18 @@
<?php
namespace app\common\model\article;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 文章评论模型
* Class ArticleComment
* @package app\common\model\article
*/
class ArticleComment extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
@@ -0,0 +1,18 @@
<?php
namespace app\common\model\article;
use app\common\model\BaseModel;
/**
* 文章投票模型(点赞/踩)
* Class ArticleVote
* @package app\common\model\article
*/
class ArticleVote extends BaseModel
{
// 点赞
const VOTE_LIKE = 1;
// 踩
const VOTE_DISLIKE = 2;
}
+116
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, '/'));
}
}
@@ -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();
}
}
@@ -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();
}
}
@@ -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();
}
}
@@ -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');
}
}
@@ -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
{
}
@@ -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');
}
}
@@ -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
{
}
@@ -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\channel;
use app\common\model\BaseModel;
/**
* 微信公众号回复
* Class OfficialAccountReply
* @package app\common\model\channel
*/
class OfficialAccountReply extends BaseModel
{
}
@@ -0,0 +1,13 @@
<?php
namespace app\common\model\chat;
use app\common\model\BaseModel;
class PrivateChatMessage extends BaseModel
{
protected $name = 'private_chat_message';
public const TYPE_TEXT = 'text';
public const TYPE_IMAGE = 'image';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\chat;
use app\common\model\BaseModel;
class PrivateChatSession extends BaseModel
{
protected $name = 'private_chat_session';
}
@@ -0,0 +1,14 @@
<?php
namespace app\common\model\community;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class CommunityComment extends BaseModel
{
use SoftDelete;
protected $name = 'community_comment';
protected $deleteTime = 'delete_time';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\community;
use app\common\model\BaseModel;
class CommunityFollow extends BaseModel
{
protected $name = 'community_follow';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\community;
use app\common\model\BaseModel;
class CommunityLike extends BaseModel
{
protected $name = 'community_like';
}
@@ -0,0 +1,29 @@
<?php
namespace app\common\model\community;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class CommunityPost extends BaseModel
{
use SoftDelete;
protected $name = 'community_post';
protected $deleteTime = 'delete_time';
public function getImagesAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setImagesAttr($value)
{
return $value ? json_encode($value, JSON_UNESCAPED_UNICODE) : '[]';
}
public function tags()
{
return $this->belongsToMany(CommunityTag::class, 'la_community_post_tag', 'tag_id', 'post_id');
}
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\community;
use app\common\model\BaseModel;
class CommunityTag extends BaseModel
{
protected $name = 'community_tag';
}
@@ -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\decorate;
use app\common\model\BaseModel;
/**
* 装修配置-页面
* Class DecorateTabbar
* @package app\common\model\decorate
*/
class DecoratePage extends BaseModel
{
}
@@ -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\decorate;
use app\common\model\BaseModel;
use app\common\service\FileService;
/**
* 装修配置-底部导航
* Class DecorateTabbar
* @package app\common\model\decorate
*/
class DecorateTabbar extends BaseModel
{
// 设置json类型字段
protected $json = ['link'];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* @notes 获取底部导航列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/23 12:07
*/
public static function getTabbarLists()
{
$tabbar = self::select()->toArray();
if (empty($tabbar)) {
return $tabbar;
}
foreach ($tabbar as &$item) {
if (!empty($item['selected'])) {
$item['selected'] = FileService::getFileUrl($item['selected']);
}
if (!empty($item['unselected'])) {
$item['unselected'] = FileService::getFileUrl($item['unselected']);
}
}
return $tabbar;
}
}
+46
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'] ? '正常' : '停用';
}
}
+44
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'] ? '正常' : '停用';
}
}
@@ -0,0 +1,26 @@
<?php
namespace app\common\model\device;
use app\common\model\BaseModel;
/**
* 用户设备信息模型
*/
class UserDevice extends BaseModel
{
protected $name = 'user_device';
public function getPlatformTextAttr($value, $data): string
{
$map = [
'android' => 'Android',
'ios' => 'iOS',
'h5' => 'H5',
'mp_weixin' => '微信小程序',
'windows' => 'Windows',
'mac' => 'Mac',
];
return $map[$data['platform']] ?? $data['platform'];
}
}
+47
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'] ? '正常' : '停用';
}
}
+47
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'] ? '正常' : '停用';
}
}
+24
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';
}
+25
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';
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\league;
use app\common\model\BaseModel;
class League extends BaseModel
{
protected $name = 'league';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryAiAnalysis extends BaseModel
{
protected $name = 'lottery_ai_analysis';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryCategory extends BaseModel
{
protected $name = 'lottery_category';
}
@@ -0,0 +1,20 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryDraw extends BaseModel
{
protected $name = 'lottery_draw';
// JSON字段自动转数组
protected $json = ['numbers', 'zodiac', 'elements', 'color'];
protected $jsonAssoc = true;
public function category()
{
return $this->belongsTo(LotteryCategory::class, 'category_id');
}
}
@@ -0,0 +1,19 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryDrawResult extends BaseModel
{
protected $name = 'lottery_draw_result';
protected $json = ['trend'];
protected $jsonAssoc = true;
public function game()
{
return $this->belongsTo(LotteryGame::class, 'code', 'code');
}
}
@@ -0,0 +1,15 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryGame extends BaseModel
{
protected $name = 'lottery_game';
public function gameCategory()
{
return $this->belongsTo(LotteryGameCategory::class, 'category', 'value');
}
}
@@ -0,0 +1,15 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryGameCategory extends BaseModel
{
protected $name = 'lottery_game_category';
public function games()
{
return $this->hasMany(LotteryGame::class, 'category', 'value');
}
}
@@ -0,0 +1,92 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryNumberMapping extends BaseModel
{
protected $name = 'lottery_number_mapping';
// 类型常量
const TYPE_ZODIAC = 1; // 生肖
const TYPE_COLOR = 2; // 波色
const TYPE_ELEMENT = 3; // 五行
protected $json = ['numbers'];
protected $jsonAssoc = true;
/**
* 获取指定年份的全部映射数据
*/
public static function getByYear(int $year): array
{
$list = self::where('year', $year)->order('type asc, sort asc')->select()->toArray();
$result = ['zodiac' => [], 'color' => [], 'element' => []];
foreach ($list as $item) {
$item['numbers'] = is_string($item['numbers']) ? json_decode($item['numbers'], true) : $item['numbers'];
match ((int)$item['type']) {
self::TYPE_ZODIAC => $result['zodiac'][] = $item,
self::TYPE_COLOR => $result['color'][] = $item,
self::TYPE_ELEMENT => $result['element'][] = $item,
};
}
return $result;
}
/**
* 获取指定年份某类型的映射(按attr_name索引)
*/
public static function getMapByType(int $year, int $type): array
{
$list = self::where('year', $year)->where('type', $type)->order('sort asc')->select()->toArray();
$map = [];
foreach ($list as $item) {
$nums = is_string($item['numbers']) ? json_decode($item['numbers'], true) : $item['numbers'];
$map[$item['attr_name']] = $nums;
}
return $map;
}
/**
* 根据号码反查属性名(如:号码1 → 生肖"马"、波色"红波"、五行"水"
*/
public static function lookupNumber(int $year, int $number): array
{
$all = self::where('year', $year)->order('type asc, sort asc')->select()->toArray();
$result = ['zodiac' => '', 'color' => '', 'element' => ''];
foreach ($all as $item) {
$nums = is_string($item['numbers']) ? json_decode($item['numbers'], true) : $item['numbers'];
if (in_array($number, $nums)) {
match ((int)$item['type']) {
self::TYPE_ZODIAC => $result['zodiac'] = $item['attr_name'],
self::TYPE_COLOR => $result['color'] = $item['attr_name'],
self::TYPE_ELEMENT => $result['element'] = $item['attr_name'],
};
}
}
return $result;
}
/**
* 从上一年份复制映射数据到新年份(用于年度轮转后微调)
*/
public static function copyToNextYear(int $fromYear, int $toYear): int
{
$exists = self::where('year', $toYear)->count();
if ($exists > 0) {
return 0;
}
$list = self::where('year', $fromYear)->select()->toArray();
$count = 0;
foreach ($list as $item) {
unset($item['id']);
$item['year'] = $toYear;
$item['create_time'] = time();
$item['update_time'] = time();
self::create($item);
$count++;
}
return $count;
}
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\lottery;
use app\common\model\BaseModel;
class LotteryRegion extends BaseModel
{
protected $name = 'lottery_region';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchData extends BaseModel
{
protected $name = 'match_data';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchEvent extends BaseModel
{
protected $name = 'match';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchEventLog extends BaseModel
{
protected $name = 'match_event';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchHistory extends BaseModel
{
protected $name = 'match_history';
}
@@ -0,0 +1,11 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchLineup extends BaseModel
{
protected $name = 'match_lineup';
protected $autoWriteTimestamp = false;
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchLiveText extends BaseModel
{
protected $name = 'match_live_text';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchRecent extends BaseModel
{
protected $name = 'match_recent';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class MatchRound extends BaseModel
{
protected $name = 'match_round';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class WorldCupPersonRanking extends BaseModel
{
protected $name = 'worldcup_person_ranking';
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model\match;
use app\common\model\BaseModel;
class WorldCupStanding extends BaseModel
{
protected $name = 'worldcup_standing';
}
@@ -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';
}
@@ -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);
}
}
+30
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';
}
+56
View File
@@ -0,0 +1,56 @@
<?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\pay;
use app\common\enum\PayEnum;
use app\common\model\BaseModel;
use app\common\service\FileService;
class PayConfig extends BaseModel
{
protected $name = 'dev_pay_config';
// 设置json类型字段
protected $json = ['config'];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
/**
* @notes 支付图标获取器 - 路径添加域名
* @param $value
* @return string
* @author ljj
* @date 2021/7/28 2:12 下午
*/
public function getIconAttr($value)
{
return empty($value) ? '' : FileService::getFileUrl($value);
}
/**
* @notes 支付方式名称获取器
* @param $value
* @param $data
* @return string|string[]
* @author ljj
* @date 2021/7/31 2:24 下午
*/
public function getPayWayNameAttr($value,$data)
{
return PayEnum::getPayDesc($data['pay_way']);
}
}
+54
View File
@@ -0,0 +1,54 @@
<?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\pay;
use app\common\model\BaseModel;
use app\common\service\FileService;
class PayWay extends BaseModel
{
protected $name = 'dev_pay_way';
public function getIconAttr($value,$data)
{
return FileService::getFileUrl($value);
}
/**
* @notes 支付方式名称获取器
* @param $value
* @param $data
* @return mixed
* @author ljj
* @date 2021/7/28 4:02 下午
*/
public static function getPayWayNameAttr($value,$data)
{
return PayConfig::where('id',$data['pay_config_id'])->value('name');
}
/**
* @notes 关联支配配置模型
* @return \think\model\relation\HasOne
* @author ljj
* @date 2021/10/11 3:04 下午
*/
public function payConfig()
{
return $this->hasOne(PayConfig::class,'id','pay_config_id');
}
}
@@ -0,0 +1,24 @@
<?php
namespace app\common\model\points;
use app\common\enum\PayEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class PointsOrder extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
public function getPayWayTextAttr($value, $data)
{
return PayEnum::getPayDesc($data['pay_way']);
}
public function getPayStatusTextAttr($value, $data)
{
return PayEnum::getPayStatusDesc($data['pay_status']);
}
}
@@ -0,0 +1,13 @@
<?php
namespace app\common\model\points;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class PointsProduct extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
@@ -0,0 +1,46 @@
<?php
namespace app\common\model\popup;
use app\common\model\BaseModel;
use app\common\service\FileService;
use think\model\concern\SoftDelete;
/**
* 页面弹窗配置模型
*/
class PagePopup extends BaseModel
{
use SoftDelete;
protected $name = 'page_popup';
protected $deleteTime = 'delete_time';
/**
* 完整图片URL
*/
public function getImageAttr($value): string
{
if (empty($value)) return '';
if (preg_match('/^https?:\/\//i', $value)) return $value;
return FileService::getFileUrl($value);
}
public function getPopupTypeTextAttr($value, $data): string
{
$map = [1 => '图片弹窗', 2 => '文字弹窗', 3 => '图文混合'];
return $map[$data['popup_type']] ?? '';
}
public function getLinkTypeTextAttr($value, $data): string
{
$map = [0 => '不跳转', 1 => '站内路径', 2 => '外部H5', 3 => '拨打电话'];
return $map[$data['link_type']] ?? '';
}
public function getFrequencyTextAttr($value, $data): string
{
$map = [1 => '每次', 2 => '每会话一次', 3 => '每天一次', 4 => '仅一次'];
return $map[$data['frequency']] ?? '';
}
}
@@ -0,0 +1,20 @@
<?php
namespace app\common\model\popup;
use app\common\model\BaseModel;
/**
* 弹窗操作日志
*/
class PagePopupLog extends BaseModel
{
protected $name = 'page_popup_log';
protected $autoWriteTimestamp = false;
public function getActionTextAttr($value, $data): string
{
$map = [1 => '展示', 2 => '点击', 3 => '关闭'];
return $map[$data['action']] ?? '';
}
}
@@ -0,0 +1,57 @@
<?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\recharge;
use app\common\enum\PayEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 充值订单模型
* Class RechargeOrder
* @package app\common\model
*/
class RechargeOrder extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
/**
* @notes 支付方式
* @param $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 18:32
*/
public function getPayWayTextAttr($value, $data)
{
return PayEnum::getPayDesc($data['pay_way']);
}
/**
* @notes 支付状态
* @param $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 18:32
*/
public function getPayStatusTextAttr($value, $data)
{
return PayEnum::getPayStatusDesc($data['pay_status']);
}
}
@@ -0,0 +1,58 @@
<?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\refund;
use app\common\enum\RefundEnum;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
/**
* 退款日志模型
* Class RefundLog
* @package app\common\model\refund
*/
class RefundLog extends BaseModel
{
/**
* @notes 操作人描述
* @param $value
* @param $data
* @return mixed
* @author 段誉
* @date 2022/12/1 10:55
*/
public function getHandlerAttr($value, $data)
{
return Admin::where('id', $data['handle_id'])->value('name');
}
/**
* @notes 退款状态描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/1 10:55
*/
public function getRefundStatusTextAttr($value, $data)
{
return RefundEnum::getStatusDesc($data['refund_status']);
}
}
@@ -0,0 +1,71 @@
<?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\refund;
use app\common\enum\RefundEnum;
use app\common\model\BaseModel;
/**
* 退款记录模型
* Class RefundRecord
* @package app\common\model\refund
*/
class RefundRecord extends BaseModel
{
/**
* @notes 退款类型描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/1 10:41
*/
public function getRefundTypeTextAttr($value, $data)
{
return RefundEnum::getTypeDesc($data['refund_type']);
}
/**
* @notes 退款状态描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/1 10:44
*/
public function getRefundStatusTextAttr($value, $data)
{
return RefundEnum::getStatusDesc($data['refund_status']);
}
/**
* @notes 退款方式描述
* @param $value
* @param $data
* @return string|string[]
* @author 段誉
* @date 2022/12/6 11:08
*/
public function getRefundWayTextAttr($value, $data)
{
return RefundEnum::getWayDesc($data['refund_way']);
}
}
@@ -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');
}
}
@@ -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']);
}
}
+251
View File
@@ -0,0 +1,251 @@
<?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\service\FileService;
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|nickname|mobile|account', '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(1, 9);
}
$sn = $prefix . $rand_str;
if (User::where(['sn' => $sn])->find()) {
return self::createUserSn($prefix, $length);
}
return $sn;
}
/**
* @notes VIP等级名称映射(从数据库动态获取)
*/
public static function getVipLevelMap(): array
{
static $map = null;
if ($map === null) {
$map = [0 => '普通用户'];
$levels = \app\common\model\vip\VipLevel::where('status', 1)->column('name', 'level');
foreach ($levels as $level => $name) {
$map[(int) $level] = $name;
}
}
return $map;
}
/**
* @notes 获取VIP信息(含自动过期判断和免费次数重置)
*/
public function getVipInfo(): array
{
$now = time();
$isVip = $this->getData('is_vip') == 1 && $this->getData('vip_expire_time') > $now;
// VIP已过期自动清除
if ($this->getData('is_vip') == 1 && $this->getData('vip_expire_time') <= $now) {
$this->save(['is_vip' => 0, 'vip_level' => 0]);
$isVip = false;
}
// 每日免费次数重置
$today = date('Y-m-d');
if ($this->getData('ai_free_date') !== $today) {
$this->save(['ai_free_count' => 3, 'ai_free_date' => $today]);
$freeCount = 3;
} else {
$freeCount = (int) $this->getData('ai_free_count');
}
// 获取等级卡片背景图
$cardImage = '';
if ($isVip) {
$level = (int) $this->getData('vip_level');
$cardImage = \app\common\model\vip\VipLevel::where('level', $level)
->where('status', 1)
->value('image', '');
}
return [
'is_vip' => $isVip,
'vip_level' => $isVip ? (int) $this->getData('vip_level') : 0,
'vip_level_name' => $isVip ? (self::getVipLevelMap()[$this->getData('vip_level')] ?? '会员') : '',
'vip_expire_time' => $isVip ? date('Y年m月d日', $this->getData('vip_expire_time')) : '',
'vip_expire_timestamp' => $isVip ? (int) $this->getData('vip_expire_time') : 0,
'vip_card_image' => $cardImage,
'ai_free_count' => $freeCount,
];
}
/**
* @notes 生成唯一邀请码
*/
public static function createInviteCode($length = 8): string
{
$chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
do {
$code = '';
for ($i = 0; $i < $length; $i++) {
$code .= $chars[mt_rand(0, strlen($chars) - 1)];
}
} while (User::where('invite_code', $code)->find());
return $code;
}
}
@@ -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\user;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 账户流水记录模型
* Class AccountLog
* @package app\common\model\user
*/
class UserAccountLog extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
+27
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
{
}
@@ -0,0 +1,20 @@
<?php
namespace app\common\model\user;
use app\common\model\BaseModel;
class UserChannelConfig extends BaseModel
{
protected $name = 'user_channel_config';
public function getChannelIdsAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setChannelIdsAttr($value)
{
return is_array($value) ? json_encode($value) : $value;
}
}
@@ -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
{
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace app\common\model\vip;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class VipLevel extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace app\common\model\vip;
use app\common\enum\PayEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class VipOrder extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
public function getPayWayTextAttr($value, $data)
{
return PayEnum::getPayDesc($data['pay_way']);
}
public function getPayStatusTextAttr($value, $data)
{
return PayEnum::getPayStatusDesc($data['pay_status']);
}
}