1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace app\model;
- use think\Model;
- use xiaohongwu\Vr;
- class DesignerCollectionWorks extends Model
- {
- public function getDescAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.ali_oss_bindurl');
- $item = 'https://' . $domain . '/';
- $list = explode(',',$value);
- foreach($list as $v){
- $arr[] = $item.$v;
- }
- return $arr;
- }
- public function getCoverImgAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.ali_oss_bindurl');
- $item = 'https://' . $domain . '/';
- $value = $item.$value;
- return $value;
- }
- public function getVrCaseAttr($value)
- {
- if (empty($value)) return $value;
- $list = explode(',',$value);
- foreach($list as $v){
- $new[] = ['vr_link'=>$v,'vr_img'=>getFirstImg($v)];
- }
- return $new;
- }
- public function setCoverImgAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.ali_oss_bindurl');
- $item = 'https://' . $domain . '/';
- $value = str_replace($item,'',$value);
- return $value;
- }
- public function setDescAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.ali_oss_bindurl');
- $item = 'https://' . $domain . '/';
- $list = explode(',',$value);
- $str = null;
- foreach($list as $v){
- $str.= str_replace($item,'',$v).',';
- }
- return trim($str,',');
- }
- public function decostyle()
- {
- return $this->hasOne(Decostyle::class, 'id','style_id')->bind(['style_name'=>'name']);
- }
- public function housetype()
- {
- return $this->hasOne(Housetype::class, 'id','housetype_id')->bind(['housetype_name'=>'name']);
- }
- }
|