Beispiel #1
0
 function act_getProducts2pc($select, $where)
 {
     $listArr = UserCacheModel::getOpenSysApi('pc.getEbayProducts2PcProducts', array('all' => 'all'), 'gw88');
     if ($listArr) {
         foreach ($listArr as $value) {
             $tName = 'pc_products';
             $where = "WHERE is_delete=0 and productsStatus=1 and sku='{$value['sku']}'";
             $skuCount = OmAvailableModel::getTNameCount($tName, $where);
             if (!$skuCount) {
                 $pc_pro = array();
                 $pc_pro['id'] = $value['id'];
                 if (!empty($value['sku'])) {
                     $tmpArr = explode('_', $value['sku']);
                     $pc_pro['spu'] = $tmpArr[0];
                 }
                 $pc_pro['sku'] = $value['sku'];
                 $pc_pro['productsStatus'] = 1;
                 $pc_pro['productsComfirmerId'] = getPersonIdByName($value['comfirmuser']);
                 $pc_pro['productsComfirmTime'] = $value['comfirmtime'];
                 OmAvailableModel::addTNameRow2arr($tName, $pc_pro);
             }
         }
         self::$errCode = 200;
         self::$errMsg = 'success';
         return true;
     } else {
         self::$errCode = 404;
         self::$errMsg = 'error';
         return false;
     }
 }
Beispiel #2
0
 function act_getTNameCount($tName, $where)
 {
     $ret = OmAvailableModel::getTNameCount($tName, $where);
     if ($ret !== false) {
         return $ret;
     } else {
         self::$errCode = OmAvailableModel::$errCode;
         self::$errMsg = OmAvailableModel::$errMsg;
         return false;
     }
 }
 function act_getTNameCount()
 {
     $jsonArr = isset($_GET['jsonArr']) ? $_GET['jsonArr'] : '';
     //传过来的base64编码的json字符串
     if (empty($jsonArr)) {
         self::$errCode = 101;
         self::$errMsg = '参数数组为空';
         return false;
     }
     $jsonArr = json_decode(base64_decode($jsonArr), true);
     //对base64及json解码
     if (!is_array($jsonArr)) {
         self::$errCode = 103;
         self::$errMsg = '参数数组不是数组格式';
         return false;
     }
     $tName = $jsonArr['tName'];
     //表名
     $where = $jsonArr['where'];
     //where,要带上关键字WHERE
     if (empty($tName) || empty($where)) {
         self::$errCode = '300';
         self::$errMsg = '必要参数不完整';
         return false;
     }
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if ($count !== false) {
         self::$errCode = '200';
         self::$errMsg = '成功';
         return $count;
     } else {
         self::$errCode = '404';
         self::$errMsg = '数据库操作错误';
         return false;
     }
 }
Beispiel #4
0
 function push_ebay_orderid_queue($ebay_orderid, $ebay_account, $rabbit = "", $recordNumber = "")
 {
     global $dbConn, $rabbitMQClass, $FLIP_GLOBAL_EBAY_ACCOUNT;
     //var_dump($rabbitMQClass);
     if ($rabbit != "") {
         $rabbitMQClass = $rabbit;
     }
     $accountId = $FLIP_GLOBAL_EBAY_ACCOUNT[$ebay_account];
     /*
     //step 1 check ebay orderid statistic table
     $where = " where orderid='".$ebay_orderid."' and accountId='".$accountId."' ";
     if(OrderidsModel::judgeOrderidsList('orderid',$where) === true){
     	echo "ebay orderid[$ebay_orderid] already exists in ebay orderid statistic table\n";
     	return false;
     }else{
     	//新增
     }
     */
     $tName = 'om_unshipped_order_extension_ebay';
     $where = "WHERE orderId='{$ebay_orderid}'";
     $flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
     var_dump($flagCountUnshipped);
     $tName = 'om_shipped_order_extension_ebay';
     $flagCountshipped = OmAvailableModel::getTNameCount($tName, $where);
     if (!empty($flagCountUnshipped) || !empty($flagCountshipped)) {
         return false;
     }
     //判断队列中是否有相同的值不能发布
     //$table_name='ebay_order_id_queue_'.$ebay_account;
     $exchange = 'ebay_order_id_queue_' . $ebay_account;
     $rabbitMQClass->queue_publish($exchange, $ebay_orderid);
     return true;
     /*$check_sql='select * from '.$table_name.' where ebay_orderid="'.$ebay_orderid.'"';
     		$check=$dbConn->query($check_sql);
     		$check=$dbConn->fetch_array_all($check);
     		if(count($check)==0){
     			$sql='insert into '.$table_name.' (ebay_orderid) value("'.$ebay_orderid.'")';
     			
     			$try_insert_count=0;
     			while(1){
     				$try_insert_count++;
     				$res=$dbConn->query($sql);
     				if($res){
     					echo "Push ebay orderid[$ebay_orderid]  into queue table successfully!\n";
     					break;
     				}else{
     					if($try_insert_count==3){
     						$lost_orderid_path = EBAY_RAW_DATA_PATH.'lost_ebay_orderid/'.$ebay_account.'/lost_sql.txt';
     						write_lost_sql($lost_orderid_path, $sql."\n");
     						echo "oops...failed again,give this order[$ebay_orderid] up finally!\n";
     						break;
     					}
     					echo "fail to push  ebay orderid[$ebay_orderid]  into queue table !Sleep 10 sconds then try again\n";
     					sleep(10);
     				}
     			}
     		}else{
     			echo "ebay orderid[$ebay_orderid] already exists in queue\n";
     		}*/
 }
 echo "\n";
 $start = $per * $i;
 $tName = 'pc_goods_combine';
 $select = 'combineSpu,combineUserId,addTime';
 $where = "WHERE is_delete=0 limit {$start},{$per}";
 $combineSpuList = OmAvailableModel::getTNameList($tName, $select, $where);
 foreach ($combineSpuList as $value) {
     $combineSpu = $value['combineSpu'];
     $combineUserId = $value['combineUserId'];
     $addTime = $value['addTime'];
     if (empty($combineSpu)) {
         continue;
     }
     $tName = 'pc_auto_create_spu';
     $where = "WHERE spu='{$combineSpu}'";
     $count1 = OmAvailableModel::getTNameCount($tName, $where);
     if (!$count1) {
         $dataAuto = array();
         $dataAuto['spu'] = $combineSpu;
         $dataAuto['purchaseId'] = $combineUserId;
         $dataAuto['createdTime'] = $addTime;
         $dataAuto['status'] = 2;
         $dataAuto['isSingSpu'] = 2;
         if (strpos($combineSpu, 'CB') === 0) {
             $dataAuto['prefix'] = 'CB';
         }
         OmAvailableModel::addTNameRow2arr($tName, $dataAuto);
         echo "{$combineSpu} insert autoCreateSpu success\n";
     } else {
         echo "{$combineSpu} has exist autoCreateSpu\n";
     }
Beispiel #6
0
 public function view_addOrUpdateSpeicailSpuOn()
 {
     $useId = $_SESSION['userId'];
     $personName = getPersonNameById($useId);
     if (empty($personName)) {
         $status = "<font color=red>系统找不到登录人信息!</font><br/>";
         echo $status;
         exit;
     }
     if (isset($_POST['submit']) && $_POST['submit'] != '') {
         $uploadfile = 'addOrUpdateSpeicailSpuExcelImport_' . date("Y") . date("m") . date("d") . date("H") . date('i') . date('s') . '_' . $personName . ".xls";
         if (move_uploaded_file($_FILES['upfile']['tmp_name'], 'upload/' . $uploadfile)) {
             echo "<font color=BLUE>文件上传成功!</font><br>";
         } else {
             echo "<font color=red> 文件上传失败!</font>";
             exit;
         }
         $fileName = 'upload/' . $uploadfile;
         $filePath = $fileName;
         $PHPExcel = new PHPExcel();
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($filePath)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($filePath)) {
                 echo 'no Excel';
                 return;
             }
         }
         $PHPExcel = $PHPReader->load($filePath);
         $currentSheet = $PHPExcel->getSheet(0);
         $highestRow = $currentSheet->getHighestRow();
         //表格中的最大行数
         echo "表格总行数为 {$highestRow} <br />";
         if ($highestRow > 30000) {
             echo "表格不能超过30000行,请重新整理表格导入,谢谢!";
             exit;
         }
         $status = '';
         $flag = true;
         //标识检测结果
         $tName = 'pc_special_property';
         $select = 'id,propertyName';
         $where = "WHERE isOn=1";
         $pspList = OmAvailableModel::getTNameList($tName, $select, $where);
         $IPArr = array();
         foreach ($pspList as $value) {
             $IPArr[$value['id']] = $value['propertyName'];
         }
         if (empty($IPArr)) {
             echo "启用的特殊属性记录为空,退出";
             exit;
         }
         for ($i = 2; $i <= $highestRow; $i++) {
             //先检查导入表格的正确性
             $spu = trim($currentSheet->getCell('A' . $i)->getValue());
             //spu
             $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
             $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
             $specailPropertyName = trim($currentSheet->getCell('B' . $i)->getValue());
             //$specailPropertyName = preg_replace("/(\s|\&nbsp\;| |\xc2\xa0)/","",$specailPropertyName);
             if (empty($spu)) {
                 $status .= "第 {$i} 行,SPU为空 <br/>";
                 $flag = false;
                 continue;
             }
             $tName = 'pc_auto_create_spu';
             $where = "WHERE is_delete=0 AND isSingSpu=1 AND spu='{$spu}'";
             if (!OmAvailableModel::getTNameCount($tName, $where)) {
                 $status .= "第 {$i} 行,SPU不存在 <br/>";
                 $flag = false;
                 continue;
             }
             $propertyId = intval(array_search($specailPropertyName, $IPArr));
             if ($propertyId <= 0) {
                 $status .= "第 {$i} 行,找不到 {$specailPropertyName} 这个特殊属性记录 <br/>";
                 $flag = false;
                 continue;
             }
         }
         if (!$flag) {
             //验证不通过
             echo "<font color=red>{$status}</font>";
             exit;
         } else {
             $status = '';
             for ($i = 2; $i <= $highestRow; $i++) {
                 //先检查导入表格的正确性
                 $spu = trim($currentSheet->getCell('A' . $i)->getValue());
                 //spu
                 $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
                 $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
                 $specailPropertyName = trim($currentSheet->getCell('B' . $i)->getValue());
                 //spu
                 $propertyId = intval(array_search($specailPropertyName, $IPArr));
                 $tName = 'pc_special_property_spu';
                 $where = "WHERE spu='{$spu}' AND propertyId={$propertyId}";
                 if (OmAvailableModel::getTNameCount($tName, $where)) {
                     $status .= "第 {$i} 行,{$spu} 已经存在 {$specailPropertyName} 这个特殊属性<br/>";
                 } else {
                     $dataArr = array();
                     $dataArr['spu'] = $spu;
                     $dataArr['propertyId'] = $propertyId;
                     OmAvailableModel::addTNameRow2arr($tName, $dataArr);
                     $status .= "第 {$i} 行,{$spu} 添加至 {$specailPropertyName} 成功 <br/>";
                 }
             }
             echo "<font color=green>{$status}</font>";
             exit;
         }
     }
 }
