|
@@ -227,6 +227,80 @@ class Common extends CI_Controller {
|
|
|
exit(json_result('0000',$this->response['0000'],['list'=>$list]));
|
|
|
}
|
|
|
|
|
|
+ // 图片上传
|
|
|
+ public function update_firewalld(){
|
|
|
+ // var_dump($_FILES);
|
|
|
+ // $type = intval($this->input->post("fileType",true));
|
|
|
+
|
|
|
+ $filename = trim($_FILES['file']['name']);
|
|
|
+ $path = '../upload/firewalld';
|
|
|
+ $config['file_name'] = $filename;
|
|
|
+
|
|
|
+ if (!file_exists('../upload')) mkdir('../upload');
|
|
|
+ if (!file_exists('../upload/firewalld')) mkdir('../upload/firewalld');
|
|
|
+
|
|
|
+ $config['upload_path'] = $path.'/'; // 设置图片上传路径
|
|
|
+ $config['allowed_types'] = '*'; // 设置图片上传格式
|
|
|
+ $config['max_size'] = 10240; // 设置文件上传大小
|
|
|
+
|
|
|
+ $this->load->library('upload', $config);
|
|
|
+
|
|
|
+ if ( ! $this->upload->do_upload('file'))
|
|
|
+ {
|
|
|
+ $error = array('error' => $this->upload->display_errors('',''));
|
|
|
+
|
|
|
+ // if (empty($this->version)) {
|
|
|
+ // $data = array('error'=>transfer_error_tips($error['error']));
|
|
|
+ // }else{
|
|
|
+ $data = array('error'=>$error['error']);
|
|
|
+ // }
|
|
|
+ exit(json_result('0012',$this->response['0012'],$data));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $data = $this->upload->data();
|
|
|
+ $imagePath = '/upload/firewalld/'.$data['file_name'];
|
|
|
+
|
|
|
+ exit(json_result('0000',$this->response['0000'],array('path'=>$imagePath)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function firewalld(){
|
|
|
+ $this->load->view('common/index');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取制造商下拉列表
|
|
|
+ public function manu_nav(){
|
|
|
+ $list = $this->db->query('select id,name,no from company where type = 2')->result_array();
|
|
|
+ foreach ($list as $key => $value) {
|
|
|
+ if (!empty($value['no'])) {
|
|
|
+ $list[$key]['name'] = $value['no'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ exit(json_result('0000',$this->response['0000'],['list'=>$list]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 上传固件文件
|
|
|
+ public function uploadFilewalld(){
|
|
|
+ $body = file_get_contents('php://input');
|
|
|
+
|
|
|
+ $body = json_decode($body,true);
|
|
|
+ $path = $body['path'];
|
|
|
+ $version = $body['version'];
|
|
|
+ $manuId = $body['manuId'];
|
|
|
+
|
|
|
+ $infodata = $this->db->query('select * from firmware_info where manuId = '.$manuId)->row_array();
|
|
|
+ $data = ['version'=>$version,'path'=>$path,'manuId'=>$manuId];
|
|
|
+
|
|
|
+ if (empty($infodata)) {
|
|
|
+ $this->db->insert('firmware_info', $data);
|
|
|
+ }else{
|
|
|
+ $this->db->where('id', $infodata['id']);
|
|
|
+ $this->db->update('firmware_info', $data);
|
|
|
+ }
|
|
|
+ exit(json_result('0000',$this->response['0000']));
|
|
|
+ }
|
|
|
+
|
|
|
public function workmode() {
|
|
|
$version = $this->session->userdata('version');
|
|
|
if (empty($version)) {
|