コード例 #1
0
ファイル: My_Controller.php プロジェクト: aidear/100event
 protected function _data($category, $related_id)
 {
     // TODO :: 编辑 分类名称,删除 分类,不显示无内容的分类
     $this->load->model("album_model");
     if ($this->input->post()) {
         if ($this->input->post('add_resource')) {
             $data = array();
             //查找该资源的信息
             $this->db->where('id', $this->input->post('alb_id'));
             $ablum_data = $this->db->get('album')->row_array();
             if (!empty($ablum_data)) {
                 $data['category'] = $ablum_data['category'];
                 $data['cat_id'] = $ablum_data['cat_id'];
             }
             // 添加资源内容
             $data['title'] = $this->input->post('title');
             $data['alb_id'] = $this->input->post('alb_id');
             $data['intro'] = $this->input->post('intro');
             $data['created'] = time();
             $data['updated'] = time();
             //if(!empty($data['title']) && !empty($data['intro']))
             if (!empty($data['title'])) {
                 $this->load->library('upload4');
                 $upload = new upload4();
                 // 实例化上传类
                 $upload->maxSize = 3145728;
                 // 设置附件上传大小
                 $upload->saveRule = 'uniqid';
                 // 上传文件命名规则
                 $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg', 'zip', 'rar', 'pdf', 'bmp', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'txt');
                 // 设置附件上传类型
                 $upload->savePath = 'upload/album/' . date('Ym', time()) . '/' . date('d', time()) . '/';
                 // 设置附件上传目录
                 if (!file_exists('upload/album/' . date('Ym', time()) . '/' . date('d', time()) . '/')) {
                     mkdir('upload/album/' . date('Ym', time()) . '/' . date('d', time()) . '/', 0777, true);
                     //大缩略图路径
                 }
                 if (!$upload->upload()) {
                     _reminder($upload->getErrorMsg());
                 } else {
                     $info = $upload->getUploadFileInfo();
                     foreach ($info as $key => $item) {
                         $pic_file = $item['savepath'] . $item['savename'];
                         $type = $item['extension'];
                     }
                 }
                 /*dump_echo($info);
                 					exit();
                 
                 					
                 					$this->upload4->maxSize  = 5242880 ;// 设置附件上传大小
                 					$this->upload4->allowExts  = array('jpg', 'gif', 'png', 'jpeg', 'zip', 'rar', 'pdf', 'bmp');// 设置附件上传类型
                 					$this->upload4->savePath =  'album/'.date('Ym',time()).'/'.date('d',time()).'/';// 设置附件上传目录
                 					if(!$this->upload4())// 上传错误提示错误信息
                 					{
                 						_reminder($upload->getErrorMsg());
                 					}
                 					else// 上传成功 获取上传文件信息
                 					{
                 						$info =  $upload->getUploadFileInfo();
                 					}
                 					dump_echo($info);
                 					exit();
                 
                 			
                 					// TODO :: 内容检查,类型区分
                 					//图片上传
                 					$this->load->library('upload3');
                 					$filedir = 'album/'.date('Ym',time()).'/'.date('d',time()).'/';
                 					$upload_obj = 'upload/';
                 					$this->upload3->field = 'pic';
                 					$this->upload3->set_dir($upload_obj, $filedir);
                 					$fs = $this->upload3->execute();
                 					foreach($fs as $item)
                 					{
                 						dump_echo($item);
                 						
                 						if($item['flag'] == -1)
                 						{
                 							_reminder('暂只支持图片格式、压缩文件格式、pdf格式,请重新上传!');
                 						}
                 						else if($item['flag'] == -2)
                 						{
                 							_reminder('上传的文件超过限制的文件大小,请重新上传!');
                 						}
                 						
                 						$pic_file = $upload_obj.$filedir.$item['name'];
                 						
                 					}
                 					exit();*/
                 $data['file_path'] = $pic_file;
                 $data['type'] = $type;
                 $data['display'] = $this->input->post('display');
                 $return = $this->album_model->save_resource($data);
                 if (!empty($return) && isset($return)) {
                     $this->_reminder('添加成功!');
                 } else {
                     $this->_reminder('添加失败!');
                 }
             } else {
                 $this->_reminder('输入的产品不能为空!');
             }
         } else {
             // 新建 专辑/相册
             $data = array();
             $data['user_id'] = $this->_user_id;
             $data['cat_id'] = $this->input->post('cat_id');
             $data['title'] = $this->input->post('title');
             //$data['intro'] = $this->input->post('intro');
             $data['created'] = time();
             $data['updated'] = time();
             $data['category'] = $category;
             $data['related_id'] = $related_id;
             if (!empty($data['title'])) {
                 $num = $this->album_model->save($data);
                 if (!empty($num) && isset($num)) {
                     if ($this->input->post('cc') == 1) {
                         $option = "<option value={$num}>" . $data['title'] . "</option>";
                         if ($data['cat_id'] == 1) {
                             $type = "zj";
                         } elseif ($data['cat_id'] == 2) {
                             $type = "xc";
                         }
                         $result = array('result' => 1, 'type' => $type, 'option' => $option);
                         echo json_encode($result);
                         exit;
                     } else {
                         $this->_reminder('新增成功!');
                     }
                 } else {
                     $this->_reminder('新增失败!');
                 }
             } else {
                 $this->_reminder('输入的栏目不能为空,请重新输入!');
             }
         }
     }
     //专辑列表
     $this->album_model->category = $category;
     $this->album_model->related_id = $related_id;
     foreach ($this->album_model->get_list() as $key => $item) {
         $this->_view_data[$key] = $item;
     }
     $this->_view_data['current_controller'] = '';
     //get_called_class();//strtolower(get_called_class());
 }
