功能更新

This commit is contained in:
2020-03-30 21:16:28 +08:00
parent b16e4ab920
commit f31f3b99fa
23 changed files with 464 additions and 230 deletions

View File

@@ -83,10 +83,34 @@ class Config extends Model {
return $data;
}
public function getThemesList(){
public function getThemesList($request){
return [
'pc' => [],
'mobile' => []
'pc' => $this->getList('pc'),
'mobile' => $this->getList('mobile')
];
}
protected function getList($type){
$tempPath = app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR;
$file = opendir($tempPath);
$list = [];
while (false !== ($filename = readdir($file))) {
if (!in_array($filename, array('.', '..'))) {
$files = $tempPath . $filename . '/info.php';
if (is_file($files)) {
$info = include($files);
if (isset($info['type']) && $info['type'] == $type) {
$info['id'] = $filename;
$preview = '/template/' . $filename . '/' . $info['preview'];
$info['preview'] = is_file($tempPath . $preview) ? $preview : '/static/common/images/default.png';
$list[] = $info;
}else{
continue;
}
}
}
}
return $list;
}
}