mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 19:05:34 +08:00
51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
class ome_goods_list{
|
|
function goods_list($cols='*',$filter=array(),$start=0,$limit=-1,$orderType=null , &$object){
|
|
|
|
$ident=md5($cols.var_export($filter,true).$start.$limit);
|
|
if(!$object->_dbstorage[$ident]){
|
|
if(!$cols){
|
|
$cols = $object->defaultCols;
|
|
}
|
|
if($object->appendCols){
|
|
$cols.=','.$object->appendCols;
|
|
}
|
|
$sql = 'SELECT '.$cols.' FROM '.$object->table_name(true).' WHERE '.$object->_filter($filter);
|
|
|
|
if(is_array($orderType)){
|
|
$orderType = trim(implode(' ',$orderType))?$orderType:$object->defaultOrder;
|
|
if($orderType){
|
|
$sql.=' ORDER BY '.implode(' ',$orderType);
|
|
}
|
|
}elseif($orderType){
|
|
$sql .= ' ORDER BY ' . $orderType;
|
|
}else{
|
|
$sql.=' ORDER BY '.implode(' ', $object->defaultOrder);
|
|
}
|
|
// $count = $object->db->count($sql);
|
|
$rows = $object->db->selectLimit($sql,$limit,$start);
|
|
$object->tidy_data($rows,$cols);
|
|
$object->_dbstorage[$ident]=$rows;
|
|
}
|
|
return $object->_dbstorage[$ident];
|
|
}
|
|
|
|
|
|
}
|