<?php if (Tools::P('saveCarrier') == 'add') { $carrier = new Carrier(); $carrier->copyFromPost(); if ($carrier->add() && $carrier->updateLogo()) { UIAdminAlerts::conf('配送商已添加'); $_GET['id'] = $carrier->id; } if (is_array($carrier->_errors) and count($carrier->_errors) > 0) { $errors = $carrier->_errors; } } if (isset($_GET['id'])) { $id = (int) Tools::G('id'); $obj = new Carrier($id); } if (Tools::P('saveCarrier') == 'edit') { if (Validate::isLoadedObject($obj)) { $obj->copyFromPost(); if ($obj->update() && $obj->updateLogo()) { UIAdminAlerts::conf('配送商已更新'); } } if (is_array($obj->_errors) and count($obj->_errors) > 0) { $errors = $obj->_errors; } } if (isset($errors)) { UIAdminAlerts::MError($errors); }