Exemple #1
0
 public function ajax_category_class()
 {
     $gc_parent_id = $this->input->get('gc_id');
     $where = array('parent_id' => $gc_parent_id, 'order_by' => 'listorder asc, gc_id asc');
     $this->load->model('a_goods_model');
     $data = $this->a_goods_model->get_query($where, $this->tb_gc, 'gc_id,parent_id,gc_name,type_id');
     if (!empty($data)) {
         $json = cc_json_encode($data);
         echo $json;
     }
     exit(0);
 }
Exemple #2
0
 function image_upload()
 {
     $field_id = $this->input->get_post('id');
     //语言包配置---加载
     $lang = $this->config->item('language');
     if ($lang) {
         $this->_language = $lang;
     }
     $this->lang->load('jslang', $this->_language);
     //检测用户是否session失效
     //    	if(intval($this->shop_id)<=0){
     //			$res['error']=lang('js_session_error');
     //			$json=cc_json_encode($res);echo $json;
     //            return false;
     //    	}
     //		$this->load->model('a_shop_model');
     //		$shop_info=$this->a_shop_model->get_one(array('shop_id'=>$this->shop_id),'shop');
     //
     //		//检测用户是否失效
     //		if(!isset($shop_info['shop_id']) || empty($shop_info['shop_id'])){
     //			$res['error']=lang('js_session_error');
     //			$json=cc_json_encode($res);echo $json;
     //            return false;
     //		}
     //获取该商铺拥有空间的大小
     //		$sg_id=empty($shop_info['sg_id'])?1:$shop_info['sg_id'];
     //		$sg_info=$this->m_shop_model->get_one(array('sg_id'=>$sg_id),'shop_grade');
     //		$space_limit=$sg_info['sg_space_limit'];
     //获取该商铺已经使用的空间大小
     //		$space_size=$this->m_shop_model->get_one(array('isadmin'=>0,'shop_id'=>$this->shop_id,'sts'=>0),'uploadfile','sum(filesize) as file_size');
     //		$now_space_size=isset($space_size['file_size'])?$space_size['file_size']:0;
     //剩余可以使用空间大小,false表示不做限制
     //		$remaid = $space_limit > 0 ? $space_limit * 1024 * 1024 - $now_space_size : false;
     //		if($remaid ===false){
     //			$res['error']=lang('js_space_limit_arrived');
     //			$json=cc_json_encode($res);echo $json;
     //            return false;
     //		}
     $config = array('module' => 'shop_goods', 'shop_id' => 0, 'isadmin' => 0, 'sts' => 0, 'class_id' => 1);
     $this->load->library('iupload_lib');
     $this->iupload_lib->initialize($config);
     //配置初始化文件
     $this->iupload_lib->do_uploadfile($field_id);
     //上传附件
     $re_msg = $this->iupload_lib->error_data();
     $re_data = $this->iupload_lib->file_data();
     if (!empty($re_msg)) {
         $res['error'] = $re_msg[0];
         $json = cc_json_encode($res);
         echo $json;
         return false;
     }
     $this->file_id = $this->iupload_lib->save_data();
     //保存数据到数据库
     //if ($this->instance=='shop_goods'){
     /**生成水印图片**/
     //			$wm_info=$this->m_shop_model->get_one(array('shop_id'=>$this->shop_id),'shop_watermark');
     //			if(isset($wm_info['wm_model'])&& intval($wm_info['wm_model']) >0){
     //				/**生成水印**/
     //				$this->load->library('ithumb_lib');
     //				$full_path=$re_data['full_path'];
     //				$path_arr=explode('.',$full_path);
     //				$config['img_path']=$path_arr[0].'_b.'.$path_arr[1];
     //				$config['wm_model']=$wm_info['wm_model'];
     //				$config['wm_post']=$wm_info['wm_model']=='1'?$wm_info['txt_pos']:$wm_info['image_pos'];
     //
     //				$config['wm_txt']=$wm_info['txt'];
     //				$config['wm_txt_size']=$wm_info['txt_size'];
     //				$config['wm_txt_font']=$wm_info['txt_font'];
     //				$config['wm_txt_color']=$wm_info['txt_color'];
     //
     //				$config['wm_image_path']=$wm_info['image_path'];
     //				$config['wm_opacity']=$wm_info['image_transition'];
     //				$this->ithumb_lib->initialize($config);
     //				$this->ithumb_lib->water_mark();
     //			}
     //}
     $res['msg'] = 'success';
     $res['file_id'] = $this->file_id;
     $res['realname'] = $re_data['client_name'];
     $res['filename'] = $re_data['file_name'];
     $base_path = str_replace('\\', '/', FCPATH);
     $res['filepath'] = str_replace($base_path, '', $re_data['full_path']);
     $json = cc_json_encode($res);
     $json = new_stripslashes($json);
     echo $json;
     //$this->script="window.parent.do_uploadedfile('$json');";
     //$this->upload_iframe();
     return true;
 }
