本文整理匯總了PHP中CommonModel::errCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::errCode方法的具體用法?PHP CommonModel::errCode怎麽用?PHP CommonModel::errCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonModel
的用法示例。
在下文中一共展示了CommonModel::errCode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkContent
public static function checkContent($content)
{
self::initDB();
$content = trim($content);
$sql = "select id from " . self::$table . " where content = '{$content}' limit 1";
//echo $sql;
$query = self::$dbConn->query($sql);
if ($query) {
$ret = self::$dbConn->fetch_array_all($query);
return (int) $ret[0]['id'];
//count($ret); //成功, 返回列表數據
} else {
self::$errCode = "003";
self::$errMsg = "error";
return false;
}
}
示例2: getPartnerIdBySku
/**
* CommonModel::getPartnerIdBySku()
* 根據SKU獲取供應商ID
* @param string $sku 料號
* @return 供應商ID
* add by wangminwei 2013-11-13
*/
public static function getPartnerIdBySku($sku)
{
self::initDB();
//$sql = "SELECT partnerId FROM pc_goods_partner_relation WHERE sku = '{$sku}'";
$sql = "SELECT partnerId FROM ph_user_partner_relation WHERE sku = '{$sku}'";
$query = self::$dbConn->query($sql);
if ($query) {
$rtn = self::$dbConn->fetch_array_all($query);
if (!empty($rtn)) {
return $rtn[0]['partnerId'];
} else {
return false;
}
} else {
self::$errCode = 10000;
self::$errMsg = "獲取數據失敗";
return false;
}
}
示例3: addIoRecores
public static function addIoRecores($paraArr)
{
self::initDB();
$ordersn = isset($paraArr['ordersn']) ? $paraArr['ordersn'] : '';
//發貨單號或者是單據的ordersn
$sku = $paraArr['sku'];
//sku
$amount = $paraArr['amount'];
//數量
$positionId = isset($paraArr['positionId']) ? $paraArr['positionId'] : 0;
//倉位ID
$purchaseId = $paraArr['purchaseId'];
//采購員id
$ioType = $paraArr['ioType'];
//出/入庫,1為出庫,2為入庫
$ioTypeId = $paraArr['ioTypeId'];
//出入庫類型id,即出入庫類型表中對應的id
$userId = $paraArr['userId'];
//添加人id
$reason = isset($paraArr['reason']) ? $paraArr['reason'] : '';
//原因
$storeId = isset($paraArr['storeId']) ? intval($paraArr['storeId']) : 1;
//倉庫,默認為1
$createdTime = time();
$tName = 'wh_iorecords';
$set = "SET ordersn='{$ordersn}',sku='{$sku}',amount='{$amount}',positionId='{$positionId}',purchaseId='{$purchaseId}',ioType='{$ioType}',ioTypeId='{$ioTypeId}',userId='{$userId}',reason='{$reason}',createdTime='{$createdTime}',storeId='{$storeId}'";
$sql = "INSERT INTO {$tName} {$set}";
$query = self::$dbConn->query($sql);
if ($query) {
$insertId = self::$dbConn->insert_id($query);
return $insertId;
//成功, 返回插入的id
} else {
self::$errCode = "002";
self::$errMsg = "添加失敗";
return false;
//失敗則設置錯誤碼和錯誤信息, 返回false
}
}