1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace app\model;
- use think\Model;
- class ConstructionRecord 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;
- $domain = config('app.ali_oss_bindurl');
- $url = 'https://' . $domain . '/' . $value;
- return $url;
- }
- public function setVideoAttr($value)
- {
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://' . $domain . '/';
- return str_replace($search, '', $value);
- }
- public function getVideoCoverAttr($value){
- if (empty($value)) return $value;
- $domain = config('app.ali_oss_bindurl');
- $url = 'https://' . $domain . '/' . $value;
- return $url;
- }
- public function setVideoCoverAttr($value)
- {
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://' . $domain . '/';
- return str_replace($search, '', $value);
- }
- public function step()
- {
- return $this->belongsTo(ConstructionStep::class, 'step_id');
- }
- }
|