function item_city_box($city_txt, $city_select_txt) { $aCities = osc_get_cities(); $item = osc_item() != null ? osc_item() : array(); switch (count($aCities)) { case 0: // 0 regions ?> <div class="clearfix"> <label><?php echo $city_txt; ?> </label> <div class="input"> <input class="city_name" id="city_name" type="text" name="city" value="<?php echo get_city_name($item); ?> " /> </div> </div> <?php break; case 1: // only one region ?> <input class="city_id" id="city_id" type="hidden" name="cityId" value="<?php echo get_city_id($item); ?> " /> <?php break; default: // more than one region ?> <div class="clearfix"> <label><?php echo $city_txt; ?> </label> <div class="input"> <select class="city_id" id="city_id" name="cityId"> <option value=""><?php echo $city_select_txt; ?> </option> <?php foreach ($aCities as $city) { ?> <option value="<?php echo $city['pk_i_id']; ?> "><?php echo $city['s_name']; ?> </option> <?php } ?> </select> </div> </div> <?php break; } }
<?php require_once "includes/model.php"; include 'assets/header.php'; include 'assets/search.php'; include 'assets/login.php'; include 'assets/leftmenu.php'; $city_id = $_GET['city']; $city_name = get_city_name($city_id); $city_id = $_GET['city']; $city_name = get_city_name($city_id); ?> <?php include 'assets/mainview_search.php'; include 'assets/rightmenu.php'; ?>
public function orders_edit() { //订单添加 if ($this->isPost()) { $orders = M('orders'); $orders_id = $this->_post('orders_id'); /* $save_data['pay_type'] = $this->_post('pay_type'); $save_data['orders_status'] = $this->_post('orders_status');*/ $save_data['is_del'] = $this->_post('is_del') > 0 ? '1' : '0'; $list = $orders->where("orders_id={$orders_id}")->save($save_data); //echo $orders->getLastSql();die(); if ($list !== false) { $this->success('数据保存成功!', "__APP__/Orders/orders_list/"); exit; } else { $this->error("没有更新任何数据!", "__APP__/Orders/orders_list/"); } exit; } $orders = M('orders'); $orders_id = $this->_get('orders_id'); $arr = $orders->where("orders_id={$orders_id}")->find(); //订单地址 省市区 $this->assign('address', get_city_name($arr['district_id'])); /*if($arr['status']!=1){ $this->error("无效的订单,不可以编辑!","__APP__/Orders/orders_list/"); }*/ $orders_item = M("orders_item"); $arr_orders_item = $orders_item->join("join cms_item on cms_orders_item.item_id = cms_item.item_id")->where("orders_id = " . $orders_id)->select(); $total_price = 0; foreach ($arr_orders_item as $v) { $total_price += $v['buy_price'] * $v['buy_num']; } $this->assign('total_price', $total_price); $this->assign('arr', $arr); $this->assign('arr_orders_item', $arr_orders_item); $this->display(); }
function get_dianpu_baseinfo($suppid = 0, $suppinfo) { if (intval($suppid) <= 0) { return; } global $smarty; $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('supplier_shop_config') . " WHERE supplier_id = " . $suppid; $shopinfo = $GLOBALS['db']->getAll($sql); $_goods_attr = array(); foreach ($shopinfo as $value) { $_goods_attr[$value['code']] = $value['value']; } $smarty->assign('ghs_css_path', 'themes/' . $_goods_attr['template'] . '/images/ghs/css/ghs_style.css'); //入驻商所选模板样式路径 $shoplogo = empty($_goods_attr['shop_logo']) ? 'themes/' . $_goods_attr['template'] . '/images/dianpu.jpg' : $_goods_attr['shop_logo']; $smarty->assign('shoplogo', $shoplogo); //商家logo $smarty->assign('shopname', htmlspecialchars($_goods_attr['shop_name'])); //店铺名称 $smarty->assign('suppid', $suppinfo['supplier_id']); //商家名称 $smarty->assign('suppliername', htmlspecialchars($suppinfo['supplier_name'])); //商家名称 $smarty->assign('userrank', htmlspecialchars($suppinfo['rank_name'])); //商家等级 $smarty->assign('region', get_province_city($_goods_attr['shop_province'], $_goods_attr['shop_city'])); $opint = $GLOBALS['db']->getOne("SELECT value FROM " . $GLOBALS['ecs']->table('supplier_shop_config') . " WHERE code = 'shop_opint' and supplier_id = " . $suppid); if (empty($opint)) { $city = get_city_name($_goods_attr['shop_city']); $pointJson = file_get_contents('http://api.map.baidu.com/geocoder/v2/?ak=dDbtTxnNUxSPt68hA2PhrNqS&output=json&address=' . $_goods_attr['shop_address'] . 'city=' . $city); //获取地图坐标 $pointArr = json_decode($pointJson, true); } else { $option = explode(',', $opint); $pointArr['result']['location']['lng'] = $option[0]; $pointArr['result']['location']['lat'] = $option[1]; } $smarty->assign('opint', $pointArr['result']['location']); $smarty->assign('address', $_goods_attr['shop_address']); $smarty->assign('serviceqq', $_goods_attr['qq']); $smarty->assign('serviceww', $_goods_attr['ww']); $smarty->assign('serviceemail', $_goods_attr['service_email']); $smarty->assign('servicephone', $_goods_attr['service_phone']); $smarty->assign('createtime', gmdate('Y-m-d', $suppinfo['add_time'])); //商家创建时间 $suppid = intval($suppid) > 0 ? intval($suppid) : intval($_GET['suppId']); }
function get_pickup_point_list() { $result = get_filter(); if ($result === false) { $filter = array(); $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keyword'] = json_str_iconv($filter['keyword']); } $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $filter['province'] = empty($_REQUEST['province']) ? '' : trim($_REQUEST['province']); $filter['city'] = empty($_REQUEST['city']) ? '' : trim($_REQUEST['city']); $filter['district'] = empty($_REQUEST['district']) ? '' : trim($_REQUEST['district']); $where = ''; if (!empty($filter['keyword'])) { $where = " AND (shop_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%' OR contact LIKE '%" . mysql_like_quote($filter['keyword']) . "%')"; } if (!empty($filter['province'])) { $where .= " AND province_id=" . $filter['province']; } if (!empty($filter['city'])) { $where .= " AND city_id=" . $filter['city']; } if (!empty($filter['district'])) { $where .= " AND district_id=" . $filter['district']; } /* 自提点总数 */ $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('pickup_point') . 'WHERE supplier_id=0 ' . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 获取自提点数据 */ $sql = 'SELECT * ' . 'FROM ' . $GLOBALS['ecs']->table('pickup_point') . 'WHERE supplier_id=0' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order']; $filter['keyword'] = stripslashes($filter['keyword']); set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $arr = array(); $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); while ($rows = $GLOBALS['db']->fetchRow($res)) { $rows['province'] = get_city_name($rows['province_id']); $rows['city'] = get_city_name($rows['city_id']); $rows['district'] = get_city_name($rows['district_id']); $arr[] = $rows; } return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); }
function get_locale_mem($ip) { $mem = api_open_mmc(); if ($city_name = $mem->ns_get(GET_DEVICE, $ip)) { return $city_name; } $city_name = get_city_name($ip); if (empty($city_name)) { $city_name = $ip; } $mem->ns_set(GET_LOCALE, $ip, $city_name, GET_LOCALE_EXPIRE); return $city_name; }