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.
yanzong/app/common/model/RecoveryImage.php

48 lines
1.0 KiB

11 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:批量插入回收图片记录
11 months ago
* @param int $orderId 回收ID
11 months ago
* @param array $imageIds 图片ID集
* @return array|false
* @author: wanghousheng
*/
11 months ago
public static function increased(int $orderId, array $imageIds)
11 months ago
{
$dataset = [];
foreach ($imageIds as $imageId) {
$dataset[] = [
'image_id' => $imageId,
11 months ago
'order_id' => $orderId,
11 months ago
'store_id' => self::$storeId
];
}
return (new static)->addAll($dataset);
}
}