if($emp_desc_content == false){
//新增
$emp_desc_type = $emp_desc->get_dict_emp_desc_type();
foreach ($emp_desc_type as $key => $val) {
$desc_type = $key;
$desc_info = trim(I($key));
$emp_id = $_SESSION['emp_id'];
if(false == $emp_desc->add_emp_desc($emp_id,$desc_type,$desc_info)){
$this->error('保存失败');
}
}
$this->success('保存成功');
}else{
//更新
$emp_desc_type = $emp_desc->get_dict_emp_desc_type();
foreach ($emp_desc_type as $key => $val) {
$desc_type = $key;
$desc_info = trim(I($key));
$emp_id = $_SESSION['emp_id'];
if(false == $emp_desc->save_emp_desc($emp_id,$desc_type,$desc_info)){
$this->error('保存失败');
}
}
$this->success('保存成功');
}不解,为什么ADD返回了成功,而SAVE,[b][/b],但是却返回了失败。 public function save_emp_desc($emp_id,$desc_type,$desc_info)
{
$where['emp_id'] = $emp_id;
$where['desc_type'] = $desc_type;
$data['desc_info'] = $desc_info;
if($this->where($where)->save($data)){
return true;
}else{
return false;
}
}
/*
* 新增员工资料-工作经历
*
*/
public function add_emp_desc($emp_id,$desc_type,$desc_info)
{
$data['emp_id'] = $emp_id;
$data['desc_type'] = $desc_type;
$data['desc_info'] = $desc_info;
if($this->add($data)){
return true;
}else{
return false;
}
}结果保存成功了,却返回了失败。。。 最佳答案