|
@@ -103,4 +103,28 @@ class Config extends Controller
|
|
$this->assign('form_items', $this->setData($fields, $info));
|
|
$this->assign('form_items', $this->setData($fields, $info));
|
|
return $this->fetch('public/edit');
|
|
return $this->fetch('public/edit');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 设置表单数据
|
|
|
|
+ * @param array $fields 字段组
|
|
|
|
+ * @param array $info 字段值组
|
|
|
|
+ * @author 似水星辰 [ 2630481389@qq.com ]
|
|
|
|
+ * @return mixed
|
|
|
|
+ */
|
|
|
|
+ public function setData($fields = [], $info =[]){
|
|
|
|
+ if(is_array($fields)){
|
|
|
|
+ foreach($fields as &$v){
|
|
|
|
+ if($v['type'] != 'sort'){
|
|
|
|
+ if($v['type'] == 'password'){
|
|
|
|
+ $v['value'] = '';
|
|
|
|
+ }else if($v['type'] == 'attr'){
|
|
|
|
+ $v['value'] = htmlspecialchars_decode($info[$v['name']]);
|
|
|
|
+ }else{
|
|
|
|
+ $v['value'] = $info[$v['name']];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $fields;
|
|
|
|
+ }
|
|
}
|
|
}
|