public function view_updatePmOn() { $packingMaterials = new PackingMaterialsAct(); $id = isset($_POST['id']) ? post_check($_POST['id']) : ''; $pmAlias = isset($_POST['pmAlias']) ? post_check($_POST['pmAlias']) : ''; $pmName = isset($_POST['pmName']) ? post_check($_POST['pmName']) : ''; $pmNotes = isset($_POST['pmNotes']) ? post_check($_POST['pmNotes']) : ''; $pmLength = isset($_POST['pmLength']) ? post_check($_POST['pmLength']) : ''; $pmWidth = isset($_POST['pmWidth']) ? post_check($_POST['pmWidth']) : ''; $pmHeight = isset($_POST['pmHeight']) ? post_check($_POST['pmHeight']) : ''; $pmCost = isset($_POST['pmCost']) ? post_check($_POST['pmCost']) : ''; $pmWeight = isset($_POST['pmWeight']) ? post_check($_POST['pmWeight']) : ''; $pmDimension = isset($_POST['pmDimension']) ? post_check($_POST['pmDimension']) : ''; $pmDivider = isset($_POST['pmDivider']) ? post_check($_POST['pmDivider']) : ''; $pmRatio = isset($_POST['pmRatio']) ? post_check($_POST['pmRatio']) : ''; if (intval($id) == 0) { $status = "非法id"; header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}"); exit; } if (empty($pmAlias) || empty($pmName) || empty($pmLength) || empty($pmWidth) || empty($pmHeight) || empty($pmCost) || empty($pmWeight) || empty($pmDimension)) { //后台空数据验证 $status = "修改失败,存在空数据"; header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}"); exit; } $countPmDivider = $packingMaterials->act_getPmCount("where pmName='{$pmDivider}' and is_delete=0"); if (trim($pmDivider) != '' && $countPmDivider <= 0) { $status = "修改失败,不存在该包材类名为 '{$pmDivider}' 的记录(包材除数)"; } else { $set = "set pmAlias='{$pmAlias}',pmNotes='{$pmNotes}',pmLength='{$pmLength}',pmWidth='{$pmWidth}',pmHeight='{$pmHeight}',pmCost='{$pmCost}',pmWeight='{$pmWeight}',pmDimension='{$pmDimension}',pmDivider='{$pmDivider}'"; if (!empty($pmRatio)) { $set .= ",pmRatio='{$pmRatio}'"; } $where = "where is_delete=0 and id='{$id}'"; $status = $packingMaterials->act_updatePm($set, $where); if ($status > 0) { $status = '修改成功'; //将新的包材信息添加到mem中 $key = 'pc_pm_' . $id; $dataPm = array(); $dataPm['id'] = $id; $dataPm['pmAlias'] = $pmAlias; $dataPm['pmName'] = $pmName; $dataPm['pmNotes'] = $pmNotes; $dataPm['pmLength'] = $pmLength; $dataPm['pmWidth'] = $pmWidth; $dataPm['pmHeight'] = $pmHeight; $dataPm['pmCost'] = $pmCost; $dataPm['pmWeight'] = $pmWeight; $dataPm['pmDimension'] = $pmDimension; $dataPm['pmRatio'] = $pmRatio; $value = $dataPm; setMemNewByKey($key, $value); //这里不保证能添加成功 //更新全部包材的mem信息 $pmList = $packingMaterials->act_getPmList('*', "WHERE is_delete=0"); if (!empty($pmList)) { setMemNewByKey('pc_pm_all', $pmList); //这里不保证能添加成功 } } else { $status = '无修改数据'; } } header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}"); }