本文整理匯總了PHP中CommonModel::findOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::findOne方法的具體用法?PHP CommonModel::findOne怎麽用?PHP CommonModel::findOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonModel
的用法示例。
在下文中一共展示了CommonModel::findOne方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}
示例2: 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;
}
示例3: switch
switch ($v['ebay_carrier']) {
case "SurePost":
$Track_website = "www.ups.com";
break;
case "UPS":
$Track_website = "www.ups.com";
break;
case "USPS":
$Track_website = "www.usps.com";
break;
default:
$Track_website = "";
}
//根據跟蹤號長度獲取對應回複內容模板
if (strlen($v['ebay_tracknumber']) == 31) {
$trackTempl = $tpl_obj->findOne('*', " WHERE `id` = '41' AND `is_delete` = 0");
//Letter模板
} else {
$trackTempl = $tpl_obj->findOne('*', " WHERE `id` = '40' AND `is_delete` = 0");
}
//處理模板內容
$buyer_id = $v['ebay_userid'];
$seller_id = $v['ebay_account'];
$trackNum = isset($v['ebay_tracknumber']) ? $v['ebay_tracknumber'] : '';
$item_id = isset($v['ebay_itemid']) ? $v['ebay_itemid'] : '';
$content = $trackTempl['content'];
$content = str_replace('{buyer}', $buyer_id, $content);
$content = str_replace('{tracknum}', $trackNum, $content);
$content = str_replace('{url}', "<a href ='{$Track_website}'>" . $Track_website . '</a>', $content);
$content = str_replace("&", "&", $content);
$returnData['itemid'] = $item_id;