$value, 'text' => $printerType[$value]]; } /** * 自动转换printer_config为array格式 * @param $value * @return string */ public function getPrinterConfigAttr($value) { return json_decode($value, true); } /** * 自动转换printer_config为json格式 * @param $value * @return string */ public function setPrinterConfigAttr($value) { return json_encode($value); } /** * 获取全部 * @return mixed */ public static function getAll() { $model = new static; return $model->where('is_delete', '=', 0) ->order(['sort' => 'asc', $model->getPk() => 'desc']) ->select(); } /** * 获取列表 * @return \think\Paginator * @throws \think\exception\DbException */ public function getList() { return $this->where('is_delete', '=', 0) ->order(['sort' => 'asc', $this->getPk() => 'desc']) ->paginate(15, false, [ 'query' => Request::instance()->request() ]); } /** * 物流公司详情 * @param $printer_id * @return null|static * @throws \think\exception\DbException */ public static function detail($printer_id) { return self::get($printer_id); } }