function deal_upload($data = '') { $config['upload_path'] = './upload/recommond/'; $config['allowed_types'] = 'gif|jpg|png'; $this->load->library('upload', $config); if (!$this->upload->do_upload('pic')) { if ($data == 'add') { $error = array('error' => $this->upload->display_errors()); _reminder($error['error']); } } else { //上传成功之后,生成两张缩略图 $data = $this->upload->data(); //返回上传图片的信息 $this->load->library("image_lib"); //载入图像处理类库 //大图缩略图 $config_big_thumb = array('image_library' => 'gd2', 'source_image' => $data['full_path'], 'new_image' => "./upload/recommond/b_" . $data['file_name'], 'create_thumb' => true, 'maintain_ratio' => true, 'width' => 200, 'height' => 200, 'thumb_marker' => ""); //小图缩略图 $config_small_thumb = array('image_library' => 'gd2', 'source_image' => $data['full_path'], 'new_image' => "./upload/recommond/s_" . $data['file_name'], 'create_thumb' => true, 'maintain_ratio' => true, 'width' => 40, 'height' => 40, 'thumb_marker' => ""); $this->image_lib->initialize($config_big_thumb); $this->image_lib->resize(); //生成small缩略图 $this->image_lib->initialize($config_small_thumb); $this->image_lib->resize(); //生成small缩略图 return $data; } }
function delete_contact() { $id = $this->input->get('id'); $this->load->model('company_contact_model'); $a_data['id'] = $id; $a_num = $this->company_contact_model->delete($a_data); if (!empty($a_num) && isset($a_num)) { _reminder('删除用户成功!'); } else { _reminder('删除用户失败!'); } }
function upload_company_image($field, $type = 'add') { $config['upload_path'] = './upload/company/'; if (!file_exists("./upload/company/")) { mkdir("./upload/company/", 0777, true); //大缩略图路径 } $config['allowed_types'] = 'gif|jpg|png'; $this->load->library('upload', $config); if (!$this->upload->do_upload($field)) { if ($field != 'logo') { if ($type != 'save') { $error = array('error' => $this->upload->display_errors()); _reminder($error['error']); } } } else { //上传成功之后,生成两张缩略图 $data = $this->upload->data(); //返回上传图片的信息 $this->load->library("image_lib"); //载入图像处理类库 //大图缩略图 $config_big_thumb = array('image_library' => 'gd2', 'source_image' => $data['full_path'], 'new_image' => "./upload/company/b_" . $data['file_name'], 'create_thumb' => true, 'maintain_ratio' => true, 'width' => 200, 'height' => 200, 'thumb_marker' => ""); /*//小图缩略图 $config_small_thumb=array( 'image_library' => 'gd2',//gd2图库 'source_image' => $data['full_path'],//原图 'new_image' => "./upload/recommond/s_".$data['file_name'],//小缩略图 'create_thumb' => true,//是否创建缩略图 'maintain_ratio' => true, 'width' => 40,//缩略图宽度 'height' => 40,//缩略图的高度 'thumb_marker'=>""//缩略图名字后加上 "",可以代表是一个的缩略图 );*/ $this->image_lib->initialize($config_big_thumb); $this->image_lib->resize(); //生成small缩略图 /*$this->image_lib->initialize($config_small_thumb); $this->image_lib->resize();//生成small缩略图*/ return $data; } }
function upload_ground_image($field, $type = 'add') { $config['upload_path'] = './upload/ground_pic/'; if (!file_exists("./upload/ground_pic/")) { mkdir("./upload/ground_pic/", 0777, true); //大缩略图路径 } $config['allowed_types'] = 'gif|jpg|png'; $this->load->library('upload', $config); if (!$this->upload->do_upload($field)) { if ($field != 'logo') { if ($type != 'save') { $error = array('error' => $this->upload->display_errors()); _reminder($error['error']); } } } else { //上传成功之后,生成两张缩略图 $data = $this->upload->data(); //返回上传图片的信息 return $data; } }
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('批量导入成功!'); }
function deal_advert_upload() { $post_data = $this->input->post(); $dir_date = date('Ymd'); $config['upload_path'] = "./upload/advert/{$dir_date}"; if (!file_exists("./upload/advert/{$dir_date}")) { mkdir("./upload/advert/{$dir_date}", 0777, true); //大缩略图路径 } $config['allowed_types'] = 'gif|jpg|png'; $config['file_name'] = date('YmdHis', time()); $this->load->library('upload', $config); if (!$this->upload->do_upload('file')) { $error = array('error' => $this->upload->display_errors()); $this->load->view('upload_form', $error); _reminder($this->upload->display_errors()); } else { $pic_data = $this->upload->data(); //$this->load->view('upload_success', $data); } $this->db->where('id', $post_data['hide_id']); $advert_data = $this->db->get('reservation_ads')->row_array(); if (!empty($advert_data)) { $updated_data['pic'] = "upload/advert/{$dir_date}/" . $pic_data['file_name']; $this->db->where('id', $post_data['hide_id']); $updated_data['is_pass'] = 3; if (trim($this->input->post('address'))) { $updated_data['address'] = $this->input->post('address'); } if (trim($this->input->post('instructions'))) { $updated_data['instructions'] = $this->input->post('instructions'); } $this->db->update('reservation_ads', $updated_data); _reminder('上传成功!'); } else { _reminder('上传失败!'); } }
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()); }
function deal_comment_reply() { $post_data = $this->input->post(); if (empty($post_data['content'])) { _reminder('回复的内容给不能为空!'); } if (empty($post_data['user_id'])) { _reminder('未登录不能回复'); } $data = array('user_id' => $post_data['user_id'], 'comment_id' => $post_data['c_id'], 'content' => $post_data['content'], 'created' => time()); $this->load->model('comment_reply_model'); $num = $this->comment_reply_model->insert($data); if (!empty($num)) { _reminder('回复成功!'); } else { _reminder('回复失败!'); } }
function diary_modify() { $post_data = $this->input->post(); $title = $post_data['title']; $content = $post_data['content']; $diary_id = $post_data['diary_id']; if (empty($title)) { _reminder('修改的标题不能为空!'); } $this->load->model('diary_model'); $a_data = array('id' => $diary_id); $a_num = $this->diary_model->get_row_array($a_data); $modify_data = array('id' => $diary_id, 'title' => $title, 'content' => $content, 'updated' => time()); $modify_num = $this->diary_model->save($modify_data); if (!empty($modify_num)) { _reminder('修改成功!'); } else { _reminder('修改失败!'); } }
function all_delete_res_page_advert() { $this->logs('批量删除预定的广告信息'); $post_data = $this->input->post(); if (!empty($post_data['ids'])) { foreach ($post_data['ids'] as $key => $item) { $this->db->where('id', $item); $images_data = $this->db->get('ads_images')->row_array(); if (!empty($images_data)) { $update_images_data = array('is_rent' => 0, 'ads_pic' => ''); $this->db->where('id', $images_data['id']); $num = $this->db->update('ads_images', $update_images_data); if ($num) { $this->db->where('id', $item); $del_num = $this->db->delete('reservation_ads'); if (!empty($del_num)) { _reminder('删除成功!'); } else { _reminder('删除失败!'); } } else { _reminder('操作失败!'); } } } } }
function deal_password() { $post_data = $this->input->post(); $arr_field = array('昵称' => 'nick_name', '邮箱' => 'email', '验证码' => 'verify_code'); foreach ($arr_field as $key => $item) { if (empty($post_data[$item])) { _reminder($key . '不能为空,请重新输入!'); } } //验证码 //strtolower($captcha) == strtolower($this->session->userdata('captcha')) }
function edit_company_permission() { $post_data = $this->input->post(); //$arr_field = array('company_id'=>'参数','com_per_id'=>'参数','username'=>'主管名称','password'=>'密码','repassword'=>'确认密码'); $arr_field = array('company_id' => '参数', 'com_per_id' => '参数', 'username' => '主管名称'); foreach ($arr_field as $key => $item) { if (empty($post_data[$key])) { _reminder($item . '不能为空,请重新输入!'); } } // if($post_data['password'] != $post_data['repassword']) // { // $this->_reminder('俩次输入的密码不一致,请重新输入!'); // } if (!empty($post_data['checkbox'])) { $permission = implode($post_data['checkbox'], '|'); } else { $permission = ''; } $this->load->model('company_permission_model'); if (empty($permission)) { $where_delete = array('id' => $post_data['com_per_id']); $num = $this->company_permission_model->delete($where_delete); } else { $this->load->model('user_model'); $where_user = array('nick_name' => $post_data['username']); $data_user = $this->user_model->get_row_array($where_user); if (!empty($data_user)) { $user_id = $data_user['id']; } else { $user_id = ''; } $time = time(); //xingde.wei //$where_per = array('id'=>$post_data['com_per_id'],'company_id'=>$post_data['company_id'],'user_id'=>$user_id,'username'=>$post_data['username'],'password'=>$post_data['password'],'permission'=>$permission,'updated'=>$time); $where_per = array('id' => $post_data['com_per_id'], 'company_id' => $post_data['company_id'], 'user_id' => $user_id, 'username' => $post_data['username'], 'permission' => $permission, 'updated' => $time); $num = $this->company_permission_model->save($where_per); } if (!empty($num)) { $this->_reminder('保存成功!'); } else { $this->_reminder('保存失败!'); } }
function deal_ads_reservation() { $post_data = $this->input->post(); $arr_field = array('title', 'start_time', 'end_time', 'price', 'company', 'instructions', 'user_id', 'exh_id'); $user_id = $this->session->userdata('uid'); if (empty($user_id)) { _reminder('未登陆用户,不能申请广告位!'); } foreach ($post_data['title'] as $key => $item) { if ($item == 0) { unset($post_data['title'][$key]); } } if (!empty($post_data['title'])) { foreach ($post_data['title'] as $key => $value) { if ($post_data['start_time'][$key] > $post_data['end_time'][$key]) { _reminder('广告起始时间不对!'); } } foreach ($post_data['title'] as $key => $value) { $this->db->where('id', $value); $num_data = $this->db->get('exhibition_ads')->row_array(); if (!empty($num_data)) { $data[$key]['ad_id'] = $num_data['id']; } else { _reminder('编号不存在,操作失败!'); } $data[$key]['start_time'] = strtotime($post_data['start_time'][$key]); $data[$key]['end_time'] = strtotime($post_data['end_time'][$key]); if ($post_data['start_time'][$key] > $post_data['end_time'][$key]) { _reminder('广告起始时间不对!'); } $data[$key]['user_id'] = $user_id; $guonian = ceil(($data[$key]['end_time'] - $data[$key]['start_time']) / 86400); //60s*60min*24h $guonian += 1; $this->db->where('id', $num_data['id']); $advinfo = $this->db->get('exhibition_ads')->row_array(); $price = $advinfo['price'] ? $advinfo['price'] : 3000; $data[$key]['price'] = $guonian * $price; $data[$key]['address'] = $post_data['address'][$key]; $data[$key]['instructions'] = $post_data['instructions'][$key]; $dir_date = date('Ymd'); $config['upload_path'] = "./upload/advert/{$dir_date}"; if (!file_exists("./upload/advert/{$dir_date}")) { mkdir("./upload/advert/{$dir_date}", 0777, true); //大缩略图路径 } $config['allowed_types'] = 'gif|jpg|png'; $config['file_name'] = date('YmdHis', time()) . $key; $this->load->library('upload', $config); $_FILES['xx']['name'] = $_FILES['file']['name'][$key]; $_FILES['xx']['type'] = $_FILES['file']['type'][$key]; $_FILES['xx']['size'] = $_FILES['file']['size'][$key]; $_FILES['xx']['tmp_name'] = $_FILES['file']['tmp_name'][$key]; $_FILES['xx']['error'] = $_FILES['file']['error'][$key]; //print_r($_FILES); if (!$this->upload->do_upload('xx')) { $error = array('error' => $this->upload->display_errors()); //$this->load->view('upload_form', $error); _reminder($this->upload->display_errors('', '')); } else { $pic_data = $this->upload->data(); //$this->load->view('upload_success', $data); $updated_data['pic'] = "upload/advert/{$dir_date}/" . $pic_data['file_name']; $data[$key]['pic'] = $updated_data['pic']; } if (!empty($post_data['hide_id'])) { $data[$key]['exh_id'] = $post_data['hide_id']; } else { _reminder('缺少参数,请谨慎操作!'); } $this->db->insert('reservation_ads', $data[$key]); } _reminder('提交申请成功!'); } else { _reminder('没有广告内容提交!'); } //dump_echo($data); }
function delete_lanmu() { $a_data = $this->input->post(); $id = $a_data['lanmu_id']; $this->load->model('product_model'); $b_data['category_id'] = $id; $b_num = $this->product_model->get_list($b_data); foreach ($b_num as $item) { $c_data['id'] = $item['id']; $this->product_model->delete($c_data); } $d_data['id'] = $id; $this->load->model('product_category_model'); $d_num = $this->product_category_model->delete($d_data); if (!empty($d_num) && isset($d_num)) { _reminder('删除栏目成功!'); } else { _reminder('删除栏目失败!'); } }
/** * 所有进入找个控制器的 */ function edit_exh_company() { $this->load->model("participation_model"); if ($this->input->post('exh_c_id')) { $id = $this->input->post('exh_c_id'); $result = $this->participation_model->getCompanyInfo($id); $user_id = $this->session->userdata('uid'); if ($user_id == $result['user_id']) { $data['id'] = $id; $data['exh_num'] = $this->input->post('exh_num'); $data['com_orders'] = $this->input->post('com_orders'); $this->participation_model->save($data); _reminder('展位号修改成功!'); } else { _reminder('你没有权限修改这个公司展位!'); } } else { $id = $this->input->get('xcid'); $result = $this->participation_model->getCompanyInfo($id); $user_id = $this->session->userdata('uid'); if ($user_id == $result['user_id']) { $this->_view_data['exh_company'] = $result; $this->_view_data['action_prefix'] = 'company'; $this->_view_data['page_content_id'] = 'he_fair_bitmap'; $this->_template('exhibition_company_edit'); } else { _reminder('你没有权限修改这个公司展位!'); } } //$this->_template('exhibition_booth_edit'); }
function all_delete_video() { $this->logs('批量删除视频'); $post_data = $this->input->post('box_cont'); if (empty($post_data)) { _reminder('不能为空,请重新选择!'); } foreach ($post_data as $key => $value) { $where_delete = array('id' => $value); $this->main_model->delete($where_delete); } _reminder('批量删除成功!'); }
function deal_edit_diary_reply() { $this->logs('处理编辑日志回复'); $post_data = $this->input->post(); $update_data = array('content' => $post_data['content']); $this->db->where('id', $post_data['hide_id']); $num = $this->db->update('diary_reply', $update_data); if ($num) { _reminder('保存成功!'); } else { _reminder('保存失败!'); } }
function add_lanmu() { $lanmu = $this->input->get('lanmu'); $uid = $this->input->get('uid'); $a_data = array('user_id' => $uid); $this->load->model('dingzhi_model'); $a_num = $this->dingzhi_model->get_row_array($a_data); // 用户的所有定制信息 if (!empty($a_num['business']) && isset($a_num['business'])) { $a_lanmu = $a_num['business'] . "," . $lanmu; } else { $a_lanmu = $lanmu; } $b_data = array("id" => $a_num['id'], 'user_id' => $uid, 'business' => $a_lanmu); $b_num = $this->dingzhi_model->save($b_data); if (!empty($b_num) && isset($b_num)) { _reminder('定制行业成功!'); } else { _reminder('定制行业失败!'); } }
function deal_edit_exhibition_authority() { $this->load->model('exhibition_permission_model'); $post_data = $this->input->post(); if (empty($post_data['hide_id'])) { _reminder('缺少参数,请谨慎操作!'); } if (!empty($post_data['exhibition_authority'])) { if ($post_data['exhibition_authority'][0] == 'exhibition_basic_news') { $post_data['exhibition_authority'][] = 'exhibition_detail_news'; } $permission = implode($post_data['exhibition_authority'], ','); $data_insert = array('id' => $post_data['hide_id'], 'permission' => $permission, 'updated' => time()); $num = $this->exhibition_permission_model->save($data_insert); } else { $where_delete = array('id' => $post_data['hide_id']); $num = $this->exhibition_permission_model->delete($where_delete); } if (!empty($num)) { _reminder('操作成功!'); } else { _reminder('操作失败!'); } }
function all_delete_template_list() { $this->logs('批量删除模板'); $ids = $this->input->post('box_cont'); if (empty($ids)) { _reminder('选项不能为空,请重新操作!'); } foreach ($ids as $key => $item) { $where_delete = array('id' => $item); $this->main_model->delete($where_delete); } _reminder('批量删除成功!'); }
function now_time_schedule() { $get_data = $this->input->get(); $time = strtotime($get_data['time']); $this->load->model('exhibition_model'); $this->load->model('schedule_model'); //会展网 $where_find_exh = array('id' => $get_data['id']); $data_find_exh = $this->exhibition_model->get_row_array($where_find_exh); if (!empty($data_find_exh)) { $parent_exh_title = $data_find_exh['title']; $begin_time = $data_find_exh['begin_time']; $end_time = $data_find_exh['end_time']; } if (!empty($get_data['cat_id'])) { //子会展的信息 $where_find_schedule_cat = array('id' => $get_data['cat_id']); $data_find_schedule_cat = $this->exhibition_model->get_row_array($where_find_schedule_cat); if (!empty($data_find_schedule_cat)) { $parent_exh_title = $data_find_schedule_cat['title']; $begin_time = $data_find_schedule_cat['begin_time']; $end_time = $data_find_schedule_cat['end_time']; } $where_find_schedule = array('exb_id' => $get_data['cat_id'], 'date_time' => $time, 'order_by' => 'str_time asc'); $data_find_schedule = $this->schedule_model->get_list($where_find_schedule); } else { $where_find_schedule = array('exb_id' => $get_data['id'], 'date_time' => $time, 'order_by' => 'str_time asc'); $data_find_schedule = $this->schedule_model->get_list($where_find_schedule); } if (!empty($data_find_schedule)) { $html_test = ''; foreach ($data_find_schedule as $k3 => $v3) { //判断data_name 类型(上午,中午,下午) if ($v3['date_name'] == 1) { $v3['date_name'] = "上午"; } else { if ($v3['date_name'] == 2) { $v3['date_name'] = "中午"; } else { if ($v3['date_name'] == 3) { $v3['date_name'] = "下午"; } else { if ($v3['date_name'] == 4) { $v3['date_name'] = "晚上"; } } } } $html_test .= '<table border="0" cellspacing="4" cellpadding="2"> <tr> <td></td> <td>' . date('Y-m-d', $v3['date_time']) . ' 日程表</td> </tr> <tr> <td>' . $v3["date_name"] . '</td> <td></td> </tr> <tr> <td bgcolor="#cccccc" width="100px">' . date("H:i", $v3["str_time"]) . " - " . date("H:i", $v3["end_time"]) . '</td> <td bgcolor="#cccccc" width="530px">' . $v3['title'] . '</td> </tr> <tr> <td></td> <td>' . $v3['intro'] . '</td> </tr> <tr> <td></td> <td></td> </tr> </table> <div style="padding:10px;"></div>'; } require_once "./third_part/tcpdf/tcpdf.php"; //实例化 $pdf = new TCPDF('p', 'mm', 'A4', true, 'UTF-8', false); // 设置文档信息 $pdf->SetCreator('Helloweba'); $pdf->SetAuthor('yueguangguang'); $pdf->SetTitle($parent_exh_title); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, PHP'); // 设置页眉和页脚信息 $pdf->SetHeaderData('', 0, $parent_exh_title . ' ' . date('Y-m-d', $begin_time) . ' ~ ' . date('Y-m-d', $end_time), '', array(0, 0, 0), array(0, 0, 0)); $pdf->setFooterData(array(0, 0, 0), array(0, 64, 128)); // 设置页眉和页脚字体 $pdf->setHeaderFont(array('stsongstdlight', '', '10')); $pdf->setFooterFont(array('helvetica', '', '8')); // 设置默认等宽字体 $pdf->SetDefaultMonospacedFont('courier'); // 设置间距 $pdf->SetMargins(15, 27, 15); $pdf->SetHeaderMargin(5); $pdf->SetFooterMargin(2); // 设置分页 $pdf->SetAutoPageBreak(TRUE, 25); // set image scale factor $pdf->setImageScale(1.25); // set default font subsetting mode $pdf->setFontSubsetting(true); //设置字体 $pdf->SetFont('stsongstdlight', '', 12); $pdf->AddPage(); $str1 = $html_test; $pdf->writeHTML($str1, true, false, false, false, 'center'); //$pdf->writeHTMLCell(0, 0, '', '', $str1, 0, 1, 0, true, '', true); //$pdf->Write(0,$str1,'', 0, 'L', true, 0, false, false, 0); $pdf_title = $time . '.pdf'; //输出PDF if (!empty($get_data['type']) && $get_data['type'] == 'stamp') { $pdf->Output($pdf_title); } else { $pdf->Output($pdf_title, 'D'); } } else { _reminder('日程安排是空的,请选择有内容的日程表下载!'); } }
function upload_excel() { $post_data = $this->input->post(); $this->load->library('upload2'); $filedir = 'xls/' . date('Ym', time()) . '/' . date('d', time()) . '/'; $upload_obj = 'upload/'; $this->upload2->field = 'xls'; $this->upload2->set_dir($upload_obj, $filedir); $fs = $this->upload2->execute(); if (!empty($fs) && isset($fs)) { foreach ($fs as $item) { $pic_file = $upload_obj . $filedir . $item['name']; } } error_reporting(E_ALL ^ E_NOTICE); require_once 'third_part/Excel/reader.php'; $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('utf-8'); $data->read($pic_file); $list_result = $data->sheets[0]['cells']; //导入的excel表格的第一个shell数据结果 //dump_echo($list_result); $first_value = array_values(array_shift($list_result)); $arr_check = array('公司名称', '展位号'); if ($arr_check != $first_value) { _reminder('录入的参数不对,请参考默认参数导入!'); } if (!empty($list_result)) { $this->load->model('company_model'); $this->load->model('participation_model'); foreach ($list_result as $item) { $where_find_com = array('name' => $item[1]); $data_find_com = $this->company_model->get_row_array($where_find_com); @($com_id = $data_find_com['id']); $where_com = array('com_name' => $item[1], 'exh_num' => $item[2], 'exb_id' => $post_data['exb_id']); $check_data = $this->participation_model->get_row_array($where_com); if (!empty($check_data)) { $where_delete_row = array('id' => $check_data['id']); $this->participation_model->delete($where_delete_row); } $arr_insert = array('com_id' => $com_id, 'exb_id' => $post_data['exb_id'], 'com_name' => $item[1], 'exh_num' => $item[2], 'created' => time()); $this->participation_model->insert($arr_insert); } _reminder('导入成功!'); } else { _reminder('数据为空,请先录入数据!'); } }
function deal_edit_user_banned() { $this->logs('处理编辑ip管控'); $post_data = $this->input->post(); $update_arr = array('ip1', 'ip2', 'ip3', 'ip4'); foreach ($update_arr as $item) { $update_data[$item] = $post_data[$item]; } $update_data['dateline'] = date("Y-m-d H:i:s"); $update_data['expiration'] = date("Y-m-d H:i:s"); if ($post_data['hide_id'] == -1) { $num = $this->db->insert('banned', $update_data); } else { $this->db->where('id', $post_data['hide_id']); $num = $this->db->update('banned', $update_data); } if ($num) { _reminder('保存成功!'); } else { _reminder('保存失败!'); } }
function all_delete_datum_reply() { $this->logs('批量删除资料评论的回复'); $ids = $this->input->post('box_ids'); if (empty($ids)) { _reminder('您未选中要删除的选项,请重新操作!'); } $this->load->model('datum_reply_model'); foreach ($ids as $key => $item) { $where_delete = array('id' => $item); $this->datum_reply_model->delete($where_delete); } _reminder('批量删除成功!'); }
function send_message_delete() { $message_id = $this->input->get('message_id'); $pre_page = $_SERVER['HTTP_REFERER']; //获取当前的网页地址 if (!empty($message_id) && isset($message_id)) { $this->load->model('message_model'); $a_data['id'] = $message_id; $a_num = $this->message_model->get_row_array($a_data); if ($a_num['from_delete'] == 0) { if ($a_num['to_delete'] == 0) { $b_data = array('id' => $message_id, 'from_delete' => 1); $b_num = $this->message_model->save($b_data); if (!empty($b_num) && isset($b_num)) { _reminder('删除成功!'); } else { _reminder('删除失败!'); } } else { if ($a_num['to_delete'] == 1) { $b_data['id'] = $message_id; $message_data = $this->message_model->get_row_array($b_data); $m_data = array('title' => $message_data['title'], 'reply' => 2); $this->message_model->delete($m_data); $b_num = $this->message_model->delete($b_data); if (!empty($b_num) && isset($b_num)) { _reminder('删除成功!'); } else { _reminder('删除失败!'); } } } } } }
function delete_user() { $name = $this->input->get('name'); $uid = $this->input->get('uid'); $this->load->model('guanzhu_model'); $a_data = array("user_id" => $uid); //该用户的所有关注信息 $a_num = $this->guanzhu_model->get_row_array($a_data); $u = explode(",", $a_num['user_ids']); $this->load->model('user_model'); $b_data = array("nick_name" => $name); $b_num = $this->user_model->get_row_array($b_data); foreach ($u as $k => $item) { if ($item == $b_num['id']) { unset($u[$k]); } } $x = implode(",", $u); $d = array("id" => $a_num['id'], "user_id" => $a_num['user_id'], "com_ids" => $a_num['com_ids'], "user_ids" => $x, "grd_ids" => $a_num['grd_ids'], "exh_ids" => $a_num['exh_ids']); $this->load->model('guanzhu_model'); $d_num = $this->guanzhu_model->save($d); if (!empty($d_num) && isset($d_num)) { _reminder('删除关注用户成功!'); } else { _reminder('删除关注用户失败!'); } }
function deal_photo() { $post_data = $this->input->post(); $targ_w = $targ_h = 94; //$jpeg_quality = 90; $src = $post_data['hide_pic']; $img_r = imagecreatefromjpeg($src); $dst_r = ImageCreateTrueColor($targ_w, $targ_h); echo $img_r; imagecopyresampled($dst_r, $img_r, 0, 0, $_POST['x'], $_POST['y'], $targ_w, $targ_h, $_POST['w'], $_POST['h']); //header('Content-type: image/jpeg'); imagejpeg($dst_r, $src); //imagedestroy(); _reminder('保存成功!'); }
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('导入成功!'); }
function deal_edit_letter_list() { $this->logs('处理编辑私信的内容'); $post_data = $this->input->post(); $update_arr = array('title', 'content'); foreach ($update_arr as $item) { $update_data[$item] = $post_data[$item]; } $this->db->where('id', $post_data['hide_id']); $num = $this->db->update('message', $update_data); if ($num) { _reminder('保存成功!'); } else { _reminder('保存失败!'); } }