本文整理汇总了PHP中CommonModel::transSafetySql方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel::transSafetySql方法的具体用法?PHP CommonModel::transSafetySql怎么用?PHP CommonModel::transSafetySql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonModel
的用法示例。
在下文中一共展示了CommonModel::transSafetySql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_submitEditData
public function view_submitEditData()
{
$tid = isset($_POST['tid']) ? intval($_POST['tid']) : 0;
$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;
$tpl_obj = new CommonModel('msg_ebaycstpl');
$tplRel_obj = new CommonModel('msg_ebaycsrel');
$tplInfo = $tpl_obj->findOne('*', " where id='{$tid}' ");
if (empty($tplInfo)) {
$msgdata = array('data' => array('不存在的模板!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList');
goErrMsgPage($msgdata);
exit;
}
$tpl_obj->updateData(array('name' => $name, 'subject' => $subject, 'content' => $content, 'updateTime' => time()), " where id='{$tid}'");
$countries = CommonModel::transSafetySql($countries);
$tplRel_obj->updateData(array('tplId' => 0), " where tplId='{$tid}'");
$contrySql = implode("', '", $countries);
$tplRel_obj->updateData(array('tplId' => $tid), " where countryCode in ('{$contrySql}')");
$msgdata = array('data' => array('执行成功!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList');
goOkMsgPage($msgdata);
exit;
}
示例2: view_sendCsMail
public function view_sendCsMail()
{
$returnData = array('code' => 'fail', 'msg' => '', 'itemid' => '');
$itemId = isset($_GET['itemId']) ? trim($_GET['itemId']) : '';
//ItemId
$buyerId = isset($_GET['userId']) ? trim($_GET['userId']) : '';
//买家id
$seller = isset($_GET['account']) ? trim($_GET['account']) : '';
//卖家ID
$contryCode = isset($_GET['country']) ? trim($_GET['country']) : '';
//国家代码
$buytime = isset($_GET['paidTime']) ? intval($_GET['paidTime']) : '';
//购买时间
$returnData['itemid'] = $itemId;
if (empty($itemId) || empty($contryCode)) {
$returnData['msg'] = '缺少参数';
echo json_encode($returnData);
exit;
}
$ecm_obj = new EbayCsMailManageModel();
$v_result = $ecm_obj->validateSend($buyerId, $seller, $buytime, $itemId);
//验证是否需要发送
if (!$v_result) {
$returnData['msg'] = '无需发送';
$returnData['code'] = 'noneed';
echo json_encode($returnData);
exit;
}
$tokenFile = WEB_PATH . 'lib/ebaylibrary/keys/keys_' . $seller . ".php";
// echo $tokenFile;exit;
if (!file_exists($tokenFile)) {
$returnData['code'] = 'fail';
$returnData['msg'] = '没找到账号token!';
echo json_encode($returnData);
exit;
}
include $tokenFile;
/*----- 导出为全局变量 ugly code -----*/
$GLOBALS['siteID'] = $siteID;
$GLOBALS['production'] = $production;
$GLOBALS['compatabilityLevel'] = $compatabilityLevel;
$GLOBALS['devID'] = $devID;
$GLOBALS['appID'] = $appID;
$GLOBALS['certID'] = $certID;
$GLOBALS['serverUrl'] = $serverUrl;
$GLOBALS['userToken'] = $userToken;
/*----- 导出为全局变量 -----*/
$tpl_obj = new CommonModel('msg_ebaycstpl');
$tplRel_obj = new CommonModel('msg_ebaycsrel');
$country = CommonModel::transSafetySql(array($contryCode));
$contryCode = $country[0];
$row = $tplRel_obj->findOne('*', "where countryCode='{$contryCode}'");
if (empty($row)) {
$returnData['code'] = 'fail';
$returnData['msg'] = '未找到国家代码!';
echo json_encode($returnData);
exit;
}
$tplID = $row['tplId'];
$tplInfo = $tpl_obj->findOne('*', " where id='{$tplID}'");
if (!$tplInfo) {
$returnData['code'] = 'fail';
$returnData['msg'] = '没设置模板!';
echo json_encode($returnData);
exit;
} else {
$returnData['tplId'] = $tplID;
}
$result = $ecm_obj->sendEbayCsMail($itemId, $buyerId, $tplInfo['content'], $tplInfo['subject']);
// $result = TRUE;
if (FALSE === $result) {
$returnData['code'] = 'fail';
$returnData['msg'] = EbayCsMailManageModel::$errMsg;
echo json_encode($returnData);
exit;
} else {
$returnData['code'] = 'success';
$returnData['msg'] = '处理成功!';
echo json_encode($returnData);
}
}