p2 project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
743 B

<?php
namespace app\home\service;
use app\model\ConfigModel;
class ConfigService extends BaseHomeService
{
public function getConfigByKey($param)
{
try {
if (empty($param['name'])) {
return $this->toData('400', lang('parameter_error'));
}
$configData = [];
$config = ConfigModel::where(['name'=>trim($param['name'])])->find();
if (!empty($config)) {
$configData = $config->toArray();
}
return $this->toData('0', 'SUCCESS', ['data' => $configData]);
} catch (\Exception $e) {
return $this->toData('500', 'The system is busy. Please try again later.', [$e->getMessage()]);
}
}
}