コード例 #2
0
ファイル: template.php プロジェクト: aidear/100event
 function deal_edit_template()
 {
     $this->logs('处理编辑模板');
     $post_data = $this->input->post();
     $arr_field = array('模板标题' => 'title', '描述' => 'intro', '模板类型' => 'type', '是否显示' => 'is_show', '排序' => 'sequence', '参数' => 'hide_id');
     foreach ($arr_field as $key => $value) {
         if (empty($post_data[$value])) {
             _reminder($key . '不能为空,请重新操作!');
         }
     }
     $this->load->library('upload4');
     $upload = new upload4();
     // 实例化上传类
     $upload->maxSize = 3145728;
     // 设置附件上传大小
     $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg', 'css');
     // 设置附件上传类型
     $upload->savePath = 'useful/css/template/';
     // 设置附件上传目录
     /*$upload->thumb = true;
     		$upload->thumbPrefix='b_';	 //设置缩略图的后缀
     		$upload->thumbMaxWidth='150';	//设置缩略图的宽度
     		$upload->thumbMaxHeight='150';	//设置缩略图的高度*/
     if (!$upload->upload()) {
         //_reminder($upload->getErrorMsg());
     } else {
         $info = $upload->getUploadFileInfo();
         $count_info = count($info);
         if ($count_info == 1) {
             _reminder('缺少文件没上传,请重新上传!');
         } else {
             if ($count_info == 2) {
                 $pic = $info[0]['savename'];
                 $css_file = $info[1]['savename'];
             }
         }
     }
     if (empty($pic)) {
         $pic = $post_data['hide_pic'];
     }
     if (empty($css_file)) {
         $css_file = $post_data['hide_css_file'];
     }
     $arr_insert = array('title', 'intro', 'type', 'is_show', 'sequence');
     foreach ($arr_insert as $item) {
         $data_insert[$item] = $post_data[$item];
     }
     $data_insert['id'] = $post_data['hide_id'];
     $data_insert['pic'] = $pic;
     $data_insert['css_file'] = $css_file;
     $data_insert['updated'] = time();
     $this->load->model('template_model');
     $num = $this->template_model->save($data_insert);
     if (!empty($num)) {
         _reminder('保存成功!');
     } else {
         _reminder('保存失败!');
     }
 }
