yangsai@163.com 6 months ago
parent 7f82fd1569
commit 73da7be742
  1. 23
      application/controllers/Admin/User.php

@ -90,12 +90,25 @@ class Admin_UserController extends Ctrl_Admin{
}
public function userseteditAction(){
$table = $_POST['table'];
$id = $_POST['id'];
$data = $_POST;
unset($data['table']);
$model = new $table();
if($table=='ExcelSetModel'){
$array = array('number'=>'on','sex'=>'on','birthday'=>'on','strains_id'=>'on','gene'=>'on','cage_num'=>'on','content'=>'on','hair_color'=>'on','fenlong'=>'on','fanzhi'=>'on','breeding_tag'=>'on','see_bole_tag'=>'on','give_medicine'=>'on','father'=>'on','mother'=>'on','remark'=>'on');
print_r($_POST['now_squirrel']);
print_r($array);
print_r(array_merge(array_diff($array,$_POST['now_squirrel']),array_diff($_POST['now_squirrel'],$array)));die;
$data['now_squirrel'] = $this->excelarray($data['now_squirrel']);
$data['handle_squirrel'] = $this->excelarray($data['handle_squirrel']);
}
if(!$model->update($data)) Tool_Fnc::ajaxMsg('变更失败', '500');
Tool_Fnc::ajaxMsg('变更成功', '1');
}
public function excelarray($excelarray){
$array = array('number'=>'on','sex'=>'on','birthday'=>'on','strains_id'=>'on','gene'=>'on','cage_num'=>'on','content'=>'on','hair_color'=>'on','fenlong'=>'on','fanzhi'=>'on','breeding_tag'=>'on','see_bole_tag'=>'on','give_medicine'=>'on','father'=>'on','mother'=>'on','remark'=>'on');
$diff = array_diff_key($array,$excelarray);
foreach($diff as $key => &$val){
$val = false;
}
foreach($excelarray as $ke => &$va){
$va = true;
}
return json_encode(array_merge($diff,$excelarray));
}
}
Loading…
Cancel
Save