VrGroup.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\model;
  4. use think\Model;
  5. /**
  6. * @mixin \think\Model
  7. */
  8. class VrGroup extends Model
  9. {
  10. /**
  11. * 关联视图
  12. */
  13. public function views()
  14. {
  15. return $this->hasMany(VrView::class, 'vr_group_id');
  16. }
  17. /**
  18. * 关联员工表
  19. */
  20. public function employee()
  21. {
  22. return $this->hasOne(Employee::class,'id','emp_id');
  23. }
  24. /**
  25. * 关联文件夹
  26. */
  27. public function floder()
  28. {
  29. return $this->belongsTo(VrFolder::class, 'floder_id');
  30. }
  31. /**
  32. * 拼接
  33. */
  34. public function getLogoPathAttr($value)
  35. {
  36. if (empty($value)) return $value;
  37. $domain = config('app.vr_ali_oss_bindurl');
  38. $ali_oss_bindurl = 'https://'.$domain.'/';
  39. $url = $ali_oss_bindurl . $value;
  40. return $url;
  41. }
  42. /**
  43. * 拼接
  44. */
  45. public function getPicPathAttr($value)
  46. {
  47. if (empty($value)) return $value;
  48. $domain = config('app.vr_ali_oss_bindurl');
  49. $ali_oss_bindurl = 'https://'.$domain.'/';
  50. $url = $ali_oss_bindurl . $value;
  51. $url = str_replace('//vr','/vr',$url);//错误数据
  52. return $url;
  53. }
  54. /**
  55. * 处理
  56. */
  57. public function setLogoPathAttr($value){
  58. $domain = config('app.vr_ali_oss_bindurl');
  59. $search = 'https://'.$domain.'/';
  60. return str_replace($search, '', $value);
  61. }
  62. /**
  63. * 处理
  64. */
  65. public function setPicPathAttr($value){
  66. $domain = config('app.vr_ali_oss_bindurl');
  67. $search = 'https://'.$domain.'/';
  68. return str_replace($search, '', $value);
  69. }
  70. /**
  71. * 处理
  72. */
  73. public function getCreatetimeAttr($value){
  74. if (empty($value)) return $value;
  75. return date('Y-m-d H:i:s',(int)$value);
  76. }
  77. /**
  78. * 处理
  79. */
  80. public function getUpdatetimeAttr($value){
  81. if (empty($value)) return $value;
  82. return date('Y-m-d H:i:s',(int)$value);
  83. }
  84. // /**
  85. // * 处理
  86. // */
  87. public function getPublishTimeAttr($value){
  88. if (empty($value)) return $value;
  89. return date('Y-m-d H:i:s',(int)$value);
  90. }
  91. // /**
  92. // * 处理
  93. // */
  94. public function getReviewTimeAttr($value){
  95. if (empty($value)) return $value;
  96. return date('Y-m-d H:i:s',(int)$value);
  97. }
  98. }