Beispiel #7
0
 public function view_getProductsCombineSpuCompleteList()
 {
     $combineSpu = $_GET['combineSpu'] ? post_check(trim($_GET['combineSpu'])) : '';
     $userId = $_SESSION['userId'];
     $tName = 'pc_spu_web_maker a,(select spu,max(id) as id from pc_spu_web_maker group by spu) b';
     $select = 'a.*';
     $where = 'where a.is_delete=0 AND a.isSingSpu=2 AND a.isTake=1 AND a.isComplete=1 AND a.spu=b.spu and a.id=b.id ';
     if (!isAccessAll('products', 'getAllCombineSpuListPermission')) {
         $where .= "AND a.webMakerId='{$userId}' ";
     }
     if (!empty($combineSpu)) {
         $skuArr = array_filter(explode(',', $combineSpu));
         $countSkuArr = count($skuArr);
         for ($i = 0; $i < $countSkuArr; $i++) {
             if (preg_match("/^[A-Z0-9]+\$/", $skuArr[$i])) {
                 if ($i == 0) {
                     $where .= " AND (a.spu like'{$skuArr[$i]}%' ";
                 } else {
                     $where .= " OR a.spu like'{$skuArr[$i]}%'";
                 }
                 if ($i == $countSkuArr - 1) {
                     $where .= ") ";
                 }
             }
         }
     }
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 50;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by a.completeTime desc " . $page->limit;
     $productsComfirmList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (!empty($productsComfirmList)) {
         $countProComList = count($productsComfirmList);
         for ($i = 0; $i < $countProComList; $i++) {
             $tName = 'pc_auto_create_spu';
             $select = 'purchaseId';
             $where = "WHERE is_delete=0 AND spu='{$productsComfirmList[$i]['spu']}'";
             $autoSpuList = OmAvailableModel::getTNameList($tName, $select, $where);
             if (!empty($autoSpuList)) {
                 $productsComfirmList[$i]['purchaseId'] = $autoSpuList[0]['purchaseId'];
             }
         }
     }
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $navlist = array(array('url' => 'index.php?mod=products&act=getProductsComfirmList', 'title' => '产品制作'), array('url' => 'index.php?mod=products&act=getProductsCombineSpuCompleteList', 'title' => '3.虚拟SPU完成'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 5);
     $this->smarty->assign('twovar', 515);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', '3.虚拟SPU完成');
     $this->smarty->assign('productsCombineSpuList', empty($productsComfirmList) ? array() : $productsComfirmList);
     $this->smarty->display("productsCombineSpuCompleteList.htm");
 }
     //continue;
 }
 if (preg_match("/^[A-Z]{2}[0-9]{6}\$/", $spu)) {
     $sort = intval(substr($spu, 2));
 } else {
     $sort = 0;
 }
 $set = "SET spu='{$spu}',purchaseId='{$purchaseId}',createdTime='{$now}',sort='{$sort}',status=2";
 if (!$countAutoCreSpu) {
     OmAvailableModel::addTNameRow($tName, $set);
     echo "{$spu} autoCreateSpu insert success\n";
 }
 //添加SPU档案
 $tName = 'pc_spu_archive';
 $where = "WHERE spu='{$spu}'";
 $countSpuArchive = OmAvailableModel::getTNameCount($tName, $where);
 if ($countSpuArchive) {
     echo "{$spu} spuArchive has exist!\n";
     $set = "SET categoryPath='{$value['goods_category']}',purchaseId='{$pcGoodsArr['purchaseId']}'";
     OmAvailableModel::updateTNameRow($tName, $set, $where);
     echo "{$spu} spuArchive update category and purchaseId success! {$value['goods_category']}  {$pcGoodsArr['purchaseId']} \n";
     //continue;
 }
 $dataSpuArchive = array();
 $dataSpuArchive['spu'] = $spu;
 $dataSpuArchive['categoryPath'] = $value['goods_category'];
 $dataSpuArchive['spuName'] = $value['goods_name'];
 $dataSpuArchive['spuPurchasePrice'] = $value['goods_cost'];
 $dataSpuArchive['spuLowestPrice'] = $value['goods_cost'];
 $dataSpuArchive['spuCalWeight'] = $value['goods_weight'];
 $dataSpuArchive['isPacking'] = $value['ispacking'] == 0 ? 1 : 2;
 public function view_getSpuSpecialTMList()
 {
     $spu = $_GET['spu'] ? post_check(trim($_GET['spu'])) : '';
     $tName = 'pc_special_transport_manager';
     $select = '*';
     $where = 'WHERE 1=1 ';
     $tmpTMIdStr = '';
     if (!empty($spu)) {
         $tNameSpu = 'pc_special_transport_manager_spu';
         $selectSpu = 'stmnId';
         $whereSpu = "WHERE spu='{$spu}' group by stmnId";
         $propertyIdList = OmAvailableModel::getTNameList($tNameSpu, $selectSpu, $whereSpu);
         $tmpArr = array();
         foreach ($propertyIdList as $value) {
             $tmpArr[] = $value['stmnId'];
         }
         if (!empty($tmpArr)) {
             $tmpTMIdStr = implode(',', $tmpArr);
         } else {
             $tmpTMIdStr = '0';
         }
     }
     if ($tmpTMIdStr != '') {
         $where .= "AND id in({$tmpTMIdStr})";
     }
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 100;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by id desc " . $page->limit;
     $spuSpecialTMList = OmAvailableModel::getTNameList($tName, $select, $where);
     foreach ($spuSpecialTMList as $key => $value) {
         $tName = 'pc_special_stmnid_transportid';
         $select = '*';
         $where = "WHERE stmnId='{$value['id']}' limit 1";
         $psstList = OmAvailableModel::getTNameList($tName, $select, $where);
         //$spuSpecialTMList[$key]['canOrNot'] = $psstList[0]['canOrNot'];
     }
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $navlist = array(array('url' => 'index.php?mod=category&act=getCategoryList', 'title' => '类别管理'), array('url' => '#', 'title' => '特殊料号-运输方式管理列表'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 4);
     $this->smarty->assign('twovar', 45);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', '特殊料号-运输方式管理列表');
     $this->smarty->assign('spuSpecialTMList', empty($spuSpecialTMList) ? null : $spuSpecialTMList);
     $this->smarty->display("spuSpecialTransportList.htm");
 }
Beispiel #10
0
 function act_addProductsCategoryAppoint()
 {
     $largeCategoryId = intval($_POST['largeCategoryId']);
     $appointPEId = intval($_POST['appointPEId']);
     $addUserId = $_SESSION['userId'];
     if ($largeCategoryId <= 0 || $appointPEId <= 0 || $addUserId <= 0) {
         self::$errCode = '101';
         self::$errMsg = '必填项为空或登录超时,请检查';
         return false;
     }
     $tName = 'pc_products_large_category_appoint';
     $where = "WHERE is_delete=0 AND appointPEId={$appointPEId} AND largeCategoryId={$largeCategoryId}";
     if (OmAvailableModel::getTNameCount($tName, $where)) {
         self::$errCode = '102';
         self::$errMsg = '已经存在该记录';
         return false;
     }
     $dataArr = array();
     $dataArr['largeCategoryId'] = $largeCategoryId;
     $dataArr['appointPEId'] = $appointPEId;
     $dataArr['addUserId'] = $addUserId;
     $dataArr['addTime'] = time();
     OmAvailableModel::addTNameRow2arr($tName, $dataArr);
     self::$errCode = '200';
     self::$errMsg = '添加成功';
     return true;
 }
Beispiel #11
0
 public function view_getSpuModityRecordList()
 {
     $spu = isset($_GET['spu']) ? post_check($_GET['spu']) : '';
     $recordType = isset($_GET['recordType']) ? post_check($_GET['recordType']) : '';
     $PEId = isset($_GET['PEId']) ? post_check($_GET['PEId']) : '';
     $status = isset($_GET['status']) ? post_check($_GET['status']) : '';
     $addUserId = isset($_GET['addUserId']) ? post_check($_GET['addUserId']) : '';
     $timeSearchType = isset($_GET['timeSearchType']) ? post_check($_GET['timeSearchType']) : '';
     $startdate = isset($_GET['startdate']) ? post_check($_GET['startdate']) : '';
     $enddate = isset($_GET['enddate']) ? post_check($_GET['enddate']) : '';
     $tName = 'pc_spu_modify_record';
     $select = '*';
     $where = 'WHERE is_delete=0 ';
     if (!empty($spu)) {
         $where .= "AND spu='{$spu}' ";
     }
     if (intval($recordType) > 0) {
         $where .= "AND recordType='{$recordType}' ";
     }
     if (intval($PEId) > 0) {
         $where .= "AND PEId='{$PEId}' ";
     }
     if (intval($status) > 0) {
         $where .= "AND status='{$status}' ";
     }
     if (intval($addUserId) > 0) {
         if (intval($addUserId) == 9999) {
             $where .= "AND addUserId='0' ";
         } else {
             $where .= "AND addUserId='{$addUserId}' ";
         }
     }
     if (intval($timeSearchType) > 0) {
         if ($startdate != '') {
             $start = strtotime($startdate . ' 00:00:00');
             if ($timeSearchType == 1) {
                 $where .= "AND addTime>='{$start}' ";
             } elseif ($timeSearchType == 2) {
                 $where .= "AND handleTime>='{$start}' ";
             } elseif ($timeSearchType == 3) {
                 $where .= "AND completeTime>='{$start}' ";
             }
         }
         if ($enddate != '') {
             $end = strtotime($enddate . ' 23:59:59');
             if ($timeSearchType == 1) {
                 $where .= "AND addTime<='{$end}' ";
             } elseif ($timeSearchType == 2) {
                 $where .= "AND handleTime<='{$end}' ";
             } elseif ($timeSearchType == 3) {
                 $where .= "AND completeTime<='{$end}' ";
             }
         }
     }
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 100;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= 'order by id desc ';
     $where .= $page->limit;
     $spuModityRecordList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $navlist = array(array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreatePrefixList', 'title' => 'SPU管理'), array('url' => 'index.php?mod=autoCreateSpu&act=getSpuModityRecordList', 'title' => 'SPU产品修改/优化管理'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 2);
     $this->smarty->assign('twovar', 26);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', 'SPU产品修改/优化管理');
     $this->smarty->assign('spuModityRecordList', empty($spuModityRecordList) ? array() : $spuModityRecordList);
     $this->smarty->display("spuModifyRecordList.htm");
 }
Beispiel #12
0
function isExistAppointByPEId2($PEId)
{
    $tName = 'pc_products_large_category_appoint';
    $where = "WHERE is_delete=0 and appointPEId='{$PEId}'";
    $PECount = OmAvailableModel::getTNameCount($tName, $where);
    return $PECount;
}
Beispiel #13
0
 /**
  * 转移订单对应下的总表信息,没有批量处理事件
  * @para $data as array
  * @add by Herman.Xi
  * @last modified 20131022
  * $in 默认为进入订单模式
  */
 public static function shiftAllOrderRowNoEvent($orderData, $tName = 'om_shipped_order')
 {
     self::initDB();
     //var_dump($orderData); exit;
     $obj_order_data = $orderData['orderData'];
     $orderExtenData = $orderData['orderExtenData'];
     $orderUserInfoData = $orderData['orderUserInfoData'];
     $orderDetailArr = $orderData['orderDetail'];
     $orderWhInfoData = $orderData['orderWhInfoData'];
     //var_dump($obj_order_data); exit;
     //$tName = 'om_unshipped_order';
     $where = "WHERE recordNumber='{$obj_order_data['recordNumber']}' AND platformId={$obj_order_data['platformId']}";
     $flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
     //var_dump($flagCountUnshipped); exit;
     /*$tName = 'om_shipped_order';
     		$flagCountshipped = OmAvailableModel :: getTNameCount($tName, $where);*/
     if ($obj_order_data) {
         //判断订单是否已经在系统2个订单表(未发货和已发货)中存在
         $platfrom = omAccountModel::getPlatformSuffixById($obj_order_data['platformId']);
         $extension = $platfrom['suffix'];
         //获取后缀名称
         //echo $extension; echo "<br>"; exit;
         $insertOrderDataRow = self::insertOrderRow($obj_order_data, $tName);
         //插入到order表
         if (empty($insertOrderDataRow)) {
             self::$errCode = "020";
             self::$errMsg = "插入订单失败!";
             return false;
         }
         //$orderExtenData['omOrderId'] = $obj_order_data['id'];
         //$orderExtenData['omOrderId'] = $insertOrderDataRow;
         //$orderUserInfoData['omOrderId'] = $insertOrderDataRow;
         //$orderUserInfoData['omOrderId'] = $obj_order_data['id'];
         if ($orderExtenData) {
             $resultExten = self::insertExtension($orderExtenData, $extension, $tName);
             //插入到order_extend表
             if (!$resultExten) {
                 self::$errCode = "021";
                 self::$errMsg = "插入订单附加表失败!";
                 return false;
             }
         }
         if ($orderUserInfoData) {
             $resultUserInfo = self::insertUserinfoRow($orderUserInfoData, $tName);
             //插入到order_userInfo表
             if (!$resultUserInfo) {
                 self::$errCode = "022";
                 self::$errMsg = "插入用户信息表失败!";
                 return false;
             }
         }
         if ($orderWhInfoData) {
             $resultWhInfo = self::insertWhInfoRow($orderWhInfoData, $tName);
             //插入到order_userInfo表
             if (!$resultWhInfo) {
                 self::$errCode = "022";
                 self::$errMsg = "插入仓库信息表失败!";
                 return false;
             }
         }
         foreach ($orderDetailArr as $orderDetail) {
             $orderDetailData = $orderDetail['orderDetailData'];
             $orderDetailExtenData = $orderDetail['orderDetailExtenData'];
             //$orderDetailData['omOrderId'] = $insertOrderDataRow;
             //$orderDetailData['omOrderId'] = $obj_order_data['id'];
             $orderDetailData['createdTime'] = time();
             $insertOrderDatilRow = self::insertOrderdetail($orderDetailData, $tName);
             //插入到detail表
             if (empty($insertOrderDatilRow)) {
                 self::$errCode = "023";
                 self::$errMsg = "插入订明细单失败!";
                 return false;
             }
             //$orderDetailExtenData['omOrderdetailId'] = $insertOrderDatilRow;
             //$orderDetailExtenData['omOrderdetailId'] = $orderDetailData['id'];
             if ($orderDetailExtenData) {
                 $resultOrderDetailExten = self::insertDetailExtension($orderDetailExtenData, $extension, $tName);
                 //插入到detailExtend
                 if (!$resultOrderDetailExten) {
                     self::$errCode = "024";
                     self::$errMsg = "插入订单明细附带表失败!";
                     return false;
                 }
             }
         }
         /*if($obj_order_data['platformId'] == 1 && $in){
         			$insertOrderidsDada = array('omOrderId'=>$insertOrderDataRow,'PayPalPaymentId'=>$orderData['orderExtenData']['PayPalPaymentId'],'orderid'=>$orderData['orderExtenData']['orderId'],'accountId'=>$orderData['orderData']['accountId'],'saletime'=>time());
         			$insertOrderids = OrderidsModel::insertOrderidsList($insertOrderidsDada);
         			if (!$insertOrderids) {
         				self::$errCode	=	"025";
         				self::$errMsg	=	"插入ebay订单IDS失败!";
         				return false;
         			}
         		}
         		if(isset($orderData['orderNote']) && !empty($orderData['orderNote'])){
         			$orderNote = $orderData['orderNote'];
         			$insertOrderNoteDada = array('omOrderId'=>$insertOrderDataRow,'content'=>$orderNote['content'],'userId'=>$orderNote['userId'],'createdTime'=>$orderNote['createdTime']);
         			$insertOrderNoteids = self::insertOrderNotesRow($insertOrderNoteDada);
         			if (!$insertOrderNoteids) {
         				self::$errCode	=	"026";
         				self::$errMsg	=	"插入订单Note失败!";
         				return false;
         			}
         		}*/
         /*$buyerInfo = $orderUserInfoData;
         		$buyerInfo['platformId'] = $obj_order_data['platformId'];
         		unset($buyerInfo['omOrderId']);
         		unset($buyerInfo['countrySn']);
         		unset($buyerInfo['currency']);
         		unset($buyerInfo['currency']);
         		//var_dump($buyerInfo);
         		$insertBuyerInfo = self::insertBuyerInfoRow($buyerInfo);
         		//var_dump($insertBuyerInfo);
         		if (!$insertBuyerInfo) {
         			return false;
         		}
         		$ProductStatus = new ProductStatus();			
         		if(!$ProductStatus->updateSkuStatusByOrderStatus(array($insertOrderDataRow))){
         			self::$errCode	=	"400";
         			self::$errMsg	=	"已经包含订单信息,不能重复插入!";
         			return false;
         		}*/
         //var_dump($insertOrderDataRow); exit;
         //return $insertOrderDataRow;
         self::$errCode = "200";
         self::$errMsg = "转移成功!";
         return true;
     } else {
         self::$errCode = "400";
         self::$errMsg = "已经包含订单信息,不能重复插入!";
         return false;
     }
 }
Beispiel #14
0
 public function view_3WithoutGoodsInfoExcelOutPutOn()
 {
     $fileName = "3WithoutGoodsInfoExcelOutPut.xls";
     $excel = new ExportDataExcel('browser', $fileName);
     $excel->initialize();
     $tableHeader = array('SPU', 'SKU', '仓位', '重量', '包材', '英文品名', '海关编码', '状态');
     $excel->addRow($tableHeader);
     $visbleSpu = '';
     $tName = 'pc_goods';
     $select = 'spu';
     $where = "WHERE is_delete=0 group by spu ";
     $spuList = OmAvailableModel::getTNameList($tName, $select, $where);
     foreach ($spuList as $value) {
         $spu = $value['spu'];
         $tName = 'pc_spu_tax_hscode';
         $select = 'customsNameEN,hsCode';
         $where = "WHERE spu='{$spu}'";
         $spuHscodeList = OmAvailableModel::getTNameList($tName, $select, $where);
         $customsNameEN = $spuHscodeList[0]['customsNameEN'];
         //英文品名
         $hsCode = $spuHscodeList[0]['hsCode'];
         //海关编码
         $tName = 'pc_goods';
         $select = 'sku,goodsWeight,goodsStatus,pmId';
         $where = "WHERE is_delete=0 AND spu='{$spu}'";
         $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
         foreach ($skuList as $v) {
             $flag = 0;
             //标识是否属于三无产品
             $sku = $v['sku'];
             $goodsWeight = $v['goodsWeight'];
             $pmId = $v['pmId'];
             $goodsStatus = $v['goodsStatus'];
             $tName = 'pc_goods_whId_location_raletion';
             $where = "WHERE sku='{$sku}' AND isHasLocation=1";
             $skuWlListCount = OmAvailableModel::getTNameCount($tName, $where);
             $isHasLocation = $skuWlListCount ? 1 : 2;
             //如果无内容则默认为无仓位
             if (empty($customsNameEN)) {
                 $flag = 1;
             }
             if (empty($hsCode)) {
                 $flag = 1;
             }
             if ($goodsWeight == 0) {
                 $flag = 1;
             }
             if (intval($pmId) <= 0) {
                 $flag = 1;
             }
             if ($isHasLocation != 1) {
                 $flag = 1;
             }
             if ($flag == 0) {
                 continue;
             }
             $tableBody = array();
             if ($visbleSpu == $spu) {
                 $tableBody[] = '';
             } else {
                 $tableBody[] = $spu;
             }
             $tableBody[] = $sku;
             $tableBody[] = $isHasLocation == 1 ? '有' : '无';
             $tableBody[] = $goodsWeight != 0 ? '有' : '无';
             $tableBody[] = intval($pmId) > 0 ? '有' : '无';
             $tableBody[] = !empty($customsNameEN) ? '有' : '无';
             $tableBody[] = !empty($hsCode) ? '有' : '无';
             $tableBody[] = $goodsStatus == 1 || $goodsStatus == 51 ? '在线' : '停售';
             $visbleSpu = $spu;
             $excel->addRow($tableBody);
         }
     }
     $excel->finalize();
     exit;
 }
Beispiel #15
0
 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} 记录已插入成功";
         }
         //下面对关联单料号的组合料号进行修改
         $tName = 'pc_sku_combine_relation';
         $select = '*';
         $where = "WHERE sku='{$newSkuPcSku}' group by combineSku";
         $skuRelationList = OmAvailableModel::getTNameList($tName, $select, $where);
         if (empty($skuRelationList)) {
             self::$errMsg .= "<br/>其中,无关联组合料号被更新";
         } else {
             $combineSkuArr = array();
             foreach ($skuRelationList as $value) {
                 $combineSkuArr[] = $value['combineSku'];
             }
             $combineSkuStr = implode(',', $combineSkuArr);
             $set = "SET sku='{$new_sku}'";
             $where = "WHERE sku='{$newSkuPcSku}'";
             $affectRows = OmAvailableModel::updateTNameRow($tName, $set, $where);
             self::$errMsg .= "<br/>";
             self::$errMsg .= "其中,组合料号 {$combineSkuStr} 中共有 {$affectRows} 条单料号数据已更新";
         }
         //////
         BaseModel::commit();
         BaseModel::autoCommit();
         return;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = '404';
         self::$errMsg = $e->getMessage();
         return;
     }
 }
