//新建规格
public function construction(){
$id = $_GET['id'];//dump($id);die;
$this->assign('id', $id);
if(IS_POST){
$admin_id = $_POST['admin_id'];
$sta_name = $_POST['sta_name'];
$data['isValid'] = '1';
$data['createTime'] = date("Y-m-d H:i:s");
$data['name'] = $sta_name;
$data['adminUserId'] = $admin_id;
$sta = M('re_goodsstandard')->add($data);
if(!empty($sta)){
$name = $_POST['name'];
$child = explode(',', $name);
if(is_array($child)){
foreach($child as $v){
$arr[] = array(
'isValid' => '1',
'createTime' =>date("Y-m-d H:i:s"),
'name' => $v,
'parentStandardId' => $sta,
'adminUserId' => $admin_id
);
}
if($arr)
{
$childer = M('re_goodsstandard')->addAll($arr);
//$this->redirect('norms', array('id' => $admin_id));
$this->ajaxReturn($admin_id);
}
}
}
}
$this->display();
}
转载于:https://www.cnblogs.com/babyoctopus/p/6247624.html