Ejemplo n.º 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;
     }
 }
Ejemplo n.º 2
0
 public function act_login()
 {
     $errStr = "";
     $username = "";
     $password = "";
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $username = trim($_POST['username']);
         $password = trim($_POST['password']);
     } else {
         $username = trim($_GET['username']);
         $password = trim($_GET['password']);
     }
     $loginInfo = Auth::login($username, $password);
     $loginInfo = json_decode($loginInfo, true);
     if (isset($loginInfo['errCode'])) {
         return array('errCode' => $loginInfo['errCode'], 'errMsg' => '用户名或者密码错误', 'data' => '');
     }
     $_SESSION['userId'] = getPersonIdByName($username);
     //userId存的是统一用户的id
     //$_SESSION['userId']        = $loginInfo['userId'];
     $_SESSION['userToken'] = $loginInfo['userToken'];
     //userToken是分系统的token
     $_SESSION['lastLoginTime'] = $loginInfo['lastLoginTime'];
     $_SESSION['username'] = $username;
     //$where  = "and `username` = '$username'";
     //        $result = UserModel::getUserInfo($where);
     //		if(!empty($result)){
     //			$where1 = "and `username` = '$username'";
     //			$data = array(
     //				'userPowerId' => $loginInfo['userId']
     //			);
     //			UserModel::update($data,$where1);
     //		}else{
     //			$data = array(
     //				'userPowerId' => $loginInfo['userId'],
     //				'userName'    => $username,
     //			);
     //			UserModel::insertRow($data);
     //		}
     //存储缓存数据
     //UserCacheModel::userInfoCache($loginInfo['userToken'] ,$loginInfo['userId']);
     return array('url' => 'index.php?mod=goods&act=getGoodsList');
 }
