예제 #1
0
 /**
  * 修改密码
  */
 public function change_pwd()
 {
     if ($this->input->post()) {
         if ($this->manage_model->check_login()) {
             $rs = $this->manage_model->change_pwd();
             if ($rs == 1) {
                 form_submit_json("200", "操作成功");
             } else {
                 form_submit_json("300", $rs);
             }
         } else {
             form_submit_json("300", "旧密码不正确!");
         }
     } else {
         $this->load->view('manage/changepwd.php');
     }
 }
예제 #2
0
 public function save_project()
 {
     //主档图片处理
     if (!$_FILES["imgfile"]['name'] and !$this->input->post('old_img')) {
         //未上传图片
         form_submit_json("300", "请添加图片");
         exit;
     }
     //旧图片
     $old_img = $this->input->post('old_img');
     $old_img_a = $this->input->post('old_img_a');
     //详情表信息a
     $huxing = $this->input->post('huxing');
     $config['upload_path'] = './././uploadfiles/huxing/';
     $config['allowed_types'] = 'gif|jpg|png|jpeg';
     $config['encrypt_name'] = true;
     $this->load->library('upload', $config);
     $this->db->trans_start();
     //主档图片上传
     if ($this->upload->do_upload('imgfile')) {
         $imgfile = $this->upload->data();
     } else {
         if (!$_FILES["imgfile"]['name'] and $this->input->post('old_img')) {
             $imgfile = array();
             $imgfile['file_name'] = $this->input->post('old_img');
         } else {
             form_submit_json("300", $this->upload->display_errors('<b>', '</b>'));
             exit;
         }
     }
     $data_head = array('project' => $this->input->post('project'), 'remark' => $this->input->post('remark'), 'bb_valid' => $this->input->post('bb_valid'), 'qy_valid' => $this->input->post('qy_valid'), 'price' => $this->input->post('price'), 'pic' => $imgfile['file_name'], 'kaipan' => $this->input->post('kaipan'), 'kaifa' => $this->input->post('kaifa'), 'wuye_gongsi' => $this->input->post('wuye_gongsi'), 'wuye_leixing' => $this->input->post('wuye_leixing'), 'jianzhu_leixing' => $this->input->post('jianzhu_leixing'), 'jianzhu_mianji' => $this->input->post('jianzhu_mianji'), 'zhuangxiu' => $this->input->post('zhuangxiu'), 'hushu' => $this->input->post('hushu'), 'chewei' => $this->input->post('chewei'), 'rongji' => $this->input->post('rongji'), 'ludi' => $this->input->post('ludi'), 'wuyefei' => $this->input->post('wuyefei'), 'point' => $this->input->post('point'), 'address' => $this->input->post('address'), 'cdate' => date('Y-m-d H:i:s', time()));
     if ($this->input->post('id')) {
         //修改主档
         $this->db->where('id', $this->input->post('id'));
         $this->db->update($this->tables[4], $data_head);
         $id = $this->input->post('id');
         //删除旧数据
         $this->db->delete($this->tables[5], array('head_id' => $id));
     } else {
         //新增主档
         //保存主档信息,取得主档保存的id
         $this->db->insert($this->tables[4], $data_head);
         $id = $this->db->insert_id();
     }
     //详情表图片以及数据保存a
     foreach ($huxing as $i => $v) {
         $filename = 'userfile' . $i;
         if ($this->upload->do_upload($filename)) {
             $userfile = $this->upload->data();
             $data_detail = array('huxing' => $v, 'pic' => $userfile['file_name'], 'head_id' => $id);
             $this->db->insert($this->tables[5], $data_detail);
         } else {
             if (!$_FILES[$filename]['name'] and $old_img_a[$i]) {
                 //修改保存,但不修改图片
                 $data_detail = array('huxing' => $v, 'pic' => $old_img_a[$i], 'head_id' => $id);
                 $this->db->insert($this->tables[5], $data_detail);
             } else {
                 form_submit_json("300", $this->upload->display_errors('<b>', '</b>'));
                 exit;
             }
         }
     }
     $this->db->trans_complete();
     if ($this->db->trans_status() === FALSE) {
         return $this->db_error;
     } else {
         return 1;
     }
 }
예제 #3
0
파일: manage.php 프로젝트: binshen/market
 public function delete_news($id)
 {
     $ret = $this->manage_model->delete_news($id);
     if ($ret == 1) {
         form_submit_json("200", "操作成功", 'list_news', '', '');
     } else {
         form_submit_json("300", "删除失败");
     }
 }
예제 #4
0
파일: manage.php 프로젝트: binshen/website
 public function push_house_to_user()
 {
     $today = date('Y-m-d');
     $broker_id = $this->session->userdata('user_id');
     $open_id = $_POST['open_id'];
     if ($open_id == -1) {
         $wx_users_list = $this->manage_model->list_wx_user();
         foreach ($wx_users_list as $wx_user) {
             $open_id = $wx_user['openid'];
             $articles = array();
             $data = $_POST['data'];
             foreach ($data as $h) {
                 $articles[] = array('title' => urlencode($h['title']), 'url' => 'http://www.funmall.com.cn/b_house/view_detail/' . $h['id'], 'picurl' => 'http://www.funmall.com.cn/uploadfiles/pics/' . $h['bg_pic']);
                 $this->job_model->updateHousePush($open_id, $h['id'], $today, $broker_id);
             }
             $this->api_model->send_message($open_id, $articles);
         }
     } else {
         $articles = array();
         $data = $_POST['data'];
         foreach ($data as $h) {
             $articles[] = array('title' => urlencode($h['title']), 'url' => 'http://www.funmall.com.cn/b_house/view_detail/' . $h['id'], 'picurl' => 'http://www.funmall.com.cn/uploadfiles/pics/' . $h['bg_pic']);
             $this->job_model->updateHousePush($open_id, $h['id'], $today, $broker_id);
         }
         $this->api_model->send_message($open_id, $articles);
     }
     form_submit_json("200", "操作成功", 'list_house_push');
 }