Example #1
0
 public function index()
 {
     $results = get_area_cache();
     $gets = I('get.');
     $cur_url = str_ireplace('|', '/', $gets['cur_url']);
     //session('cur_url',$cur_url);
     $alphabets = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z');
     /*查询level小于1的数据,用于筛选省市*/
     foreach ($results as $k => $v) {
         if ($v['level'] < 2) {
             $data[] = $v;
         }
     }
     /*按字母顺序组合城市列表数组*/
     for ($i = A; $i <= Z; $i++) {
         foreach ($results as $k => $v) {
             if ($i == $v['first_char'] && $v['level'] == 1) {
                 $data_city[$i][$k] = $v;
             }
         }
     }
     $this->assign('data', $data);
     //dump($data);die;
     $this->assign('alphabets', $alphabets);
     $this->assign('data_city', $data_city);
     $this->display();
 }
Example #2
0
 public function index()
 {
     $gets = I('get.');
     $product_id = $gets['product_id'];
     $member_id = session('home_member_id');
     /* 获取所选商品信息 */
     $map['id'] = $product_id;
     $product_info = get_info($this->product_table, $map);
     $product_type = $product_info['type'];
     if (!$product_type) {
         $this->error('产品类型错误');
     }
     if (intval($product_type)) {
         // 文件上传插件第二次加载页面时的报错
         /* 确定要加载的第一步的页面 */
         session('buy_first_view', $this->first_step_view[$product_type]);
     }
     $temp['0'] = $product_info;
     /* 获取格式为 id=>title 的语言分类数组 */
     $language_text = id_and_text(get_language_cache());
     /* 获取格式为 id=>title 的领域分类数组 */
     $industry_text = id_and_text(get_industry_cache());
     /* 获取格式为 id=>title 的属性分类数组 */
     $ability_text = id_and_text(get_ability_cache());
     /* 获取所有属性,并将键值转换为子数组的ID */
     $ability_all = array_id_key(get_ability_cache());
     /* 获取所有行业,并将键值转换为子数组的ID */
     $industry_all = array_id_key(get_industry_cache());
     $temp = int_to_string($temp, array("language_id" => $language_text, "to_language_id" => $language_text));
     /* 将二维数组还原成一维数组 */
     $product_info = $temp[0];
     /* 将行业ID转换为包含title的数组 */
     $product_info['industry_id_arr'] = int_to_arr(json_decode($product_info['industry_id'], true), $industry_all);
     /* 将属性ID转换为包含title的数组 */
     $product_info['ability_id_arr'] = int_to_arr(json_decode($product_info['ability_id'], true), $ability_all);
     // print_r($product_info);
     $address_result = get_address_info($member_id);
     $data['address_result'] = $address_result;
     $data['product_info'] = $product_info;
     $this->assign($data);
     // 根据数据表中的字段获取地址信息
     $area = get_area_cache();
     $data['area'] = $area;
     // 		dump($data['product_info']);die;
     $this->assign('data', $data);
     /* 按照所传产品类型确定第一步加载的页面 */
     $this->display(session('buy_first_view'));
 }
