hasOne('app\\common\\model\\settings\\Printer', 'printer_id', 'printer_id'); } /** * 获取档口类型列表 */ public static function getStallTypeList() { static $stallTypeEnum = []; if (empty($stallTypeEnum)) { $stallTypeEnum = StallTypeEnum::data(); } return $stallTypeEnum; } /** * 获取全部 * $is_printer 是否必须配置了打印机 */ public static function getAll($shop_supplier_id = 0, $is_printer = false, $stallTypeArr = []) { $model = new static(); if ($shop_supplier_id) { $model = $model->where('shop_supplier_id', '=', $shop_supplier_id); } if ($is_printer) { $model = $model->where('printer_id', '>', 0)->where('status', '=', 1); } if ($stallTypeArr) { $model = $model->where('stall_type', 'in', $stallTypeArr); } return $model->where('is_delete', '=', 0) ->order(['sort' => 'asc'])->select(); } /** * 获取列表 */ public function getList($params, $shop_supplier_id = 0) { $where = []; if ($shop_supplier_id){ $where['shop_supplier_id'] = $shop_supplier_id; } if (isset($params['stall_type'])) { $where['stall_type'] = $params['stall_type']; } return $this->with(['printer']) ->where('is_delete', '=', 0) ->where($where) ->order(['sort' => 'asc']) ->paginate($params); } /** * 物流公司详情 */ public static function detail($stall_id) { return self::find($stall_id); } }