예제 #1
0
 function index()
 {
     $pid = $_POST["compareid"];
     //读取所有的床垫的TID
     $mattessTid_t = fetch_array("select id from " . dbtable("product_type") . " where id='2' or upid='2'");
     $mattessType = array();
     foreach ($mattessTid_t as $row) {
         $mattessTid[] = $row["id"];
         $mattessType[$row["tid"]] = $row["tname"];
     }
     $comtype = fetch_array("select * from " . dbtable("product_compare") . " where 1 and status=1 order by  displayorder desc, id asc");
     $data["comtype"] = $comtype;
     foreach ($pid as $row) {
         $res_one = fetch_one_array("select * from " . dbtable("product") . " where id='" . $row . "' ");
         if (in_array($res_one["tid"], $mattessTid)) {
             $resimage = fetch_one_array("select imgurl from " . dbtable("product_img") . " where pid='" . $row . "' and status='1' order by  displayorder limit 1");
             $res_one["compare"] = unserialize($res_one["compare"]);
             $res_one['com_imgurl'] = $resimage['imgurl'];
             $res[] = $res_one;
         }
     }
     $data["mattessType"] = $mattessType;
     $data["reslist"] = $res;
     $this->load->view('compare', $data);
     //dump($res);
 }
예제 #2
0
 function index()
 {
     $per_page = getgpc("per_page");
     $per_page = $per_page ? $per_page : 0;
     $pnum = 8;
     $list = fetch_array("select * from " . dbtable("englandstyle") . " where 1  and status=1 order by displayorder desc, id desc limit {$per_page},{$pnum}");
     foreach ($list as $key => $row) {
         $res[intval($key / 4)][] = $row;
     }
     $count = fetch_one_array("select count(*) as num from " . dbtable("englandstyle") . " where 1  and status=1");
     $data['total_num'] = $count['num'];
     $data['per_page'] = $per_page + $pnum;
     $data['pnum'] = $pnum;
     $data["reslist"] = $res;
     $this->load->view('englandstyle', $data);
 }
예제 #3
0
function prize_no($no, $table, $no_sign)
{
    $tmp_year = date("Y");
    // $tmp_year=substr($tmp_year,4);
    // $tmp_month=date("m");
    // $tmp_date=date("d");
    // $rechar2 =$no_sign . $tmp_year . $tmp_month .$tmp_date;
    $rechar2 = $no_sign . $tmp_year;
    $count = fetch_one_array("select count(*) as num from " . dbtable($table) . " where left({$no},6)='{$rechar2}' order by substring({$no},7,5)+0 desc limit 1");
    if ($count['num'] > 0) {
        $sql = "select substring({$no},7,5) as no from " . dbtable($table) . " where left({$no},6)='{$rechar2}' order by substring({$no},7,5)+0 desc limit 1";
        $res = fetch_one_array($sql);
        $no1 = vsprintf("%04s", $res['no'] + 1);
    } else {
        $no1 = "0001";
    }
    $rechar = $rechar2 . $no1;
    return $rechar;
}
예제 #4
0
 function update_password()
 {
     $username = getgpc("username");
     $old_password = getgpc("old_password");
     $new_password = getgpc("new_password");
     $new_password1 = getgpc("new_password1");
     $data = array();
     $md5salt = $this->config->item("md5salt");
     if ($username) {
         //
         $res = fetch_one_array("select * from " . dbtable("admin_user") . " where username='******'");
         if (!$res) {
             alert("错误,找不到该用户");
         } elseif ($res["password"] != md5($md5salt . $old_password)) {
             alert("输入旧密码不正确!");
         }
     }
     if (empty($old_password)) {
         alert("请输入旧密码");
     }
     if (empty($new_password)) {
         alert("请输入新密码");
     }
     if (empty($new_password1)) {
         alert("请输入确认密码");
     }
     if ($old_password == $new_password) {
         alert("请输入旧密码与新密码一样");
     }
     if ($new_password != $new_password1) {
         alert("请输入新密码与确认密码不一致");
     } else {
         $updata['password'] = md5($md5salt . $new_password);
         dbupdate("admin_user", $updata, array('username' => $username));
         // echo" <script language='javascript'>this.close();alert('修改密码成功,请记住新密码哟!');</script>";
         alert("修改密码成功,请记住新密码哟!", "admin.php?mod=login");
     }
     // $this->db->update('admin_user', $updata);
 }
