DailyWork.php 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class DailyWork extends Model
  5. {
  6. public function user(){
  7. return $this->belongsTo('user', 'uid')->bind(['headimgurl']);
  8. }
  9. public function employee(){
  10. return $this->hasOne('employee','uid','uid')->bind(['name', 'org_id']);
  11. }
  12. public function getEnclosureFileAttr($value)
  13. {
  14. if(empty($value)) return $value;
  15. $ali_oss_bindurl = config('app.ali_oss_bindurl');
  16. $str = explode(',',$value);
  17. $array = [];
  18. foreach($str as $v){
  19. $array[] = 'https://' . $ali_oss_bindurl .'/'. $v;
  20. }
  21. return $array;
  22. }
  23. public function getMediaIdAttr($value)
  24. {
  25. if (empty($value)) return '';
  26. $arr = explode(',', $value);
  27. return $arr;
  28. }
  29. public function getWeixinMediaAttr($value)
  30. {
  31. if (empty($value)) return '';
  32. $arr = explode(',', $value);
  33. return $arr;
  34. }
  35. }