/** * 创建主商户 */ function create() { //处理post的值 if ($this->input->post('title')) { // var_dump($_POST); $keys = array('title', 'desc', 'posterUrl'); foreach ($keys as $key) { $data[$key] = $this->input->post($key); } $data['couponType'] = avosPointer('CouponType', $this->input->post('couponTypeId')); $data['subType'] = avosPointer('CouponType', $this->input->post('subTypeId')); $result = $this->model->create($data); if ($result < 0) { echo $result; } else { $this->session->set_flashdata('msg', '创建成功'); redirect('admin/shops/index', 'refresh'); } } $headTypes = $this->ctype_m->get_all_headType(); $subTypes = array(); foreach ($headTypes as $type) { $subTypes = array_merge($subTypes, $type['subTypes']); } // display form $data['title'] = '新建总商户'; $data['main'] = 'admin_shops_create'; $data['parentId'] = $parentId; $data['couponTypes'] = $headTypes; $data['subTypes'] = $subTypes; $this->load->view($this->config->item('admin_template'), $data); }