init: 项目初始代码

This commit is contained in:
2026-10-14 14:00:29 +08:00
commit cc434cf89f
464 changed files with 66984 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace app\api\model;
/**
* @mixin \think\Model
*/
class ImagesFile extends BaseModel
{
/**
* 上传用户昵称关联
*/
public function uploader()
{
return $this->hasOne(User::class, 'id', 'up_id')->bind(['uploader_name'=>'nickname']);
}
// 根据ID查询
public function scopeId($query, $id)
{
if (is_array($id)) {
$query->where('id', 'in', $id);
} else {
$query->where('id', '=', $id);
}
}
// 根据上传人查询
public function scopeUpId($query, $up_id)
{
$query->where('up_id', '=', $up_id);
}
// 根据文件MD5值查询
public function scopeFileMd5($query, $md5)
{
$query->where('file_md5', '=', $md5);
}
// 根据文件hash值查询
public function scopeFileHash($query, $hash)
{
$query->where('file_hash', '=', $hash);
}
}