Beispiel #1
0
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function upload_base($method)
 {
     $this->response->setHeader("Content-Type", "application/json; charset=utf-8");
     $this->view->disable();
     if ($this->request->isPost() && $this->request->hasFiles()) {
         $files = $this->request->getUploadedFiles();
         $filename = "Import-" . date("YmdHis");
         $excel = ExcelLoader::getInstance();
         $project_id = $this->session->get('Manager')->project_id;
         echo $project_id . "\n";
         $i = 1;
         foreach ($files as $file) {
             $newname = "./upload/" . $filename . "-" . $i . ".xls";
             echo $newname . "\n";
             $file->moveTo($newname);
             $ans = $excel->{$method}($newname, $project_id, $this->db);
             echo $ans . "\n";
             if ($ans != 0) {
                 echo json_encode($ans);
                 return;
             }
             $i++;
         }
         echo 0;
     } else {
         echo json_encode(array('error' => '错误的接口访问'));
     }
 }
Beispiel #3
0
    }
    public function setBankSymbol($symbol)
    {
        $this->bank_symbol = $symbol;
    }
    public function getPurchaserID()
    {
        require_once $this->excel_map_file;
        $mydata = new $this->bank_symbol();
        return $purchaser_id = $mydata->getPurchaserId();
    }
}
//BBT
$myLoader = new ExcelLoader();
$myLoader->setExcelFile("data/BBT.xls");
$myLoader->setExcelMapFile("data/BBT.php");
$myLoader->setBankSymbol("BBT");
$myLoader->removeDataInDB();
$myLoader->loadDataFormExcel();
$myLoader->pushDataToDB();
unset($myLoader);
unset($DataMap);
//BOKF
$bokfLoader = new ExcelLoader();
$bokfLoader->setExcelFile("data/BOKF CMS Rate Sheet.xlsx");
$bokfLoader->setExcelMapFile("data/BOKF.php");
$bokfLoader->setBankSymbol("BOKF");
$bokfLoader->removeDataInDB();
$bokfLoader->loadDataFormExcel();
$bokfLoader->pushDataToDB();
//"BOKF CMS Rate Sheet.xlsx"