예제 #5
0
 function chlogin()
 {
     $adminname = getgpc("adminname");
     $adminpwd = getgpc("adminpwd");
     $chres = fetch_one_array("select * from " . dbtable("admin_user") . " where username='******'");
     //dump($chres);
     if ($chres) {
         $md5salt = $this->config->item("md5salt");
         if ($chres["password"] == md5($md5salt . $adminpwd)) {
             //正常登录
             $_SESSION['chadmin'] = 1;
             $_SESSION['admin_id'] = $chres['id'];
             $_SESSION['admin_utype'] = $chres['utype'];
             $_SESSION['admin_username'] = $chres['username'];
             $ip = convertip();
             $updata = array('uid' => $chres['id'], 'username' => $chres['username'], 'time' => date("Y-m-d H:i:s"), 'ip' => $ip['ip'], 'ipaddr' => $ip['addr']);
             $this->db->insert('admin_user_loginlog', $updata);
             alert("登录成功", "admin.php");
             exit;
         }
     }
     alert("账号或者密码错误", "admin.php?mod=login");
 }
예제 #6
0
 function export()
 {
     $list = fetch_array("select p.*,u.tname,u.city from " . dbtable("prize") . " p," . dbtable("shopprize") . " u where p.city_id=u.id order by  p.prize_date");
     foreach ($list as $key => $row) {
         if ($row['status'] == 1) {
             $city_no = $row['city_no'];
             $city_data = fetch_one_array("select tname from " . dbtable("shopprize") . " where city_no='" . $city_no . "'");
             $list[$key]['extname'] = $city_data['tname'];
         } else {
             $list[$key]['extname'] = "";
         }
     }
     $data["plist"] = $list;
     $this->load->view('prize_output', $data);
     header("Content-Type:application/vnd.ms-excel");
     header("Pragma: public");
     header("Expires:0");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-Type: application/force-download");
     header("Content-Type: application/octet-stream");
     header("Content-Type: application/download");
     header("Content-Disposition:attachment;filename=prize_output.xls");
     header("Content-Transfer-Encoding: binary ");
 }
예제 #7
0
 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);
     }
 }
예제 #8
0
					<div class="prev_p"></div>
					<div class="next_p"></div>
				</div>
			</li>
			<li>
				<h4>双海绵边框和海绵边框</h4>
				<p>海绵边框在床垫边缘增强了牢固的支撑,延展了有效睡眠空间,而双海绵边框提供更为牢固的支撑。</p>
				<img src="images/support/pic_support_2.jpg">
				<img src="images/support/pic_support_2_cover.jpg" class="movein_cover">
				<h4>双海绵边框和海绵边框应用产品</h4>
				<div class="re_banner">
					<div class="box">
						<ul class="relative_product">
							<?php 
