2026-03-21 02:55:24 +08:00
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
2026-03-29 11:22:52 +08:00
|
|
|
// | Author: ScottPan Team
|
2026-03-21 02:55:24 +08:00
|
|
|
// +----------------------------------------------------------------------
|
2026-03-29 11:22:52 +08:00
|
|
|
|
2026-03-21 02:55:24 +08:00
|
|
|
declare (strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace app\dao\system\attachment;
|
|
|
|
|
|
|
|
|
|
use app\dao\BaseDao;
|
|
|
|
|
use app\model\system\attachment\SystemAttachment;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* Class SystemAttachmentDao
|
|
|
|
|
* @package app\dao\attachment
|
|
|
|
|
*/
|
|
|
|
|
class SystemAttachmentDao extends BaseDao
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置模型
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
protected function setModel(): string
|
|
|
|
|
{
|
|
|
|
|
return SystemAttachment::class;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取图片列表
|
|
|
|
|
* @param array $where
|
|
|
|
|
* @param int $page
|
|
|
|
|
* @param int $limit
|
|
|
|
|
* @return array
|
|
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
* @throws \think\db\exception\DbException
|
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function getList(array $where, int $page, int $limit)
|
|
|
|
|
{
|
|
|
|
|
return $this->search($where)->where('module_type', 1)->page($page, $limit)->order('att_id DESC')->select()->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取扫码上传的图片数据
|
|
|
|
|
* @param $scan_token
|
|
|
|
|
* @return array
|
|
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
* @throws \think\db\exception\DbException
|
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function scanUploadImage($scan_token)
|
|
|
|
|
{
|
|
|
|
|
return $this->getModel()->where('scan_token', $scan_token)->field('att_dir,att_id')->select()->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 移动图片
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return \crmeb\basic\BaseModel
|
|
|
|
|
*/
|
|
|
|
|
public function move(array $data)
|
|
|
|
|
{
|
|
|
|
|
return $this->getModel()->whereIn('att_id', $data['images'])->update(['pid' => $data['pid']]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取名称
|
|
|
|
|
* @param array $where
|
|
|
|
|
* @param int $page
|
|
|
|
|
* @param int $limit
|
|
|
|
|
* @return array
|
|
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
* @throws \think\db\exception\DbException
|
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function getLikeNameList(array $where, int $page, int $limit)
|
|
|
|
|
{
|
|
|
|
|
return $this->search($where)->page($page, $limit)->order('att_id desc')->select()->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取昨日系统生成
|
|
|
|
|
* @param int $type
|
|
|
|
|
* @param int $relationId
|
|
|
|
|
* @return \think\Collection
|
|
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
* @throws \think\db\exception\DbException
|
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function getYesterday(int $type = 1, $relationId = 0)
|
|
|
|
|
{
|
|
|
|
|
return $this->getModel()->where('type', $type)->when($relationId, function ($query) use ($relationId) {
|
|
|
|
|
$query->where('relation_id', $relationId);
|
|
|
|
|
})->whereTime('time', 'yesterday')->where('module_type', 2)->field(['name', 'att_dir', 'att_id', 'image_type'])->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除昨日生成海报
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*/
|
|
|
|
|
public function delYesterday()
|
|
|
|
|
{
|
|
|
|
|
$this->getModel()->whereTime('time', 'yesterday')->where('module_type', 2)->delete();
|
|
|
|
|
}
|
|
|
|
|
}
|