SmartScreenData.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class SmartScreenData extends Model
  5. {
  6. public function setCoverAttr($value)
  7. {
  8. $domain = config('app.ali_oss_bindurl');
  9. $search = 'https://'.$domain.'/';
  10. return str_replace($search, '', $value);
  11. }
  12. /**
  13. * 图片拼接
  14. */
  15. public function getCoverAttr($value)
  16. {
  17. if (empty($value)) return $value;
  18. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  19. $url = 'https://' . $ali_oss_bindurl . '/' . $value;
  20. return $url;
  21. }
  22. public function setVideoCaseAttr($value)
  23. {
  24. $domain = config('app.ali_oss_bindurl');
  25. $search = 'https://'.$domain.'/';
  26. return str_replace($search, '', $value);
  27. }
  28. public function getVideoCaseAttr($value)
  29. {
  30. if (empty($value)) return $value;
  31. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  32. $url = 'https://' . $ali_oss_bindurl . '/' . $value;
  33. return $url;
  34. }
  35. //一级分类
  36. public function cate1()
  37. {
  38. return $this->belongsTo(SmartScreenCate::class, 'cate1','id');
  39. }
  40. //二级分类
  41. public function cate2()
  42. {
  43. return $this->belongsTo(SmartScreenCate::class, 'cate2','id');
  44. }
  45. //三级分类
  46. public function cate3()
  47. {
  48. return $this->belongsTo(SmartScreenCate::class, 'cate3','id');
  49. }
  50. //上传人
  51. public function employee()
  52. {
  53. return $this->belongsTo(Employee::class, 'employee_id','id');
  54. }
  55. //
  56. public function designer()
  57. {
  58. return $this->belongsTo(Employee::class, 'designer_id','id');
  59. }
  60. //asd
  61. public function community()
  62. {
  63. return $this->belongsTo(SmartScreenCate::class, 'community_id','id');
  64. }
  65. public function decostyle()
  66. {
  67. return $this->belongsTo(SmartScreenCate::class, 'decostyle_id','id');
  68. }
  69. public function housetype()
  70. {
  71. return $this->belongsTo(SmartScreenCate::class, 'housetype_id','id');
  72. }
  73. }