/*include_once "/data/scripts/ebay_order_cron_job/ebay_order_cron_config.php";
include_once "/data/scripts/ebay_order_cron_job/function_purchase.php";*/
$tNameUnShipped = 'om_unshipped_order';
/*$tNameOrderIdList = OrderInfoModel :: getTNameOrderIdByTSA($tNameUnShipped, $start, $end,' 1=1',900);

$orderIdArr = array ();
foreach ($tNameOrderIdList as $value) {
	$orderIdArr[] = $value['id'];
}
$orderIdStr = implode(',', $orderIdArr);
if (empty ($orderIdStr)) {
	$orderIdStr = 0;
}*/
//$where = "WHERE id in($orderIdStr) AND channelId = '0' ";
$where = "WHERE channelId=0 ";
$count = OmAvailableModel::getTNameCount($tNameUnShipped, $where);
$start = 0;
$per = 5000;
$page = ceil($count / $per);
echo "totalcount = {$count}";
echo "\n";
echo "totalpage = {$page}";
echo "\n";
for ($i = 0; $i < $page; $i++) {
    echo "currentPage = {$i}";
    echo "\n";
    $start = $start * $i;
    $where = "WHERE channelId=0 ";
    $where .= " limit {$start},{$per}";
    $shipOrderList = OrderindexModel::showOrderList($tNameUnShipped, $where);
    foreach ($shipOrderList as $key => $value) {
Beispiel #17
0
 function act_getInStoreDetailList()
 {
     $iostoreId = $_GET['iostoreId'] ? post_check(trim($_GET['iostoreId'])) : 0;
     //退料单状态,草稿或者已经发送至仓库
     $iostoreId = intval($iostoreId);
     if ($iostoreId <= 0) {
         $status = '退料单非法';
         header("Location:index.php?mod=products&act=getInStoreList&status={$status}");
         exit;
     }
     $tName = 'pc_products_iostore';
     $select = '*';
     $where = "WHERE iostoreTypeId=2 AND is_delete=0 AND id={$iostoreId} ";
     $inStoreList = OmAvailableModel::getTNameList($tName, $select, $where);
     $inStore = $inStoreList[0];
     if (empty($inStore)) {
         $status = '系统不存在该退料单';
         header("Location:index.php?mod=products&act=getInStoreList&status={$status}");
         exit;
     }
     $tName = 'pc_products_iostore_detail';
     $select = '*';
     $where = "WHERE is_delete=0 AND iostoreId={$iostoreId} ";
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 1000;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by id desc " . $page->limit;
     $inStoreDetailList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (!empty($inStoreDetailList)) {
         $whInfoList = getWhInfo();
         //根据接口取得对应仓库信息
         $whArr = array();
         foreach ($whInfoList as $value) {
             if (intval($value['id']) > 0) {
                 $whArr[$value['id']] = $value['whName'];
             }
         }
         $countStoreDetailList = count($inStoreDetailList);
         for ($i = 0; $i < $countStoreDetailList; $i++) {
             $sku = $inStoreDetailList[$i]['sku'];
             $tName = 'pc_goods';
             $select = 'goodsName';
             $where = "WHERE sku='{$sku}'";
             $skuInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
             $inStoreDetailList[$i]['goodsName'] = $skuInfoList[0]['goodsName'];
             $tName = 'pc_goods_whId_location_raletion';
             $select = 'location,whId';
             $where = "WHERE sku='{$sku}'";
             $skuLocWhInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
             $inStoreDetailList[$i]['location'] = $skuLocWhInfoList[0]['location'];
             $inStoreDetailList[$i]['whName'] = $whArr[$skuLocWhInfoList[0]['whId']];
         }
     }
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     return array('inStore' => $inStore, 'inStoreDetailList' => $inStoreDetailList, 'show_page' => $show_page);
 }
Beispiel #18
0
 function act_isSpuExist()
 {
     $spu = $_POST['spu'] ? trim(post_check($_POST['spu'])) : '';
     $count = OmAvailableModel::getTNameCount('pc_auto_create_spu', "WHERE spu='{$spu}'");
     if ($count) {
         return true;
     } else {
         self::$errCode = 1;
         self::$errMsg = '不存在此SPU';
         return false;
     }
 }
Beispiel #19
0
 function act_addInput()
 {
     //$pidNew = $_POST['pidNew']?post_check($_POST['pidNew']):'';//类别
     $finalIdArr = $_POST['finalIdStr'];
     //新建属性-类别4
     $inputName = $_POST['inputName'] ? post_check($_POST['inputName']) : '';
     //类别
     $textStatus = $_POST['textStatus'] ? post_check($_POST['textStatus']) : '';
     //文本方式
     if (empty($finalIdArr) || empty($inputName)) {
         self::$errCode = 101;
         self::$errMsg = '类别或属性名不能为空';
         return false;
     }
     if (intval($textStatus) <= 0) {
         self::$errCode = 102;
         self::$errMsg = '文本方式有误';
         return false;
     }
     $tmpArr = array();
     if (!is_array($finalIdArr)) {
         $tmpArr[] = $finalIdArr;
         $finalIdArr = $tmpArr;
     }
     $finalPathArr = array();
     foreach ($finalIdArr as $cid) {
         $catePath = CategoryModel::getCategoryPathById($cid);
         if (empty($catePath)) {
             self::$errCode = 109;
             self::$errMsg = '类别有误';
             return false;
         }
         $finalPathArr[] = $catePath;
     }
     $tName = 'pc_goods_category';
     foreach ($finalPathArr as $value) {
         $where = "WHERE path like'%{$value}-%' and is_delete=0";
         $count = OmAvailableModel::getTNameCount($tName, $where);
         if ($count) {
             self::$errCode = 105;
             self::$errMsg = '只能在最小分类进行复制';
             return false;
         }
     }
     try {
         $pidNewStr = '';
         BaseModel::begin();
         $tName = 'pc_archive_input';
         foreach ($finalPathArr as $value) {
             $where = "WHERE inputName='{$inputName}' AND categoryPath='{$value}'";
             $countIN = OmAvailableModel::getTNameCount($tName, $where);
             if (!$countIN) {
                 $pidNewStr .= CategoryModel::getCategoryNameByPath($value) . ' ';
                 $set = "SET inputName='{$inputName}',categoryPath='{$value}',textStatus='{$textStatus}'";
                 OmAvailableModel::addTNameRow($tName, $set);
             }
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         self::$errCode = 200;
         self::$errMsg = "{$inputName} 添加到 {$pidNewStr} 成功";
         return true;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = 201;
         self::$errMsg = $e->getMessage();
         return false;
     }
 }
 public function act_batchAddSpecialTMSpuOn()
 {
     $stmnId = $_POST['stmnId'];
     $spuArr = $_POST['spuArr'];
     if (intval($stmnId) <= 0) {
         self::$errCode = '101';
         self::$errMsg = "异常,错误";
         return false;
     }
     if (!is_array($spuArr) || empty($spuArr)) {
         self::$errCode = '102';
         self::$errMsg = "SPU信息为空";
         return false;
     }
     $spuArr = array_filter($spuArr);
     //print_r($spuArr);exit;
     $returnArr = array();
     $spanStatus = '';
     $insertSpuArr = array();
     foreach ($spuArr as $spu) {
         if (preg_match("/^[A-Z0-9]+\$/", $spu)) {
             $tName = 'pc_special_transport_manager_spu';
             $where = "WHERE spu='{$spu}'";
             $pstmnSpuIsExist = OmAvailableModel::getTNameCount($tName, $where);
             if (!$pstmnSpuIsExist) {
                 $tName = 'pc_goods';
                 $where = "WHERE is_delete=0 AND spu='{$spu}'";
                 $spuIsExist = OmAvailableModel::getTNameCount($tName, $where);
                 if ($spuIsExist) {
                     $tName = 'pc_special_transport_manager_spu';
                     $dataTmpArr = array();
                     $dataTmpArr['stmnId'] = $stmnId;
                     $dataTmpArr['spu'] = $spu;
                     $insertId = OmAvailableModel::addTNameRow2arr($tName, $dataTmpArr);
                     $insertSpuArr[$insertId] = $spu;
                     $spanStatus .= "<font color='green'>{$spu} 添加成功</font><br/>";
                 } else {
                     $spanStatus .= "<font color='red'>{$spu} 在产品信息中不存在</font><br/>";
                 }
             } else {
                 $spanStatus .= "<font color='red'>{$spu} 已经存在于特殊料号-运输方式管理中</font><br/>";
             }
         } else {
             $spanStatus .= "<font color='red'>{$spu} 格式有误</font><br/>";
         }
     }
     $returnArr['spanStatus'] = $spanStatus;
     $returnArr['insertSpuArr'] = $insertSpuArr;
     self::$errCode = '200';
     self::$errMsg = "操作成功";
     return $returnArr;
 }
Beispiel #21
0
 function act_accountCount($accountCondition, $countCondition)
 {
     $accAct = new AccountAct();
     $accountList = $accAct->act_getAccountList('id,account', "where platformId = 1 and token!='' and is_delete = 0 {$accountCondition}");
     $tName = "fb_comment_record_ebay";
     foreach ($accountList as $accountInfo) {
         $account = $accountInfo['account'];
         $PositiveSql = " where account='{$account}' and CommentType='Positive' {$countCondition}";
         $PositiveRes = OmAvailableModel::getTNameCount($tName, $PositiveSql);
         //好评数
         $NeutralSql = " where account='{$account}' and CommentType='Neutral' {$countCondition}";
         $NeutralRes = OmAvailableModel::getTNameCount($tName, $NeutralSql);
         //中评数
         $NegativeSql = " where account='{$account}' and CommentType='Negative' {$countCondition}";
         $NegativeRes = OmAvailableModel::getTNameCount($tName, $NegativeSql);
         //差评数
         $upNeutralsql = " where account='{$account}'  and status='21' {$countCondition}";
         $upNeutralRes = OmAvailableModel::getTNameCount($tName, $upNeutralsql);
         //中评修改数
         $upNegativeSql = " where account='{$account}' and status='31' {$countCondition}";
         $upNegetiveRes = OmAvailableModel::getTNameCount($tName, $upNegativeSql);
         //差评修改数
         $total = $PositiveRes + $NeutralRes * 0.6 + $NegativeRes;
         //总评数
         $per_positive = $PositiveRes / $total;
         $per_positive = round($per_positive * 100, 2);
         $countRes["{$account}"] = array("PositiveRes" => $PositiveRes, "NeutralRes" => $NeutralRes, "NegativeRes" => $NegativeRes, "upNeutralRes" => $upNeutralRes, "upNegetiveRes" => $upNegetiveRes, "total" => $total, "per_positive" => $per_positive);
     }
     return $countRes;
     var_dump($countRes);
     exit;
 }
Beispiel #22
0
 public function view_addInputOn()
 {
     $inputName = $_GET['inputName'] ? post_check(trim($_GET['inputName'])) : '';
     $pid = $_GET['pid'] ? post_check(trim($_GET['pid'])) : '';
     if (empty($inputName)) {
         $status = "属性名不能为空";
         header("Location:index.php?mod=property&act=addInput&status={$status}");
         exit;
     }
     if (empty($pid)) {
         $status = "类别不能为空";
         header("Location:index.php?mod=property&act=addInput&status={$status}");
         exit;
     }
     $categoryName = getAllCateNameByPath($pid);
     $pathImplodeStr = getAllPathBypid($pid);
     $tName = 'pc_archive_input';
     $where = "WHERE inputName='{$inputName}' and categoryPath IN ({$pathImplodeStr})";
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if ($count) {
         $status = "{$categoryName} 或其父类下已经存在 {$inputName} 属性";
         header("Location:index.php?mod=property&act=addInput&status={$status}");
         exit;
     }
     $set = "SET inputName='{$inputName}',categoryPath='{$pid}'";
     $insertId = OmAvailableModel::addTNameRow($tName, $set);
     if (!$insertId) {
         $status = "系统插入数据错误";
         header("Location:index.php?mod=property&act=addInput&status={$status}");
         exit;
     }
     $status = "{$categoryName} 中添加 {$inputName} 文本属性成功";
     header("Location:index.php?mod=property&act=addInput&status={$status}");
 }
Beispiel #23
0
 function act_getUnusualOrderList()
 {
     $sku = isset($_GET['sku']) ? $_GET['sku'] : '';
     $purid = isset($_GET['purid']) ? base64_decode($_GET['purid']) : '';
     $abStatus = isset($_GET['abStatus']) ? $_GET['abStatus'] : '';
     $isConfirm = isset($_GET['isConfirm']) ? $_GET['isConfirm'] : '';
     $startTime = isset($_GET['startTime']) ? $_GET['startTime'] : '';
     $endTime = isset($_GET['endTime']) ? $_GET['endTime'] : '';
     $page = isset($_GET['page']) ? $_GET['page'] : '1';
     $where = "where storeId=1 and isConfirm=1 and abStatus=0 ";
     if (!empty($sku)) {
         $where .= "and sku='{$sku}' ";
     }
     if (!empty($purid)) {
         $where .= "and purchaseId in ({$purid}) ";
     }
     if (!empty($abStatus)) {
         $where .= "and abStatus='{$abStatus}' ";
     }
     if (is_numeric($isConfirm)) {
         $where .= "and isConfirm='{$isConfirm}' ";
     }
     if (!empty($startTime)) {
         $where .= "and createdTime>='{$startTime}' ";
     }
     if (!empty($endTime)) {
         $where .= "and createdTime<='{$endTime}' ";
     }
     $totalrow = OmAvailableModel::getTNameCount("wh_abnormal_purchase_orders", $where);
     $pagesize = 100;
     //每页显示条数
     $pageindex = $page;
     $limit = "limit " . ($pageindex - 1) * $pagesize . ",{$pagesize}";
     $where .= 'order by id desc ' . $limit;
     $list = OmAvailableModel::getTNameList("wh_abnormal_purchase_orders", "*", $where);
     $datalist[0] = $totalrow;
     $datalist[1] = $list;
     return json_encode($datalist);
 }
Beispiel #24
0
 public function act_getSYNCCount()
 {
     $OrderTime1 = !empty($_POST['OrderTime1']) ? $_POST['OrderTime1'] : '';
     $OrderTime2 = !empty($_POST['OrderTime2']) ? $_POST['OrderTime2'] : '';
     $start = strtotime($OrderTime1);
     $end = strtotime($OrderTime2);
     //return $OrderTime1.'  '.$OrderTime2;
     if ($start > 0 && $end > 0) {
         $tName = 'om_unshipped_order';
         $where = " WHERE is_delete=0 AND orderAddTime>={$start} AND orderAddTime<={$end}";
         $accountList = $_SESSION['accountList'];
         $platformList = $_SESSION['platformList'];
         //echo "<pre>"; print_r($accountList); exit;
         $platformsee = array();
         for ($i = 0; $i < count($platformList); $i++) {
             $platformsee[] = $platformList[$i];
         }
         if ($platformsee) {
             $where .= ' AND platformId IN (' . join(",", $platformsee) . ') ';
         } else {
             $where .= " AND 1=2 ";
         }
         $accountsee = array();
         for ($i = 0; $i < count($accountList); $i++) {
             $accountsee[] = $accountList[$i];
         }
         if ($accountsee) {
             $where .= ' AND accountId IN (' . join(",", $accountsee) . ') ';
         } else {
             $where .= " AND 1=2 ";
         }
         $count = OmAvailableModel::getTNameCount($tName, $where);
         self::$errCode = 200;
         self::$errMsg = "同步订单数为 {$count}";
         return false;
     } else {
         self::$errCode = 101;
         self::$errMsg = '请选择同步时间';
         return false;
     }
 }
Beispiel #25
0
 function act_addAutoSpuForOld()
 {
     $data = array();
     $data['spu'] = trim($_POST['spu']);
     $data['isSingSpu'] = trim($_POST['isSingSpu']);
     $data['createdTime'] = time();
     $data['purchaseId'] = $_SESSION['userId'];
     if (preg_match("/^[A-Z]{2}[0-9]{6}\$/", $data['spu'])) {
         $data['prefix'] = substr($data['spu'], 0, 2);
         $data['sort'] = intval(substr($data['spu'], 2));
     }
     //验证spu是否已经存在
     if ($data['isSingSpu'] == 1) {
         $tName = 'pc_goods';
         $where = "WHERE spu='{$data['spu']}' and is_delete=0";
     } else {
         $tName = 'pc_goods_combine';
         $where = "WHERE combineSpu='{$data['spu']}' and is_delete=0";
     }
     $res = OmAvailableModel::getTNameCount($tName, $where);
     if (empty($res)) {
         self::$errCode = 03;
         self::$errMsg = "{$data['spu']} 不在系统中存在,请重新添加";
         return false;
     } else {
         $tName = 'pc_auto_create_spu';
         $where = "WHERE spu='{$data['spu']}'";
         $countSpu = OmAvailableModel::getTNameCount($tName, $where);
         if ($countSpu) {
             self::$errCode = 04;
             self::$errMsg = "{$data['spu']} 已经添加到自动生成SPU列表中";
             return false;
         }
         if (SpuModel::insertSkuRow($data)) {
             return true;
         } else {
             self::$errCode = 05;
             self::$errMsg = '添加失败';
             return false;
         }
     }
 }
 function act_invokeListOrders(MarketplaceWebServiceOrders_Interface $service, $request, $account, $site, $accountId, $flip_transportList, $message)
 {
     //		/global $account, $site, $accountId, $flip_transportList , $message;
     try {
         $response = $service->getOrder($request);
         //echo ("Service Response\n");
         //echo ("=============================================================================\n");
         if ($response->isSetGetOrderResult()) {
             //echo ("ListOrdersResult\n");
             $listOrdersResult = $response->getGetOrderResult();
             /*if ($listOrdersResult->isSetNextToken()) {
             			//echo ("	NextToken----");
             			//echo ($listOrdersResult->getNextToken() . "\n");
             		}
             		
             		if ($listOrdersResult->isSetCreatedBefore()) {
             			//echo ("CreatedBefore----");
             			//echo ($listOrdersResult->getCreatedBefore() . "\n");
             		}
             		if ($listOrdersResult->isSetLastUpdatedBefore()) {
             			//echo ("LastUpdatedBefore----");
             			//echo ($listOrdersResult->getLastUpdatedBefore() . "\n");
             		}*/
             if ($listOrdersResult->isSetOrders()) {
                 $orders = $listOrdersResult->getOrders();
                 $orderList = $orders->getOrder();
                 $orderIndex = 1;
                 $now = time();
                 //BaseModel :: begin(); //开始事务
                 foreach ($orderList as $order) {
                     //echo ("***********Orders $orderIndex************\n\n");
                     $orderIndex++;
                     $orderData = array();
                     //om_unshipped_order
                     $orderUserInfoData = array();
                     //om_unshipped_order_userInfo
                     $orderExtenData = array();
                     //om_unshipped_order_extension
                     $street2 = '';
                     //街道2
                     $street3 = '';
                     //街道3
                     if ($order->isSetAmazonOrderId() && $order->isSetOrderStatus() && $order->getOrderStatus() == 'Unshipped') {
                         //$orderData['ebay_status'] = 1; //同步进来的订单的状态
                         $orderData['recordNumber'] = $order->getAmazonOrderId();
                         //平台上的订单id
                         //echo "AmazonOrderId ==== {$orderData['recordNumber']}\n";
                     } else {
                         //echo 'getOrderStatus======' . $order->getOrderStatus() . "\n";
                         if ($order->getOrderStatus() == 'Shipped') {
                             //表示已经发货了的订单
                             $shippedRecordNum = $order->getAmazonOrderId();
                             $tName = 'om_shipped_order';
                             $where = "WHERE recordNumber='{$shippedRecordNum}' and accountId='{$accountId}' and ShippedTime=''";
                             $set = "SET ShippedTime='{$now}'";
                             //标记发货时间
                             $affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
                             if ($affectRow) {
                                 $message .= "<font color='green'>update {$shippedRecordNum} ShippedTime success" . "</font><br>";
                             } else {
                                 $message .= "<font color='red'>update {$shippedRecordNum} ShippedTime fail may be has shippedTime or had no this recordNumber" . "</font><br>";
                             }
                         }
                         continue;
                     }
                     if ($order->isSetPurchaseDate()) {
                         //亚马逊平台上的下单时间
                         $orderData['ordersTime'] = strtotime($order->getPurchaseDate());
                         //echo ("addTime  ==== {$order->getPurchaseDate()}\n");
                     }
                     if ($order->isSetLastUpdateDate()) {
                         //支付时间
                         $orderData['paymentTime'] = strtotime($order->getLastUpdateDate());
                         //echo ("paidTime  ==== {$order->getLastUpdateDate()}\n");
                     }
                     $orderstatus = '';
                     //订单状态
                     //if ($order->isSetOrderStatus()) {
                     //                    	if($order->getOrderStatus() == 'Unshipped'){
                     //							$orderstatus				= 1;
                     //						}
                     //					}
                     if ($order->isSetFulfillmentChannel()) {
                         $orderExtenData['FulfillmentChannel'] = $order->getFulfillmentChannel();
                         //echo ("FulfillmentChannel  ==== "); //订单配送方式
                         //echo ($orderExtenData['FulfillmentChannel'] . "\n");
                     }
                     if ($order->isSetSalesChannel()) {
                         $orderExtenData['SalesChannel'] = $order->getSalesChannel();
                         //echo ("SalesChannel ==== ");
                         //echo ($orderExtenData['SalesChannel'] . "\n");
                     }
                     if ($order->isSetOrderChannel()) {
                         $orderExtenData['OrderChannel'] = $order->getOrderChannel();
                         //echo ("OrderChannel ====");
                         //echo ($orderExtenData['OrderChannel'] . "\n");
                     }
                     if ($order->isSetShipServiceLevel()) {
                         $orderExtenData['ShipServiceLevel'] = $order->getShipServiceLevel();
                         //echo ("ShipServiceLevel ==== ");
                         //echo ($orderExtenData['ShipServiceLevel'] . "\n");
                     }
                     if ($order->isSetShippingAddress()) {
                         //判断是否设置了地址
                         $shippingAddress = $order->getShippingAddress();
                         if ($shippingAddress->isSetName()) {
                             //获取收件人姓名
                             $orderUserInfoData['username'] = htmlentities($shippingAddress->getName(), ENT_QUOTES);
                             //echo ("username ==== ");
                             //echo ($orderUserInfoData['username'] . "\n");
                         }
                         if ($shippingAddress->isSetAddressLine1()) {
                             //街道1
                             $orderUserInfoData['street'] = htmlentities($shippingAddress->getAddressLine1(), ENT_QUOTES);
                             //echo ("street ==== ");
                             //echo ($orderUserInfoData['street'] . "\n");
                         }
                         if ($shippingAddress->isSetAddressLine2()) {
                             //街道2
                             $street2 = htmlentities($shippingAddress->getAddressLine2(), ENT_QUOTES);
                         }
                         if ($shippingAddress->isSetAddressLine3()) {
                             //街道3
                             $street3 = htmlentities($shippingAddress->getAddressLine3(), ENT_QUOTES);
                         }
                         if ($shippingAddress->isSetCity()) {
                             //城市
                             $orderUserInfoData['city'] = htmlentities($shippingAddress->getCity(), ENT_QUOTES);
                             //echo ("city ==== ");
                             //echo ($orderUserInfoData['city'] . "\n");
                         }
                         if ($shippingAddress->isSetCounty()) {
                             //郡,县
                             $orderUserInfoData['address2'] = htmlentities($shippingAddress->getCounty() . ' ' . $street2, ENT_QUOTES);
                             $orderUserInfoData['address3'] = htmlentities($shippingAddress->getCounty() . ' ' . $street3, ENT_QUOTES);
                             //echo ("address2 ==== ");
                             //echo ($orderUserInfoData['address2'] . "\n");
                             //echo ("address3 ==== ");
                             //echo ($orderUserInfoData['address3'] . "\n");
                         }
                         if ($shippingAddress->isSetDistrict()) {
                             //地方,区
                             //echo ("District ==== " . $shippingAddress->getDistrict() . "\n");
                         }
                         if ($shippingAddress->isSetStateOrRegion()) {
                             //州
                             $orderUserInfoData['state'] = htmlentities($shippingAddress->getStateOrRegion(), ENT_QUOTES);
                             //echo ("state ==== ");
                             //echo ($orderUserInfoData['state'] . "\n");
                         }
                         if ($shippingAddress->isSetPostalCode()) {
                             //邮编
                             $orderUserInfoData['zipCode'] = htmlentities($shippingAddress->getPostalCode(), ENT_QUOTES);
                             //echo ("zipCode ==== ");
                             //echo ($orderUserInfoData['zipCode'] . "\n");
                         }
                         if ($shippingAddress->isSetCountryCode()) {
                             //国家简称
                             /*$ebay_countrynames = array('US'=>'United States', "UK"=>"United Kingdom");
                             		$orderData['ebay_couny'] 	= 	$shippingAddress->getCountryCode() ;
                             		$orderData['ebay_site'] 	= 	$shippingAddress->getCountryCode() ;
                             		$orderData['ebay_countryname'] 	= 	$ebay_countrynames[$shippingAddress->getCountryCode()];*/
                             //$sql = "SELECT regions_en FROM  ebay_region WHERE  regions_jc =  '".$shippingAddress->getCountryCode()."'";
                             //                        	$sql	= $dbcon->execute($sql);
                             //							$amazon_countryname	= $dbcon->fetch_one($sql);
                             $orderUserInfoData['countrySn'] = $shippingAddress->getCountryCode();
                             //这里要调用运输方式管理系统的数据,获取国家简称对应的国家名称
                             $countryNameInfo = CommonModel::getCountrieInfoBySn($orderUserInfoData['countrySn']);
                             //根据国家简称获取该国家的信息
                             //$orderData['ebay_site'] = $shippingAddress->getCountryCode() ;
                             $orderUserInfoData['countryName'] = trim($countryNameInfo['regions_en']);
                             //获得国家名称
                             //echo ("getCountryCode==== " . $orderUserInfoData['countrySn'] . "\n");
                         }
                         if ($shippingAddress->isSetPhone()) {
                             //手机
                             $orderUserInfoData['phone'] = $shippingAddress->getPhone();
                             //echo ("phone ==== ");
                             //echo ($orderUserInfoData['phone'] . "\n");
                         }
                     }
                     if ($order->isSetOrderTotal()) {
                         $orderTotal = $order->getOrderTotal();
                         if ($orderTotal->isSetCurrencyCode()) {
                             //币种
                             $orderUserInfoData['currency'] = $orderTotal->getCurrencyCode();
                             //echo ("currency ==== ");
                             //echo ($orderUserInfoData['currency'] . "\n");
                         }
                         if ($orderTotal->isSetAmount()) {
                             //订单总价,线上总价
                             $orderData['onlineTotal'] = $orderTotal->getAmount();
                             $orderData['actualTotal'] = $orderTotal->getAmount();
                             //echo ("onlineTotal ==== ");
                             //echo ($orderData['onlineTotal'] . "\n");
                         }
                     }
                     if ($order->isSetNumberOfItemsShipped()) {
                         //echo ("ItemsShipped ==== " . $order->getNumberOfItemsShipped() . "\n");
                     }
                     if ($order->isSetNumberOfItemsUnshipped()) {
                         //echo ("NumberOfItemsUnshipped ==== " . $order->getNumberOfItemsUnshipped() . "\n");
                     }
                     if ($order->isSetPaymentExecutionDetail()) {
                         $paymentExecutionDetail = $order->getPaymentExecutionDetail();
                         $paymentExecutionDetailItemList = $paymentExecutionDetail->getPaymentExecutionDetailItem();
                         foreach ($paymentExecutionDetailItemList as $paymentExecutionDetailItem) {
                             echo "######PaymentExecutionDetailItem######\n";
                             if ($paymentExecutionDetailItem->isSetPayment()) {
                                 $payment = $paymentExecutionDetailItem->getPayment();
                                 if ($payment->isSetCurrencyCode()) {
                                     //echo ("CurrencyCode ==== ");
                                     //echo ($payment->getCurrencyCode() . "\n");
                                 }
                                 if ($payment->isSetAmount()) {
                                     //echo (" Amount ==== ");
                                     //echo ($payment->getAmount() . "\n");
                                 }
                             }
                             if ($paymentExecutionDetailItem->isSetSubPaymentMethod()) {
                                 //echo ("SubPaymentMethod ==== ");
                                 //echo ($paymentExecutionDetailItem->getSubPaymentMethod() . "\n");
                             }
                         }
                     }
                     if ($order->isSetPaymentMethod()) {
                         $orderExtenData['PaymentMethod'] = $order->getPaymentMethod();
                         //echo ("PaymentMethod ==== ");
                         //echo ($orderExtenData['PaymentMethod'] . "\n");
                     }
                     if ($order->isSetMarketplaceId()) {
                         $orderExtenData['MarketplaceId'] = $order->getMarketplaceId();
                         //echo ("MarketplaceId ==== ");
                         //echo ($orderExtenData['MarketplaceId'] . "\n");
                     }
                     if ($order->isSetBuyerName()) {
                         //买家ID
                         $orderUserInfoData['platformUsername'] = htmlentities($order->getBuyerName(), ENT_QUOTES);
                         //echo ("platformUsername ==== ");
                         //echo ($orderUserInfoData['platformUsername'] . "\n");
                     }
                     if ($order->isSetBuyerEmail()) {
                         //买家email
                         $orderUserInfoData['email'] = $order->getBuyerEmail();
                         //echo ("email ==== ");
                         //echo ($orderUserInfoData['email'] . "\n");
                     }
                     if ($order->isSetShipmentServiceLevelCategory()) {
                         $orderExtenData['ShipmentServiceLevelCategory'] = $order->getShipmentServiceLevelCategory();
                         //echo ("ShipmentServiceLevelCategory ==== ");
                         //echo ($orderExtenData['ShipmentServiceLevelCategory'] . "\n");
                     }
                     //$orderData['ebay_user']			=	$user;
                     $orderData['platformId'] = 11;
                     //amazon的平台ID为11
                     $orderData['accountId'] = $accountId;
                     //amazon的账号ID
                     //echo ("accountId ==== ");
                     //echo ($orderData['accountId'] . "\n");
                     $orderData['orderAddTime'] = time();
                     //添加到系统的时间
                     //echo ("orderAddTime ==== ");
                     //echo ($orderData['orderAddTime'] . "\n");
                     $orderData['orderStatus'] = C('STATEPENDING');
                     //默认订单状态
                     $orderData['orderType'] = C('STATEPENDING_INITIAL');
                     //默认订单类型
                     $orderData = array('orderData' => $orderData, 'orderExtenData' => $orderExtenData, 'orderUserInfoData' => $orderUserInfoData);
                     $tName = 'om_unshipped_order';
                     $where = "WHERE recordNumber='{$orderData['orderData']['recordNumber']}' AND platformId={$orderData['orderData']['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个订单表(未发货和已发货)中存在
                         //$orderData['ebay_ordersn']	=	generateOrdersn();
                         $detailrequest = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
                         $detailrequest->setSellerId(MERCHANT_ID);
                         $detailrequest->setAmazonOrderId($orderData['orderData']['recordNumber']);
                         $orderDetailArr = self::act_invokeListOrderItems($service, $detailrequest);
                         //var_dump($orderDetailArr); exit;
                         for ($i = 0; $i < count($orderDetailArr); $i++) {
                             $orderDetailArr[$i]['orderDetailData']['recordNumber'] = $orderData['orderData']['recordNumber'];
                         }
                         //print_r($orderDetailArr);
                         if (!empty($orderDetailArr)) {
                             $orderData['orderDetail'] = $orderDetailArr;
                             $insertData = array();
                             //var_dump($obj_order_detail_data); echo "<br>";
                             $calcInfo = CommonModel::calcAddOrderWeight($orderDetailArr);
                             //计算重量和包材
                             //var_dump($calcInfo); exit;
                             $orderData['orderData']['ORcalcWeight'] = $calcInfo[0];
                             $orderData['orderData']['calcWeight'] = $calcInfo[0];
                             $orderData['orderData']['pmId'] = $calcInfo[1];
                             if ($orderData['orderData']['calcWeight'] != $totalweight) {
                                 $insertData['old_totalweight'] = $totalweight;
                                 $insertData['new_totalweight'] = $orderData['orderData']['calcWeight'];
                             }
                             if ($orderData['orderData']['pmId'] != $pmId) {
                                 $insertData['old_pmId'] = $pmId;
                                 $insertData['new_pmId'] = $orderData['orderData']['pmId'];
                             }
                             $newcarrier = get_carrier($orderData['orderData']['calcWeight'], $orderData['orderUserInfoData']['countryName'], $account, $orderData['orderUserInfoData']['currency']);
                             $orderData['orderData']['transportId'] = $flip_transportList[$newcarrier];
                             $orderData['orderData']['ORtransportId'] = $flip_transportList[$newcarrier];
                             $rtn = OldsystemModel::orderErpInsertorder($orderData);
                             //var_dump($rtn);
                             if ($rtn['errcode'] == 200) {
                                 //var_dump($rtn);
                                 $rtn_data = $rtn['data'];
                                 $orderId = $rtn_data['orderId'];
                                 $message .= "<font color='green'>" . date("Y-m-d H:i:s") . " 插入老系统成功,订单编号 [{$orderId}] </font><br>";
                                 $pmId = $rtn_data['pmId'];
                                 $totalweight = $rtn_data['totalweight'];
                                 $shipfee = $rtn_data['shipfee'];
                                 $carrier = $rtn_data['carrier'];
                                 $carrierId = $rtn_data['carrierId'];
                                 $status = $rtn_data['status'];
                                 $orderData['orderData']['id'] = $orderId;
                                 //赋予新系统订单编号@20140501
                                 if (count($orderData['orderDetail']) > 1) {
                                     $orderData['orderData']['orderAttribute'] = 3;
                                 } else {
                                     if (isset($orderData['orderDetail'][0]['orderDetailData']['amount']) && $orderData['orderDetail'][0]['orderDetailData']['amount'] > 1) {
                                         $orderData['orderData']['orderAttribute'] = 2;
                                     }
                                 }
                                 /*$calcShippingInfo = CommonModel :: calcAddOrderShippingFee($orderData,1);//计算运费
                                 		//var_dump($calcShippingInfo); exit;
                                 		//$insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
                                 		$orderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];*/
                                 $calcShippingInfo = TransAPIModel::trans_carriers_fix_get($orderData['orderData']['transportId'], $orderData['orderData']['calcWeight'], $orderData['orderUserInfoData']['countryName']);
                                 //计算运费
                                 //var_dump($calcShippingInfo);
                                 $orderData['orderData']['calcShipping'] = $calcShippingInfo['fee'];
                                 //$orderData['orderData']['transportId'] = $calcShippingInfo['carrierId'];
                                 $orderData['orderData']['channelId'] = $calcShippingInfo['channelId'];
                                 $orderData['orderData']['ORchannelId'] = $calcShippingInfo['channelId'];
                                 if ($orderData['orderData']['calcShipping'] != $shipfee) {
                                     $insertData['old_shippfee'] = $shipfee;
                                     $insertData['new_shippfee'] = $orderData['orderData']['calcShipping'];
                                 }
                                 if ($orderData['orderData']['transportId'] != $carrierId) {
                                     $insertData['old_carrierId'] = $carrierId;
                                     $insertData['new_carrierId'] = $orderData['orderData']['transportId'];
                                 }
                                 if (!empty($insertData)) {
                                     $insertData['ebay_id'] = $orderId;
                                     $insertData['addtime'] = time();
                                     //var_dump($insertData);
                                     OldsystemModel::insertTempSyncRecords($insertData);
                                     // 插入临时对比记录表
                                 }
                                 $orderData = AutoModel::auto_contrast_intercept($orderData);
                                 //print_r($interceptInfo); exit;
                                 /*$orderData['orderData']['orderStatus'] = $interceptInfo['orderStatus'];
                                 		$orderData['orderData']['orderType'] = $interceptInfo['orderType'];*/
                                 //var_dump($orderData); exit;
                                 if (OrderAddModel::insertAllOrderRow($orderData)) {
                                     //echo 'insert success!' . "\n";
                                     $message .= "<font color='green'>" . date("Y-m-d H:i:s") . ", 新增订单{$orderData['orderData']['recordNumber']}成功</font><br>";
                                 } else {
                                     $message .= "<font color='red'>" . date("Y-m-d H:i:s") . ", 新增订单{$orderData['orderData']['recordNumber']}失败</font><br>";
                                     //echo OrderAddModel :: $errMsg;
                                 }
                             }
                         } else {
                             //echo "Amazon ID: ".$orderData['recordnumber']." 订单详情添加失败\n";
                             $message .= "<font color='red'>Amazon ID: " . $orderData['orderData']['recordNumber'] . " has no detail </font><br>";
                         }
                     } else {
                         $message .= "<font color='red'>Amazon ID: " . $orderData['orderData']['recordNumber'] . " had exist</font><br>";
                     }
                 }
             }
         }
     } catch (MarketplaceWebServiceOrders_Exception $ex) {
         $message .= "Caught Exception: " . $ex->getMessage() . "<br>";
         $message .= "Response Status Code: " . $ex->getStatusCode() . "<br>";
         $message .= "Error Code: " . $ex->getErrorCode() . "<br>";
         $message .= "Error Type: " . $ex->getErrorType() . "<br>";
         $message .= "Request ID: " . $ex->getRequestId() . "<br>";
         $message .= "XML: " . $ex->getXML() . "<br>";
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         $message .= $e->getMessage() . "<br>";
     }
     return $message;
 }
Beispiel #27
0
 /**
  *功能:提供接口,给深圳ERP同步SPU报关相关信息
  * */
 public function act_getSpuHscodeTaxCount()
 {
     $tName = 'pc_spu_tax_hscode';
     $where = "WHERE 1=1";
     $spuHscodeCount = OmAvailableModel::getTNameCount($tName, $where);
     self::$errCode = 200;
     self::$errMsg = "成功";
     return $spuHscodeCount;
 }
Beispiel #28
0
 function act_updateSpuArchivePid()
 {
     $spu = $_POST['spu'];
     $pid = $_POST['pid'];
     $userId = $_SESSION['userId'];
     if (intval($userId) <= 0) {
         self::$errCode = '100';
         self::$errMsg = "登陆超时,请重试";
         return false;
     }
     if (empty($spu) || empty($pid)) {
         self::$errCode = '101';
         self::$errMsg = "异常,错误!";
         return false;
     }
     $tName = 'pc_spu_archive';
     $select = 'categoryPath';
     $where = "WHERE is_delete=0 AND spu='{$spu}'";
     $spuList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($spuList)) {
         self::$errCode = '102';
         self::$errMsg = "该SPU档案不存在";
         return false;
     }
     if ($spuList[0]['categoryPath'] == $pid) {
         self::$errCode = '110';
         self::$errMsg = "类别无修改";
         return false;
     }
     $tName = 'pc_goods_category';
     $where = "WHERE path='{$pid}' and is_delete=0";
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if (!$count) {
         self::$errCode = '103';
         self::$errMsg = "所选类别不存在,请刷新重试!";
         return false;
     }
     $where = "WHERE path like'{$pid}-%' and is_delete=0";
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if ($count) {
         self::$errCode = '104';
         self::$errMsg = "产品档案只能建立在最小分类下,请选择最小分类";
         return false;
     }
     try {
         BaseModel::begin();
         $tName = 'pc_spu_archive';
         $where = "WHERE spu='{$spu}'";
         $dataTmpArr = array();
         $dataTmpArr['categoryPath'] = $pid;
         OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
         //更新SPU档案的类别
         $tName = 'pc_archive_spu_property_value_relation';
         $where = "WHERE spu='{$spu}'";
         OmAvailableModel::deleteTNameRow($tName, $where);
         //物理删除该SPU产品档案选择属性记录
         $tName = 'pc_archive_spu_input_value_relation';
         $where = "WHERE spu='{$spu}'";
         OmAvailableModel::deleteTNameRow($tName, $where);
         //物理删除SPU产品档案文本记录
         $tName = 'pc_goods';
         $where = "WHERE is_delete=0 AND spu='{$spu}'";
         $dataTmpArr = array();
         $dataTmpArr['goodsCategory'] = $pid;
         OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
         //更新该SPU下所有SKU的类别
         BaseModel::commit();
         BaseModel::autoCommit();
         OmAvailableModel::newData2ErpInterfOpen('pc.erp.updateGoodsCategoryBySpu', array('spu' => $spu, 'pid' => $pid), 'gw88');
         $personName = getPersonNameById($userId);
         error_log(date('Y-m-d_H:i') . " {$personName} 将SPU:{$spu} 类别改为 {$pid} 原始类别为: {$spuList[0]['categoryPath']} \r\n", 3, WEB_PATH . "log/updateSpuCategoryLog.txt");
         self::$errCode = 200;
         self::$errMsg = "修改成功";
         return true;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = 404;
         self::$errMsg = '修改失败,原因为:' . $e->getMessage();
         return false;
     }
 }
Beispiel #29
0
 public function view_getSkuWeightAuditList()
 {
     $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
     $status = isset($_GET['status']) ? post_check($_GET['status']) : '';
     $addUserId = isset($_GET['addUserId']) ? post_check($_GET['addUserId']) : '';
     $auditerId = isset($_GET['auditerId']) ? post_check($_GET['auditerId']) : '';
     $timeSearchType = isset($_GET['timeSearchType']) ? post_check($_GET['timeSearchType']) : '';
     $startdate = isset($_GET['startdate']) ? post_check($_GET['startdate']) : '';
     $enddate = isset($_GET['enddate']) ? post_check($_GET['enddate']) : '';
     $tName = 'pc_goods_weight_audit';
     $select = '*';
     $where = 'WHERE is_delete=0 ';
     if (!empty($sku)) {
         $where .= "AND sku='{$sku}' ";
     }
     if (intval($status) > 0) {
         $where .= "AND status='{$status}' ";
     }
     if (intval($addUserId) > 0) {
         $where .= "AND addUserId='{$addUserId}' ";
     }
     if (intval($auditerId) > 0) {
         $where .= "AND auditerId='{$auditerId}' ";
     }
     if (intval($timeSearchType) > 0) {
         if ($startdate != '') {
             $start = strtotime($startdate . ' 00:00:00');
             if ($timeSearchType == 1) {
                 $where .= "AND addTime>='{$start}' ";
             } elseif ($timeSearchType == 2) {
                 $where .= "AND auditTime>='{$start}' ";
             }
         }
         if ($enddate != '') {
             $end = strtotime($enddate . ' 23:59:59');
             if ($timeSearchType == 1) {
                 $where .= "AND addTime<='{$end}' ";
             } elseif ($timeSearchType == 2) {
                 $where .= "AND auditTime<='{$end}' ";
             }
         }
     }
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 100;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= 'order by id desc ';
     $where .= $page->limit;
     $skuWeightAuditList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $navlist = array(array('url' => 'index.php?mod=goods&act=getGoodsList', 'title' => '产品信息'), array('url' => 'index.php?mod=goods&act=getSkuWeightAuditList', 'title' => 'SKU重量审核列表'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 1);
     $this->smarty->assign('twovar', 110);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', 'SKU重量审核列表');
     $this->smarty->assign('skuWeightAuditList', empty($skuWeightAuditList) ? array() : $skuWeightAuditList);
     $this->smarty->display("skuWeightAuditList.htm");
 }
Beispiel #30
0
 public function view_updateSpuPrefixOn()
 {
     $id = $_GET['id'];
     $prefix = $_GET['prefix'] ? post_check(trim($_GET['prefix'])) : '';
     $isSingSpu = $_GET['isSingSpu'] ? post_check(trim($_GET['isSingSpu'])) : '';
     $companyId = $_GET['companyId'] ? post_check(trim($_GET['companyId'])) : '';
     $isUse = $_GET['isUse'] ? post_check(trim($_GET['isUse'])) : '';
     if (!preg_match("/^[A-Z]{2}\$/", $prefix)) {
         $status = "前缀必须是两个大写字母的组合";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     if (intval($isSingSpu) != 1 && intval($isSingSpu) != 2) {
         $status = "单/组合料号有误";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     $companyInfo = getCompanyNameById($companyId);
     if (empty($companyInfo)) {
         $status = "公司信息有误";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     if (intval($isUse) == 0) {
         $status = "启动/禁用不能为空";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     $tName = 'pc_auto_create_spu_prefix';
     $select = '*';
     $where = "WHERE id={$id}";
     $spuPrefixList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($spuPrefixList)) {
         $status = "不存在该记录";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     $where = "WHERE prefix='{$prefix}' and companyId='{$companyId}' and id<>'{$id}'";
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if ($count) {
         $status = "该公司下已经存在 {$prefix} 前缀";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     $set = "SET prefix='{$prefix}',isSingSpu='{$isSingSpu}',companyId='{$companyId}',isUse='{$isUse}'";
     $where = "WHERE id='{$id}'";
     $affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
     if (!$affectRow) {
         $status = "无数据修改";
         header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
         exit;
     }
     $isSingSpuStr = 1 ? '单料号' : '虚拟料号';
     $isUseStr = 1 ? '启用' : '禁用';
     $status = "{$spuPrefixList[0]['prefix']} 修改为 {$prefix} 成功,{$isSingSpuStr} {$isUseStr}";
     header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
 }