function edit() { $name = $this->getActionName(); $model = D($name); $id = $_REQUEST[$model->getPk()]; $vo = $model->getById($id); $vo = sys_get_dp_detail($vo); $this->assign('vo', $vo); $this->display(); }
public function detail() { $dp_id = intval($_REQUEST['id']); $page = intval($_REQUEST['p']); $review_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id); if (!$review_item) { app_redirect(url("index", "index")); } //验证是否为当前商家会员管理的点评 $s_account_info = es_session::get("account_info"); if (in_array($review_item['supplier_location_id'], $s_account_info['location_ids']) && $review_item['from_data'] != "") { $is_admin = 1; $GLOBALS['tmpl']->assign("is_admin", $is_admin); } $review_item = sys_get_dp_detail($review_item); $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']); //供应商的地址列表 //定义location_id $locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']); $json_location = array(); $location_ids = array(0); foreach ($locations as $litem) { $location_ids[] = $litem['id']; $arr = array(); $arr['title'] = $litem['name']; $arr['address'] = $litem['address']; $arr['tel'] = $litem['tel']; $arr['lng'] = $litem['xpoint']; $arr['lat'] = $litem['ypoint']; $json_location[] = $arr; } $GLOBALS['tmpl']->assign("json_location", json_encode($json_location)); $GLOBALS['tmpl']->assign("locations", $locations); $GLOBALS['tmpl']->assign("store_info", $store_info); //输出回应列表 $sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id; $count = $GLOBALS['db']->getOne($sql_count); $page_size = app_conf("PAGE_SIZE"); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . " order by create_time desc limit " . $limit; $reply_list = $GLOBALS['db']->getAll($sql); foreach ($reply_list as $k => $v) { $reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']); $reply_list[$k]['create_time_format'] = pass_date($v['create_time']); } $page = new Page($count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('reply_list', $reply_list); $GLOBALS['tmpl']->assign('user_auth', get_user_auth()); $review_list_html = decode_topic($GLOBALS['tmpl']->fetch('inc/review/reply_list.html')); $GLOBALS['tmpl']->assign('review_list_html', $review_list_html); $GLOBALS['tmpl']->assign('review_item', $review_item); $GLOBALS['tmpl']->display('review_detail.html'); }