示例#1
0
 public function update()
 {
     $params = parent::get_params('POST', array("type", "content"));
     extract($params);
     $this->site_model->set_content($type, $content);
     parent::finish(true);
 }
示例#2
0
 public function create()
 {
     $this->load->model('admin_model');
     $this->me = $this->admin_model->check_login();
     parent::require_login();
     $params = parent::get_params('POST', array('name', 'type', 'link', 'color'));
     extract($params);
     if (!isset($_FILES["userfile"])) {
         parent::finish(false, '请选择图片');
     }
     if (empty($name)) {
         parent::finish(false, '请输入名称');
     }
     if (empty($link)) {
         parent::finish(false, '请输入链接');
     }
     if (empty($color)) {
         parent::finish(false, '请输入背景色');
     }
     $config['upload_path'] = './static/uploads/';
     $config['allowed_types'] = 'gif|jpg|png';
     $config['max_size'] = '2048';
     $config['file_name'] = date("Ymd") . rand(100000000000, 9999999999999);
     $this->load->library('upload', $config);
     if (!$this->upload->do_upload("userfile")) {
         parent::finish(false, $this->upload->display_errors());
     } else {
         $returnConfig = $this->upload->data();
         $data = array('name' => $name, 'type' => 1, 'img' => $returnConfig['file_name'], 'link' => $link, 'color' => $color);
         $this->db->insert('slide', $data);
         parent::finish(true);
     }
 }
示例#3
0
 public function edit_god()
 {
     $params = parent::get_params('POST', array('alipay', 'goddesc', 'tags'));
     extract($params);
     $temp_tags = json_decode($tags, true);
     if (count($temp_tags) < 0 || count($temp_tags) > 5) {
         parent::finish(false, "输入的标签太多或者太少");
     }
     // 处理标签请求
     foreach ($temp_tags as $key => $value) {
         if (strlen($value) < 1 && strlen($value) > 20) {
             parent::finish(false, "每个擅长标签请小于20字符");
         }
         if (!$this->tag_model->is_exist(array("name" => $value, "type" => "0"))) {
             parent::finish(false, "您输入的标签:" . $value . "不存在!");
         }
     }
     if ($this->user_model->edit($this->me['id'], array("god_description" => $goddesc, "alipay" => $alipay, "god_skilled_tags" => json_encode($temp_tags)))) {
         $this->finish(true);
     } else {
         $this->finish(false, "服务器异常!");
     }
 }
示例#4
0
 public function remove()
 {
     $params = parent::get_params('POST', array('name'));
     extract($params);
     $this->check_admin_login();
     if (false === $this->admin_model->remove($name)) {
         parent::finish(false, '目标是自己或不存在');
     }
     parent::finish(true);
 }