12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\data\model;
- use app\data\model\helpers\HasUser;
- use think\admin\Model;
- /**
- * 人才库数据模型
- * Class DataUser
- * @package app\data\model
- */
- class DataPoolTalent extends Model
- {
- use HasUser;
- protected $append = ['names','merge_area'];
- /**
- * 格式化创建时间
- * @param string $value
- * @return string
- */
- public function getCreateAtAttr(string $value): string
- {
- return format_datetime($value);
- }
- public function getMergeAreaAttr($_,$model){
- return $model['province'].$model['city'].$model['area'];
- }
- public function getNamesAttr($_,$model){
- $startString = mb_substr($model['name'], 0, 0, "UTF-8");
- $endString = mb_substr($model['name'], 1, mb_strlen($model['name']), "UTF-8");
- $replacement = str_repeat('*', 1);
- $out = $startString . $replacement . $endString;
- return $out;
- }
- public function getZzImgsAttr($_,$model){
- return array_filter(explode(',',$model['zz_imgs']));
- }
- public function zc(){
- return $this->belongsTo(DataZhicheng::class,'zc_id');
- }
- public function gzll(){
- return $this->hasMany(DataPoolTalentChild::class,'info_id');
- }
- static function onAfterRead(\think\Model $model){
- $model['graduate_school'] ? : $model['graduate_school'] = '';
- $model['major'] ? : $model['major'] = '';
- $model['log'] ? : $model['log'] = '';
- $model['download_url_code'] = sysconf('android.download_url_code');
- }
- public static $audit=[
- 1=>'待审核',
- 2=>'审核通过',
- 3=>'审核不通过',
- ];
- /**
- * @return array
- */
- public static function getAudit(): array
- {
- return self::$audit;
- }
- }
|