You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
12 months ago
|
<?php
|
||
|
declare (strict_types=1);
|
||
|
|
||
|
namespace app\common\model;
|
||
|
|
||
|
use cores\BaseModel;
|
||
|
use think\model\relation\BelongsTo;
|
||
|
|
||
|
class RecoveryImage extends BaseModel
|
||
|
{
|
||
|
|
||
|
// 定义表名
|
||
|
protected $name = 'server_recovery_image';
|
||
|
|
||
|
// 定义主键
|
||
|
protected $pk = 'id';
|
||
|
|
||
|
protected $updateTime = false;
|
||
|
|
||
|
/**
|
||
|
* 关联文件库
|
||
|
* @return BelongsTo
|
||
|
*/
|
||
|
public function file(): BelongsTo
|
||
|
{
|
||
|
return $this->belongsTo('UploadFile', 'image_id', 'file_id');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @notes:批量插入回收图片记录
|
||
|
* @param int $recoveryId 回收ID
|
||
|
* @param array $imageIds 图片ID集
|
||
|
* @return array|false
|
||
|
* @author: wanghousheng
|
||
|
*/
|
||
|
public static function increased(int $recoveryId, array $imageIds)
|
||
|
{
|
||
|
$dataset = [];
|
||
|
foreach ($imageIds as $imageId) {
|
||
|
$dataset[] = [
|
||
|
'image_id' => $imageId,
|
||
|
'recovery_id' => $recoveryId,
|
||
|
'store_id' => self::$storeId
|
||
|
];
|
||
|
}
|
||
|
return (new static)->addAll($dataset);
|
||
|
}
|
||
|
}
|