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