foreach ($list["1_6"] as $row) {
    $resptrait = fetch_one_array("select * from " . dbtable("product_img") . " where pid='" . $row['id'] . "' and status='1'  order by  istop,displayorder,id limit 1");
    ?>
								<li><a href="index.php?c=product&m=prolist&id=<?php 
    echo $row['id'];
    ?>
"><img src="<?php 
    echo substr($resptrait['imgurl'], 0, 1) == "/" ? "." : "";
    echo $resptrait['imgurl'];
    ?>
"><p><?php 
    echo $row['entitle'];
    ?>
<br><?php 
    echo $row['stitle'];
    ?>
</p></a></li>
예제 #9
0
 function get_englandstyle()
 {
     $per_page = getgpc("per_page");
     $pnum = getgpc("pnum");
     $count = fetch_one_array("select count(*) as num from " . dbtable("englandstyle") . " where 1  and status=1");
     $list = fetch_array("select * from " . dbtable("englandstyle") . " where 1  and status=1 order by displayorder desc, id desc limit {$per_page},{$pnum}");
     foreach ($list as $key => $row) {
         $res[intval($key / 4)][] = $row;
     }
     $str = '';
     $span_id = "#like_num_";
     if ($res) {
         foreach ($res as $key => $row) {
             foreach ($row as $trow) {
                 $str .= '<ul>';
                 $str .= '<li>';
                 $str .= '<a onclick="btnlike(' . $trow['id'] . ')"><img src="' . $trow['simgurl'] . '"></a>';
                 $str .= '<a class="title" onclick="btnlike(' . $trow['id'] . ')">' . $trow['title'] . '</a>';
                 $str .= '<p>' . nl2br($trow['intr']) . '</p>';
                 $str .= '<div>';
                 $str .= '<p class="date">' . $trow['showtime'] . '<a  class="btn_like" onclick=like(' . $trow['id'] . ',"' . $span_id . '")" ><span id="like_num_' . $trow["id"] . '">' . $trow['lovenum'] . '</span></a></p>';
                 $str .= '</div>';
                 $str .= '</li>';
                 $str .= '</ul>';
             }
         }
         $next_page = $per_page + $pnum;
         $str .= '<script>';
         $str .= '$("#per_page").val(' . $next_page . ')';
         // $str .='findbranch('.$list[0]["log"].','.$list[0]['lat'].',"'.$list[0]['tname'].'","'.$addr0.'")';
         $str .= '</script>';
     }
     echo $str;
 }
예제 #10
0
 function prolist()
 {
     $id = getGP('id');
     $res = fetch_one_array("select p.*,t.tname,t.upid from " . dbtable("product") . " p ," . dbtable("product_type") . " t where p.tid=t.id and p.id='{$id}' and p.status=1 ");
     //读取所有的床垫的TID
     $mattessTid_t = fetch_array("select id from " . dbtable("product_type") . " where id='2' or upid='2'");
     foreach ($mattessTid_t as $row) {
         $mattessTid[] = $row["id"];
     }
     $hardness = $res['hardness'] * 20 - 10;
     $hardness = $hardness < 0 ? 10 : $hardness;
     $data['hardness'] = $hardness;
     $data['res'] = $res;
     $resimage = fetch_array("select * from " . dbtable("product_img") . " where pid='" . $id . "' and status=1 and status='1'");
     $data['resimage'] = $resimage;
     $resptrait = fetch_array("select * from " . dbtable("product_ptrait") . " where pid='" . $id . "'   and status=1 order by  displayorder");
     $data['resptrait'] = $resptrait;
     $ptraitlist = array();
     foreach ($resptrait as $row) {
         $title = $row['title'];
         $ptraitlist[$title] = $row;
     }
     $data['ptraitlist'] = $ptraitlist;
     $tid = $res['tid'];
     $respro_query = $this->db->select('imgurl,title,id,entitle,stitle')->from('web_product')->where("`tid` = '{$tid}' and `id` != '{$id}'")->get();
     $respro = $respro_query->result_array();
     $respro = fetch_array("select * from " . dbtable("product") . " where tid='" . $res['tid'] . "' and status='1' and id not in ({$id}) order by  id");
     foreach ($respro as $key => $row) {
         $pid = $row['id'];
         $resimage = fetch_one_array("select imgurl from " . dbtable("product_img") . " where pid='" . $pid . "' and status='1' order by  displayorder limit 1");
         $respro[$key]['imgurl'] = $resimage['imgurl'];
     }
     $data['prodata'] = $respro;
     $data["mattessTid"] = $mattessTid;
     if (checkmobile()) {
         $indexpushres = fetch_array("select * from " . dbtable("indexpush_type") . "");
         $index_data = array();
         foreach ($indexpushres as $row) {
             $tid = $row['id'];
             $pushres = fetch_array("select * from " . dbtable("indexpush") . " where tid='" . $tid . "' and status='1' and type='2' order by istop desc ,displayorder ");
             $index_data[$tid] = $pushres;
         }
         $data['index_data'] = $index_data;
         $this->load->view('mobile/product_detail', $data);
     } else {
         $indexpushres = fetch_array("select * from " . dbtable("indexpush_type") . "");
         $index_data = array();
         foreach ($indexpushres as $row) {
             $tid = $row['id'];
             $pushres = fetch_array("select * from " . dbtable("indexpush") . " where tid='" . $tid . "' and status='1' and type='1' order by istop desc ,displayorder ");
             $index_data[$tid] = $pushres;
         }
         $data['index_data'] = $index_data;
         //产品类别
         $query_prod_type = $this->db->select('tname,id,upid,displayorder')->from('web_product_type')->order_by('displayorder', 'asc')->get();
         $query_prod = $this->db->select('id,tid,stitle,entitle')->from('web_product')->get();
         $prod_types = $query_prod_type->result_array();
         $prods = $query_prod->result_array();
         foreach ($prod_types as $key => $value) {
             foreach ($prods as $k => $v) {
                 if ($v['tid'] == $value['id']) {
                     $prod_types[$key]['child_1'][] = $prods[$k];
                 }
             }
         }
         $prod_type_list = tree($prod_types, 'upid', 'id');
         $prod_type_list = get_menu($prod_type_list, 'upid', 'id');
         $data['prod_types'] = $prod_type_list;
         $this->load->view('product', $data);
     }
 }
예제 #11
0
 function result()
 {
     $section_value = $_POST['section_value'];
     if (empty($section_value)) {
         alert("请选择试题!");
     }
     $re_value = sel_product($section_value);
     $if_value = $re_value['data'];
     if (empty($if_value)) {
         alert("没有找到符合你要求的床垫!");
     }
     $where = "";
     if ($re_value['status'] == "1") {
         $restype = fetch_array("select id from " . dbtable("product_type") . " where upid='2'");
         $type_id = "";
         foreach ($restype as $key => $row) {
             if ($key != 0) {
                 $type_id .= ",";
             }
             $type_id .= "'" . $row['id'] . "'";
         }
         $where .= " p.tid in ({$type_id}) ";
     } else {
         $if_value = $re_value['data'];
         $where .= " p.stitle in ({$if_value})";
     }
     //		$sel_value=explode(",",$section_value);
     //		$pro_name[1]='"经典超级保背健","经典呵背","温度智慧 I 1600","温度智慧 II 1600","皇家皇冠","皇家红宝石"';
     //		$image[1]=array("jdcjbbj.jpg","jdkb.jpg","wdzh1600.jpg","wdzh2600.jpg","hjhg.jpg","hjhbs.jpg");
     //		$pro_name[2]='"经典A-B保背健","经典豪华保背健","温度智慧 I 1200","温度智慧 II 1200","皇家红宝石","帝冠"';
     //		$image[2]=array("jdab.jpg","jdahbbj.jpg","wdzh1200.jpg","wdzh2200.jpg","hjhbs.jpg","dg.jpg");
     //		$pro_name[3]='"经典超级保背健","经典呵背","温度智慧 I 1600","温度智慧 II 1600","皇家金钻石","传家宝"';
     //		$image[3]=array("jdcjbbj.jpg","jdhb.jpg","wdzh1600.jpg","wdzh2600.jpg","hjjzs.jpg","cjb.jpg");
     //		$pro_name[4]='"温度智慧 II 1600","皇家金钻石","传家宝"';
     //		$image[3]=array("wdzh2600.jpg","hjjzs.jpg","cjb.jpg");
     //		$pro_name[5]='"经典薄款保背健","经典保背健","经典A-B保背健","温度智慧 I 1200","温度智慧 II 1200","皇家蓝宝石","皇家绿宝石"';
     //		$image[3]=array("jdpkbbj.jpg","jdbb.jpg","jdab.jpg","wdzh1200.jpg","wdzh2200.jpg","hjlbs.jpg","hjlbs.jpg",);
     ///*
     // * 搜索产品的结果只按第四题目的选择进行产品筛选
     // * 1表示羽毛,2表示棉花,3表示木头,4表示沙滩,5表示草地
     // */
     //		switch($sel_value['3'])
     //		{
     //			case "1":
     //			case "2":
     //			case "3":
     //			case "4":
     //			case "5":
     //				$key=$sel_value[3];
     //			    $res=fetch_array("select p.*,t.tname from ".dbtable("product")." p ,".dbtable("product_type")." t where p.tid=t.id and p.stitle in (".$where.") and p.status=1 order by t.displayorder");
     //				foreach($res as $key=>$row)
     //				{
     //					$pid=$row['id'];
     //					$resimage=fetch_one_array("select imgurl from ".dbtable("product_img")." where pid='".$pid."' and status='1' order by  displayorder limit 1");
     //					$res[$key]['imgurl']=$resimage['imgurl'];
     //				}
     //				$data['res']=$res;
     //			break;
     //		}
     //		$pro_data=array();
     //		$key=0;
     //		for($i=0;$i<count($if_value);$i++)
     //		{
     //			$where ="p.stitle='".$if_value[$i]."'";
     //			$res=fetch_one_array("select p.*,t.tname from ".dbtable("product")." p ,".dbtable("product_type")." t where p.tid=t.id and ".$where." and p.status=1 order by t.displayorder");
     //			if(!empty($res['id']))
     //			{
     //				$pid=$res['id'];
     //				$pro_data[$key]=$res;
     //				$resimage=fetch_one_array("select imgurl from ".dbtable("product_img")." where pid='".$pid."' and status='1' order by  displayorder limit 1");
     //				$pro_data[$key]['imgurl']=$resimage['imgurl'];
     //				$key++;
     //			}
     //		}
     $res = fetch_array("select p.*,t.tname from " . dbtable("product") . " p ," . dbtable("product_type") . " t where p.tid=t.id and (" . $where . ") and p.status=1 order by t.displayorder");
     foreach ($res as $key => $row) {
         $pid = $row['id'];
         $resimage = fetch_one_array("select imgurl from " . dbtable("product_img") . " where pid='" . $pid . "' and status='1' order by  displayorder limit 1");
         $res[$key]['imgurl'] = $resimage['imgurl'];
     }
     $data['res_list'] = $res;
     if (checkmobile()) {
         $this->load->view('mobile/selection_result', $data);
     } else {
         $this->load->view('selection_result', $data);
     }
 }
예제 #12
0
 public function iskv()
 {
     //删除
     $id = intval(getgpc("id"));
     $istop_value = intval(getgpc("iskv_value"));
     $ch = fetch_one_array("select * from " . dbtable("news") . " where id='" . $id . "'");
     if ($ch) {
         $this->db->where('id', $id);
         $this->db->update('news', array('iskv' => $istop_value));
         // DB::update("news",array('status'=>0)," id='".$id."'");
         if ($istop_value == "1") {
             $upsql = "update " . dbtable("news") . " set iskv='0' where id!='" . $id . "'";
             $this->db->query($upsql);
             alert("KV显示成功", "");
         } else {
             alert("取消KV显示成功", "");
         }
     }
     alert("操作失败", "");
 }
예제 #13
0
 function news_detail()
 {
     $id = getgpc("id");
     $reslist = fetch_one_array("select *,date_format(showtime,'%Y-%m-%d') as news_date from " . dbtable("news") . " where 1 and id='" . $id . "' and status=1 ");
     $data["reslist"] = $reslist;
     $reslist = fetch_array("select n.*,date_format(n.showtime,'%Y-%m-%d') as news_date from " . dbtable("news") . "  as n ," . dbtable("newslink") . "  as l where 1 and l.lid=n.id and n.status=1  limit 4");
     $data["linklist"] = $reslist;
     $this->load->view('newsdetail', $data);
 }
예제 #14
0
 function updateuser()
 {
     $mongo = getMyMongodb();
     $list = fetch_array("select * from " . dbtable("user") . " where 1");
     foreach ($list as $row) {
         //更新用户附加信息表
         $ch = fetch_one_array("select * from " . dbtable("user_info") . " where uid='" . $row['id'] . "'");
         if (!$ch) {
             $indata = array('uid' => $row['id']);
             $this->db->insert('user_info', $indata);
         }
         $ch = fetch_one_array("select * from " . dbtable("user_set") . " where uid='" . $row['id'] . "'");
         if (!$ch) {
             $this->db->insert('user_set', array('uid' => $row['id']));
         }
         /*
                     //更新本班的讨论组
                     $chc=fetch_array("SELECT
                                 s.id AS 'sid',
                                 s.`name` AS 'sname',
                                 g.id AS 'gid',
                                 g.`name` AS 'gname',
                                 c.id AS 'cid',
                                 c.`name` AS 'cname'
                             FROM
                                 isc_school s,
                                 isc_grade g,
                                 isc_class c
                             WHERE
                                 s.id = g.upid
                             AND g.id = c.upid");
                     foreach($chc as $row){
                         $ch=fetch_one_array("select * from ".dbtable("chat_group")." where classid='".$row["cid"]."'");
                         if(!$ch){
                             $indata=array(
                                 'type'=>1,
                                 'title'=>$row['sname'].$row['gname'].$row['cname'],
                                 'pnum'=>0,
                                 'createuid'=>0,
                                 'gtime'=>date("Y-m-d H:i:s"),
                                 'schoolid'=>$row['sid'],
                                 'gradeid'=>$row["gid"],
                                 'classid'=>$row["cid"],
                                 'status'=>1
                             );
                             $this->db->insert('chat_group', $indata) ;
                             $gid=$this->db->insert_id();
                         }else{
                             $gid=$ch["id"];
                         }
                         //将全部的班级成员加入讨论组
                         $ulist=fetch_array("SELECT
                                             u.id,u.user_token
                                             FROM
                                                 isc_user u,
                                                 isc_user_info i,
                                                 isc_child_info c
                                             WHERE
                                             u.id =i.uid and
                                                 c.classid = '".$gid."'
                                             AND(i.uid = c.mid OR i.uid = c.pid)
                                             ORDER BY
                                                 i.uid ASC");
                         foreach($ulist as $u){
                             $ch=fetch_one_array("select * from ".dbtable("chat_group_member")." where gid='".$gid."' and uid='".$u['id']."'");
                             if(!$ch){
                                 $indata_m=array(
                                     'gid'=>$gid,
                                     'uid'=>$u['id'],
                                     'user_token'=>$u['user_token'],
                                     'gtime'=>date("Y-m-d H:i:s"),
                                     'status'=>1
                                 );
                                 $this->db->insert('chat_group_member', $indata_m) ;
         
                                 $this->db->query("update ".dbtable("chat_group")." set pnum=pnum+1 where id='".$gid."'");
                             }
                         }
                     }
                     //*/
         // 更新消息表
         $mongo->insert("userMessages", array("userid" => $row['id'], "user_token" => $row['user_token']));
         //*/
     }
 }
예제 #15
0
 public function contentdel()
 {
     //删除
     $id = intval(getgpc("id"));
     $ch = fetch_one_array("select * from " . dbtable("employment_content") . " where id='" . $id . "'");
     if ($ch) {
         $this->db->where('id', $id);
         $this->db->update('employment_content', array('status' => 0));
         alert("删除成功", "");
     }
     alert("删除失败", "");
 }
예제 #16
0
 public function areadel()
 {
     //删除
     $id = intval(getgpc("id"));
     $ch = fetch_one_array("select * from " . dbtable("joininfo_area") . " where id='" . $id . "'");
     if ($ch) {
         $this->db->where('id', $id);
         $this->db->update('joininfo_area', array('status' => 0));
         alert("删除成功", "");
     }
     alert("删除失败", "");
 }
예제 #17
0
 public function index_url()
 {
     //面包屑导航
     $menuadd = array("name" => "英伦风尚", 'link' => "?mod=englandstyle&act=index_url");
     $data['headpagemenu'] = $this->createmenu($menuadd);
     $data['headpagetitle'] = "英伦风尚";
     //左侧菜单
     $data['menumod'] = "product";
     //
     $addsql = "";
     $keyword = getgpc("keyword");
     if ($keyword) {
         $addsql = " and title like '%" . $keyword . "%'";
     }
     //数据总量
     $count = fetch_one_array("select count(*) as num from " . dbtable("englandstyle_url") . " 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=englandstyle&act=index_url&keyword=' . $keyword;
     $config['total_rows'] = $count["num"];
     $config['per_page'] = $pnum;
     $this->pagination->initialize($config);
     $data["page"] = $this->pagination->create_links();
     $list = fetch_array("select *,date_format(gtime,'%Y-%m-%d') as import_date from " . dbtable("englandstyle_url") . " where 1 {$addsql} and status>=1 order by displayorder desc, id desc limit {$per_page},{$pnum} ");
     $data["reslist"] = $list;
     $this->load->view('englandstyle_index_url', $data);
 }