58 lines
1.0 KiB
PHP
58 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace app\admin\model\config;
|
|
|
|
use think\Model;
|
|
use think\Session;
|
|
use think\Config;
|
|
|
|
class Pay extends Model
|
|
{
|
|
|
|
|
|
|
|
public function getList(){
|
|
return Config::get('pay');
|
|
}
|
|
|
|
/**
|
|
* 设置状态
|
|
* @param $name
|
|
* @param $status
|
|
* @return void
|
|
*/
|
|
public function setStatus($name,$status = true){
|
|
$config = $this->getList();
|
|
|
|
foreach ($config as &$item){
|
|
if($item['type'] == $name){
|
|
$item['status'] = $status ? 1 : 0;
|
|
}
|
|
}
|
|
$configFile = CONF_PATH . 'extra' . DS . 'pay.php';
|
|
|
|
file_put_contents($configFile, '<?php' . "\n\nreturn " . var_export_short($config) . ";\n");
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 获取选中的平台
|
|
* @return false|mixed
|
|
*/
|
|
public static function getChecked(){
|
|
$config = Config::get('pay');
|
|
|
|
$list = [];
|
|
|
|
foreach ($config as $item){
|
|
if($item['status']){
|
|
$list[] = $item['type'];
|
|
}
|
|
}
|
|
return $list;
|
|
}
|
|
|
|
}
|