__('全部状态'), self::STATUSUNPAID => __('待支付'), self::STATUSFINISH => __('完成'), self::STATUSFREEZE => __('冻结'), self::STATUSCANCEL => __('取消'), ]; if($type == -1){ return $status_names; } if(isset($status_names[$type])){ return $status_names[$type]; } return __('未定义'); } //users public function users() { return $this->hasOne('Users','id','user_id',[],'LEFT')->setEagerlyType(0); } //操作列表 public function getstatusList() { return [self::STATUSFINISH => __('Finish'), 2 => __('Freeze'), 3 => __('Cancel')]; } public function getCreateTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getUpdateTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setCreateTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setUpdateTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } }