12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace app\model;
- use think\Model;
- class SmartScreenData extends Model
- {
- public function setCoverAttr($value)
- {
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- /**
- * 图片拼接
- */
- public function getCoverAttr($value)
- {
- if (empty($value)) return $value;
- $ali_oss_bindurl = config('app.ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/' . $value;
- return $url;
- }
- public function setVideoCaseAttr($value)
- {
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- public function getVideoCaseAttr($value)
- {
- if (empty($value)) return $value;
- $ali_oss_bindurl = config('app.ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/' . $value;
- return $url;
- }
- //一级分类
- public function cate1()
- {
- return $this->belongsTo(SmartScreenCate::class, 'cate1','id');
- }
- //二级分类
- public function cate2()
- {
- return $this->belongsTo(SmartScreenCate::class, 'cate2','id');
- }
- //三级分类
- public function cate3()
- {
- return $this->belongsTo(SmartScreenCate::class, 'cate3','id');
- }
- //上传人
- public function employee()
- {
- return $this->belongsTo(Employee::class, 'employee_id','id');
- }
- //
- public function designer()
- {
- return $this->belongsTo(Employee::class, 'designer_id','id');
- }
- //asd
- public function community()
- {
- return $this->belongsTo(SmartScreenCate::class, 'community_id','id');
- }
- public function decostyle()
- {
- return $this->belongsTo(SmartScreenCate::class, 'decostyle_id','id');
- }
- public function housetype()
- {
- return $this->belongsTo(SmartScreenCate::class, 'housetype_id','id');
- }
- }
|