/**
* [CAN_POST]
* just test to get score [Android]
*/
public function getAndroidScore($params = [], $os = 'Android')
{
$params = ['Mali-G72', 'OpenGL ES 3.2 V1', '9', 'HUAWEI', '123', '4', '4', '2000'];//测试值
$jsonFile = ROOT_PATH . '/temp/retjson.json';//中间临时文件,用于存放json数据,建议根据项目来使用多个中间临时文件
$iniFile = ROOT_PATH . '/JsonINIConverter/BaseDeviceProfiles.ini';//需要根据项目存到服务器一份,这里是测试文件,建议放在ROOT_PATH . '/temp/base.ini'
$command = ROOT_PATH . "/JsonINIConverter toDeviceProfile {$os} {$iniFile} {$jsonFile} \"{$params[0]}\" \"{$params[1]}\" \"{$params[2]}\" \"{$params[3]}\" \"{$params[4]}\" \"{$params[5]}\" \"{$params[6]}\" \"{$params[7]}\"";
echo $command . PHP_EOL;
$res = exec($command, $output, $return_var);
echo $res . PHP_EOL;
if ($res !== 'completed') {
throw new CustomException('Run Command Error: ' . $res . ', ' . (is_array($output) ?implode("",$output):$output) . ', ' . $return_var);
}
if (!file_exits($jsonFile)) {
throw new CustomException('文件不存在!');
}
if (is_readable($jsonFile)){
$json = file_get_contents($jsonFile);
} else {
throw new CustomException('文件无可读权限!');
}
exit($json);
return json_decode($json, 1);
}
|