Example #3
0
 public function index()
 {
     /*检查地区缓存*/
     get_area_cache();
     $map['pid'] = 0;
     if (I('pid')) {
         $map['pid'] = intval(I('pid'));
     }
     $keywords = I('keywords');
     if ($keywords) {
         $map['title'] = array('like', "%{$keywords}%");
     }
     $map['status'] = array('gt', -1);
     $result = $this->page($this->table, $map, 'id asc');
     $result = int_to_string($result);
     $data['result'] = $result;
     $this->assign($data);
     $this->display();
 }
 /**
  * 地址信息修改
  * @author						赵群
  * @date						2015-07-22
  */
 public function edit()
 {
     $apptype = (!empty(I('post.apptype')) and I('post.apptype') == C('APP_KEY')) ? true : false;
     //手机app接口密钥
     if ($apptype) {
         $app_key = trim(I("key"));
         $member_id = I("home_member_id");
         $this->isLoginExpire($app_key, $member_id);
     }
     unset($_POST["apptype"]);
     unset($_POST["key"]);
     unset($_POST["home_member_id"]);
     if (!empty(I("post."))) {
         if ($apptype) {
             $_POST["apptype"] = $apptype;
             $_POST["home_member_id"] = $member_id;
         }
         $this->update();
     } else {
         $gets = I('get.');
         $map = array('id' => $gets['id']);
         //获取用户类型
         $member_id = session('home_member_id');
         $type = get_info('member', array('id' => $member_id), $field = array('type'));
         //获取用户需要修改的单条信息
         $res = get_info($this->table, $map);
         //获取地址的分类路径并拆分成数组
         $area = get_area_cache();
         $ret = explode('-', $res['area_path']);
         $data['area'] = $area;
         //根据数据表中的字段获取地址信息
         $province_data = array();
         $city_data = array();
         $area_data = array();
         foreach ($area as $value) {
             if ($value['id'] == $ret[2]) {
                 $province_data['province'] = $value['title'];
                 $province_data['id'] = $value['id'];
                 $province_data['path'] = $value['path'];
             }
             if ($value['id'] == $ret[3]) {
                 $city_data['city'] = $value['title'];
                 $city_data['id'] = $value['id'];
                 $city_data['path'] = $value['path'];
             }
             if ($value['id'] == $ret[4]) {
                 $area_data['area'] = $value['title'];
                 $area_data['id'] = $value['id'];
                 $area_data['path'] = $value['path'];
             }
         }
         if ($apptype) {
             // $appinfo["area"] = getAreaInfo();//地理信息
             $appinfo["ret"] = (array) $ret;
             //用户地址的分类路径
             $appinfo["province_data"] = $province_data;
             //省
             $appinfo["city_data"] = $city_data;
             //市
             $appinfo["area_data"] = $area_data;
             //区
             $appinfo['res'] = (array) $res;
             $this->ajaxReturn($appinfo);
         }
         // 			$this->assign('data',$data)->assign('res',$res)->assign('ret',$ret)->assign('province_data',$province_data)->assign('city_data',$city_data)->assign('area_data',$area_data);
         $this->assign('data', $data)->assign('res', $res)->assign('ret', $ret)->assign('province_data', $province_data)->assign('city_data', $city_data)->assign('area_data', $area_data)->assign('type', $type);
         $this->display();
     }
 }
 /**
  * 店铺搜索列表首页
  * 按照客户点击的筛选条件来设置查询条件  
  * 查询出店铺内有用户搜索商品的所有店铺
  * @author						李东
  * @date						2015-07-07
  */
 public function index()
 {
     //手机app接口密钥
     $apptype = (!empty(I('post.apptype')) and I('post.apptype') == C('APP_KEY')) ? true : false;
     if ($apptype) {
         $app_key = trim(I("post.key"));
         //md5加密的登录时间
         $member_id = I("post.home_member_id");
         //用户id
         $this->isLoginExpire($app_key, $member_id);
         //判断登录过期
     }
     /*通过产品列表与用户选择条件获取店铺查询条件*/
     $map2 = $this->get_term();
     //排序
     $ord = intval(I('order'));
     if ($ord <= 0) {
         $order = 'recommend desc';
         /*默认排序条件*/
     } else {
         if ($ord == 1) {
             $order = 'star_num desc';
         } else {
             if ($ord == 2) {
                 $order = 'comment_num desc';
             }
         }
     }
     $data['order'] = $ord;
     //价格搜索
     $min_price = I('min_price');
     $data['min_price'] = $min_price;
     $max_price = I('max_price');
     $data['max_price'] = $max_price;
     $price_map = array();
     if (is_numeric($min_price)) {
         $price_map[] = array('egt', $min_price);
     } else {
         $price_map[] = array('egt', 0);
     }
     if (is_numeric($max_price)) {
         $price_map[] = array('elt', $max_price);
     }
     if (count($price_map) >= 2) {
         $price_map[] = 'and';
         $map2['min_price'] = $price_map;
     } else {
         $map2['min_price'] = $price_map[0];
     }
     //标题值搜索
     $language_text = id_and_text(get_language_cache());
     $keywords = I('keywords', '');
     if (!empty($keywords)) {
         $map2['title'] = array('like', '%' . $keywords . '%');
     }
     $data['keywords'] = $keywords;
     $map2['member.id'] = array('gt', 0);
     $result = $this->page(D($this->member_model), $map2, $order, '', $this->limit);
     // 		dump($result);die;
     /*计算查询出的店铺数量*/
     $seller_count = count($result);
     /*获取语言信息*/
     $language = get_language_cache();
     /*获取技能信息*/
     $ability = list_to_tree(get_ability_cache());
     /*获取行业信息*/
     $industry = get_industry_cache();
     /*获取数组键值为语言ID的新数组*/
     foreach ($language as $val) {
         $language_id_key[$val['id']] = $val;
     }
     foreach ($result as $key => $row) {
         /*处理擅长语言*/
         $good_at = json_decode($row['good_at'], true);
         $good_at_new = array();
         //必须设置为空,不然会影响循环之后的数据
         foreach ($good_at as $k => $v) {
             $good_at_new[$k]['id'] = $v;
             $good_at_new[$k]['title'] = $language_id_key[$v]['title'];
         }
         $result[$key]['good_at_arr'] = $good_at_new;
         /*处理店铺logo*/
         if (is_file($row['logo'])) {
             $result[$key]['logo'] = __ROOT__ . '/' . $row['logo'];
         } else {
             $result[$key]['logo'] = __ROOT__ . '/Public/Home/img/company_img.jpg';
         }
     }
     /*常见问题*/
     $common_problem = get_common_problem();
     $data['common_problem'] = $common_problem;
     $data['seller_count'] = $seller_count;
     $data['result'] = $result;
     $data['language'] = $language;
     $data['ability'] = $ability;
     $data['industry'] = $industry;
     $data['seller_type'] = $this->seller_type;
     $data['param'] = $this->search;
     if ($apptype) {
         $this->ajaxReturn($data);
         //返回给手机app的json数据
     }
     $buy_shop = array();
     if (!empty($this->member_info)) {
         $buy_shop = json_decode($this->member_info['has_buy'], true);
     }
     $data['buy_shop'] = $buy_shop;
     //@赵群@查询地理信息
     $area = get_area_cache();
     $area_id_key = array_id_key($area);
     $address_data = array();
     foreach ($result as $key => $value) {
         $address_data[] = get_info('address', array('member_id' => $value['member_id']), $field = array('member_id', 'area_path'));
     }
     foreach ($address_data as $key => $value) {
         $address_arr = $value['area_path'];
         $path = explode('-', $address_arr);
         $new_address = $area_id_key[$path['2']]['title'] . $area_id_key[$path['3']]['title'] . $area_id_key[$path['4']]['title'];
         $address_data[$key]['path'] = $new_address;
     }
     // 		dump($address_data);die;
     // dump($data);die;
     $this->assign($data)->assign('address_data', $address_data);
     $this->display();
 }
 public function companyinfo()
 {
     if (session('home_shop_id')) {
         $shop_id = session('home_shop_id');
         //查询用户店铺的信息
         $shop_info = get_info(D('MemberShopView'), array('id' => $shop_id));
         //print_r($shop_info);exit;
         //查询地理信息
         $area_data = get_area_cache();
         $area_list = list_to_tree($area_data);
         //查询店铺的地理信息
         $shop_area_id = $shop_info['area_id'];
         foreach ($area_list as $val) {
             foreach ($val['_child'] as $v) {
                 foreach ($v['_child'] as $vv) {
                     if ($vv['id'] == $shop_area_id) {
                         $shop_info['city'] = $v['id'];
                         $shop_info['province'] = $val['id'];
                         $city_data = $val['_child'];
                         $area_k = $v['_child'];
                     }
                 }
             }
         }
         //查询语种分类
         $language_data = list_to_tree(get_language_cache());
         //查询擅长的领域
         $good_at = json_decode($shop_info['good_at']);
         $data['shop_info'] = $shop_info;
         $data['area_data'] = $area_data;
         $data['city_data'] = $city_data;
         $data['area_k'] = $area_k;
         $data['good_at'] = $good_at;
         $data['language_data'] = $language_data;
         // 			$time_data_s = explode("~", $shop_info['work_time_s']);
         // 			$time_data_e = explode("~", $shop_info['work_time_e']);
         $time_data_s = json_decode($shop_info['work_time_s']);
         $time_data_e = json_decode($shop_info['work_time_e']);
         $this->assign('time_data_s', $time_data_s)->assign('time_data_e', $time_data_e);
         $tips_msg = array('status' => 1, 'info' => $data);
         $this->appOut($tips_msg, $this->apptype, 1);
         //			if ($apptype){
         //				$appinfo['shop_info'] = $shop_info;//用户店铺信息
         //				$appinfo['area_data'] = $area_data;//地理信息
         //				$appinfo['good_at'] = $good_at;//擅长领域
         //				$appinfo['language_data'] = $language_data;//语种分类
         //				$this->ajaxReturn($data['address']);
         //			}
         //			$this->assign($data);
         //			$this->display();
     } else {
         $tips_msg = array('status' => 1, 'info' => '您的店铺尚未开通!', 'url' => U('Home/Index/index'));
         $this->appOut($tips_msg, $this->apptype, 0);
     }
 }
 public function index()
 {
     if (session('home_member_id')) {
         //判断用户是否已经登录,如果登录就不能再注册
         header("location:" . U("Home/Index/index"));
     } else {
         if (IS_POST) {
             //接收用户的传值
             $apptype = (!empty(I('post.apptype')) and I('post.apptype') == C('APP_KEY')) ? true : false;
             //手机app接口密钥
             //手机返回json数据
             if ($apptype) {
                 $ajax = true;
             } else {
                 $ajax = false;
             }
             $type = I('get.type');
             $telephone = I('telephone');
             $password = md5(md5(I('password')));
             //密码
             //$email = I('email');
             $confirmPassword = md5(md5(I('confirmPassword')));
             //	确认密码
             $code = I('code');
             //验证码
             $province = I('province');
             //省id
             $city = I('city');
             //市id
             if ($apptype) {
                 $member_id = intval(I('registerId'));
             } else {
                 $member_id = session('registerId');
             }
             //验证信息的合法性
             $rules = array(array('telephone', 'require', '请输入手机号'), array('password', 'require', '请输入密码!'));
             $is_telephone = 0;
             $is_email = 0;
             //验证手机号码合法性
             if (preg_match('/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/', $telephone)) {
                 $_POST['telephone'] = $telephone;
                 $is_telephone = 1;
                 $info = get_info('member', array('telephone' => $telephone, 'status' => 1, 'type' => array('GT', -2)));
                 if ($info) {
                     //如果手机号码被使用就删除这条记录
                     delete_data($this->table, array('id' => $member_id));
                     $this->error('手机号已被使用', '', $ajax);
                 }
             }
             /* if(preg_match("/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/", $email)){
             				$_POST['telephone']=$telephone;
             				$is_email=1;
             				
             				$info=get_info('member',array('telephone'=>$telephone,'status'=>1,'type'=>array('GT',-2)));
             				if($info){
             					$this->error('邮箱已被使用');
             				}
             			} */
             if ($is_telephone == 0) {
                 $this->error('请输入正确的手机号', '', $ajax);
             }
             /* if($is_email==0){
             				$this->error('请输入邮箱!');
             			} */
             //验证验证码的正确性
             //查询验证码
             $member_info = get_info($this->table, array('id' => $member_id, 'telephone' => $telephone));
             $member_code = $member_info['code'];
             if ($code != $member_code) {
                 $this->error('验证码不正确,请重新输入!', '', $ajax);
             }
             //组织填写member表中需要系统自动定义的字段????????????????????????????????
             //生成用户登录的code数字的形式存入到数据库中
             //$username = uniqid();//以微秒计数生成唯一的id
             if ($type == 1) {
                 $_POST['type'] = 1;
                 //表示普通用户
                 $_POST['role_id'] = 7;
             } else {
                 if ($type == 2) {
                     $_POST['type'] = 2;
                     //表示个人译者
                     $_POST['role_id'] = 8;
                 } else {
                     if ($type == 3) {
                         $_POST['type'] = 3;
                         //表示公司
                         $_POST['role_id'] = 9;
                     }
                 }
             }
             //将用户的信息存入到member表中
             $_POST['id'] = $member_id;
             //$_POST['type'] = 0;
             $_POST['password'] = $password;
             $_POST['confirmPassword'] = $confirmPassword;
             $_POST['username'] = $telephone;
             $_POST['integration'] = 100;
             $result = update_data($this->table, $rules);
             /*@刘巧将用户手机号作为昵称并隐藏4位*/
             $username = substr($telephone, 0, 5) . '****' . substr($telephone, 9);
             //将需要的信息存入到session中直接表示用户登录了
             if (is_numeric($result)) {
                 session('home_member_id', $result);
                 //将用户的id存入session值
                 session('nickname', $username);
                 //用户的昵称存入session值
                 session('points', 100);
                 //注册用户积分
                 session('home_member_tel', $telephone);
                 if ($apptype) {
                     $userinfo["home_member_id"] = $result;
                     //用户的id
                     $userinfo["nickname"] = $username;
                     //用户的昵称
                     $userinfo['balance'] = "0.00";
                     //账户余额
                     $userinfo['withdrawals'] = "0.00";
                     //可提现金额
                 }
                 //生成店铺信息
                 if ($type == 2) {
                     unset($_POST);
                     $_POST['type'] = 2;
                     //个人译者
                     $_POST['member_id'] = $result;
                     $_POST['status'] = 3;
                     $result = update_data($this->shop);
                     session('home_shop_id', $result);
                     session('nickname', $username);
                     //用户的昵称存入session值
                     session('home_member_tel', $telephone);
                     session('type', $type);
                     if ($apptype) {
                         $userinfo["home_shop_id"] = $result;
                         $userinfo["type"] = $type;
                     }
                 } else {
                     if ($type == 3) {
                         unset($_POST);
                         $_POST['type'] = 3;
                         //公司注册
                         $_POST['member_id'] = $result;
                         $_POST['status'] = 3;
                         //表示没有审核通过
                         $_POST['area_id'] = $city;
                         $result = update_data($this->shop);
                         session('nickname', $username);
                         //用户的昵称存入session值
                         session('home_member_tel', $telephone);
                         session('home_shop_id', $result);
                         session('type', $type);
                         if ($apptype) {
                             $userinfo["home_shop_id"] = $result;
                             $userinfo["type"] = $type;
                         }
                     }
                 }
                 //生成店铺日程信息,这个日程信息是初始化的日程信息
                 $sql = '';
                 for ($i = 1; $i <= 3; $i++) {
                     for ($s = 1; $s <= 7; $s++) {
                         $sql .= "insert into `sr_shop_time`(`shop_id`,`time`,`week`,`type`) values({$result},{$i},{$s},3);";
                     }
                 }
                 $Model = M();
                 $result2 = $Model->execute($sql);
                 if (is_numeric($result2)) {
                     if ($apptype) {
                         $data["status"] = "1";
                         $data["info"] = "注册成功!";
                         $data["userinfo"] = $userinfo;
                         $this->ajaxReturn($data);
                     } else {
                         if ($type == 1) {
                             $content = C('REGSUCCEESS');
                             $account = $I('telephone');
                             send_code($content, $account);
                             $this->success('注册成功!', U('Home/Index/index'));
                         } else {
                             $this->success('注册成功!', U('/User/StoreSetting/index'));
                         }
                     }
                 } else {
                     if ($apptype) {
                         $this->error($result2, '', $ajax);
                     } else {
                         $this->error($result2, U('Home/Index/index'));
                     }
                 }
             } else {
                 if ($apptype) {
                     $this->error($result, '', $ajax);
                 } else {
                     $this->error($result, U('Home/Index/index'));
                 }
             }
         } else {
             //查询地理信息
             $area_data = get_area_cache();
             //接收判断是哪一种注册
             $type = intval(I('type'));
             $data['area_data'] = $area_data;
             $data['type'] = $type;
             $this->assign($data);
             if (!empty($type)) {
                 $this->display('index_1_1');
             } else {
                 $this->display('index_1');
             }
         }
     }
 }
