12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\model;
- use think\Model;
- class BuildingProgress extends Model
- {
- public function getImgAttr($value){
- if(empty($value)) return $value;
- $arr = explode(',', $value);
- $domain = config('app.ali_oss_bindurl');
- foreach($arr as &$item){
- $item = 'https://'.$domain.'/'.$item;
- }
- return $arr;
- }
- public function setImgAttr($value)
- {
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://' . $domain . '/';
- return str_replace($search, '', $value);
- }
- public function getVideoAttr($value){
- if (empty($value)) return $value;
- $ali_oss_bindurl = config('app.ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/' . $value;
- return $url;
- }
- public function setVideoAttr($value)
- {
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://' . $domain . '/';
- return str_replace($search, '', $value);
- }
- public function label()
- {
- return $this->belongsTo(BuildingLabel::class, 'label_id');
- }
- }
|