1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- declare(strict_types=1);
- namespace app\model;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class VrView extends Model
- {
- /**
- * 关联VR视图组
- */
- public function group()
- {
- return $this->belongsTo(VrGroup::class, 'vr_group_id');
- }
- /**
- * 拼接
- */
- public function getPicPathAttr($value)
- {
- if (empty($value)) return $value;
- $ali_oss_bindurl = config('app.vr_ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/' . $value;
- return $url;
- }
- /**
- * 处理
- */
- public function setPicPathAttr($value){
- $ali_oss_bindurl = config('app.vr_ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/';
- return str_replace($url, '', $value);
- }
- /**
- * 拼接
- */
- // public function getVrPathAttr($value)
- // {
- // if (empty($value)) return $value;
- // // $ali_oss_bindurl = config('app.ali_oss_bindurl');
- // $ali_oss_bindurl = 'vr.oss.xueque.net/';
- // $url = 'https://' . $ali_oss_bindurl . $value;
- // return $url;
- // }
- /**
- * 处理
- */
- public function setVrPathAttr($value){
- $ali_oss_bindurl = config('app.vr_ali_oss_bindurl');
- $url = 'https://' . $ali_oss_bindurl . '/';
- return str_replace($url, '', $value);
- }
- /**
- * 关联视图
- */
- public function hotspot()
- {
- return $this->hasMany(VrHotspot::class, 'view_id');
- }
- }
|