public function used_index() { $config = M('config')->where('id=1')->find(); $xiaohao_config = json_decode($config['xiaohao_config'], true); import('ORG.Util.Page'); $type_list = $this->get_xiaohao_type(); $this->assign('type_list', $type_list); $xh_model = new XiaohaoViewModel(); $keyword = I('keyword'); $ftype = I('ftype'); if (!empty($keyword) && !empty($ftype)) { $where[$ftype] = array('like', '%' . $keyword . '%'); } $type_id = I('type_id', ''); if ($type_id != '') { $where['type_id'] = $type_id; } $where['isused'] = 1; $count = $xh_model->where($where)->count(); $numsOfpage = $xiaohao_config['numsofpage']; if ($numsOfpage == '') { $numsOfpage = 30; } $page = new Page($count, $numsOfpage); $show = $page->show(); $xiaohao_temp = $xh_model->where($where)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $xiaohao = array(); foreach ($xiaohao_temp as $k => $v) { if ($v['encry_key'] != '') { $v['note_no'] = '***' . str_replace('...', '***', cut_str(encrypt($v['note_no'], 'D', $v['encry_key']), 30, 3)); $v['account'] = '***' . str_replace('...', '***', cut_str(encrypt($v['account'], 'D', $v['encry_key']), 3, 2)); $v['email'] = '***' . str_replace('...', '***', cut_str(encrypt($v['email'], 'D', $v['encry_key']), 10, 3)); } else { $v['note_no'] = '***' . str_replace('...', '***', cut_str($v['note_no'], 30, 3)); $v['account'] = '***' . str_replace('...', '***', cut_str($v['account'], 3, 2)); $v['email'] = '***' . str_replace('...', '***', cut_str($v['email'], 10, 3)); } $xiaohao[] = $v; } $this->assign('count', $count); $this->assign('show', $show); $this->assign('xiaohao_list', $xiaohao); $this->display(); }
public function xh() { import('ORG.Util.Page'); $config = M('config')->where('id=1')->find(); $xiaohao_config = json_decode($config['xiaohao_config'], true); if ($xiaohao_config['valid'] != 1) { $this->message2('无该项业务或者业务暂停!', __APP__ . '/Index'); } $kongbao_page = json_decode($config['kongbao_page'], true); $kongbao_page_temp = array(); foreach ($kongbao_page as $key1 => $v1) { $kongbao_page_temp[$key1] = stripslashes(htmlspecialchars_decode($v1)); } $this->assign('kongbao_page', $kongbao_page_temp); $seo_seoo = json_decode($config['seo_seoo'], true); $seo_seoo_temp = array(); foreach ($seo_seoo as $key1 => $v1) { $seo_seoo_temp[$key1] = stripslashes(htmlspecialchars_decode($v1)); } $this->assign('seo_seoo', $seo_seoo_temp); $userid = session('userid'); $model = new Model('xiaohao_type'); $list = $model->order('sort_order asc')->select(); $type_list = array(); $type_list_temp = array(); foreach ($list as $k => $v) { if ($xiaohao_config['stop_view'] == 0 && $v['state'] == 1) { continue; } if ($v['state'] == 0) { $v['name'] = $v['name'] . '(正常出售)'; } if ($v['state'] == 1) { $v['name'] = $v['name'] . '(暂停出售)'; } $v['config'] = json_decode($v['config'], true); $type_list[] = $v; $type_list_temp[$v['id']] = $v; } $this->assign('type_list', $type_list); $user = M('user')->where('id=' . $userid)->find(); $user_type = $user['user_type']; if (empty($user_type) || $user_type == '') { $user_type = 1; } $user_level = M('user_level')->where('id=' . $user_type)->find(); $level_config = json_decode($user_level['config'], true); $this->assign('level_config', $level_config); $where = array(); $where['isused'] = 0; $xh_type_id = I('xh_type_id', ''); if ($xh_type_id != '') { $where['type_id'] = $xh_type_id; } if ($xiaohao_config['stop_view'] == 0) { $where['state'] = 0; } $xh_model = new XiaohaoViewModel(); $xh_counts = $xh_model->where($where)->count(); $page = new Page($xh_counts, 10); $show = $page->show(); $xh_list_temp = $xh_model->where($where)->order('addtime desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $xh_list = array(); if (!empty($xh_list_temp)) { foreach ($xh_list_temp as $xh) { $temp = array(); $temp['id'] = $xh['id']; $temp['account'] = rtrim(cut_str($xh['account'], 2, 0), '...') . ''; if ($xh['encry_key'] != '') { $temp['account'] = rtrim(cut_str(encrypt($xh['account'], 'D', $xh['encry_key']), 2, 0), '...') . '***'; } $temp['query_url'] = U('xh_query', array('id' => $xh['id'])); $temp['type_name'] = $type_list_temp[$xh['type_id']]['name']; $temp['price'] = $type_list_temp[$xh['type_id']]['config']['price']['a' . $user_type]; $xh_list[] = $temp; } } $this->assign('xh_list', $xh_list); $this->assign('show', $show); $user_type_list = M('user_level')->order('sort_order asc')->select(); $level_list = array(); foreach ($user_type_list as $ulevel) { $ulevel['config'] = json_decode($ulevel['config'], true); if (isset($ulevel['config']['level_view']) && $ulevel['config']['level_view'] == 1) { continue; } $ulevel['id'] = 'a' . $ulevel['id']; $level_list[] = $ulevel; } $this->assign('user_level_list', $level_list); $this->display(); }