Exemple #3
0
 public function ajax_check_login()
 {
     $data['msg'] = '0';
     if (isset($this->session->userdata['member_user_id']) && intval($this->session->userdata['member_user_id'] > 0)) {
         $data['msg'] = '1';
     }
     echo cc_json_encode($data);
 }
Exemple #4
0
 function image_upload()
 {
     $field_id = $this->input->get_post('id');
     $config = array('module' => 'shop_goods', 'isadmin' => 1, 'sts' => 0, 'class_id' => 1);
     $this->load->library('ifile_lib', $config);
     $this->ifile_lib->initialize();
     //配置初始化文件
     $this->ifile_lib->do_uploadfile($field_id);
     //上传附件
     $re_msg = $this->ifile_lib->error_data();
     $re_data = $this->ifile_lib->file_data();
     if (!empty($re_msg)) {
         $res['error'] = $re_msg[0];
         $json = cc_json_encode($res);
         echo $json;
         return false;
     }
     $this->file_id = $this->ifile_lib->save_data();
     //保存数据到数据库
     //if ($this->instance=='shop_goods'){
     /**生成水印图片**/
     //			$wm_info=$this->a_shop_model->get_one(array('shop_id'=>$this->shop_id),'shop_watermark');
     //			if(isset($wm_info['wm_model'])&& intval($wm_info['wm_model']) >0){
     //				/**生成水印**/
     //				$this->load->library('ithumb_lib');
     //				$full_path=$re_data['full_path'];
     //				$path_arr=explode('.',$full_path);
     //				$config['img_path']=$path_arr[0].'_b.'.$path_arr[1];
     //				$config['wm_model']=$wm_info['wm_model'];
     //				$config['wm_post']=$wm_info['wm_model']=='1'?$wm_info['txt_pos']:$wm_info['image_pos'];
     //
     //				$config['wm_txt']=$wm_info['txt'];
     //				$config['wm_txt_size']=$wm_info['txt_size'];
     //				$config['wm_txt_font']=$wm_info['txt_font'];
     //				$config['wm_txt_color']=$wm_info['txt_color'];
     //
     //				$config['wm_image_path']=$wm_info['image_path'];
     //				$config['wm_opacity']=$wm_info['image_transition'];
     //				$this->ithumb_lib->initialize($config);
     //				$this->ithumb_lib->water_mark();
     //			}
     //}
     $res['msg'] = 'success';
     $res['file_id'] = $this->file_id;
     $res['realname'] = $re_data['client_name'];
     $res['filename'] = $re_data['file_name'];
     $base_path = str_replace('\\', '/', FCPATH);
     $res['filepath'] = str_replace($base_path, '', $re_data['full_path']);
     $json = cc_json_encode($res);
     $json = new_stripslashes($json);
     echo $json;
     //$this->script="window.parent.do_uploadedfile('$json');";
     //$this->upload_iframe();
     return true;
 }