123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace app\api\model;
- use think\Model;
- class SubmitEditModel extends Model
- {
-
-
- // 表名
- protected $name = 'submit_edit';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- ];
- public function getImagesAttr($value)
- {
- if (empty($value)){
- return '';
- }
- $images=explode(',',trim($value));
- if (!empty($images)){
- foreach ($images as $k=>$v){
- $images[$k]=config('site.cdnurl').$v;
- }
- }
- // $status = [-1=>'删除',0=>'禁用',1=>'正常',2=>'待审核'];
- return $images;
- }
- public function getCreateTimeAttr($value)
- {
- return date('Y-m-d',$value);
- }
- public function property(){
- return $this->belongsTo('app\admin\model\Property','property_id','id')->field('id,p_name as name');
- }
- public function village(){
- return $this->belongsTo('app\admin\model\village\Village','village_id','id')->field('id,v_name as name');
- }
- public function dong(){
- return $this->belongsTo('app\admin\model\village\VillageDong','dong_id','id')->field('id,d_name as name');
- }
- public function danyuan(){
- return $this->belongsTo('app\admin\model\village\VillageDanyuan','danyuan_id','id')->field('id,dy_name as name');
- }
- public function hu(){
- return $this->belongsTo('app\admin\model\village\VillageHu','hu_id','id')->field('id,hu_name as name');
- }
- public function member(){
- return $this->belongsTo('app\admin\model\Member','mid','id')->field('id,avatar,nickname');
- }
- public function SubmitType(){
- return $this->belongsTo('app\admin\model\submit\SubmitTypeModel','type_id','id')->field('id,name');
- }
- }
|