Пример #1
0
 public function put()
 {
     $request_data = $this->input->post();
     //权限检查
     if (isset($request_data['id'])) {
         role::check('product_feature_edit');
     } else {
         role::check('product_feature_add');
     }
     //安全过滤
     $request_data = trims::run($request_data);
     tool::filter_strip_tags($request_data);
     $request_data['type'] = isset($request_data['type']) ? $request_data['type'] : 0;
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //初始化返回数据
         $return_data = array();
         $validation = Validation::factory($request_data);
         $validResult = $validation->pre_filter('trim')->add_rules('name', 'required', 'length[1,100]');
         if ($validResult->validate() == FALSE) {
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         // 调用底层服务
         $attribute_service = AttributeService::get_instance();
         //是输入项时,要先删除旧的选项值
         if (isset($request_data['type']) && $request_data['type'] == 1) {
             $request_data['option_name'] = '';
             $request_data['id'] > 0 && $attribute_service->clear_attribute_value($request_data['id']);
         } else {
             //数据验证
             if (!isset($request_data['option_name']) || empty($request_data['option_name'])) {
                 throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
             }
         }
         //执行添加
         $set_data = array();
         $set_data['apply'] = self::ATTRIBUTE_TYPE;
         $set_data['name'] = html::specialchars($request_data['name']);
         $set_data['alias'] = html::specialchars($request_data['alias']);
         $set_data['memo'] = html::specialchars($request_data['memo']);
         $set_data['type'] = $request_data['type'];
         if ($request_data['id']) {
             $return_data['id'] = $set_data['id'] = $request_data['id'];
             $attribute_service->update($set_data);
         } else {
             $return_data['id'] = $attribute_service->add($set_data);
         }
         if (!$return_data['id']) {
             throw new MyRuntimeException('Internal Error', 500);
         }
         //option
         if ($request_data['type'] == 0 && isset($request_data['option_name']) && !empty($request_data['option_name'])) {
             foreach ($request_data['option_name'] as $key => $val) {
                 $att_val = array();
                 $att_val['attribute_id'] = $return_data['id'];
                 $att_val['name'] = html::specialchars($val);
                 $att_val['alias'] = isset($request_data['option_alias'][$key]) ? html::specialchars($request_data['option_alias'][$key]) : '';
                 $att_val['order'] = (int) $request_data['option_order'][$key];
                 if (isset($request_data['option_image'][$key]) && !empty($request_data['option_image'][$key])) {
                     $att_val['image'] = $request_data['option_image'][$key];
                 }
                 if (isset($request_data['option_id_old'][$key]) && !empty($request_data['option_id_old'][$key])) {
                     $att_val['id'] = $request_data['option_id_old'][$key];
                 }
                 $flag = $attribute_service->save_attribute_value($att_val);
                 if (!$flag) {
                     throw new MyRuntimeException('Internal Error', 500);
                 }
             }
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '保存成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $this->_ex($ex, $request_data, $return_struct);
     }
 }
Пример #2
0
 public function check_name()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         $request_data = trims::run($request_data);
         //标签过滤
         tool::filter_strip_tags($request_data);
         //必须为ajax请求
         if (!$this->is_ajax_request()) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         //* 权限验证 */
         $site_id = site::id();
         if ($site_id == 0) {
             throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
         }
         if (!isset($request_data['name']) || empty($request_data['name'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 404);
         }
         $inquieysubject_service = InquirysubjectService::get_instance();
         if (isset($request_data['subject_id']) && is_numeric($request_data['subject_id'])) {
             $inquieysubject = $inquieysubject_service->get($request_data['subject_id']);
             //判断站点
             if ($site_id != $inquieysubject['site_id']) {
                 throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 404);
             }
             if ($inquieysubject['name'] == $request_data['name']) {
                 exit(Kohana::lang('o_global.true'));
             }
         }
         $query_struct = array('where' => array('site_id' => $site_id, 'name' => $request_data['name']));
         // 调用底层服务
         if ($inquieysubject_service->count($query_struct)) {
             exit(Kohana::lang('o_global.false'));
         } else {
             exit(Kohana::lang('o_global.true'));
         }
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template->content = $return_struct;
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
Пример #3
0
 public function post()
 {
     role::check('product_filter');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         $request_data = trims::run($request_data);
         //标签过滤
         tool::filter_strip_tags($request_data);
         if (!isset($request_data['id']) || !is_numeric($request_data['id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         // 调用底层服务
         $alias_filter_service = Alias_filterService::get_instance();
         $alias_filter = $alias_filter_service->get($request_data['id']);
         //数据验证
         $validResult = Validation::factory($request_data)->add_rules('title', 'required', 'length[1,100]')->add_rules('uri_name', 'length[0,100]');
         if ($validResult->validate() == FALSE) {
             //* 输出错误的具体信息 ==根据业务逻辑定制== */
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         //title重复判断
         if ($request_data['title'] != $alias_filter['title'] && $alias_filter_service->check_exist_title($request_data['title'])) {
             throw new MyRuntimeException(Kohana::lang('o_product.category_title_has_exists'), 409);
         }
         //uri_name重复判断
         if ($request_data['uri_name'] != $alias_filter['uri_name'] && $alias_filter_service->check_exist_uri_name($request_data['uri_name'])) {
             throw new MyRuntimeException(Kohana::lang('o_product.uri_name_has_exists'), 409);
         }
         //获取过滤结构
         $filter = array();
         $filter['keywords'] = html::specialchars($request_data['keywords']);
         if (isset($request_data['pricefrom']) && preg_match('/^(0\\.\\d+|[1-9]\\d*(\\.\\d+)?)$/', $request_data['pricefrom'])) {
             $filter['pricefrom'] = $request_data['pricefrom'];
         }
         if (isset($request_data['priceto']) && preg_match('/^(0\\.\\d+|[1-9]\\d*(\\.\\d+)?)$/', $request_data['priceto'])) {
             $filter['priceto'] = $request_data['priceto'];
         }
         if (isset($request_data['brand']) && !empty($request_data['brand'])) {
             $filter['brands'] = $request_data['brand'];
         }
         if (isset($request_data['attribute']) && !empty($request_data['attribute'])) {
             $filter['attributes'] = $request_data['attribute'];
         }
         if (isset($request_data['feature']) && !empty($request_data['feature'])) {
             $filter['features'] = $request_data['feature'];
         }
         //执行修改
         $set_data = array();
         $set_data['id'] = $request_data['id'];
         $set_data['pid'] = $request_data['pid'];
         if ($request_data['oldpid'] != $request_data['pid']) {
             if (!empty($request_data['pid'])) {
                 $parents = $alias_filter_service->get_parents_by_filter_id($request_data['pid']);
                 $parent_ids = array();
                 foreach ($parents as $val) {
                     $parent_ids[] = $val['id'];
                 }
                 if (in_array($request_data['id'], $parent_ids)) {
                     throw new MyRuntimeException('设置父分类错误', 400);
                 }
                 $set_data['level_depth'] = count($parent_ids) + 1;
             } else {
                 $set_data['level_depth'] = 1;
             }
         }
         $set_data['category_id'] = $request_data['category_id'];
         //$set_data['classify_id'] = $request_data['classify_id'];
         $set_data['uri_name'] = $request_data['uri_name'];
         $set_data['title'] = html::specialchars($request_data['title']);
         $set_data['filter_struct'] = json_encode($filter);
         $set_data['update_timestamp'] = time();
         $alias_filter_service->set($set_data['id'], $set_data);
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '操作成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template->content = $return_struct;
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
Пример #4
0
 /**
  * 通过AJAX验证商品SKU是否已存在
  *
  */
 public function sku_exists()
 {
     try {
         $request_data = $this->input->get();
         $request_data = trims::run($request_data);
         empty($request_data['sku']) && exit('false');
         $id = isset($request_data['id']) ? $request_data['id'] : 0;
         if (BLL_Product::sku_exists($request_data['sku'], $request_data['id'])) {
             exit('false');
         } else {
             exit('true');
         }
     } catch (MyRuntimeException $ex) {
         exit('false');
     }
 }
Пример #5
0
 public function post()
 {
     role::check('product_category_edit');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         $request_data = trims::run($request_data);
         //标签过滤
         tool::filter_strip_tags($request_data, array('description'));
         //数据验证
         $validResult = Validation::factory($request_data)->pre_filter('trim')->add_rules('pid', 'required', 'numeric')->add_rules('title', 'required', 'length[1,100]')->add_rules('title_manage', 'length[1,255]')->add_rules('uri_name', 'required', 'length[1,255]')->add_rules('description', 'length[0,1024]')->add_rules('memo', 'length[0,65535]')->add_rules('meta_title', 'length[0,255]')->add_rules('meta_keywords', 'length[0,255]')->add_rules('meta_description', 'length[0,65535]')->add_rules('is_show', 'numeric');
         if ($validResult->validate() == FALSE) {
             //* 输出错误的具体信息 ==根据业务逻辑定制== */
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         // 调用底层服务
         $category_service = CategoryService::get_instance();
         /*获取分类数据*/
         $category = $category_service->get($request_data['id']);
         //判断title是否存在
         if ($request_data['title'] != $category['title'] && $category_service->check_exist_title($request_data['title'])) {
             throw new MyRuntimeException(Kohana::lang('o_product.category_title_manage_has_exists'), 409);
         }
         //uri_name重复判断
         if (strtolower($request_data['uri_name']) != strtolower($category['uri_name']) && $category_service->check_exist_uri_name($request_data['uri_name'])) {
             throw new MyRuntimeException(Kohana::lang('o_product.uri_name_has_exists'), 409);
         }
         //执行修改
         if ($request_data['oldpid'] != $request_data['pid']) {
             $child_ids = $category_service->get_childrens_by_category_id($request_data['id']);
             if (in_array($request_data['pid'], $child_ids) || $request_data['pid'] == $request_data['id']) {
                 throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
             }
         }
         //if(!empty($category['pic_attach_id']) && $request_data['pic_attach_id'] != $category['pic_attach_id']){
         //  AttributeService::get_instance()->delete_attachment($category['pic_attach_id']);
         //}
         $set_data = $request_data;
         $set_data['update_timestamp'] = time();
         $category_service->set($set_data['id'], $set_data);
         if ($request_data['oldpid'] != $request_data['pid']) {
             $category_service->update_categories();
         }
         //if($request_data['is_show'] == 0){
         $category_service->update_show_val_by_id($category['id'], $request_data['is_show']);
         //}
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '操作成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $this->_ex(&$ex, $return_struct, $request_data);
     }
 }
Пример #6
0
 public function put()
 {
     //* 收集请求数据 ==根据业务逻辑定制== */
     $request_data = $this->input->post();
     $request_data = trims::run($request_data);
     if ($request_data['id'] > 0) {
         role::check('product_collection_edit');
     } else {
         role::check('product_collection_add');
     }
     //标签过滤
     tool::filter_strip_tags($request_data);
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array();
         //数据验证
         $validResult = Validation::factory($request_data)->pre_filter('trim')->add_rules('title', 'required', 'length[1,100]')->add_rules('lable', 'length[0,32]')->add_rules('description', 'length[0,1024]')->add_rules('meta_title', 'length[0,100]')->add_rules('meta_keywords', 'length[0,255]')->add_rules('meta_description', 'length[0,255]')->add_rules('memo', 'length[0,255]');
         if ($validResult->validate() == FALSE) {
             //* 输出错误的具体信息 ==根据业务逻辑定制== */
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         // 调用底层服务
         $collection_service = CollectionService::get_instance();
         if ($request_data['id'] > 0) {
             $collection = $collection_service->get($request_data['id']);
             //判断title是否存在
             if ($collection['title'] != $request_data['title'] && $collection_service->check_exist_title($request_data['title'])) {
                 throw new MyRuntimeException(Kohana::lang('o_product.collection_title_has_exists'), 409);
             }
         } else {
             if ($collection_service->check_exist_title($request_data['title'])) {
                 throw new MyRuntimeException(Kohana::lang('o_product.collection_title_has_exists'), 409);
             }
         }
         //执行添加
         $set_data = array();
         $set_data['title'] = $request_data['title'];
         $set_data['label'] = $request_data['label'];
         $set_data['meta_title'] = $request_data['meta_title'];
         $set_data['meta_keywords'] = $request_data['meta_keywords'];
         $set_data['meta_description'] = $request_data['meta_description'];
         $set_data['description'] = $request_data['description'];
         $set_data['memo'] = $request_data['memo'];
         $set_data['update_timestamp'] = time();
         if ($request_data['id'] > 0) {
             $return_data['id'] = $set_data['id'] = $request_data['id'];
             $collection_service->set($set_data['id'], $set_data);
         } else {
             $set_data['create_timestamp'] = time();
             $return_data['id'] = $collection_service->add($set_data);
         }
         if (!$return_data['id']) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 500);
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '操作成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $this->_ex($ex, $return_struct, $request_data);
     }
 }
Пример #7
0
 public function edit_save()
 {
     role::check('product_brand_edit');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //$profiler = new Profiler;
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         $request_data = trims::run($request_data);
         //标签过滤
         tool::filter_strip_tags($request_data, array('detial'));
         //数据验证
         if (!isset($request_data['id']) || !is_numeric($request_data['id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 404);
         }
         //数据验证
         $validResult = Validation::factory($request_data)->pre_filter('trim')->add_rules('name', 'required', 'length[1,100]');
         if ($validResult->validate() == FALSE) {
             //* 输出错误的具体信息 ==根据业务逻辑定制== */
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         //name重复判断
         $query_struct = array('where' => array('name' => $request_data['name']));
         // 调用底层服务
         $brand_service = BrandService::get_instance();
         $brand = $brand_service->get($request_data['id']);
         if ($request_data['name'] != $brand['name'] && $brand_service->count($query_struct)) {
             throw new MyRuntimeException(Kohana::lang('o_product.brand_name_exists'), 409);
         }
         //执行修改
         $set_data = array();
         $set_data['order'] = (int) $request_data['order'];
         $set_data['name'] = $request_data['name'];
         $set_data['alias'] = $request_data['alias'];
         $set_data['logo'] = $request_data['logo'];
         $set_data['url'] = $request_data['url'];
         $set_data['page_title'] = $request_data['page_title'];
         $set_data['meta_keywords'] = $request_data['meta_keywords'];
         $set_data['meta_description'] = $request_data['meta_description'];
         $set_data['detial'] = $request_data['detial'];
         $set_data['id'] = $request_data['id'];
         $brand_service->set($set_data['id'], $set_data);
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '操作成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template->content = $return_struct;
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
Пример #8
0
 public function post()
 {
     role::check('product_classify_edit');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         /*初始化返回数据*/
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         $request_data = trims::run($request_data);
         //标签过滤
         tool::filter_strip_tags($request_data);
         if (!isset($request_data['id']) || !is_numeric($request_data['id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
         }
         //数据验证
         $validResult = Validation::factory($request_data)->pre_filter('trim')->add_rules('name', 'required', 'length[1,100]');
         if ($validResult->validate() == FALSE) {
             //* 输出错误的具体信息 ==根据业务逻辑定制== */
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         //执行修改
         $set_data = array();
         $set_data['id'] = $request_data['id'];
         $set_data['name'] = $request_data['name'];
         $set_data['alias'] = $request_data['alias'];
         $set_data['update_timestamp'] = time();
         // 调用底层服务
         $classify_service = ClassifyService::get_instance();
         $classify = $classify_service->get($request_data['id']);
         //判断name是否存在
         if ($classify['name'] != $set_data['name'] && $classify_service->check_exist_name($set_data['name'])) {
             throw new MyRuntimeException(Kohana::lang('o_product.product_classify_exist'), 409);
         }
         $this->get_arguments($request_data, $set_data);
         $classify_service->set($set_data['id'], $set_data);
         //相关品牌修改
         $request_data['brand_id'] = isset($request_data['brand_id']) ? $request_data['brand_id'] : array();
         $request_data['brand_show'] = isset($request_data['brand_show']) ? $request_data['brand_show'] : array();
         $classify_service->update_relations_by_brand_ids($set_data['id'], $request_data['brand_id'], $request_data['brand_show']);
         //相关规格修改
         $request_data['attribute_id'] = isset($request_data['attribute_id']) ? $request_data['attribute_id'] : array();
         $request_data['attribute_show'] = isset($request_data['attribute_show']) ? $request_data['attribute_show'] : array();
         $classify_service->update_relations_by_attribute_ids($set_data['id'], $request_data['attribute_id'], $request_data['attribute_show'], AttributeService::ATTRIBUTE_SPEC);
         //相关特性修改
         $request_data['feature_id'] = isset($request_data['feature_id']) ? $request_data['feature_id'] : array();
         $request_data['feature_show'] = isset($request_data['feature_show']) ? $request_data['feature_show'] : array();
         $classify_service->update_relations_by_attribute_ids($set_data['id'], $request_data['feature_id'], $request_data['feature_show'], AttributeService::ATTRIBUTE_FEATURE);
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '操作成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $this->_ex($ex, $return_struct, $request_data);
     }
 }