本文整理匯總了PHP中CommonModel::insertNewRecord方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::insertNewRecord方法的具體用法?PHP CommonModel::insertNewRecord怎麽用?PHP CommonModel::insertNewRecord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonModel
的用法示例。
在下文中一共展示了CommonModel::insertNewRecord方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: view_addNewCsTpl
public function view_addNewCsTpl()
{
$name = isset($_POST['title']) ? trim($_POST['title']) : '';
$subject = isset($_POST['topic']) ? trim($_POST['topic']) : '';
$content = isset($_POST['content']) ? trim($_POST['content']) : '';
$countries = isset($_POST['country']) ? $_POST['country'] : false;
$ectm_obj = new EbayCsTplManageModel();
if (empty($name) || empty($subject) || empty($content)) {
$msgdata = array('data' => array('數據不完整!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList');
goErrMsgPage($msgdata);
exit;
}
foreach ($countries as $country) {
//國家代碼必須存在 並且該國家還沒有關聯模板
if (!$ectm_obj->checkCountryCodeExists($country) || !$ectm_obj->checkAllowSet($country)) {
$msgdata = array('data' => array('不合法的國家代碼!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList');
goErrMsgPage($msgdata);
exit;
}
}
$tplmodel = new CommonModel('msg_ebaycstpl');
$name = htmlentities($name);
$subject = htmlentities($subject);
$content = htmlentities($content);
$insertData = array('name' => $name, 'subject' => $subject, 'content' => $content, 'updateTime' => time(), 'is_delete' => 0);
$insertId = $tplmodel->insertNewRecord($insertData);
if (FALSE === $insertId) {
$msgdata = array('data' => array('插入數據失敗!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList');
goErrMsgPage($msgdata);
exit;
}
$countryRel = new CommonModel('msg_ebaycsrel');
$update = array('tplId' => $insertId);
$countries = CommonModel::transSafetySql($countries);
foreach ($countries as $ccode) {
$countryRel->updateData($update, " where countryCode='{$ccode}'");
}
$msgdata = array('data' => array('操作成功!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList');
goOkMsgPage($msgdata);
exit;
}