本文整理汇总了PHP中BaseModel::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::begin方法的具体用法?PHP BaseModel::begin怎么用?PHP BaseModel::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addExpressRemark
public static function addExpressRemark($omOrderId, $data)
{
!self::$dbConn ? self::initDB() : null;
BaseModel::begin();
//开始事务
if (!self::deleteExpressRemark($omOrderId)) {
BaseModel::rollback();
self::$errCode = "001";
self::$errMsg = " 删除数据失败! ";
return false;
//失败则设置错误码和错误信息, 返回false
}
if (!empty($data)) {
//var_dump($data);
foreach ($data as $datavalue) {
$string = array2sql_extral($datavalue);
//$string = "('".$datavalue['omOrderId']."','". $datavalue['price']."','". $datavalue['amount']."','". $datavalue['hamcodes']."','". $datavalue['isBrand']."','". $datavalue['description']."','". $datavalue['creatorId']."','". $datavalue['createdTime'] ."'),";
$sql = "INSERT INTO " . self::$Table . " SET {$string} ";
//echo $sql;
if (!self::$dbConn->query($sql)) {
BaseModel::rollback();
self::$errCode = "002";
self::$errMsg = " 插入数据失败! ";
return false;
//失败则设置错误码和错误信息, 返回false
}
}
BaseModel::commit();
BaseModel::autoCommit();
self::$errCode = "200";
self::$errMsg = " 插入数据成功! ";
return true;
//失败则设置错误码和错误信息, 返回false
}
}
示例2: act_applyTheLineEUBTrackNumber
function act_applyTheLineEUBTrackNumber()
{
global $memc_obj;
//调用memcache获取sku信息
//var_dump($SYSTEM_ACCOUNTS);
require_once WEB_PATH . "lib/PHPExcel.php";
//PHPExcel
//exit;
$addUser = $_SESSION['sysUserId'];
$filePath = WEB_PATH . "html/upload/eub/";
//var_dump($_FILES); exit;
if (!empty($_FILES['theline_upfile']['tmp_name'])) {
$uploadfile = date("Y") . date("m") . date("d") . rand(1, 3009) . ".xls";
$filePath .= $uploadfile;
//echo $filePath;
if (!move_uploaded_file($_FILES['theline_upfile']['tmp_name'], $filePath)) {
self::$errCode = '003';
self::$errMsg = "文件上传失败!";
echo self::$errMsg;
return false;
}
} else {
self::$errCode = '003';
self::$errMsg = "文件上传不成功!";
echo self::$errMsg;
return false;
}
//var_dump($addUser);
$PHPExcel = new PHPExcel();
//var_dump($PHPExcel); exit;
$PHPReader = new PHPExcel_Reader_Excel2007();
//var_dump($PHPReader); exit;
//exit;
//var_dump($PHPReader->canRead($filePath)); exit;
if (!$PHPReader->canRead($filePath)) {
$PHPReader = new PHPExcel_Reader_Excel5();
//var_dump($PHPReader); exit;
if (!$PHPReader->canRead($filePath)) {
echo 'no Excel';
return;
}
}
//exit;
$PHPExcel = $PHPReader->load($filePath);
$excellists = excel2array($PHPExcel, $filePath, 2, 0);
//echo "<pre>";print_r($excellists); exit;
$adjust_time = date('Y-m-d H:i:s');
$recordnumbers = array();
$tracknumbers = array();
foreach ($excellists as $key => $excellist) {
$recordnumbers[] = array_shift($excellist);
$tracknumbers[] = array_shift($excellist);
}
$total = count($recordnumbers);
BaseModel::begin();
//开始事务
for ($ii = 1; $ii < $total; $ii++) {
$recordnumber = $recordnumbers[$ii];
$tracknumber = $tracknumbers[$ii];
//盘点数量
$row = $ii;
if (!preg_match('/^LN[0-9]{9}CN$/', $tracknumber)) {
self::$errMsg .= " 第" . $row . "行" . $tracknumber . " 跟踪号格式有误<br>";
}
if ($tracknumber == "") {
self::$errMsg .= " 第" . $row . "行跟踪号为空请查证<br>";
}
if (!OmEUBTrackNumberModel::applyTheLineEUBTrackNumber($recordnumber, $tracknumber)) {
BaseModel::rollback();
}
}
self::$errCode .= OmEUBTrackNumberModel::$errCode;
self::$errMsg .= OmEUBTrackNumberModel::$errMsg;
BaseModel::commit();
BaseModel::autoCommit();
return true;
}
示例3: view_modifyOrderList
//.........这里部分代码省略.........
$update_userinfo['address2'] = $_POST['edit_address2'];
}
if ($_POST['actualShipping'] != $_POST['edit_actualShipping']) {
$update_order['actualShipping'] = $_POST['edit_actualShipping'];
}
if ($_POST['city'] != $_POST['edit_city']) {
$update_userinfo['city'] = $_POST['edit_city'];
}
if ($_POST['state'] != $_POST['edit_state']) {
$update_userinfo['state'] = $_POST['edit_state'];
}
if ($_POST['countryName'] != $_POST['edit_countryName']) {
$update_userinfo['countryName'] = $_POST['edit_countryName'];
}
if ($_POST['zipCode'] != $_POST['edit_zipCode']) {
$update_userinfo['zipCode'] = $_POST['edit_zipCode'];
}
if ($_POST['landline'] != $_POST['edit_landline']) {
$update_userinfo['landline'] = $_POST['edit_landline'];
}
if ($_POST['phone'] != $_POST['edit_phone']) {
$update_userinfo['phone'] = $_POST['edit_phone'];
}
if ($_POST['transportId'] != $_POST['edit_transportId']) {
$update_order['transportId'] = $_POST['edit_transportId'];
}
if ($_POST['edit_tracknumber']) {
$update_tracknumber['omOrderId'] = $orderid;
$update_tracknumber['tracknumber'] = $_POST['edit_tracknumber'];
$update_tracknumber['addUser'] = $sysUserId;
$update_tracknumber['createdTime'] = time();
//var_dump($update_tracknumber); exit;
}
BaseModel::begin();
//开始事务
if ($update_order) {
//$sql = "UPDATE om_unshipped_order set ".array2sql($update_order)." WHERE id = ".$orderid;
//$msg = OrderLogModel::orderLog($orderid,$update_order['orderStatus'],$update_order['orderType'],$sql);
if (OrderindexModel::updateOrder('om_unshipped_order', $update_order, ' WHERE id = ' . $orderid)) {
if ($updatestatus) {
$ProductStatus = new ProductStatus();
if (!$ProductStatus->updateSkuStatusByOrderStatus(array($orderid), $batch_ostatus_val, $batch_otype_val)) {
BaseModel::rollback();
}
}
$modify_showerrorinfo = "<font color='green'>更新成功</font>";
} else {
$modify_showerrorinfo = "<font color='red'>更新失败</font>";
BaseModel::rollback();
}
}
if ($update_userinfo) {
//var_dump($update_userinfo);
if (OrderindexModel::updateOrder('om_unshipped_order_userInfo', $update_userinfo, ' WHERE omOrderId = ' . $orderid)) {
$modify_showerrorinfo = "<font color='green'>更新成功</font>";
} else {
$modify_showerrorinfo = "<font color='red'>更新失败</font>";
BaseModel::rollback();
}
}
if ($update_tracknumber) {
//echo $msg;
if (!OrderAddModel::insertOrderTrackRow($update_tracknumber)) {
/*self :: $errCode = "001";
self :: $errMsg = "跟踪号插入失败";
return false;*/
示例4: act_addRefundInfo
/**
* 写入退款单
*/
function act_addRefundInfo()
{
//print_r($_POST);
//echo '00000000000000000000';
global $dbConn;
$dbcon = $dbConn;
$refundInfo = isset($_POST['orderobj']) ? $_POST['orderobj'] : '';
$orderType = isset($refundInfo['orderType']) ? $refundInfo['orderType'] : 1;
if ($refundInfo == '') {
self::$errCode = 1;
self::$errMsg = '参数非法!';
return false;
}
$id = isset($refundInfo['id']) ? $refundInfo['id'] : '';
if ($id == '') {
self::$errCode = 2;
self::$errMsg = '参数Id为空!';
return false;
}
if ($orderType == 1) {
//$ppRtnInfo = $this->act_curlRefund($refundInfo);
$httpParsedResponseAr = $this->act_curlRefund($refundInfo);
//var_dump($httpParsedResponseAr);exit;
if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
$dataArr = $refundInfo;
$operator = $_SESSION["userCnName"];
$time = time();
$sql = "insert into ebay_refund_log (order_id,trade_id,ebay_account,buyer_id,refund_reson,refund_type,operator,refund_time,paypal_account,money,currency,country) values ('{$dataArr['id']}','{$dataArr['PayPalPaymentId']}','{$dataArr['accountId']}','{$dataArr['platformUsername']}','{$dataArr['reason']}','{$dataArr['refundType']}','{$operator}','{$time}','{$dataArr['paypalAccount']}','{$dataArr['refundSum']}','{$dataArr['currency']}','{$dataArr['countryName']}')";
//echo $sql."\n";
$dbcon->execute($sql);
//记录操作信息
$sql = "insert into ebay_refund_log_detail (order_id,sku,amount) values ";
//记录退款单个sku 信息
$skuArr = $dataArr['skuArr'];
foreach ($skuArr as $key => $sku) {
$sql .= "('{$dataArr['id']}','{$sku['sku']}','{$sku['amount']}')";
if ($key < count($skuArr) - 1) {
$sql .= ",";
}
}
if ($dbcon->execute($sql)) {
$rtnMsg = "订单编号: " . $dataArr['id'] . "退款成功";
} else {
$rtnMsg = $sql;
}
$sql = " UPDATE `om_unshipped_order` SET orderStatus=2000 , orderType=1004 WHERE id={$dataArr['id']}";
$dbConn->execute($sql);
$sql = " UPDATE `om_shipped_order` SET orderStatus=660 , orderType=710 WHERE id={$dataArr['id']}";
$dbConn->execute($sql);
self::$errCode = 200;
} else {
self::$errCode = 404;
$rtnMsg = "订单编号: " . $dataArr['id'] . "退款失败" . urldecode($httpParsedResponseAr['L_LONGMESSAGE0']) . '错误代码:' . $httpParsedResponseAr['L_ERRORCODE0'];
self::$errMsg = $rtnMsg;
return false;
}
}
//$orderObj = new OrderRefundModel();
BaseModel::begin();
$sysUserId = $_SESSION['sysUserId'];
$time = time();
$data = array();
$data['omOrderId'] = $refundInfo['id'];
$data['recordNumber'] = $refundInfo['recordNumber'];
$data['sellerAccountId'] = $refundInfo['accountId'];
$data['totalSum'] = $refundInfo['totalSum'];
$data['refundSum'] = $refundInfo['refundSum'];
$data['refundType'] = $refundInfo['refundType'] == 'Full' ? 1 : 0;
$data['platformUsername'] = $refundInfo['platformUsername'];
$data['platformId'] = $refundInfo['platformId'];
$data['platform'] = $refundInfo['platform'];
$data['transId'] = $refundInfo['PayPalPaymentId'];
$data['paypalAccount'] = $refundInfo['paypalAccount'];
$data['pass'] = $refundInfo['pass'];
$data['signature'] = $refundInfo['signature'];
$data['reason'] = $refundInfo['reason'];
$data['note'] = $refundInfo['note'];
$data['currency'] = $refundInfo['currency'];
$data['orderType'] = $orderType;
$data['addTime'] = $time;
$data['creatorId'] = $sysUserId;
$tableRefund = 'om_order_refund';
$setField = array2sql($data);
$insertId = OrderRefundModel::addTNameRow($tableRefund, $setField);
if ($insertId !== FALSE) {
foreach ($refundInfo['skuArr'] as $key => $orderInfo) {
$refundDetail = array();
$refundDetail['orderRefundId'] = $insertId;
$refundDetail['sku'] = $orderInfo['sku'];
$refundDetail['amount'] = $orderInfo['amount'];
$refundDetail['actualPrice'] = $orderInfo['actualPrice'];
$refundDetail['addTime'] = $time;
$tableRefundDetail = 'om_order_refund_detail';
$setFields = array2sql($refundDetail);
$ret2 = OrderRefundModel::addTNameRow($tableRefundDetail, $setFields);
if ($ret2 !== FALSE) {
//
//.........这里部分代码省略.........
示例5: view_productsCombineSpuComplete
public function view_productsCombineSpuComplete()
{
$combineSpu = $_GET['combineSpu'] ? $_GET['combineSpu'] : '';
$id = $_GET['id'] ? $_GET['id'] : '';
$userId = $_SESSION['userId'];
$now = time();
if (intval($userId) <= 0) {
$status = "未登录";
header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
exit;
}
if (empty($id)) {
$status = "id为空";
header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
exit;
}
$idArr = array_filter(explode(',', $id));
foreach ($idArr as $value) {
if (intval($value) <= 0) {
$status = "含有非法id";
header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
exit;
}
}
$newIdArr = implode(',', $idArr);
try {
BaseModel::begin();
$tName = 'pc_spu_web_maker';
$set = "SET isComplete=1,completeTime='{$now}'";
$where = "WHERE id in({$newIdArr})";
OmAvailableModel::updateTNameRow($tName, $set, $where);
BaseModel::commit();
BaseModel::autoCommit();
$status = "制作完成成功";
header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
$status = $e->getMessage();
header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
}
}
示例6: overWeightSplitB2B
public static function overWeightSplitB2B($omOrderId)
{
!self::$dbConn ? self::initDB() : null;
global $memc_obj;
//调用memcache获取sku信息
$mctime = time();
//var_dump($moOrderIdArr);
$tableName = 'om_unshipped_order';
$where = ' WHERE id = ' . $omOrderId . ' and is_delete = 0 and storeId = 1';
$orderData = OrderindexModel::showOrderList($tableName, $where);
$orderDetail = $orderData[$omOrderId]['orderDetail'];
$obj_order_data = $orderData[$omOrderId]['orderData'];
$orderExtenData = $orderData[$omOrderId]['orderExtenData'];
$orderUserInfoData = $orderData[$omOrderId]['orderUserInfoData'];
$_actualTotal = $obj_order_data['actualTotal'];
$_actualShipping = $obj_order_data['actualShipping'];
$_platformId = $obj_order_data['platformId'];
$_mainId = $obj_order_data['id'];
$_transportId = $obj_order_data['transportId'];
//var_dump($orderDetail); exit;
$omAvailableAct = new OmAvailableAct();
$GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 AND platformId in(1,5) ');
$weightlists = array();
$skuinfo = array();
$goods_sn_nums = 0;
$shippfee_arr = array();
$ebay_total_be = 0;
foreach ($orderDetail as $k => $f) {
$sku = trim($f['orderDetailData']['sku']);
$amount = $f['orderDetailData']['amount'];
$shippingFee = $f['orderDetailData']['shippingFee'];
$goods_sn_nums += $amount;
$ebay_total_be += $f['orderDetailData']['amount'] * $f['orderDetailData']['itemPrice'];
$shippfee_arr[$sku] = round($shippingFee / $amount, 3);
//单个料号的运费
$skuinfo[$sku] = $f;
for ($i = 1; $i <= $amount; $i++) {
$var = $sku;
$oneskuweight = CommonModel::calcOnlySkuWeight($var, 1);
//一个sku的重量
$weightlists[$var][] = $oneskuweight[0];
}
}
$rate = $_actualTotal / $ebay_total_be;
//var_dump($weightlists); exit;
if ($goods_sn_nums <= 1) {
self::$errCode = '0020';
self::$errMsg = "只有一个料号组成,不允许超重拆分";
return false;
}
//echo "==========="; exit;
$keyarray = array();
$keyarrays = array();
$checkweight = 0;
$arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
//var_dump($arrinfo); exit;
$realweight = $arrinfo[0];
$realcosts = $arrinfo[2];
$itemprices = $arrinfo[3];
foreach ($weightlists as $wk => $wv) {
foreach ($wv as $weightlist) {
$checkweight += $weightlist;
if ($checkweight > 1.85) {
$keyarrays[] = $keyarray;
$keyarray = array();
$checkweight = $weightlist;
$keyarray[$wk][] = $wk;
} else {
$keyarray[$wk][] = $wk;
}
}
}
if (!empty($keyarray)) {
$keyarrays[] = $keyarray;
}
//var_dump($keyarrays); exit;
BaseModel::begin();
//开始事务
$insert_orderData = array();
foreach ($keyarrays as $keyarray) {
$ebay_total = 0;
$totalweight = 0;
$insert_ebay_ids = array();
//var_dump($skuinfo); echo "<br>";
foreach ($keyarray as $k => $kav) {
//var_dump($skuinfo[$k]['orderDetailData']['itemPrice'], count($kav));
//$ebay_total += ($skuinfo[$k]['orderDetailData']['itemPrice'] + $shippfee_arr[$k]) * count($kav);
$ebay_total += $skuinfo[$k]['orderDetailData']['itemPrice'] * count($kav);
}
$ebay_total = $rate * $ebay_total;
$shipfee = 0;
//$val = generateOrdersn();
$insert_obj_order_data = $obj_order_data;
unset($insert_obj_order_data['id']);
$insert_obj_order_data['actualTotal'] = $ebay_total;
$insert_obj_order_data['orderType'] = C('STATEPENDING_OWDONE');
$insert_obj_order_data['orderAddTime'] = $mctime;
$insert_obj_order_data['isSplit'] = 2;
$insert_orderExtenData = $orderExtenData;
unset($insert_orderExtenData['id']);
//.........这里部分代码省略.........
示例7: createOwOrder
/**
* 生成海外备货单,根据下单人合并订单明细
* Enter description here ...
*/
public function createOwOrder()
{
global $dbConn;
$skulist = $_POST['skulist'];
$operator_id = $_SESSION[C('USER_AUTH_SYS_ID')];
//操作人员ID
$comid = $_SESSION[C('USER_COM_ID')];
//公司ID
$type = $_POST['type'];
$rollback = false;
$existSku = '';
$ismark = 0;
BaseModel::begin();
//开始事务
foreach ($skulist as $key => $sku) {
$price = PurchaseOrderModel::getPriceBySku($sku['sku']);
//SKU单价
$purid = OwOrderModel::getPurchaseidBySku($sku['sku']);
$parid = OwOrderModel::getPartnerId($sku['sku']);
//供应商ID
$parid = $parid['partnerId'];
$storeid = 1;
//仓库ID
$orderData = OwOrderModel::getOwOrderNum($operator_id);
//判断同操作员跟踪号是否已存在(未审核状态下)
$orderSN = $orderData['recordnumber'];
$main = array();
$detail = array();
if (!empty($orderSN)) {
//存在符合条件的跟踪号,直接插入采购订单明细
/*
$orderHasSku = OwOrderModel::orderExistSku($sku['sku']);
if($orderHasSku){
$existSku .= '['.$sku['sku'].'],';
continue;
}*/
$detail['sku'] = $sku['sku'];
$detail['price'] = $price;
//单价
$detail['count'] = $sku['rec'];
//采购数量
$detail['goods_recommend_count'] = $sku['rec'];
//采购数量
$detail['recordnumber'] = $orderData['recordnumber'];
$poid = $orderData['id'];
//根据跟踪号取采购主订单编号
$detail['parid'] = $parid;
//料号供应商ID
$detail['po_id'] = $poid;
$dataSet = array2sql($detail);
$sql = "insert into ph_ow_order_detail set {$dataSet} ";
$rtndetail = $dbConn->execute($sql);
if ($rtndetail === false) {
$rollback = true;
} else {
$ismark = 1;
}
} else {
//不存在符合条件的跟踪号重新生成
$recordnumber = PurchaseOrderModel::autoCreateOrderSn($purid, $comid);
//生成对应公司的采购订单跟踪号
if (!empty($recordnumber)) {
//生成采购订单号成功
$main['recordnumber'] = $recordnumber;
//跟踪号
$main['purchaseuser_id'] = $purid;
//采购员ID
$main['operator_id'] = $operator_id;
//操作人员id
$main['warehouse_id'] = $storeid;
//仓库ID
$main['company_id'] = $comid;
//公司编号
$main['partner_id'] = $parid;
//供应商ID
$main['addtime'] = time();
if ($type == "oversea") {
$main['order_type'] = 5;
// 给海外仓备货的订单
} else {
$main['order_type'] = 1;
// 正常订单
}
$dataSet = array2sql($main);
$sql = "insert into ph_ow_order set {$dataSet} ";
$rtnmain = $dbConn->execute($sql);
if ($rtnmain) {
//主订单添加成功
/*
$orderHasSku = OwOrderModel::orderExistSku($sku['sku']);
if($orderHasSku){
$existSku .= '['.$sku['sku'].'],';
continue;
}*/
$detail['sku'] = $sku['sku'];
$detail['price'] = $price;
//.........这里部分代码省略.........
示例8: act_cancelCombine
public function act_cancelCombine()
{
//更新主从订单状态及记录
$str = isset($_POST['str']) ? $_POST['str'] : "";
$orderids = explode(",", $str);
$userId = $_SESSION['sysUserId'];
BaseModel::begin();
foreach ($orderids as $orderid) {
$order = cancelCombineModel::selectRecord($orderid);
if ($order[0]['combinePackage'] == 1) {
$msg = cancelCombineModel::updateOrder($orderid);
if (!$msg) {
self::$errCode = 402;
self::$errMsg = "更新主订单失败!";
BaseModel::rollback();
return false;
}
$sonOrders = cancelCombineModel::selectSonOrder($orderid);
foreach ($sonOrders as $sonorder) {
$msg1 = cancelCombineModel::updateOrder($sonorder['split_order_id']);
if (!$msg1) {
self::$errCode = 403;
self::$errMsg = "更新子订单失败!";
BaseModel::rollback();
return false;
}
if (in_array($sonorder['split_order_id'], $orderids)) {
unset($orderids[$sonorder['split_order_id']]);
}
}
$msg2 = cancelCombineModel::updateRecords($orderid, $userId);
if (!$msg2) {
self::$errCode = 404;
self::$errMsg = "更新合并包裹记录失败!";
BaseModel::rollback();
return false;
}
}
if ($order[0]['combinePackage'] == 2) {
$mainOrder = cancelCombineModel::selectMainOrder($order[0]['id']);
$sonOrders = cancelCombineModel::selectSonOrder($mainOrder);
if (count($sonOrders) == 1) {
$msg3 = cancelCombineModel::updateOrder($mainorder);
if (!$msg3) {
self::$errCode = 405;
self::$errMsg = "更新主订单失败!";
BaseModel::rollback();
return false;
}
if (in_array($mainOrder, $orderids)) {
unset($orderids[$mainOrder]);
}
$msg4 = cancelCombineModel::updateOrder($sonOrders[0]['split_order_id']);
if (!$msg4) {
self::$errCode = 406;
self::$errMsg = "更新子订单失败!";
BaseModel::rollback();
return false;
}
} else {
$msg5 = cancelCombineModel::updateOrder($orderid);
if (!$msg5) {
self::$errCode = 407;
self::$errMsg = "更新子订单失败!";
BaseModel::rollback();
return false;
}
}
$msg6 = cancelCombineModel::updateRecords($orderid, $userId, "son");
if (!$msg6) {
self::$errCode = 408;
self::$errMsg = "更新合并包裹记录失败!";
BaseModel::rollback();
return false;
}
}
}
BaseModel::commit();
return true;
}
示例9: act_copyOrder
public function act_copyOrder()
{
$orderid = isset($_POST['orderid']) ? $_POST['orderid'] : "";
$countryName = isset($_POST['countryName']) ? $_POST['countryName'] : "";
$state = isset($_POST['state']) ? $_POST['state'] : "";
$detail_sku = isset($_POST['detail_sku']) ? $_POST['detail_sku'] : "";
$city = isset($_POST['city']) ? $_POST['city'] : "";
$landline = isset($_POST['landline']) ? $_POST['landline'] : "";
$phone = isset($_POST['phone']) ? $_POST['phone'] : "";
$zipCode = isset($_POST['zipCode']) ? $_POST['zipCode'] : "";
$street = isset($_POST['street']) ? $_POST['street'] : "";
$address2 = isset($_POST['address2']) ? $_POST['address2'] : "";
$address3 = isset($_POST['address3']) ? $_POST['address3'] : "";
$transport = isset($_POST['transport']) ? $_POST['transport'] : "";
$note = isset($_POST['note']) ? $_POST['note'] : "";
$userId = $_SESSION['sysUserId'];
$order = copyOrderModel::selectOrder($orderid);
$user = copyOrderModel::selectUser($orderid);
$details = copyOrderModel::selectDetail($orderid);
$platformId = $order['platformId'];
$plateform = copyOrderModel::selectplatform($platformId);
$table = "om_unshipped_order_extension_" . $plateform;
$extension = copyOrderModel::selectExtension($table, $orderid);
$warehouse = copyOrderModel::selectWarehouse($orderid);
$notes = copyOrderModel::selectNote($orderid);
BaseModel::begin();
if (!$order) {
self::$errCode = 501;
self::$errMsg = "原订单已完成或不存在!";
return false;
}
if ($order['isCopy'] == 2) {
self::$errCode = 502;
self::$errMsg = "此订单是复制产生的订单,不能在被复制!";
return false;
}
$new_order = array();
foreach ($order as $key => $value) {
if ($key == 'id') {
continue;
}
$new_order[$key] = $value;
if ($key == 'isCopy') {
$new_order[$key] = 2;
}
}
//$statuslist = copyOrderModel::selectStatus($status);
//$new_order['orderStatus'] = $statusList['groupId'];
//$new_order['orderType'] = $statusList['statusCode'];
//先插入订单生成订单id
//$sql = "";
foreach ($new_order as $key => $value) {
if (is_numeric($value)) {
$sql[] = "{$key}={$value}";
} else {
$sql[] = "{$key}='{$value}'";
}
}
$sql = implode(",", $sql);
$id = copyOrderModel::insertOrder($sql, $userId);
if (!$id) {
self::$errCode = 503;
self::$errMsg = "复制订单插入失败!";
BaseModel::rollback();
return false;
}
$new_user = array();
//插入用户信息
foreach ($user as $key => $value) {
$new_user[$key] = $value;
if ($key == 'omOrderId') {
$new_user[$key] = $id;
}
if ($key == 'countryName') {
$new_user[$key] = $countryName;
}
if ($key == 'state') {
$new_user[$key] = $state;
}
if ($key == 'city') {
$new_user[$key] = $city;
}
if ($key == 'landline') {
$new_user[$key] = $landline;
}
if ($key == 'phone') {
$new_user[$key] = $phone;
}
if ($key == 'zipCode') {
$new_user[$key] = $zipCode;
}
if ($key == 'street') {
$new_user[$key] = $street;
}
if ($key == 'address2') {
$new_user[$key] = $address2;
}
if ($key == 'address3') {
$new_user[$key] = $address3;
}
//.........这里部分代码省略.........
示例10: shiftOrderList
public static function shiftOrderList($where)
{
BaseModel::begin();
//开始事务
$unshipped_tableName = 'om_unshipped_order';
$shipped_tableName = 'om_shipped_order';
$orderList = self::showOrderList($unshipped_tableName, $where);
//echo "<pre>"; print_r($orderList); exit;
if (empty($orderList)) {
self::$errCode = '000';
self::$errMsg = "无操作数据!";
return false;
}
foreach ($orderList as $omOrderId => $orderData) {
$obj_order_data = $orderData['orderData'];
$orderDetail = $orderData['orderDetail'];
$insert_orderDetail = array();
foreach ($orderDetail as $detail) {
$insert_orderDetailData = $detail['orderDetailData'];
//unset ($insert_orderDetailData['id']);
$insert_orderDetailExtenData = $detail['orderDetailExtenData'];
//unset ($insert_orderDetailExtenData['omOrderdetailId']);
$insert_orderDetail[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData);
}
//BaseModel :: rollback();\
//self :: $dbConn->query('SET AUTOCOMMIT=1');
//return FALSE;
//unset ($obj_order_data['id']);
$orderExtenData = $orderData['orderExtenData'];
//unset ($orderExtenData['omOrderId']);
$orderUserInfoData = $orderData['orderUserInfoData'];
//unset ($orderExtenData['omOrderId']);
$orderWhInfoData = $orderData['orderWhInfoData'];
//unset ($orderWhInfoData['omOrderId']);
//$obj_order_data['orderStatus'] = C('STATEBUJI');
//$obj_order_data['orderType'] = C('STATEBUJI_DONE');
$insert_orderData = array();
$insert_orderData = array('orderData' => $obj_order_data, 'orderExtenData' => $orderExtenData, 'orderUserInfoData' => $orderUserInfoData, 'orderDetail' => $insert_orderDetail, 'orderWhInfoData' => $orderWhInfoData);
//var_dump($insert_orderData); exit;
if ($insertId = OrderAddModel::shiftAllOrderRowNoEvent($insert_orderData)) {
//echo $split_log .= 'insert success!' . "\n"; exit;
//var_dump($_mainId,$_spitId); exit;
if (!OrderLogModel::insertOrderLog($insertId, '从unshipped表转移数据到shipped表中,第一步:添加shipped表数据')) {
BaseModel::rollback();
self::$errCode = '001';
self::$errMsg = "转移数据添加日志失败,第一步:添加shipped表数据失败!";
return false;
}
} else {
BaseModel::rollback();
self::$errCode = '002';
self::$errMsg = "INSERT数据失败!";
return false;
}
if (self::killAllOrderRowNoEvent($omOrderId, $obj_order_data['platformId'])) {
//echo $split_log .= 'insert success!' . "\n"; exit;
//var_dump($_mainId,$_spitId); exit;
if (!OrderLogModel::insertOrderLog($omOrderId, '从unshipped表转移数据到shipped表中,第二步:删除unshipped表中数据')) {
BaseModel::rollback();
self::$errCode = '003';
self::$errMsg = "转移数据添加日志失败,第二步:删除unshipped表中数据失败!";
return false;
}
} else {
BaseModel::rollback();
self::$errCode = '004';
self::$errMsg = "KILL数据失败!";
return false;
}
}
BaseModel::commit();
BaseModel::autoCommit();
self::$errCode = '200';
self::$errMsg = "转移数据成功!";
return TRUE;
}
示例11: view_updateSpuPersonOn
public function view_updateSpuPersonOn()
{
$spu = $_POST['spu'] ? post_check(trim($_POST['spu'])) : '';
$isSingSpu = $_POST['isSingSpu'] ? post_check(trim($_POST['isSingSpu'])) : 0;
$ebaySalerId = $_POST['ebaySalerId'] ? post_check(trim($_POST['ebaySalerId'])) : 0;
$aliexpressSalerId = $_POST['aliexpressSalerId'] ? post_check(trim($_POST['aliexpressSalerId'])) : 0;
$amazonSalerId = $_POST['amazonSalerId'] ? post_check(trim($_POST['amazonSalerId'])) : 0;
$overseaSalerId = $_POST['overseaSalerId'] ? post_check(trim($_POST['overseaSalerId'])) : 0;
$webMakerId = $_POST['webMakerId'] ? post_check(trim($_POST['webMakerId'])) : 0;
if ($isSingSpu != 1 && $isSingSpu != 2) {
$status = "基础数据 单/虚拟料号出错!";
echo '<script language="javascript">
alert("' . $status . '");
</script>';
exit;
}
if (intval($_SESSION['userId']) <= 0) {
$status = "登陆超时,请重新登陆";
echo '<script language="javascript">
alert("' . $status . '");
</script>';
exit;
}
if (intval($ebaySalerId) <= 0 && intval($aliexpressSalerId) <= 0 && intval($amazonSalerId) <= 0 && !isAccessAll('autoCreateSpu', 'isCanUpdateWebMakerPower')) {
$status = "ebay/aliexpress/amazon 平台中至少要存在一个销售人员记录才能提交";
echo '<script language="javascript">
alert("' . $status . '");
</script>';
exit;
}
try {
BaseModel::begin();
$status = '';
if ($isSingSpu == 1) {
$tName = 'pc_spu_saler_single';
} else {
$tName = 'pc_spu_saler_combine';
}
$select = 'isAgree,salerId';
if (!empty($ebaySalerId)) {
$where = "WHERE is_delete=0 AND spu='{$spu}' AND platformId=1";
//ebay平台
$ebaySpuSalerList = OmAvailableModel::getTNameList($tName, $select, $where);
if (!empty($ebaySpuSalerList)) {
//更新时如果人员改动会更新是否接手状态,但是不会更新是否被销售同意/拒绝状态
if ($ebaySpuSalerList[0]['salerId'] != $ebaySalerId) {
$dataEbayArr = array();
$dataEbayArr['salerId'] = $ebaySalerId;
$dataEbayArr['isAgree'] = 1;
//add by zqt 20140421,如果换人了的话,则变为待定状态
$dataEbayArr['addTime'] = time();
OmAvailableModel::updateTNameRow2arr($tName, $dataEbayArr, $where);
}
} else {
//插入新数据时,则默认销售同意/拒绝状态为待定
$dataEbayArr = array();
$dataEbayArr['spu'] = $spu;
$dataEbayArr['salerId'] = $ebaySalerId;
$dataEbayArr['platformId'] = 1;
$dataEbayArr['addTime'] = time();
$dataEbayArr['isAgree'] = 1;
OmAvailableModel::addTNameRow2arr($tName, $dataEbayArr);
}
}
if (!empty($aliexpressSalerId)) {
$where = "WHERE is_delete=0 AND spu='{$spu}' AND platformId=2";
//ali平台
$ebaySpuSalerList = OmAvailableModel::getTNameList($tName, $select, $where);
if (!empty($ebaySpuSalerList)) {
//更新时如果人员改动会更新是否接手状态,但是不会更新是否被销售同意/拒绝状态
if ($ebaySpuSalerList[0]['salerId'] != $aliexpressSalerId) {
$dataEbayArr = array();
$dataEbayArr['salerId'] = $aliexpressSalerId;
$dataEbayArr['isAgree'] = 1;
//add by zqt 20140421,如果换人了的话,则变为待定状态
$dataEbayArr['addTime'] = time();
OmAvailableModel::updateTNameRow2arr($tName, $dataEbayArr, $where);
}
} else {
//插入新数据时,则默认销售同意/拒绝状态为待定
$dataEbayArr = array();
$dataEbayArr['spu'] = $spu;
$dataEbayArr['salerId'] = $aliexpressSalerId;
$dataEbayArr['platformId'] = 2;
$dataEbayArr['addTime'] = time();
$dataEbayArr['isAgree'] = 1;
OmAvailableModel::addTNameRow2arr($tName, $dataEbayArr);
}
}
if (!empty($amazonSalerId)) {
$where = "WHERE is_delete=0 AND spu='{$spu}' AND platformId=11";
//amazon平台
$ebaySpuSalerList = OmAvailableModel::getTNameList($tName, $select, $where);
if (!empty($ebaySpuSalerList)) {
//更新时如果人员改动会更新是否接手状态,但是不会更新是否被销售同意/拒绝状态
if ($ebaySpuSalerList[0]['salerId'] != $amazonSalerId) {
$dataEbayArr = array();
$dataEbayArr['salerId'] = $amazonSalerId;
$dataEbayArr['isAgree'] = 1;
//add by zqt 20140421,如果换人了的话,则变为待定状态
//.........这里部分代码省略.........
示例12: insertAllOrderRow
/**
* 插入订单对应下的总表信息
* @para $data as array
* @add by Herman.Xi
* @last modified 20131022
* $in 默认为进入订单模式
*/
public static function insertAllOrderRow($orderData, $extension = 'ebay', $in = true)
{
self::initDB();
//var_dump($orderData); exit;
$obj_order_data = $orderData['orderData'];
$orderExtenData = $orderData['orderExtenData'];
$orderUserInfoData = $orderData['orderUserInfoData'];
$orderDetailArr = $orderData['orderDetail'];
if ($obj_order_data['platformId'] == "2") {
//ebay
$ebay_orderid = $orderExtenData['orderId'];
$tName = 'om_unshipped_order_extension_ebay';
$where = "WHERE orderId='{$ebay_orderid}'";
$flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
$tName = 'om_shipped_order_extension_ebay';
$flagCountshipped = OmAvailableModel::getTNameCount($tName, $where);
} else {
$tName = 'om_unshipped_order';
$where = "WHERE accountId='{$obj_order_data['accountId']}' AND recordNumber='{$obj_order_data['recordNumber']}' AND platformId={$obj_order_data['platformId']} and is_delete ='0'";
$flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
$tName = 'om_shipped_order';
$flagCountshipped = OmAvailableModel::getTNameCount($tName, $where);
}
//if (empty ($flagCountUnshipped) && empty ($flagCountshipped)) { //判断订单是否已经在系统2个订单表(未发货和已发货)中存在
if (empty($flagCountUnshipped) && empty($flagCountshipped)) {
$platfrom = omAccountModel::getPlatformSuffixById($obj_order_data['platformId']);
$extension = $platfrom['suffix'];
//获取后缀名称
BaseModel::begin();
//开始事务
$insertOrderDataRow = self::insertOrderRow($obj_order_data);
//插入到order表
if (empty($insertOrderDataRow)) {
BaseModel::rollback();
//throw new Exception('insert orderData error');
}
$orderExtenData['omOrderId'] = $insertOrderDataRow;
$orderUserInfoData['omOrderId'] = $insertOrderDataRow;
$resultExten = self::insertExtension($orderExtenData, $extension);
//插入到order_extend表
if (!$resultExten) {
BaseModel::rollback();
//throw new Exception('insert orderExtenData error');
}
$resultUserInfo = self::insertUserinfoRow($orderUserInfoData);
//插入到order_userInfo表
if (!$resultUserInfo) {
BaseModel::rollback();
//throw new Exception('insert orderUserInfoData error');
}
foreach ($orderDetailArr as $orderDetail) {
$orderDetailData = $orderDetail['orderDetailData'];
$orderDetailExtenData = $orderDetail['orderDetailExtenData'];
$orderDetailData['omOrderId'] = $insertOrderDataRow;
$orderDetailData['createdTime'] = time();
$insertOrderDatilRow = self::insertOrderdetail($orderDetailData);
//插入到detail表
if (empty($insertOrderDatilRow)) {
BaseModel::rollback();
//throw new Exception('insert orderDetailData error');
}
$orderDetailExtenData['omOrderdetailId'] = $insertOrderDatilRow;
if ($orderDetailExtenData) {
$resultOrderDetailExten = self::insertDetailExtension($orderDetailExtenData, $extension);
//插入到detailExtend
if (!$resultOrderDetailExten) {
BaseModel::rollback();
//throw new Exception('insert orderDetailExtenData error');
}
}
}
if ($obj_order_data['platformId'] == 1) {
$insertOrderidsDada = array('omOrderId' => $insertOrderDataRow, 'PayPalPaymentId' => $orderData['orderExtenData']['PayPalPaymentId'], 'orderid' => $orderData['orderExtenData']['orderId'], 'accountId' => $orderData['orderData']['accountId'], 'saletime' => time());
$insertOrderids = OrderidsModel::insertOrderidsList($insertOrderidsDada);
if (!$insertOrderids) {
BaseModel::rollback();
//throw new Exception('insert orderIds error');
}
}
if (isset($orderData['orderNote']) && !empty($orderData['orderNote'])) {
$orderNote = $orderData['orderNote'];
$insertOrderNoteDada = array('omOrderId' => $insertOrderDataRow, 'content' => $orderNote['content'], 'userId' => $orderNote['userId'], 'createdTime' => $orderNote['createdTime']);
$insertOrderNoteids = OrderAddModel::insertOrderNotesRow($insertOrderNoteDada);
if (!$insertOrderNoteids) {
BaseModel::rollback();
//throw new Exception('insert orderNote error');
}
}
$buyerInfo = $orderUserInfoData;
$buyerInfo['platformId'] = $obj_order_data['platformId'];
unset($buyerInfo['omOrderId']);
unset($buyerInfo['countrySn']);
unset($buyerInfo['currency']);
//.........这里部分代码省略.........
示例13: act_operateAbOrderAPI
public function act_operateAbOrderAPI()
{
if (!isset($_POST['omData'])) {
self::$errCode = 500;
self::$errMsg = '未成功接收数据!';
return false;
}
$ostatus = 770;
$otype = 0;
$storeId = 1;
$orderstr = $_POST['omData'];
$orderstr2 = $_POST['omData2'];
$orderids = array_unique(explode(',', $orderstr));
$invoiceids = array_unique(explode(',', $orderstr2));
if (!$orderids) {
self::$errCode = 400;
self::$errMsg = '未获取订单编号信息!';
return false;
}
//var_dump($orderids); exit;
$OrderindexAct = new OrderindexAct();
$WarehouseAPIAct = new WarehouseAPIAct();
foreach ($orderids as $k => $orderId) {
BaseModel::begin();
//开始事务
$insertOrderData = array();
$AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($invoiceids[$k]);
//var_dump($AbOrderInfo); echo "<br>";
//exit;
$where = ' WHERE id = ' . $orderId . ' and is_delete = 0 AND storeId = ' . $storeId . ' LIMIT 1';
$orderList = $OrderindexAct->act_showOrderList($ostatus, $otype, $where);
//var_dump($orderList);exit;
$order = $orderList[$orderId];
$orderData = $order['orderData'];
$insert_orderData = $orderData;
unset($insert_orderData['id']);
$insert_orderData['orderStatus'] = C('STATEOUTOFSTOCK');
$insert_orderData['orderType'] = C('STATEOUTOFSTOCK_ABNORMAL');
$orderExtenData = $order['orderExtenData'];
$insert_orderExtenData = $orderExtenData;
unset($insert_orderExtenData['omOrderId']);
$orderUserInfoData = $order['orderUserInfoData'];
$insert_orderUserInfoData = $orderUserInfoData;
unset($insert_orderUserInfoData['omOrderId']);
//$orderTracknumber = $order['orderTracknumber'];
//$orderAudit = $order['orderAudit'];
$orderDetail = $order['orderDetail'];
$insertOrderData['orderData'] = $insert_orderData;
$insertOrderData['orderExtenData'] = $insert_orderExtenData;
$insertOrderData['orderUserInfoData'] = $insert_orderUserInfoData;
$insert_orderDetail = array();
$need_delete_ids = array();
foreach ($orderDetail as $dkey => $detailValue) {
$orderDetailData = $detailValue['orderDetailData'];
$orderDetailExtenData = $detailValue['orderDetailExtenData'];
if (!isset($AbOrderInfo[$orderDetailData['sku']]) || $AbOrderInfo[$orderDetailData['sku']] == 0) {
$insert_orderDetailData = $orderDetailData;
unset($insert_orderDetailData['id']);
unset($insert_orderDetailData['omOrderId']);
$insert_orderDetailExtenData = $orderDetailExtenData;
unset($insert_orderDetailExtenData['omOrderdetailId']);
$insert_orderDetail[$dkey]['orderDetailData'] = $insert_orderDetailData;
$insert_orderDetail[$dkey]['orderDetailExtenData'] = $insert_orderDetailExtenData;
$need_delete_ids[] = $orderDetailData['id'];
}
}
$insertOrderData['orderDetail'] = $insert_orderDetail;
$count_insert_orderDetail = count($insert_orderDetail);
$count_orderDetail = count($orderDetail);
$tableName = "om_unshipped_order";
if ($count_insert_orderDetail > 0 && $count_insert_orderDetail < $count_orderDetail) {
$calcWeight = CommonModel::calcNowOrderWeight($orderId);
//重新计算原来订单的重量
if (!OrderindexModel::deleteOrderDetail(array('is_delete' => 1), ' where id in(' . join(',', $need_delete_ids) . ')')) {
BaseModel::rollback();
self::$errCode = '005';
self::$errMsg = "删除原订单明细失败!";
return false;
}
$insertOrderData['orderData']['isCopy'] = 2;
$insertOrderData['orderData']['actualTotal'] = 0.0;
//var_dump($orderData);exit;
$calcInfo = CommonModel::calcAddOrderWeight($insert_orderDetail);
//计算重量和包材
//var_dump($calcInfo); exit;
$insertOrderData['orderData']['calcWeight'] = $calcInfo[0];
$insertOrderData['orderData']['pmId'] = $calcInfo[1];
if (count($insertOrderData['orderDetail']) > 1) {
$insertOrderData['orderData']['orderAttribute'] = 3;
} else {
if (isset($insertOrderData['orderDetail'][0]['orderDetailData']['amount']) && $insertOrderData['orderDetail'][0]['orderDetailData']['amount'] > 1) {
$insertOrderData['orderData']['orderAttribute'] = 2;
}
}
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, 1);
//计算运费
$insertOrderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
$insertOrderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
//print_r($insertOrderData); exit;
if ($_spitId = OrderAddModel::insertAllOrderRowNoEvent($insertOrderData)) {
//.........这里部分代码省略.........
示例14: act_updateSkuConversion
function act_updateSkuConversion()
{
$id = $_GET['id'] ? post_check(trim($_GET['id'])) : 0;
$id = intval($id);
$new_sku = $_GET['new_sku'] ? post_check(trim($_GET['new_sku'])) : '';
//new_sku
$modifiedUserId = intval($_SESSION['userId']);
$modifiedTime = time();
if ($modifiedUserId <= 0) {
self::$errCode = '103';
self::$errMsg = "登陆超时,请重试";
return;
}
if ($id <= 0) {
self::$errCode = '100';
self::$errMsg = "异常";
return;
}
if (empty($new_sku)) {
self::$errCode = '101';
self::$errMsg = "新料号不能为空";
return;
}
if (!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*\$/", $new_sku)) {
self::$errCode = '100';
self::$errMsg = "新料号 {$new_sku} 格式不合法";
return;
}
if ($modifiedUserId <= 0) {
self::$errCode = '103';
self::$errMsg = "登陆超时,请重试";
return;
}
$tName = 'pc_sku_conversion';
$select = 'new_sku';
$where = "WHERE id={$id} and is_delete=0";
$skuConNewSkuList = OmAvailableModel::getTNameList($tName, $select, $where);
//在料号转换表中找到id所在记录的新料号new_sku
$skuConNewSku = $skuConNewSkuList[0]['new_sku'];
if (empty($skuConNewSku)) {
self::$errCode = '104';
self::$errMsg = "记录的新料号不存在";
return;
}
if ($skuConNewSku == $new_sku) {
self::$errCode = '111';
self::$errMsg = "修改前后料号相同,无修改";
return;
}
$tName = 'pc_goods';
$select = '*';
$where = "WHERE is_delete=0 AND sku='{$skuConNewSku}'";
$newSkuPcList = OmAvailableModel::getTNameList($tName, $select, $where);
//在产品表里找是否存在未修改前的料号
$newSkuPc = $newSkuPcList[0];
//未修改前的料号信息
if (empty($newSkuPc)) {
self::$errCode = '105';
self::$errMsg = "修改前的料号 {$skuConNewSku} 在产品列表中不存在";
return;
}
$newSkuPcSku = $newSkuPc['sku'];
//$newSkuPcArr = array_filter(explode('_',$newSkuPc));//修改前的sku按照_来截取
// $newSpuPc = $newSkuPcArr[0];//取得新料号的SPU
// $newSkuArr = array_filter(explode('_',$new_sku));//修改后的sku按照_来截取
// $newSpu = $newSkuArr[0];//取得新料号的SPU
// if($newSpuPc != $newSpu){
// self::$errCode = '107';
// self::$errMsg = "修改前后的SPU不符,请检查";
// return;
// }
try {
BaseModel::begin();
$tName = 'pc_sku_conversion';
$set = "SET new_sku='{$new_sku}',modifiedUserId='{$modifiedUserId}',modifiedTime='{$modifiedTime}'";
$where = "WHERE id={$id} and is_delete=0";
OmAvailableModel::updateTNameRow($tName, $set, $where);
//先将转换记录修改
$tName = 'pc_goods';
$set = "SET goodsStatus=101,is_delete=1";
//将未修改前的sku状态改为 料号转化,并delete
$where = "WHERE is_delete=0 and sku='{$newSkuPcSku}'";
OmAvailableModel::updateTNameRow($tName, $set, $where);
$where = "WHERE is_delete=0 and sku='{$new_sku}'";
$newSkuCount = OmAvailableModel::getTNameCount($tName, $where);
if ($newSkuCount) {
//如果新料号在产品中已经存在,则只添加转换记录
self::$errCode = '200';
self::$errMsg = "修改转换记录成功,新料号:{$new_sku} 已经存在记录";
} else {
//如果新料号在产品表中不存在,则自动添加旧料号的记录进去
unset($newSkuPc['id']);
//去掉旧记录的id
$newSkuPc['sku'] = $new_sku;
//将旧的sku换成新的sku
OmAvailableModel::addTNameRow2arr($tName, $newSkuPc);
self::$errCode = '200';
self::$errMsg = "修改转换记录成功,新料号:{$new_sku} 记录已插入成功";
}
//下面对关联单料号的组合料号进行修改
//.........这里部分代码省略.........
示例15: act_modifyOrder
public function act_modifyOrder()
{
if (isset($_POST) && !empty($_POST)) {
//$OrderModifyAct->act_modifyOrder();
$orderid = isset($_POST['orderid']) ? $_POST['orderid'] : '';
$ostatus = isset($_POST['edit_ostatus']) ? $_POST['edit_ostatus'] : $_POST['ostatus'];
$otype = isset($_POST['edit_otype']) ? $_POST['edit_otype'] : $_POST['otype'];
$update_order = array();
$update_userinfo = array();
$update_tracknumber = array();
//$orderid = $_POST['orderid'];
//var_dump($_POST); exit;
$updatestatus = false;
if (!empty($_POST['data'])) {
$data = $_POST['data'];
}
if (isset($data['username'])) {
$update_userinfo['username'] = $data['username'];
}
if (isset($data['orderStatus'])) {
$update_order['orderStatus'] = $data['orderStatus'];
}
if (isset($data['orderType'])) {
$update_order['orderType'] = $data['orderType'];
$updatestatus = true;
}
if (isset($data['street'])) {
$update_userinfo['street'] = $data['street'];
}
if (isset($data['platformUsername'])) {
$update_userinfo['platformUsername'] = $data['platformUsername'];
}
if (isset($data['address2'])) {
$update_userinfo['address2'] = $data['address2'];
}
if (isset($data['actualShipping'])) {
$update_order['actualShipping'] = $data['actualShipping'];
}
if (isset($data['city'])) {
$update_userinfo['city'] = $data['city'];
}
if (isset($data['state'])) {
$update_userinfo['state'] = $data['state'];
}
if (isset($data['countryName'])) {
$update_userinfo['countryName'] = $data['countryName'];
}
if (isset($data['zipCode'])) {
$update_userinfo['zipCode'] = $data['zipCode'];
}
if (isset($data['landline'])) {
$update_userinfo['landline'] = $data['landline'];
}
if (isset($data['phone'])) {
$update_userinfo['phone'] = $data['phone'];
}
if (isset($data['transportId'])) {
$update_order['transportId'] = $data['transportId'];
}
if (isset($data['update_notes'])) {
$update_note = $data['update_notes'];
}
if (isset($data['note_new'])) {
$add_note = $data['note_new'];
}
if ($data['edit_tracknumber']) {
$update_tracknumber['omOrderId'] = $orderid;
$update_tracknumber['tracknumber'] = $data['edit_tracknumber'];
$update_tracknumber['addUser'] = $_SESSION['sysUserId'];
$update_tracknumber['createdTime'] = time();
//var_dump($update_tracknumber); exit;
}
BaseModel::begin();
//开始事务
if ($update_order) {
//$sql = "UPDATE om_unshipped_order set ".array2sql($update_order)." WHERE id = ".$orderid;
//$msg = commonModel::orderLog($orderid,$update_order['orderStatus'],$update_order['orderType'],$sql);
if (OrderindexModel::updateOrder('om_unshipped_order', $update_order, ' WHERE id = ' . $orderid)) {
if ($updatestatus) {
$ProductStatus = new ProductStatus();
if (!$ProductStatus->updateSkuStatusByOrderStatus(array($orderid), $batch_ostatus_val, $batch_otype_val)) {
BaseModel::rollback();
}
}
$modify_showerrorinfo = "<font color='green'>更新成功</font>";
} else {
self::$errCode = "001";
self::$errMsg = "更新订单信息失败!";
BaseModel::rollback();
return false;
}
}
if ($update_userinfo) {
//var_dump($update_userinfo);
if (OrderindexModel::updateOrder('om_unshipped_order_userInfo', $update_userinfo, ' WHERE omOrderId = ' . $orderid)) {
$modify_showerrorinfo = "<font color='green'>更新成功</font>";
} else {
self::$errCode = "002";
self::$errMsg = "更新订单用户信息失败!";
BaseModel::rollback();
//.........这里部分代码省略.........