'array' ]; public static function getLists($service_work_id, $type = null) { $where = []; //商城工单配件 if ($type == 1) { $where[] = ['spare_part_id','>', 0]; } else if ($type == 2) { //自选工单配件 $where[] = ['spare_part_id','=', 0]; } $lists = self::where('service_work_id', $service_work_id) ->where($where) ->field("id,spare_part_id, spare_name, spare_image, company_price, original_price, offering_price, spare_number,spare_unit,brand,status,remark") ->select() ->toArray(); return $lists; } }