'插件', 'component'=>'js组件', 'app'=>'应用', 'cms-temp'=>'cms模板', ]; public static function list(int $page,int $limit,string $fields,array $where=[]) { $list=Addons::where($where)->limit(($page-1)*$limit,$limit)->select(); $rows=[]; $fields=explode(',',$fields); foreach ($list as $addon){ if(!self::checkKey($addon)){ //人家的插件,不要动 $addon['price']=0; } $obj=[]; foreach ($fields as $field){ $obj[$field]=$addon[$field]; } $rows[]=$obj; } $total=Addons::where($where)->count(); $result = ['total' => $total, 'rows' => $rows]; return $result; } public static function checkKey($addon){ $key=md5($addon['type'].$addon['pack'].$addon['author'].$addon['version'].$addon['secret_key']); if($key!=$addon['key']){ return false; } return true; } }