$value, 'text' => $printerType[$value]]; } /** * 自动转换printer_config为array格式 */ public function getPrinterConfigAttr($value) { return json_decode($value, true); } /** * 自动转换printer_config为json格式 */ public function setPrinterConfigAttr($value) { return json_encode($value); } /** * 获取全部 */ public static function getAll($shop_supplier_id=0, $type = false) { $where = []; if($shop_supplier_id){ $where['shop_supplier_id'] = $shop_supplier_id; } // 判断打印机类型 by lyzflash if ($type) { $where['type'] = $type; } return (new static)->where('is_delete', '=', 0) ->where($where) ->order(['sort' => 'asc'])->select(); } /** * 获取列表 */ public function getList($limit = 10,$shop_supplier_id=0) { $where = []; if($shop_supplier_id){ $where['shop_supplier_id'] = $shop_supplier_id; } if (!empty($limit['type'])){ $where['type'] = $limit['type']; } return $this->where('is_delete', '=', 0) ->where($where) ->order(['sort' => 'asc']) ->paginate($limit); } /** * 物流公司详情 */ public static function detail($printer_id) { return (new static())->find($printer_id); } }