增加复选框后台新增和编辑
This commit is contained in:
@@ -82,6 +82,12 @@ class Document extends \think\model\Merge{
|
|||||||
$data = \think\Request::instance()->post();
|
$data = \think\Request::instance()->post();
|
||||||
|
|
||||||
if ($data !== false) {
|
if ($data !== false) {
|
||||||
|
//增加增加复选框 shu'zu数组保存
|
||||||
|
foreach($data ad $key=>$val){
|
||||||
|
if(is_array($val)){
|
||||||
|
$data[$key] = implode(',', $val);
|
||||||
|
}
|
||||||
|
}
|
||||||
/* 添加或新增基础内容 */
|
/* 添加或新增基础内容 */
|
||||||
if(empty($data['id'])){ //新增数据
|
if(empty($data['id'])){ //新增数据
|
||||||
unset($data['id']);
|
unset($data['id']);
|
||||||
@@ -109,6 +115,10 @@ class Document extends \think\model\Merge{
|
|||||||
|
|
||||||
public function detail($id){
|
public function detail($id){
|
||||||
$data = $this->get($id);
|
$data = $this->get($id);
|
||||||
|
$model_type = db('attribute')->where('model_id'=>$data['model_id'], 'type'=>array('in', 'checkbox'))->column('name');
|
||||||
|
foreach($model_type as $val){
|
||||||
|
$data->setAttr($val, explode(',', $data[$val]));
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user