/** * 添加且游优品独立模块 * web page * ajax post */ public function addqieyou() { $this->controllerTag = 'qieyou'; $this->moduleTag = 'add_pqieyou'; $inn_id = $this->get_user_inn_id(); if (is_post()) { $product = $this->check_product_value('tuan'); $product['inn_id'] = $this->get_user_inn_id(); $product['is_qieyou'] = '1'; $product['state'] = 'T'; $product_id = $this->model->create_product($product); if ($product_id) { $contant = '新建且游优品:<a href="' . base_url() . 'product/qieyouedit?pid=' . $product_id . '">' . $this->input->post('product_name') . '<a>'; $this->model->wLog('New Merchandise', $contant, 'I'); _ajaxJson('1', $product_id); } _ajaxJson('-1', '添加失败!'); } $this->viewFile = 'product/addpqieyou'; }
private function create_home_recommend($class, $p) { $data['class'] = $class; $data['classid'] = check_empty($p['classid'], '项目id不能为空!'); $data['url'] = check_empty($p['url'], 'url地址不能为空!'); $data['img'] = check_empty($p['img'], '缩略图不能为空!'); $data['name'] = check_empty($p['name'], '名称不能为空!'); $data['content'] = check_empty($p['content'], '简介不能为空!'); $data['add_content'] = isset($p['add_content']) ? $p['add_content'] : ''; $data['is_show'] = check_empty($p['is_show'], '是否显示必须选择一个值!'); $data['seq'] = check_empty($p['seq'], '排序值必须为大于0的整数!'); if ($this->get_class_info($class, $data['classid'])) { _ajaxJson('-1', '存在相同记录'); } return $this->insert($data, 'home_config'); }
function response_code($code = '-1', $msg = 'error !') { log_message('error', 'code:' . $code . ';msg:' . $msg); if (is_numeric($code)) { include APPPATH . 'libraries/error_code.php'; $msg = $code_explain[$code]; } else { $msg = $code; $code = '-1'; } if (is_post()) { _ajaxJson($code, $msg); } _jsBack($msg); }