コード例 #3
0
ファイル: exhibition.php プロジェクト: aidear/100event
 function deal_exh_excel()
 {
     $this->logs('会展excel导入操作');
     $post_data = $this->input->post();
     $this->load->library('chinesespell');
     $arr_model = array('user', 'company', 'ground', 'area', 'company_contact', 'place_order', 'exhibition');
     foreach ($arr_model as $item) {
         $this->load->model($item . '_model');
     }
     if (!empty($post_data['nick_name'])) {
         $where_find_user = array('nick_name' => $post_data['nick_name']);
         $data_find_user = $this->user_model->get_row_array($where_find_user);
         if (!empty($data_find_user)) {
             $user_id = $data_find_user['id'];
         } else {
             _reminder('你输入的会展不存在,请谨慎操作!');
         }
     } else {
         $where_find_user = array('nick_name' => '百亿小编');
         $data_find_user = $this->user_model->get_row_array($where_find_user);
         if (!empty($data_find_user)) {
             $user_id = $data_find_user['id'];
         } else {
             _reminder('系统默认的用户账户不存在,请先建立!');
         }
     }
     if (!empty($post_data['company_name'])) {
         $where_find_company = array('name' => $post_data['company_name']);
         $data_find_company = $this->company_model->get_row_array($where_find_company);
         if (!empty($data_find_company)) {
             $com_id = $data_find_company['id'];
         } else {
             _reminder('你输入的公司名称不存在,请谨慎操作!');
         }
     } else {
         $where_find_company = array('name' => '上海会展商务有限公司');
         $data_find_company = $this->company_model->get_row_array($where_find_company);
         if (!empty($data_find_company)) {
             $com_id = $data_find_company['id'];
         } else {
             _reminder('系统默认的公司账户不存在,请先建立!');
         }
     }
     $this->load->library('upload4');
     $upload = new upload4();
     // 实例化上传类
     $upload->allowExts = array('xls');
     // 设置附件上传类型
     $upload->savePath = 'upload/xls/';
     // 设置附件上传目录
     if (!$upload->upload()) {
         _reminder($upload->getErrorMsg());
     } else {
         $info = $upload->getUploadFileInfo();
         $file_name = $info[0]['savepath'] . $info[0]['savename'];
     }
     error_reporting(E_ALL ^ E_NOTICE);
     require_once 'third_part/Excel/reader.php';
     $data = new Spreadsheet_Excel_Reader();
     date_default_timezone_set('PRC');
     $data->setOutputEncoding('utf-8');
     $data->read($file_name);
     $list_result = $data->sheets[0]['cells'];
     //导入的excel表格的第一个shell数据结果
     $first_line_value = array_values(array_shift($list_result));
     //dump_echo($first_line_value);
     $arr_check = array('会展中文名称', '会展英文名称', '发布网站', '会展图片', '会展简介', '开始时间', '结束时间', '会展举办国', '会展举办省', '会展举办市', '会展场馆', '分馆', '会展场馆地址', '主办单位一', '主办单位一地址', '主办单位一联系人', '主办单位一联系人-电话', '主办单位一联系人-电邮', '主办单位二', '主办单位二地址', '主办单位二联系人', '主办单位二联系人-电话', '主办单位二联系人-电邮', '主办单位三', '主办单位三地址', '主办单位三联系人', '主办单位三联系人-电话', '主办单位三联系人-电邮', '其他主办单位', '承办单位一', '承办单位一地址', '承办单位一联系人', '承办单位一联系人-电话', '承办单位一联系人-电邮', '承办单位二', '承办单位二地址', '承办单位二联系人', '承办单位二联系人-电话', '承办单位二联系人-电邮', '承办单位三', '承办单位三地址', '承办单位三联系人', '承办单位三联系人-电话', '承办单位三联系人-电邮', '其他承办单位', '支持单位', '协办单位', '媒体单位', '赞助单位', '其他合作单位名一', '其他合作单位名二', '展品范围', '展会规模', '会展关键字', '参展价格', '广告费用', '会展类型', '官网网址', '行业', '编号');
     $arr_check = array_values($arr_check);
     if ($first_line_value != $arr_check) {
         _reminder('录入的字段格式不对,请谨慎操作!');
     }
     if (empty($list_result)) {
         _reminder('没有数据,请录入数据之后再导入!');
     }
     foreach ($list_result as $key => $item) {
         /******** 场地 start (判定该场地是否存在,如果已经存在,取该场地的id,场地的相关信息不用重新录入;不存在该场地,重新添加场地,填充相关的场地信息) ******/
         $where_find_ground = array('name' => $item[11]);
         $data_find_ground = $this->ground_model->get_row_array($where_find_ground);
         if (!empty($data_find_ground)) {
             $g_id = $data_find_ground['id'];
         } else {
             //国家 省 市的信息
             $country_id = $this->area_model->get_area_id($item[8]);
             $province_id = $this->area_model->get_area_id($item[9]);
             $city_id = $this->area_model->get_area_id($item[10]);
             $hanzi = iconv("UTF-8", "GBK//IGNORE", $item[11]);
             $hanzi = $this->chinesespell->getFullSpell($hanzi);
             $data_insert_ground = array('user_id' => $user_id, 'hanzi' => $hanzi, 'company_id' => $com_id, 'name' => $item[11], 'country' => $country_id, 'province' => $province_id, 'city' => $city_id, 'address' => $item[13]);
             @($data_ground = $this->ground_model->insert($data_insert_ground));
             $g_id = $data_ground;
         }
         /******** 场地 end ******/
         //主办单位及其他单位的一些信息 start
         $arr_host = array(array('name' => $item[14], 'address' => $item[15], 'contact' => $item[16], 'telephone' => $item[17], 'email' => $item[18]), array('name' => $item[19], 'address' => $item[20], 'contact' => $item[21], 'telephone' => $item[22], 'email' => $item[23]), array('name' => $item[24], 'address' => $item[25], 'contact' => $item[26], 'telephone' => $item[27], 'email' => $item[28]));
         $host_string = '';
         foreach ($arr_host as $k => $v) {
             if (!empty($v['name'])) {
                 $where_find_host = array('name' => $v['name']);
                 $data_find_host = $this->company_model->get_row_array($where_find_host);
                 //主办单位不存在的时候 先创建该公司 及联系人的一些资料;存在的时候直接调用名称为主办单位
                 if (empty($data_find_host)) {
                     $hanzi = iconv("UTF-8", "GBK//IGNORE", $v['name']);
                     $hanzi = $this->chinesespell->getFullSpell($hanzi);
                     $data_insert_host = array('user_id' => $user_id, 'name' => $v['name'], 'hanzi' => $hanzi, 'address' => $v['address'], 'address_pub' => 1, 'telephone' => $v['telephone'], 'telephone_pub' => 1, 'email' => $v['email'], 'email_pub' => 1);
                     $insert_company_id = $this->company_model->insert($data_insert_host);
                 } else {
                     $insert_company_id = $data_find_host['id'];
                 }
                 if (!empty($insert_company_id) && !empty($v['contact'])) {
                     //判断该联系人是否存在
                     $find_contact_zai = array('com_id' => $insert_company_id, 'username' => $v['contact']);
                     $find_contact_zai_num = $this->company_contact_model->get_row_array($find_contact_zai);
                     if (empty($find_contact_zai_num)) {
                         $data_insert_contact = array('com_id' => $insert_company_id, 'username' => $v['contact'], 'created' => time());
                         $this->company_contact_model->insert($data_insert_contact);
                     }
                 }
                 $host_string .= $v['name'] . ',';
             }
         }
         //主办单位的每个单位
         $host_string = trim($host_string, ',');
         //主办单位及其他单位的一些信息 end
         //承办单位及其他单位的一些信息 start
         $arr_organize = array(array('name' => $item[30], 'address' => $item[31], 'contact' => $item[32], 'telephone' => $item[33], 'email' => $item[34]), array('name' => $item[35], 'address' => $item[36], 'contact' => $item[37], 'telephone' => $item[38], 'email' => $item[39]), array('name' => $item[40], 'address' => $item[41], 'contact' => $item[42], 'telephone' => $item[43], 'email' => $item[44]));
         $organize_string = '';
         foreach ($arr_organize as $k => $v) {
             if (!empty($v['name'])) {
                 $where_find_organize = array('name' => $v['name']);
                 $data_find_organize = $this->company_model->get_row_array($where_find_organize);
                 if (empty($data_find_organize)) {
                     $hanzi = iconv("UTF-8", "GBK//IGNORE", $v['name']);
                     $hanzi = $this->chinesespell->getFullSpell($hanzi);
                     $data_insert_organize = array('user_id' => $user_id, 'hanzi' => $hanzi, 'name' => $v['name'], 'address' => $v['address'], 'address_pub' => 1, 'telephone' => $v['telephone'], 'telephone_pub' => 1, 'email' => $v['email'], 'email_pub' => 1);
                     $num_insert_organize = $this->company_model->insert($data_insert_organize);
                 } else {
                     $num_insert_organize = $data_find_organize['id'];
                 }
                 if (!empty($num_insert_organize) && !empty($v['contact'])) {
                     //判断该联系人是否存在
                     $find_concact_organize_zai = array('com_id' => $num_insert_organize, 'username' => $v['contact']);
                     $find_concact_organize_zai_num = $this->company_contact_model->get_row_array($find_concact_organize_zai);
                     if (empty($find_concact_organize_zai_num)) {
                         $data_insert_contact = array('com_id' => $num_insert_organize, 'username' => $v['contact'], 'created' => time());
                         $this->company_contact_model->insert($data_insert_contact);
                     }
                 }
                 $organize_string .= $v['name'] . ',';
             }
         }
         $organize_string = trim($organize_string, ',');
         //承办单位及其他单位的一些信息 end
         //支持单位 start
         $support_string = '';
         if (!empty($item[46])) {
             $arr_support = explode(',', trim($item[46], ','));
             if (!empty($arr_support)) {
                 foreach ($arr_support as $k => $v) {
                     $name = trim($v, ' ');
                     $find_support_com = array('name' => $v);
                     $num_support_com = $this->company_model->get_row_array($find_support_com);
                     //把不存在站内的支持单位 添加到站内
                     if (empty($num_support_com)) {
                         $hanzi = iconv("UTF-8", "GBK//IGNORE", $v);
                         $hanzi = $this->chinesespell->getFullSpell($hanzi);
                         $insert_support_com = array('name' => $v, 'hanzi' => $hanzi, 'user_id' => $user_id);
                         $this->company_model->insert($insert_support_com);
                     }
                 }
             }
             $support_string = trim($item[46], ',');
         }
         //支持单位 end
         //协办单位 start
         $co_organize_string = '';
         if (!empty($item[47])) {
             $arr_co_organize = explode(',', trim($item[47], ','));
             if (!empty($arr_co_organize)) {
                 foreach ($arr_co_organize as $k => $v) {
                     $name = trim($v, ' ');
                     $find_co_organize = array('name' => $v);
                     $num_co_organize = $this->company_model->get_row_array($find_co_organize);
                     if (empty($num_co_organize)) {
                         $hanzi = iconv("UTF-8", "GBK//IGNORE", $v);
                         $hanzi = $this->chinesespell->getFullSpell($hanzi);
                         $insert_co_organize = array('name' => $v, 'hanzi' => $hanzi, 'user_id' => $user_id);
                         $this->company_model->insert($insert_co_organize);
                     }
                 }
             }
             $co_organize_string = trim($item[47], ',');
         }
         //协办单位 end
         //媒体单位 start
         $media_string = '';
         if (!empty($item[48])) {
             $arr_media = explode(',', trim($item[48], ','));
             if (!empty($arr_media)) {
                 foreach ($arr_media as $k => $v) {
                     $name = trim($v, ' ');
                     $find_media = array('name' => $v);
                     $num_media = $this->company_model->get_row_array($find_media);
                     if (empty($num_media)) {
                         $hanzi = iconv("UTF-8", "GBK//IGNORE", $v);
                         $hanzi = $this->chinesespell->getFullSpell($hanzi);
                         $insert_media = array('name' => $v, 'hanzi' => $hanzi, 'user_id' => $user_id);
                         $this->company_model->insert($insert_media);
                     }
                 }
             }
             $media_string = trim($item[48], ',');
         }
         //媒体单位 end
         //赞助单位 start
         $sponsor_string = '';
         if (!empty($item[49])) {
             $arr_sponsor = explode(',', trim($item[49], ','));
             if (!empty($arr_sponsor)) {
                 foreach ($arr_sponsor as $k => $v) {
                     $name = trim($v, ' ');
                     $find_sponsor = array('name' => $v);
                     $num_sponsor = $this->company_model->get_row_array($find_sponsor);
                     if (empty($num_sponsor)) {
                         $hanzi = iconv("UTF-8", "GBK//IGNORE", $v);
                         $hanzi = $this->chinesespell->getFullSpell($hanzi);
                         $insert_sponsor = array('name' => $v, 'hanzi' => $hanzi, 'user_id' => $user_id);
                         $this->company_model->insert($insert_sponsor);
                     }
                 }
             }
             $sponsor_string = trim($item[49], ',');
         }
         //赞助单位 end
         //行业信息
         if (!empty($item[59])) {
             $business = $item[59];
         } else {
             $business = '其他';
         }
         //会展的logo图片 start
         if (!empty($item[4])) {
             $pic = $item[4];
         } else {
             $pic = "useful/img/exhibition_default.jpg";
         }
         //会展的logo图片 end
         //会展的录入(当前会展不存在的时候,录入表格的一系列的信息) start
         //其他单位
         @($danwei_exb = $item[50] . ',' . $item[51]);
         $find_exhibition = array('title' => $item[1], 'user_id' => $user_id);
         $num_exhibition = $this->exhibition_model->get_row_array($find_exhibition);
         if (empty($num_exhibition)) {
             $hanzi = iconv("UTF-8", "GBK//IGNORE", $item[1]);
             $hanzi = $this->chinesespell->getFullSpell($hanzi);
             $insert_exhibition_data = array('title' => $item[1], 'hanzi' => $hanzi, 'en_title' => $item[2], 'user_id' => $user_id, 'pic' => $pic, 'intro' => $item[5], 'begin_time' => excel_time($item[6]), 'end_time' => excel_time($item[7]), 'host' => $host_string, 'ext_host' => $item[29], 'organize' => $organize_string, 'ext_organize' => $item[45], 'support' => $support_string, 'co_organize' => $co_organize_string, 'media' => $media_string, 'sponsor' => $sponsor_string, 'danwei_exb' => $danwei_exb, 'product_range' => $item[52], 'dimensions' => $item[53], 'keyword' => $item[54], 'type' => $item[57], 'website' => $item[58], 'business' => $business, 'num' => $item[60]);
             $num_exhibition_data = $this->exhibition_model->insert($insert_exhibition_data);
             if (!empty($num_exhibition_data)) {
                 //生成广告栏位 start
                 $new_id = $num_exhibition_data;
                 //会展广告栏为的信息
                 $this->load->model('exhibition_ads_model');
                 $this->load->model('ads_images_model');
                 //会展的广告位
                 //通栏的广告位(1、2、3页) start
                 $exh_id = $new_id;
                 for ($i = 1; $i < 4; $i++) {
                     switch ($i) {
                         case 1:
                             $name = '一';
                             break;
                         case 2:
                             $name = '二';
                             break;
                         case 3:
                             $name = '三';
                             break;
                     }
                     $data = array(array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-T", 'page' => $i, 'type' => 1), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-T", 'page' => $i, 'type' => 1), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-H-1", 'page' => $i, 'type' => 2), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-H-2", 'page' => $i, 'type' => 2), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-H-1", 'page' => $i, 'type' => 2), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-H-2", 'page' => $i, 'type' => 2), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-F-1", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-F-2", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-F-3", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-T-F-4", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-F-1", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-F-2", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-F-3", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-B-F-4", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-L-1", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-L-2", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-L-3", 'page' => $i, 'type' => 3), array('exh_id' => $exh_id, 'num' => "E-{$exh_id}-{$i}-L-4", 'page' => $i, 'type' => 3));
                     $this->db->insert_batch('hz_exhibition_ads', $data);
                     unset($data);
                 }
                 //竖栏会展的广告位 end
                 //生成广告栏位 end
                 $insert_place_order = array('exb_id' => $num_exhibition_data, 'pla_id' => $g_id, 'user_id' => $user_id, 'status' => 1, 'created' => time(), 'agree_time' => time());
                 $this->place_order_model->insert($insert_place_order);
                 //自动生成默认评论 start
                 //系统自动生成默认评论一
                 $comment_title = "欢迎您来到百亿网#" . $item[1] . "#讨论区!";
                 $comment_content = "在这里您可以发表对本次会展的看法,也可以与本次会展的主办者、展商、供应商、观众展开深度讨论!";
                 $insert_comment = array('user_id' => $user_id, 'exb_id' => $num_exhibition_data, 'title' => $comment_title, 'content' => $comment_content, 'is_auto' => 1, 'created' => time(), 'updated' => time(), 'auto_type' => 1);
                 $this->load->model('comment_model');
                 $this->comment_model->insert($insert_comment);
                 //系统自动生成默认评论二
                 $comment_title1 = "评论区功能手册";
                 $comment_content1 = "如何加入讨论区?\r\n\t\t\t\t\t本站每个页面的右上方都有会展世界注册的链接,点击后填写相关内容即可成为会展世界的注册用户,拥有在评论区发帖的权限。\r\n\r\n\t\t\t\t\t如何登陆会展世界?\r\n\t\t\t\t\t本站每个页面的右上方都有会展世界登录链接,点击后填写用户名、密码和验证码即可登陆。\r\n\r\n\t\t\t\t\t如何发表新帖?如何回复?\r\n\t\t\t\t\t找到相应的会展首页,点击“发表新帖”即可发表新帖,你也可在帖子页里点击“发表新帖”发表帖子。\r\n\t\t\t\t\t帖子页每一楼都有“回复”按钮,点击即可跳转到回复框,你也可到帖子页最下面的回复框进行回复。\r\n\r\n\t\t\t\t\t如何上传图片?如何贴图?\r\n\t\t\t\t\t在发表文章(或回复)时,点击编辑框中的“上传图片”——“浏览”即可把电脑中的图片上传到论坛。\r\n\r\n\t\t\t\t\t如何修改个人资料?\r\n\t\t\t\t\t登陆后点击右上角自己的用户名,进入自己的主页,在左侧头像下方点击“管理我的信息”即可对个人资料进行编辑修改,然后点击完成即修改完毕。\r\n\r\n\t\t\t\t\t如何加关注?\r\n\t\t\t\t\t进入任一用户的主页,在其头像下方点击“关注”,提示添加关注成功即可。\r\n\r\n\t\t\t\t\t如何发私信?如何查看私信?\r\n\t\t\t\t\t登陆后在自己主页点击“我的私信”,或在对方用户主页的头像下点击“给Ta写私信”即可发站内私信。\r\n\t\t\t\t\t登陆后在自己主页点击“我的私信”,或在右上角点击私信提醒即可查看站内私信。\r\n\r\n\r\n\t\t\t\t\t如何查看我发表或回复的主题?\r\n\t\t\t\t\t登陆后,点击“我的主页”即可查看你发表或回复的主题\r\n\r\n\t\t\t\t\t为什么我的主题或回复会被删除?\r\n\t\t\t\t\t各版块均有版规,如果网友违反版规规定,管理员或者版主有权删除帖子,对于严重违反规定的做封id处理,并不另外做任何解释。\r\n\r\n\t\t\t\t\t如何查看论坛的最热话题?\r\n\t\t\t\t\t在论坛首页有“论坛热议话题”,那里汇聚了论坛的热门话题。\r\n\r\n\t\t\t\t\t标题前面的图标表示什么意思?\r\n\t\t\t\t\t——精华帖\r\n\t\t\t\t\t——下水道贴,只能在下水道区查看和回复的帖子\r\n\r\n\r\n\t\t\t\t\t如果你在使用过程中遇到其他不懂的问题,请在站务讨论版发帖咨询,其他板块一律删除。";
                 $insert_comment1 = array('user_id' => $user_id, 'exb_id' => $num_exhibition_data, 'title' => $comment_title1, 'content' => $comment_content1, 'is_auto' => 1, 'created' => time(), 'updated' => time(), 'auto_type' => 2);
                 $this->load->model('comment_model');
                 $this->comment_model->insert($insert_comment1);
                 //系统自动生成默认评论三
                 $comment_title2 = "优惠服务";
                 $comment_content2 = "近期本站将推出XXXX优惠服务,请各位注意申请使用。\r\n\t\t\t\t\t优惠详情如下:\r\n\t\t\t\t\t1\r\n\t\t\t\t\t2\r\n\t\t\t\t\t3\r\n\t\t\t\t\t4\r\n\t\t\t\t\t5\r\n\t\t\t\t\t6";
                 $insert_comment2 = array('user_id' => $user_id, 'exb_id' => $num_exhibition_data, 'title' => $comment_title2, 'content' => $comment_content2, 'is_auto' => 1, 'created' => time(), 'updated' => time(), 'auto_type' => 3);
                 $this->load->model('comment_model');
                 $this->comment_model->insert($insert_comment2);
                 //自动生成默认评论 end
             }
         } else {
             $hanzi = iconv("UTF-8", "GBK//IGNORE", $item[1]);
             $hanzi = $this->chinesespell->getFullSpell($hanzi);
             $insert_exhibition_data = array('id' => $num_exhibition['id'], 'hanzi' => $hanzi, 'title' => $item[1], 'en_title' => $item[2], 'user_id' => $user_id, 'pic' => $pic, 'intro' => $item[5], 'begin_time' => excel_time($item[6]), 'end_time' => excel_time($item[7]), 'host' => $host_string, 'ext_host' => $item[29], 'organize' => $organize_string, 'ext_organize' => $item[45], 'support' => $support_string, 'co_organize' => $co_organize_string, 'media' => $media_string, 'sponsor' => $sponsor_string, 'danwei_exb' => $danwei_exb, 'product_range' => $item[52], 'dimensions' => $item[53], 'keyword' => $item[54], 'type' => $item[57], 'website' => $item[58], 'business' => $business, 'num' => $item[60]);
             $num_exhibition_data = $this->exhibition_model->save($insert_exhibition_data);
             if (!empty($num_exhibition_data)) {
                 $find_ground_data = array('exb_id' => $num_exhibition_data, 'pla_id' => $g_id);
                 $find_ground_num = $this->place_order_model->get_row_array($find_ground_data);
                 if (empty($find_ground_num)) {
                     $insert_place_order = array('exb_id' => $num_exhibition_data, 'pla_id' => $g_id, 'user_id' => $user_id, 'status' => 1, 'created' => time(), 'agree_time' => time());
                     $this->place_order_model->insert($insert_place_order);
                 }
             }
         }
         //会展的录入(当前会展不存在的时候,录入表格的一系列的信息) end
     }
     unlink($file_name);
     _reminder('批量导入成功!');
 }
