Example #1
0
 function edit($id)
 {
     if ($this->input->post('title')) {
         $id = $this->input->post('id');
         $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->update($id, $data);
         if ($result < 0) {
             echo $result;
         } else {
             $this->session->set_flashdata('msg', '修改成功');
             redirect('admin/shops/index', 'refresh');
         }
     } else {
         $headTypes = $this->ctype_m->get_all_headType();
         $subTypes = array();
         foreach ($headTypes as $type) {
             $subTypes = array_merge($subTypes, $type['subTypes']);
         }
         $shop = $this->model->get($id);
         $data['title'] = '编辑主商户';
         $data['main'] = 'admin_shops_edit';
         $data['model'] = $shop;
         $data['shopBranches'] = $shop['shopBranches'];
         $data['coupons'] = $shop['coupons'];
         $data['couponTypes'] = $headTypes;
         $data['subTypes'] = $subTypes;
         $this->load->view($this->config->item('admin_template'), $data);
     }
 }
Example #2
0
 /**
  * 
  * 删除
  * @param integer $id
  */
 function delete($id, $parentId = '')
 {
     if ($this->model->delete($id, $parentId)) {
         $this->session->set_flashdata('msg', '删除成功');
         redirect('admin/coupontypes/index', 'refresh');
     }
 }
Example #3
0
 public function headCouponTypes_get()
 {
     $results = $this->ctype_m->get_all_headType();
     return $this->output_results($results);
 }