session_start();
header("Content-type:text/html;charset=utf-8");
date_default_timezone_set("Asia/Shanghai");
session_cache_expire(30);
//session有效时间为30分钟
$tName = 'purchase_sku_conversion';
$select = '*';
$where = "WHERE 1=1";
$purchaseSkuConvertionList = OmAvailableModel::getTNameList($tName, $select, $where);
if (!empty($purchaseSkuConvertionList)) {
    $tName = 'pc_sku_conversion';
    $where = "WHERE 1=1";
    OmAvailableModel::deleteTNameRow($tName, $where);
}
foreach ($purchaseSkuConvertionList as $value) {
    $id = $value['id'];
    $old_sku = $value['old_sku'];
    $new_sku = $value['new_sku'];
    $user = $value['user'];
    $createdtime = $value['createdtime'];
    $modifiedtime = $value['modifiedtime'];
    $dataConvertion = array();
    $dataConvertion['id'] = $id;
    $dataConvertion['old_sku'] = $old_sku;
    $dataConvertion['new_sku'] = $new_sku;
    $dataConvertion['addUserId'] = getPersonIdByName($user);
    $dataConvertion['createdTime'] = strtotime($createdtime);
    $dataConvertion['modifiedUserId'] = getPersonIdByName($user);
    $dataConvertion['modifiedTime'] = strtotime($modifiedtime);
    OmAvailableModel::addTNameRow2arr($tName, $dataConvertion);
}
Ejemplo n.º 4
0
 public function view_addOrUpdateSpuMakerOn()
 {
     $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 = 'addOrUpdateSpuMaker_' . 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();
         //表格中的最大行数
         if ($personName != '朱清庭' && $highestRow > 5000) {
             echo "表格不能超过5000行,请重新整理表格导入,谢谢!";
             exit;
         }
         $status = '';
         $flag = true;
         //标识检测结果
         ini_set("max_execution_time", 0);
         //设置脚本运行时间无限制
         for ($i = 2; $i <= $highestRow; $i++) {
             //先检查导入表格的正确性
             $spu = trim($currentSheet->getCell('A' . $i)->getValue());
             //spu
             $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
             $salerName = trim($currentSheet->getCell('B' . $i)->getValue());
             //对应销售人名称
             $salerName = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $salerName);
             $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
             //print_r($sku.'  '.$purchaseName);
             //                exit;
             if (empty($spu)) {
                 $status .= "<font color=red>第 {$i} 行,SPU为空!</font><br/>";
                 continue;
             }
             if (empty($salerName)) {
                 $status .= "<font color=red>第 {$i} 行,产品制作人为空!</font><br/>";
                 continue;
             }
             $autoCreateSpuList = isAutoCreateSpuExist($spu);
             if (empty($autoCreateSpuList)) {
                 $status .= "<font color=red>第 {$i} 行,找不到 {$spu} 的生成信息,请先将该SPU信息添加到生成SPU列表中!</font><br/>";
                 continue;
             }
             $isSingSpu = $autoCreateSpuList[0]['isSingSpu'];
             $salerId = getPersonIdByName($salerName);
             if (empty($salerId)) {
                 $status .= "<font color=red>第 {$i} 行,找不到该产品制作人!</font><br/>";
                 continue;
             }
             $tName = 'pc_spu_web_maker';
             $select = 'webMakerId,isTake,isComplete';
             $where = "WHERE is_delete=0 AND spu='{$spu}' order by id desc limit 1";
             $oldSalerList = OmAvailableModel::getTNameList($tName, $select, $where);
             if (empty($oldSalerList)) {
                 //如果该SPU没有对应网页制作人
                 $dataSpuSaler = array();
                 $dataSpuSaler['spu'] = $spu;
                 $dataSpuSaler['isSingSpu'] = $isSingSpu;
                 $dataSpuSaler['webMakerId'] = $salerId;
                 $dataSpuSaler['addTime'] = time();
                 $dataSpuSaler['isTake'] = 1;
                 //默认添加已经领取过
                 $dataSpuSaler['isComplete'] = 1;
                 //已经制作完成过
                 OmAvailableModel::addTNameRow2arr($tName, $dataSpuSaler);
                 if (!error_log(date('Y-m-d_H:i') . " {$spu} {$salerName} 添加成功 BY {$personName} \r\n", 3, WEB_PATH . "log/spuWebMakerImport.txt")) {
                     echo "{$spu} 日志输出错误,请联系管理员,谢谢";
                     exit;
                 }
                 $status .= "<font color=green>{$spu} 对应产品制作人 {$salerName} 添加记录成功</font><br/>";
             } elseif ($oldSalerList[0]['webMakerId'] != $salerId) {
                 //如果该spu最新的网页制作人和导入的人不同
                 if ($oldSalerList[0]['isTake'] == 0) {
                     //未被领取
                     $dataSpuSaler = array();
                     $dataSpuSaler['webMakerId'] = $salerId;
                     $dataSpuSaler['addTime'] = time();
                     OmAvailableModel::updateTNameRow2arr($tName, $dataSpuSaler, $where);
                     if (!error_log(date('Y-m-d_H:i') . "{$spu} {$salerName} 修改记录成功 BY {$personName} \r\n", 3, WEB_PATH . "log/spuSalerImport.txt")) {
                         echo "{$spu} 日志输出错误,请联系管理员,谢谢";
                         exit;
                     }
                     $status .= "<font color=orange>{$spu} 对应产品制作人 {$salerName} 修改记录成功</font><br/>";
                 } else {
                     //被领取了
                     $dataSpuSaler = array();
                     $dataSpuSaler['spu'] = $spu;
                     $dataSpuSaler['isSingSpu'] = $isSingSpu;
                     $dataSpuSaler['webMakerId'] = $salerId;
                     $dataSpuSaler['addTime'] = time();
                     $dataSpuSaler['isHandsOn'] = 1;
                     //更新接手状态
                     $dataSpuSaler['isTake'] = $oldSalerList[0]['isTake'];
                     $dataSpuSaler['isComplete'] = $oldSalerList[0]['isComplete'];
                     OmAvailableModel::addTNameRow2arr($tName, $dataSpuSaler);
                     if (!error_log(date('Y-m-d_H:i') . "{$spu} {$salerName} 添加接手人成功 BY {$personName} \r\n", 3, WEB_PATH . "log/spuSalerImport.txt")) {
                         echo "{$spu} 日志输出错误,请联系管理员,谢谢";
                         exit;
                     }
                     $status .= "<font color=orange>{$spu} 对应产品制作人 {$salerName} 添加接手状态成功</font><br/>";
                 }
             } else {
                 $status .= "<font>{$spu} 对应产品制作人 {$salerName} 无修改</font><br/>";
             }
         }
     }
     echo $status;
     exit;
 }
         $_combineskus = explode('_', $value['goods_sn']);
         $pcGoodsArr['combineSpu'] = $_combineskus[0] . '_' . $_combineskus[1];
         //spu只保留一个下划线
     } else {
         $_combineskus = explode('_', $value['goods_sn']);
         $pcGoodsArr['combineSpu'] = $_combineskus[0];
     }
 }
 $pcGoodsArr['combinePrice'] = $value['goods_price'];
 $pcGoodsArr['combineCost'] = $value['goods_price'];
 if (!empty($value['cguser'])) {
     //如果对应采购字段不为空
     echo "purchase is {$value['cguser']}\n";
     if (intval($value['cguser']) == 0) {
         //如果采购不是数字,则表示是名字
         $purchaseId = getPersonIdByName($value['cguser']);
     } else {
         //如果采购是数字,表示就是其ID
         $purchaseId = $value['cguser'];
     }
     echo "purchaseId is {$purchaseId}\n";
     $pcGoodsArr['combineUserId'] = $purchaseId;
 }
 $tName = 'pc_goods_combine';
 //    $where = "WHERE combineSku='{$pcGoodsArr['combineSku']}'";
 //$countIsExist = OmAvailableModel::getTNameCount($tName, $where);
 //    if($countIsExist>0){
 //        echo "{$pcGoodsArr['combineSku']} has exist\n";
 //        continue;
 //    }
 $pcGoodsArr['combineWeight'] = $value['goods_weight'] >= 10 ? $value['goods_weight'] / 1000 : $value['goods_weight'];
 $pmInfo = OmAvailableModel::getTNameList($tName, $select, $where);
 $pcGoodsArr['pmId'] = $pmInfo[0]['id'];
 $pcGoodsArr['goodsUpdateTime'] = $value['update_status_time'];
 $pcGoodsArr['goodsCreatedTime'] = $value['add_time'];
 $pcGoodsArr['goodsSort'] = $value['mainsku'];
 $pcGoodsArr['isNew'] = $value['is_new'];
 $pcGoodsArr['goodsSize'] = $value['size'];
 $pcGoodsArr['pmCapacity'] = $value['capacity'];
 $pcGoodsArr['packageType'] = $value['package_type'];
 $pcGoodsArr['goodsColor'] = intval($value['color']);
 $pcGoodsArr['goodsSize'] = intval($value['size']);
 $pcGoodsArr['checkCost'] = $value['checkCost'];
 // add by zqt 20140321
 if (!empty($value['ow_inCharge_user'])) {
     echo "OverSeaSkuCharger is {$value['ow_inCharge_user']}\n";
     $OverSeaSkuCharger = getPersonIdByName($value['ow_inCharge_user']);
     echo "OverSeaSkuCharger is '{$OverSeaSkuCharger}'\n";
     $pcGoodsArr['OverSeaSkuCharger'] = $OverSeaSkuCharger;
 }
 if (isset($specialStatusArr[$value['goods_sn']]) && !empty($specialStatusArr[$value['goods_sn']])) {
     $pcGoodsArr['specialStatus'] = $specialStatusArr[$value['goods_sn']];
     //同步该sku的特殊状态过去
     echo "specialStatus is {$specialStatusArr[$value['goods_sn']]}\n";
 } else {
     echo "NO specialStatus value!\n";
 }
 $tName = 'pc_goods';
 $set = 'SET ' . array2sql($pcGoodsArr);
 OmAvailableModel::replaceTNameRow2arr($tName, $pcGoodsArr);
 //if($affectRow){
 //$partnerId = $value['factory']?$value['factory']:0;