コード例 #4
0
ファイル: myinfo.php プロジェクト: aidear/100event
 function identify()
 {
     $this->load->model('user_model');
     if ($this->input->post()) {
         $post_data = $this->input->post();
         $this->load->library('upload4');
         $upload = new upload4();
         $upload->maxSize = 3145728;
         // 设置附件上传大小
         $filepath = "./upload/user/identify/";
         $upload->allowExts = array('jpg', 'png', 'jpeg', 'tlf');
         // 设置附件上传类型
         $upload->savePath = $filepath;
         // 设置附件上传目录
         $upload->saveRule = 'uniqid';
         $toSave = true;
         if (!$upload->upload()) {
             $toSave = false;
             $err = $upload->getErrorMsg();
             // 				_reminder($upload->getErrorMsg());
         } else {
             // 上传成功 获取上传文件信息
             $info = $upload->getUploadFileInfo();
             $count_info = count($info);
             $data_insert['id'] = $this->session->userdata('uid');
             if ($post_data['step'] == 1) {
                 if ($count_info == 2) {
                     $pattern = "/(^\\d{15}\$)|(^\\d{17}([0-9]|X)\$)/";
                     if (!preg_match($pattern, $post_data['id_card_number'])) {
                         $toSave = false;
                         $err = '身份证号码不正确,请重新输入!';
                         // 							_reminder('身份证号码不正确,请重新输入!');
                     } else {
                         $arr_insert = array('first_name', 'last_name', 'id_card_number');
                         foreach ($arr_insert as $key => $item) {
                             $data_insert[$item] = $post_data[$item];
                         }
                         $data_insert['id_card_front'] = $filepath . $info[0]['savename'];
                         $data_insert['id_card_verso'] = $filepath . $info[1]['savename'];
                     }
                 } else {
                     $toSave = false;
                     $err = '请上传正反俩张扫描件或照片!';
                     // 						_reminder('请上传正反俩张扫描件或照片!');
                 }
             } else {
                 if ($post_data['step'] == 2) {
                     $arr_insert = array('company', 'job_title');
                     foreach ($arr_insert as $item) {
                         $data_insert[$item] = $post_data[$item];
                     }
                     $this->load->model('company_model');
                     $where_company = array('name' => $post_data['company']);
                     $data_company = $this->company_model->get_row_array($where_company);
                     if (!empty($data_company)) {
                         $data_insert['company_id'] = $data_company['id'];
                     } else {
                         $toSave = false;
                         $err = '该公司不存在100event里,请重新输入!';
                         // 						_reminder('该公司不存在100event里,请重新输入!');
                     }
                     $data_insert['exh_certify_file'] = $filepath . $info[0]['savename'];
                 } else {
                     if ($post_data['step'] == 3) {
                         //xingde.wei add new event certify
                         $data_insert['event_certify_file'] = $filepath . $info[0]['savename'];
                     } else {
                         if ($post_data['step'] == 4) {
                             $data_insert['more_file'] = $filepath . $info[0]['savename'];
                         }
                     }
                 }
             }
             if ($toSave) {
                 $this->user_model->save($data_insert);
             }
         }
         if (isset($err)) {
             $this->_view_data['err'] = $err;
         }
     }
     $user_id = $this->_user_id;
     $where_user = array('id' => $user_id);
     $data_user = $this->user_model->get_row_array($where_user);
     if (isset($err)) {
         $data_user = array_merge($data_user, $post_data);
     }
     if (!empty($data_user)) {
         $this->_view_data['arr_user'] = $data_user;
     }
     $this->_view_data['current_method'] = 'identify';
     $this->_template('myinfo_identify');
 }
