public function get_localArr($inn_id = 0, $local_id = 0, $dest_id = 0) { $destInfo = array('province' => '530000', 'city' => '530700', 'dest_id' => '0', 'local_id' => '0', 'inn_id' => '0'); //所有id组合数组 $localArr = array(); $Innlist = array(); if ($inn_id) { $inn_info = $this->get_inn_info_by_inn_id($inn_id, FALSE); if (empty($inn_info)) { _jsBack('商户不存在!'); } $dest_info = $this->get_dest_info_by_dest_id($inn_info['dest_id']); $destInfo['province'] = $dest_info['province']; $destInfo['city'] = $dest_info['city']; $destInfo['dest_id'] = $inn_info['dest_id']; $destInfo['local_id'] = $inn_info['local_id']; $destInfo['inn_id'] = $inn_info['inn_id']; $localArr = $this->get_fulldest_by_local_parent_id($destInfo['dest_id'], $dest_info['parent_id']); $Innlist = $this->model->get_innlist_by_local_id($destInfo['local_id']); } else { if ($local_id) { $local_info = $this->model->get_dest_info_by_local_id($local_id, TRUE); if (empty($local_info)) { _jsBack('街道不存在!'); } $destInfo['province'] = $local_info['province']; $destInfo['city'] = $local_info['city']; $destInfo['dest_id'] = $local_info['dest_id']; $destInfo['local_id'] = $local_info['local_id']; $localArr = $this->get_fulldest_by_local_parent_id($destInfo['dest_id'], $local_info['parent_id']); $Innlist = $this->model->get_innlist_by_local_id($destInfo['local_id']); } else { if ($dest_id) { $dest_info = $this->get_dest_info_by_dest_id($dest_id); if (empty($dest_info)) { _jsBack('区域不存在!'); } $destInfo['province'] = $dest_info['province']; $destInfo['city'] = $dest_info['city']; $destInfo['dest_id'] = $dest_info['dest_id']; $localArr = $this->get_fulldest_by_local_parent_id($destInfo['dest_id'], $dest_info['parent_id']); } else { $localArr = array('dest' => array(), 'local' => array()); $destInfo = array('province' => '', 'city' => '', 'dest_id' => '0', 'local_id' => '0', 'inn_id' => '0'); } } } return array('destInfo' => $destInfo, 'localArr' => $localArr, 'Innlist' => $Innlist); }
/** * 为商户添加商品普通商品 * web page * ajax post */ public function add() { //$key_auth = $this->model->get_create_user_authcode(); $inn_id = input_int($this->input->get('sid'), 1, FALSE, FALSE, '1010'); if (!$inn_id) { if ($this->get_user_role() == INNHOLDER) { $inn_id = $this->get_user_inn_id(); } else { if (!$inn_id) { _jsBack('您尚未选择一个商户'); } } } $innInfo = $this->model->get_inn_info_by_inn_id($inn_id, FALSE); $this->viewData = array('innInfo' => $innInfo); $this->viewFile = 'product/add'; }
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); }