CompanyStrength.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. use app\model\VideoType;
  5. class CompanyStrength extends Model
  6. {
  7. /**
  8. * 封面图拼接
  9. */
  10. public function getCoverAttr($value)
  11. {
  12. if (empty($value)) return $value;
  13. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  14. $url = 'https://' . $ali_oss_bindurl . '/' . $value;
  15. return $url;
  16. }
  17. public function getCoverShareImgAttr($value)
  18. {
  19. if (empty($value)) return $value;
  20. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  21. $url = 'https://' . $ali_oss_bindurl . '/' . $value;
  22. return $url;
  23. }
  24. /**
  25. * 图片或视频拼接
  26. */
  27. public function getPicsAttr($value)
  28. {
  29. if (empty($value)) return $value;
  30. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  31. $url = 'https://' . $ali_oss_bindurl . '/' . $value;
  32. return $url;
  33. }
  34. /**
  35. * 上传人员
  36. */
  37. public function employee(){
  38. return $this->belongsTo(Employee::class, 'employee_id', 'id');
  39. }
  40. public function setCoverAttr($value)
  41. {
  42. $domain = config('app.ali_oss_bindurl');
  43. $search = 'https://'.$domain.'/';
  44. return str_replace($search, '', $value);
  45. }
  46. public function setCoverShareImgAttr($value)
  47. {
  48. $domain = config('app.ali_oss_bindurl');
  49. $search = 'https://'.$domain.'/';
  50. return str_replace($search, '', $value);
  51. }
  52. public function setPicsAttr($value)
  53. {
  54. $domain = config('app.ali_oss_bindurl');
  55. $search = 'https://'.$domain.'/';
  56. return str_replace($search, '', $value);
  57. }
  58. }