Example #8
0
/**
 * 通过path来获取地址上级信息(缓存中获取)
 * 
 * @param string $path			需要获取的信息path
 * @return array()				返回path中包含的所有ID的信息
 * 
 * @author						李东
 * @date						2015-07-01
 */
function get_area_pid($path)
{
    $pid_arr = explode('-', $path);
    $area_info = get_area_cache();
    $pid_info = array();
    $i = 0;
    foreach ($area_info as $row) {
        if (in_array($row['id'], $pid_arr)) {
            $pid_info[$i]['id'] = $row['id'];
            $pid_info[$i]['title'] = $row['title'];
            $i++;
        }
    }
    return $pid_info;
}
 public function index()
 {
     $member_id = session('home_member_id');
     if ($member_id) {
         $result_collect = get_result($this->table_collect, array('member_id' => $member_id, 'status' => 1));
         $result = array();
         foreach ($result_collect as $key => $value) {
             $result[] = get_info(D($this->member_model), array('id' => $value['collect_id']));
             $result[$key]['collect_id'] = $value['id'];
         }
         /*计算查询出的店铺数量*/
         $seller_count = count($result);
         /*获取语言信息*/
         $language = get_language_cache();
         /*获取技能信息*/
         $ability = list_to_tree(get_ability_cache());
         /*获取行业信息*/
         $industry = get_industry_cache();
         /*获取数组键值为语言ID的新数组*/
         foreach ($language as $val) {
             $language_id_key[$val['id']] = $val;
         }
         foreach ($result as $key => $row) {
             /*处理擅长语言*/
             $good_at = json_decode($row['good_at'], true);
             $good_at_new = array();
             //必须设置为空,不然会影响循环之后的数据
             foreach ($good_at as $k => $v) {
                 $good_at_new[$k]['id'] = $v;
                 $good_at_new[$k]['title'] = $language_id_key[$v]['title'];
             }
             $result[$key]['good_at_arr'] = $good_at_new;
             /*处理店铺logo*/
             if (is_file($row['logo'])) {
                 $result[$key]['logo'] = __ROOT__ . '/' . $row['logo'];
             } else {
                 $result[$key]['logo'] = __ROOT__ . '/Public/Home/img/company_img.jpg';
             }
         }
         /*常见问题*/
         $common_problem = get_common_problem();
         $data['common_problem'] = $common_problem;
         $data['seller_count'] = $seller_count;
         $data['result'] = $result;
         $data['language'] = $language;
         $data['ability'] = $ability;
         $data['industry'] = $industry;
         $data['seller_type'] = $this->seller_type;
         $data['param'] = $this->search;
         if ($apptype) {
             $this->ajaxReturn($data);
             //返回给手机app的json数据
         }
         $buy_shop = array();
         if (!empty($this->member_info)) {
             $buy_shop = json_decode($this->member_info['has_buy'], true);
         }
         $data['buy_shop'] = $buy_shop;
         //@赵群@查询地理信息
         $area = get_area_cache();
         $area_id_key = array_id_key($area);
         $address_data = array();
         foreach ($result as $key => $value) {
             $address_data[] = get_info('address', array('member_id' => $value['member_id']), $field = array('member_id', 'area_path'));
         }
         foreach ($address_data as $key => $value) {
             $address_arr = $value['area_path'];
             $path = explode('-', $address_arr);
             $new_address = $area_id_key[$path['2']]['title'] . $area_id_key[$path['3']]['title'] . $area_id_key[$path['4']]['title'];
             $address_data[$key]['path'] = $new_address;
         }
         // 			dump($data['result']);die;
         $this->assign($data)->assign('address_data', $address_data);
         $this->display();
     } else {
         $this->error('请先登录!');
     }
 }