コード例 #5
0
ファイル: company.php プロジェクト: aidear/100event
 function deal_company_product_excel()
 {
     $this->logs('导入公司产品');
     //先查找百亿小编这个账号是否存在
     $this->db->where('nick_name', '百亿小编');
     $user_data = $this->db->get('user')->row_array();
     if (!empty($user_data)) {
         $user_id = $user_data['id'];
     } else {
         _reminder('木有百亿小编这个用户,请先创建该用户');
     }
     $this->load->library('upload4');
     $upload = new upload4();
     // 实例化上传类
     $upload->allowExts = array('xls');
     // 设置附件上传类型
     $upload->savePath = 'upload/xls/';
     // 设置附件上传目录
     if (!$upload->upload()) {
         _reminder($upload->getErrorMsg());
     } else {
         $info = $upload->getUploadFileInfo();
         $file_name = $info[0]['savepath'] . $info[0]['savename'];
     }
     error_reporting(E_ALL ^ E_NOTICE);
     require_once 'third_part/Excel/reader.php';
     $data = new Spreadsheet_Excel_Reader();
     date_default_timezone_set('PRC');
     $data->setOutputEncoding('utf-8');
     $data->read($file_name);
     $list_result = $data->sheets[0]['cells'];
     //导入的excel表格的第一个shell数据结果
     $first_line_value = array_values(array_shift($list_result));
     $arr_check = array('序号', '公司中文名', '产品栏目', '产品名称', '产品详细-图片', '产品详细-标签', '产品详细-描述');
     $arr_check = array_values($arr_check);
     if ($first_line_value != $arr_check) {
         _reminder('录入的字段格式不对,请谨慎操作!');
     }
     if (empty($list_result)) {
         _reminder('没有数据,请录入数据之后再导入!');
     }
     //公司产品信息的处理
     if (!empty($list_result)) {
         foreach ($list_result as $item) {
             //先判断该公司是否存在
             $this->db->where('name', $item[2]);
             $check_company = $this->db->get('company')->row_array();
             if (!empty($check_company)) {
                 $company_id = $check_company['id'];
                 //该栏目不为空的时候 才执行下面的操作
                 if (!empty($item[3])) {
                     //判断该栏目是否已经存在该公司
                     $this->db->where('company_id', $company_id);
                     $this->db->where('name', $item[3]);
                     $check_category = $this->db->get('product_category')->row_array();
                     if (!empty($check_category)) {
                         $category_id = $check_category['id'];
                     } else {
                         $create_category = array('user_id' => $user_id, 'company_id' => $company_id, 'name' => $item[3], 'created' => time(), 'product_count' => 1);
                         $this->db->insert('product_category', $create_category);
                         $category_id = $this->db->insert_id();
                     }
                     if (!empty($item[4])) {
                         //先判断该产品是否已存在
                         $this->db->where('company_id', $company_id);
                         $this->db->where('category_id', $category_id);
                         $this->db->where('title', $item[4]);
                         $check_product = $this->db->get('product')->row_array();
                         if (empty($check_product)) {
                             $insert_product = array('company_id' => $company_id, 'user_id' => $user_id, 'category_id' => $category_id, 'title' => $item[4], 'pic' => $item[5], 'tags' => $item[6], 'intro' => $item[7], 'created' => time());
                             $this->db->insert('product', $insert_product);
                         } else {
                             $update_product = array('user_id' => $user_id, 'pic' => $item[5], 'tags' => $item[6], 'intro' => $item[7]);
                             $this->db->where('id', $check_product['id']);
                             $this->db->update('product', $update_product);
                         }
                     }
                 }
             }
         }
     }
     unlink($file_name);
     _reminder('导入成功!');
 }
