12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\admin\server\index;
- use app\admin\model\H5config;
- class H5ConfigServer
- {
- public static function getConfig()
- {
- $data = H5Config::getConfig();
- return $data;
- }
- /**
- * Notes:修改设置
- * @param string $package_name
- * @param int $package_id
- * @return int
- * User: YCP
- * Date: 2023/2/15
- */
- public static function updateConfig(array $params)
- {
- H5Config::affairBegin();
- try {
- $info = H5Config::where('config_name','h5')->first();
- if(empty($info) || $info === false)
- {
- $params['config_name'] = 'h5';
- $result = H5Config::insertGetId($params);
- H5Config::affairCommit();
- return true;
- }else{
- $result = H5Config::where('config_name','h5')->update($params);
- H5Config::affairCommit();
- return true;
- }
- throw new \Exception('操作失败!');
- }catch (\Exception $exception){
- H5Config::affairRollback();
- throw new \Exception($exception->getMessage(), 500);
- }
- }
-
- }
|