123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- declare(strict_types=1);
- namespace app\model;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class VrGroup extends Model
- {
- /**
- * 关联视图
- */
- public function views()
- {
- return $this->hasMany(VrView::class, 'vr_group_id');
- }
- /**
- * 关联员工表
- */
- public function employee()
- {
- return $this->hasOne(Employee::class,'id','emp_id');
- }
- /**
- * 关联文件夹
- */
- public function floder()
- {
- return $this->belongsTo(VrFolder::class, 'floder_id');
- }
- /**
- * 拼接
- */
- public function getLogoPathAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.vr_ali_oss_bindurl');
- $ali_oss_bindurl = 'https://'.$domain.'/';
- $url = $ali_oss_bindurl . $value;
- return $url;
- }
- /**
- * 拼接
- */
- public function getPicPathAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.vr_ali_oss_bindurl');
- $ali_oss_bindurl = 'https://'.$domain.'/';
- $url = $ali_oss_bindurl . $value;
- $url = str_replace('//vr','/vr',$url);//错误数据
- return $url;
- }
- /**
- * 处理
- */
- public function setLogoPathAttr($value){
- $domain = config('app.vr_ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- /**
- * 处理
- */
- public function setPicPathAttr($value){
- $domain = config('app.vr_ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- /**
- * 处理
- */
- public function getCreatetimeAttr($value){
- if (empty($value)) return $value;
- return date('Y-m-d H:i:s',(int)$value);
- }
- /**
- * 处理
- */
- public function getUpdatetimeAttr($value){
- if (empty($value)) return $value;
- return date('Y-m-d H:i:s',(int)$value);
- }
- // /**
- // * 处理
- // */
- public function getPublishTimeAttr($value){
- if (empty($value)) return $value;
- return date('Y-m-d H:i:s',(int)$value);
- }
- // /**
- // * 处理
- // */
- public function getReviewTimeAttr($value){
- if (empty($value)) return $value;
- return date('Y-m-d H:i:s',(int)$value);
- }
- }
|