コード例 #6
0
ファイル: deal_exhibition.php プロジェクト: aidear/100event
 function deal_exhibition_zz()
 {
     $post_data = $this->input->post();
     $user_id = $this->session->userdata('uid');
     if (empty($user_id)) {
         _reminder('您还未登陆,此操作非法!');
     }
     if (empty($post_data['hide_exh_id'])) {
         _reminder('缺少参数,请谨慎操作!');
     }
     $this->load->library('upload4');
     $upload = new upload4();
     // 实例化上传类
     $upload->maxSize = 3145728;
     // 设置附件上传大小
     $upload->saveRule = 'uniqid';
     switch ($post_data['hide_step']) {
         case 1:
             $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg', 'tif');
             break;
         case 2:
         case 3:
             $upload->allowExts = array('doc', 'pdf', 'docx');
             break;
         default:
             $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg', 'doc', 'pdf', 'docx');
             // 设置附件上传类型
             break;
     }
     $upload->savePath = 'upload/exh_pic/' . date('Ym', time()) . '/' . date('d', time()) . '/';
     // 设置附件上传目录
     if (!$upload->upload()) {
         _reminder($upload->getErrorMsg());
     } else {
         $info = $upload->getUploadFileInfo();
         $file = $info[0]['savepath'] . $info[0]['savename'];
     }
     $insert_data = '';
     if ($post_data['hide_step'] == '1') {
         $insert_data['zz_pic'] = $file;
     } else {
         if ($post_data['hide_step'] == 2) {
             $insert_data['ground_contract'] = $file;
         } else {
             if ($post_data['hide_step'] == 3) {
                 $insert_data['approval_book'] = $file;
             }
         }
     }
     $insert_data['exh_id'] = $post_data['hide_exh_id'];
     $insert_data['user_id'] = $user_id;
     $insert_data['updated'] = time();
     $this->load->model('exhibition_identify_model');
     $where_ei = array('exh_id' => $post_data['hide_exh_id']);
     $data_ei = $this->exhibition_identify_model->get_row_array($where_ei);
     if (!empty($data_ei)) {
         $insert_data['id'] = $data_ei['id'];
         $num_data = $this->exhibition_identify_model->save($insert_data);
     } else {
         $insert_data['created'] = time();
         $num_data = $this->exhibition_identify_model->insert($insert_data);
     }
     if (!empty($num_data)) {
         _reminder('上传成功!');
     } else {
         _reminder('上传失败!');
     }
 }