DataPoolTalent.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace app\data\model;
  3. use app\data\model\helpers\HasUser;
  4. use think\admin\Model;
  5. /**
  6. * 人才库数据模型
  7. * Class DataUser
  8. * @package app\data\model
  9. */
  10. class DataPoolTalent extends Model
  11. {
  12. use HasUser;
  13. protected $append = ['names','merge_area'];
  14. /**
  15. * 格式化创建时间
  16. * @param string $value
  17. * @return string
  18. */
  19. public function getCreateAtAttr(string $value): string
  20. {
  21. return format_datetime($value);
  22. }
  23. public function getMergeAreaAttr($_,$model){
  24. return $model['province'].$model['city'].$model['area'];
  25. }
  26. public function getNamesAttr($_,$model){
  27. $startString = mb_substr($model['name'], 0, 0, "UTF-8");
  28. $endString = mb_substr($model['name'], 1, mb_strlen($model['name']), "UTF-8");
  29. $replacement = str_repeat('*', 1);
  30. $out = $startString . $replacement . $endString;
  31. return $out;
  32. }
  33. public function getZzImgsAttr($_,$model){
  34. return array_filter(explode(',',$model['zz_imgs']));
  35. }
  36. public function zc(){
  37. return $this->belongsTo(DataZhicheng::class,'zc_id');
  38. }
  39. public function gzll(){
  40. return $this->hasMany(DataPoolTalentChild::class,'info_id');
  41. }
  42. static function onAfterRead(\think\Model $model){
  43. $model['graduate_school'] ? : $model['graduate_school'] = '';
  44. $model['major'] ? : $model['major'] = '';
  45. $model['log'] ? : $model['log'] = '';
  46. $model['download_url_code'] = sysconf('android.download_url_code');
  47. }
  48. public static $audit=[
  49. 1=>'待审核',
  50. 2=>'审核通过',
  51. 3=>'审核不通过',
  52. ];
  53. /**
  54. * @return array
  55. */
  56. public static function getAudit(): array
  57. {
  58. return self::$audit;
  59. }
  60. }