Пример #1
0
 public function view_fedex_shenzhen()
 {
     $l = C("_LANG_system");
     $shipfeeModel = new shipfeeModel();
     //$channelModel = new channelsManageModel;
     $channelName = isset($_GET['channelName']) ? $_GET['channelName'] : "";
     $channelId = isset($_GET['channelId']) ? $_GET['channelId'] : "";
     $carrierId = isset($_GET['carrierId']) ? $_GET['carrierId'] : "";
     $carrierName = isset($_GET['carrierName']) ? $_GET['carrierName'] : "";
     $navarr = array("<a href='index.php?mod=transportmanage&act=list'>运输方式管理</a>", ">", "<a href='index.php?mod=channelsManage&act=channels&carrierId={$carrierId}'>{$carrierName}渠道管理</a>", ">", "运费价目表");
     //$channelName = isset($_GET['channelName'])?$_GET['channelName']:"";
     /*******************分	页 start ***********************/
     $total = $shipfeeModel->fedex_shenzhen_nums();
     //计算总条数
     $num = 20;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     //$countriesManageActArr    = $countriesManageAct->act_countriesManage(' order by id asc '.$page->limit);//标准国家数据调用
     //echo "<pre>";print_r($countriesManageActArr);exit;
     $where = " " . $page->limit;
     $fedex_shenzhen = $shipfeeModel::fedex_shenzhen($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));
     }
     $this->tp->set_var("show_page", $show_page);
     /*******************分	页 end ***********************/
     $this->tp->set_file("shipfee_fedex_shenzhen", "shipfee_fedex_shenzhen.html");
     $this->tp->set_file("header", "header.html");
     $this->tp->set_file("footer", "footer.html");
     $this->tp->parse("header", "header");
     $this->tp->parse("footer", "footer");
     ob_clean();
     $navarr = array("运输方式管理", ">", "渠道管理", ">", "fedex渠道运费价目表");
     $this->tp->set_file("navdiv", "transmanagernav.html");
     $this->tp->set_block("navdiv", "navlist", "navlists");
     foreach ($navarr as $value) {
         $this->tp->set_var("location", $value);
         $this->tp->parse("navlists", "navlist", true);
     }
     $this->tp->set_block("shipfee_fedex_shenzhen", "list", "lists");
     foreach ($fedex_shenzhen as $key => $value) {
         $this->tp->set_var("id", $value['id']);
         $this->tp->set_var("channelName", $channelName);
         $this->tp->set_var("baf", $value['baf']);
         $this->tp->set_var("groupName", $value['name']);
         $this->tp->set_var("countries", $value['countrylist']);
         $this->tp->set_var("weight", $value['weightinterval']);
         $this->tp->set_var("unitprice", $value['unitprice']);
         $this->tp->set_var("type", $value['type']);
         $this->tp->parse("lists", "list", true);
     }
     $this->tp->set_var("username", $_SESSION['userName']);
     //$this->tp->set_var("transname","");
     //$this->tp->set_var("timeCount","");
     //$this->tp->set_if("addproduct","ispacking",false);
     $this->tp->parse("buff", "shipfee_fedex_shenzhen");
     $this->tp->p("buff");
     //
 }
Пример #2
0
 function modify_fedex_shenzhen()
 {
     $type = isset($_POST['type']) ? $_POST['type'] : "";
     $channelName = isset($_GET['channelName']) ? $_GET['channelName'] : "";
     $fuel = isset($_POST['fuel']) ? $_POST['fuel'] : "";
     if ($_FILES['upfile']) {
         $filename = date("Y-m-d H:i:s") . rand(1, 3009) . ".xls";
         if (move_uploaded_file($_FILES["upfile"]["tmp_name"], "../xls/" . $filename)) {
             $filepath = "../xls/" . $filename;
         } else {
             self::$errCode = 444;
             self::$errMsg = "文件上传失败!";
             return;
         }
         $PHPExcel = new PHPExcel();
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($filepath)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($filepath)) {
                 self::$errCode = 344;
                 self::$errMsg = "no excel!";
                 return false;
             }
         }
         $PHPExcel = $PHPReader->load($filepath);
         $excellists = self::excel2array($PHPExcel, $filepath, 0, 0);
         foreach ($excellists as $key => $value) {
             foreach ($value as $k => $v) {
                 if ($key > 1 && $k > 0) {
                     $country = $excellists[$key][0];
                     $weight = $excellists[1][$k];
                     $fee = $v;
                     shipfeeModel::modify_fedex_shenzhen($type, $fuel, $country, $weight, $fee);
                 }
             }
         }
     } else {
         self::$errCode = 304;
         self::$errMsg = "no files";
         return false;
     }
 }
Пример #3
0
 public static function modify_fedex_shenzhen($type, $fuel, $country, $weight, $fee)
 {
     self::initDB();
     $sql = "update trans_freight_fedex_shenzhen set unitprice={$fee},baf={$fuel} where weightinterval ='{$weight}' AND countrylist='{$country}' AND type='{$type}'";
     $query = self::$dbConn->query($sql);
     if ($query) {
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "die";
         return false;
     }
 }