本文整理汇总了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;
}*/
}