You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
namespace App\Services;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class ConfigService
|
|
{
|
|
|
|
//获取配置信息
|
|
public function GetConfigInfo($arr,$is_admin=false){
|
|
$q=DB::table('configs')->select(['label','value']);
|
|
if($is_admin){
|
|
|
|
}else{
|
|
$q=$q->whereIn('label',$arr);
|
|
}
|
|
$q=$q->get();
|
|
if(count($q)>0) {
|
|
$result = [];
|
|
foreach ($q as $k => $v) {
|
|
if($v->label=='撤销转赠权限'){
|
|
$v->value= explode(',', $v->value);
|
|
}
|
|
$result[$v->label] = $v->value;
|
|
}
|
|
return \Yz::Return(true, '查询成功', $result);
|
|
}else{
|
|
return \Yz::Return(false, '查询失败');
|
|
}
|
|
}
|
|
public function SaveConfig($data){
|
|
foreach ($data as $key=>$item){
|
|
$u=DB::table('configs')->where('label', '=', $key)->update(['value'=>$item]);
|
|
}
|
|
if($u){
|
|
return \Yz::Return(true, '操作成功');
|
|
}else{
|
|
return \Yz::Return(false, '操作失败');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|