BuildingProgress.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class BuildingProgress extends Model
  5. {
  6. public function getImgAttr($value){
  7. if(empty($value)) return $value;
  8. $arr = explode(',', $value);
  9. $domain = config('app.ali_oss_bindurl');
  10. foreach($arr as &$item){
  11. $item = 'https://'.$domain.'/'.$item;
  12. }
  13. return $arr;
  14. }
  15. public function setImgAttr($value)
  16. {
  17. $domain = config('app.ali_oss_bindurl');
  18. $search = 'https://' . $domain . '/';
  19. return str_replace($search, '', $value);
  20. }
  21. public function getVideoAttr($value){
  22. if (empty($value)) return $value;
  23. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  24. $url = 'https://' . $ali_oss_bindurl . '/' . $value;
  25. return $url;
  26. }
  27. public function setVideoAttr($value)
  28. {
  29. $domain = config('app.ali_oss_bindurl');
  30. $search = 'https://' . $domain . '/';
  31. return str_replace($search, '', $value);
  32. }
  33. public function label()
  34. {
  35. return $this->belongsTo(BuildingLabel::class, 'label_id');
  36. }
  37. }