GoodsImage.php 732 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\common\model\sharing;
  10. use app\common\model\BaseModel;
  11. /**
  12. * 拼团商品图片模型
  13. * Class GoodsImage
  14. * @package app\common\model\sharing
  15. */
  16. class GoodsImage extends BaseModel
  17. {
  18. protected $name = 'sharing_goods_image';
  19. protected $updateTime = false;
  20. /**
  21. * 关联文件库
  22. * @return \think\model\relation\BelongsTo
  23. */
  24. public function file()
  25. {
  26. $module = self::getCalledModule() ?: 'common';
  27. return $this->belongsTo("app\\{$module}\\model\\UploadFile", 'image_id', 'file_id')
  28. ->bind(['file_path', 'file_name', 'file_url']);
  29. }
  30. }