quanwei
2025-12-25 a47b138c7455dee981af9b4fac431a16c0eee675
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
 
namespace app\common\model\branch;
 
use app\common\model\BaseModel;
/**
 * 商品图片模型
 */
class ActivityFile extends BaseModel
{
    protected $name = 'branch_activity_file';
    protected $updateTime = false;
 
    /**
     * 关联文件库
     */
    public function file()
    {
        return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'file_id', 'file_id')
            ->bind(['file_path', 'file_name', 'file_url', 'is_original']);
    }
 
    /**
     * 关联文件库原图
     */
    public function original()
    {
        return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'file_id', 'file_id')
            ->bind(['file_path', 'original_path', 'is_original']);
    }
 
    /**
     * 文件详情
     */
    public static function detail($where, $with = [])
    {
        if (is_array($where)) {
            return (new static())->with($with)->where($where)->find();
        } else {
            return (new static())->with($with)->where('id', '=', $where)->find();
        }
    }
 
}