本文整理匯總了PHP中OmAvailableModel::insertRowUseValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP OmAvailableModel::insertRowUseValue方法的具體用法?PHP OmAvailableModel::insertRowUseValue怎麽用?PHP OmAvailableModel::insertRowUseValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OmAvailableModel
的用法示例。
在下文中一共展示了OmAvailableModel::insertRowUseValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: act_syncOrder
function act_syncOrder()
{
//手動同步舊係統訂單至新係統
$orderDatas = isset($_GET['orderDatas']) ? $_GET['orderDatas'] : "";
if (!$orderDatas) {
self::$errCede = '002';
self::$errMsg = '參數為空!';
return false;
}
$orderDatas = json_decode($orderDatas, true);
foreach ($orderDatas as $key => $order) {
$where = "id={$order['order']['id']}";
$msg1 = OmAvailableModel::getTNameList("om_unshipped_order", "*", $where);
$msg2 = OmAvailableModel::getTNameList("om_shipped_order", "*", $where);
if ($msg1 || $msg2) {
self::$errMsg .= "訂單{$order['order']['id']}已存在!";
unset($orderDatas[$key]);
}
}
$log_data = '';
$tablekeys = array();
$tabledatas = array();
foreach ($orderDatas as $odk => $orderD) {
if (!isset($orderD['order']['orderStatus'])) {
//var_dump($orderD,$orderD['order'],$orderD['order']['orderStatus']);//exit;
//echo "no status{$orderD['order']['id']}\n";
}
//'orderStauts'=>900, //0
//'orderType'=>21, //2
$tou = $orderD['order']['orderStatus'] == 900 && $orderD['order']['orderType'] == 21 ? 'om_shipped_' : 'om_unshipped_';
foreach ($orderD as $dk => $dataL) {
if ($dk == 'orderDetail') {
foreach ($dataL as $ssdata) {
foreach ($ssdata as $tkey => $tdata) {
//var_dump($tkey, $tdata);
$tablekeys[$tou . $tkey] = array_keys($tdata);
$tabledatas[$tou . $tkey][] = '(' . implode(',', _array2strarray(array_values($tdata))) . ')';
//$log_data .= "INSERT INTO {$tkey} SET "._array2sql($tdata)."\n\n";
}
}
} else {
$tou2 = in_array($dk, array('om_order_notes', 'om_order_tracknumber')) ? '' : $tou;
$tablekeys[$tou2 . $dk] = array_keys($dataL);
$tabledatas[$tou2 . $dk][] = '(' . implode(',', _array2strarray(array_values($dataL))) . ')';
}
}
}
unset($orderDatas);
//echo $log_data;
$sql = '';
foreach ($tablekeys as $tablen => $tablekey) {
//if (empty($tabledatas[$tablen])) var_dump($tabledatas[$tablen], $tabledatas);
//INSERT INTO `valsun_ordermanage`.`om_unshipped_order` (`id`, `recordNumber`, `platformId`, `accountId`, `ordersTime`, `paymentTime`, `onlineTotal`, `actualTotal`, `transportId`, `marketTime`, `ShippedTime`, `orderStatus`, `orderType`, `orderAttribute`, `pmId`, `isFixed`, `channelId`, `calcWeight`, `calcShipping`, `orderAddTime`, `isSendEmail`, `isNote`, `isCopy`, `isSplit`, `combinePackage`, `combineOrder`, `isBuji`, `isLock`, `lockUser`, `lockTime`, `storeId`, `is_delete`) VALUES (NULL, 'fds', '', '', '', '', '0.00', '0.00', '', NULL, NULL, '', NULL, '1', NULL, '2', NULL, '0.000', '0.000', '', '0', '0', '0', '0', '0', '0', '0', '0', NULL, NULL, '1', '0');
//$sql = "INSERT INTO {$tablen}(".implode(',', $tablekey).") VALUES ".implode(',', $tabledatas[$tablen]).";\n";
$key = implode(',', $tablekey);
$value = implode(',', $tabledatas[$tablen]);
$info = OmAvailableModel::insertRowUseValue($tablen, $key, $value);
if (!$info) {
self::$errMsg .= "插入訂單{$tabledatas[$tablen][0]}失敗!";
}
}
if (self::$errMsg == "") {
self::$errMsg = "所選訂單已插入新係統!";
self::$errCode = '200';
return true;
} else {
self::$errCode = '002';
return false;
}
/*$info = orderAddModel::syncOrder($orderDatas);
if($info){
self::$errCode = orderAddModel::$errCode;
self::$errMsg = orderAddModel::$errMsg;
return true;
}else{
self::$errCode = orderAddModel::$errCode;
self::$errMsg = orderAddModel::$errMsg;
return false;
}*/
}