public function index() { //面包屑导航 $menuadd = array("name" => "加盟管理", 'link' => "?mod=joininfo&act=index"); $data['headpagemenu'] = $this->createmenu($menuadd); $data['headpagetitle'] = "加盟管理"; //左侧菜单 $data['menumod'] = "joininfo"; // $addsql = ""; $keyword = getgpc("keyword"); $searth_date = getgpc("searth_date"); $pid = getgpc("pid"); $pid = $pid == "请选择省份" ? "0" : $pid; $cid = getgpc("cid"); $cid = $cid == "请选择城市" ? "0" : $cid; if ($keyword) { $addsql .= " and (name like '%" . $keyword . "%' or intr like '%" . $keyword . "%')"; } if ($pid) { $addsql .= " and pid='" . $pid . "'"; } if ($cid) { $addsql .= " and cid='" . $cid . "'"; } if ($searth_date) { $addsql .= " and date_format(gtime,'%Y-%m-%d')='" . $searth_date . "'"; } //数据总量 $count = fetch_one_array("select count(*) as num from " . dbtable("joininfo") . " where 1 {$addsql} and status>=1 "); //分页 $per_page = getgpc("per_page"); $per_page = $per_page ? $per_page : 0; $pnum = 20; $this->load->library('pagination'); $config['base_url'] = 'admin.php?mod=joininfo&act=index&keyword=' . $keyword; $config['total_rows'] = $count["num"]; $config['per_page'] = $pnum; $this->pagination->initialize($config); $data["page"] = $this->pagination->create_links(); $provinceList = getProvinceList(); $data["provinceList"] = $provinceList; $list = fetch_array("select *,date_format(gtime,'%Y-%m-%d') as emp_ym from " . dbtable("joininfo") . " where 1 {$addsql} and status>=1 order by displayorder desc, id desc limit {$per_page},{$pnum} "); $data["reslist"] = $list; $data['keyword'] = $keyword; $data['searth_date'] = $searth_date; $data['pid'] = $pid; $data['cid'] = $cid; $this->load->view('joininfo_index', $data); }
function index() { ////面包屑导航 // $data['headpagemenu']=array( // 0=>array('name'=>'后台','link'=>"admin.php"), // 1=>array('name'=>'网站概况','link'=>""), // ); // $data['headpagetitle']="网站概况"; ////左侧菜单 // $data['menumod']="index"; $cid = getgpc("cid"); $pid = getgpc("pid"); //分页 $per_page = getgpc("per_page"); $per_page = $per_page ? $per_page : 0; $pnum = 6; $provinceList = getProvinceList(); $data["provinceList"] = $provinceList; $data['tishi_sign'] = "0"; if (checkmobile()) { $this->load->view('mobile/shop', $data); } else { /* * PC端数据取 */ if (!$cid) { $ip = convertip(); if (strstr($ip["addr"], "市")) { $city_t = explode("市", $ip["addr"]); if (strstr($city_t[0], "省")) { $city_t = explode("省", $city_t[0]); $province = $city_t[0]; $city = $city_t[1]; $whereif = " (province like '%" . $province . "%') "; } else { $city = $city_t[0]; $province = $city_t[0]; $whereif = " (province like '%" . $province . "%') "; } } else { $city = "上海"; $province = "上海"; $whereif = " level>=4 "; } if (!$pid) { $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where " . $whereif . " and status=1"); if ($count['num'] > 0) { $list = fetch_array("select * from " . dbtable("shop") . " where " . $whereif . " and status=1 order by id asc "); // $list=fetch_array("select * from ".dbtable("shop")." where (city like '%".$city."%' or province like '%".$city."%') and status=1 order by id asc limit $per_page,$pnum "); } else { $data['tishi_sign'] = "1"; $data['tishi_data'] = "您所在的省份暂无门店<br>为您推荐以下门店!"; $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where (province like '%" . $province . "%') and status=1 limit 6"); $list = fetch_array("select * from " . dbtable("shop") . " where (province like '%" . $province . "%') and status=1 order by id asc limit 6 "); } } else { $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where pid='" . $pid . "' and status=1 "); if ($count['num'] > 0) { $list = fetch_array("select * from " . dbtable("shop") . " where pid='" . $pid . "' and status=1 order by id desc limit {$per_page},{$pnum} "); } else { // $count["num"]=6; $data['tishi_sign'] = "1"; $data['tishi_data'] = "您所在的省份暂无门店<br>为您推荐以下门店!"; $list = fetch_array("select * from " . dbtable("shop") . " where level>=4 and status=1 order by id desc limit 5 "); } } // $count=fetch_one_array("select count(*) as num from ".dbtable("shop")." where (city like '%".$city."%' or province like '%".$city."%') and status=1"); // if($count['num']>0) // { // $list=fetch_array("select * from ".dbtable("shop")." where (province like '%".$province."%') and status=1 order by id asc "); // // $list=fetch_array("select * from ".dbtable("shop")." where (city like '%".$city."%' or province like '%".$city."%') and status=1 order by id asc limit $per_page,$pnum "); // }else{ // $data['tishi_sign']="1"; // $data['tishi_data']="您所在的省份暂无门店,请选择其它省份进行查询!"; // $count=fetch_one_array("select count(*) as num from ".dbtable("shop")." where (province like '%".$province."%') and status=1 limit 6"); // $list=fetch_array("select * from ".dbtable("shop")." where (province like '%".$province."%') and status=1 order by id asc limit 6 "); // } // $list=fetch_array("select * from ".dbtable("shop")." where (province like '%".$province."%') and status=1 order by id asc limit $per_page,$pnum "); } else { $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where cid='" . $cid . "' and status=1 "); if ($count['num'] > 0) { $list = fetch_array("select * from " . dbtable("shop") . " where cid='" . $cid . "' and status=1 order by id desc limit {$per_page},{$pnum} "); } else { // $count["num"]=6; $data['tishi_sign'] = "1"; $data['tishi_data'] = "您选择的区域暂无门店<br>为您推荐以下门店!"; $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where pid='" . $pid . "' and level>=4 and status=1 limit 5 "); if ($count['num'] > 0) { $list = fetch_array("select * from " . dbtable("shop") . " where pid='" . $pid . "' and level>=4 and status=1 order by id desc limit 5 "); } else { $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where pid='" . $pid . "' and status=1 "); if ($count['num'] > 0) { $list = fetch_array("select * from " . dbtable("shop") . " where pid='" . $pid . "' and status=1 order by id desc"); } else { $count = fetch_one_array("select count(*) as num from " . dbtable("shop") . " where level>=4 and status=1 limit 5"); $list = fetch_array("select * from " . dbtable("shop") . " where level>=4 and status=1 order by id desc limit 5 "); } } // $list=fetch_array("select * from ".dbtable("shop")." where pid='".$pid."' and status=1 order by id desc limit 6 "); } } $data['res'] = $list; $this->load->library('pagination'); $config['base_url'] = 'index.php?c=shop&pid=' . $pid . "&cid=" . $cid; $config['total_rows'] = $count["num"]; $config['per_page'] = $pnum; $config['first_link'] = FALSE; $config['last_link'] = FALSE; $config['per_page'] = $pnum; $this->pagination->initialize($config); $data["page"] = $this->pagination->create_links(); if (!$pid || !$cid) { $pid = $list[0]["pid"]; // $cid= $list[0]["cid"]; } $data["pid"] = $pid; $data["cid"] = $cid; $this->load->view('shop', $data); } }
function employment() { $provinceList = getProvinceList(); $data["provinceList"] = $provinceList; $list = fetch_array("select *,date_format(gtime,'%Y-%m-%d') as emp_ym from " . dbtable("employment") . " where status=1 order by displayorder desc, id desc "); $data["reslist"] = $list; $this->load->view('employment', $data); }
public function editshop() { $id = getgpc("id"); if ($id) { $res = fetch_one_array("select * from " . dbtable("shop") . " where id ='" . $id . "' "); if (!$res) { alert("错误,没有找到该数据", ""); } else { $data["res"] = $res; } } else { $res['displayorder'] = 0; $res['status'] = 1; } $data["res"] = $res; //读取省份信息 $provinceList = getProvinceList(); $data["provinceList"] = $provinceList; $this->load->view('shop_edit', $data); }