diff --git a/include/class/table_theme.class.php b/include/class/table_theme.class.php index 5f64b0b..e2dd7d6 100644 --- a/include/class/table_theme.class.php +++ b/include/class/table_theme.class.php @@ -3,219 +3,217 @@ defined('IN_MET') or exit('No permission'); load::own_class('../traits/tfield'); + class table_theme { - + //表字库 private $tname; //表字段数组 - private $table_fiend = []; + private $table_fiend = []; //表格头部信息HTML - private $th_head = []; + private $th_head = []; //按钮组HTML - private $btn = []; + private $btn = []; //info_on 快速URL private $own_name_info; //头部搜索HTML private $search; - - //是否开启搜索 - private $search_bool = true; + private $search_bool = true; //开启底部按钮 - private $btn_bool = true; + private $btn_bool = true; //返回值 private $goret; - //全选按钮框 - private $checkall = true; + private $checkall = true; //尾部的操作 - private $lastbtn = true; - + private $lastbtn = true; // select2筛选 - private $select2 = []; + private $select2 = []; //多行头部 - private $rowsth = []; + private $rowsth = []; // 初始化 public function __construct() { - global $_M,$_YW; + global $_M, $_YW; //这个地址是后台的,也要换成前台的 //因前台暂时没有涉及到,暂时不考虑 - $this->own_name_info = $_M['url']['own_name'].'c=info_on&a=do'; - + $this->own_name_info = $_M['url']['own_name'] . 'c=info_on&a=do'; + //这个前台已经涉及到,需要现在更换 - $this->select2 = [ - 'url' => class_exists('admin') || class_exists('app') - ? $_M['url']['own_name'].'c=select&a=doselect' - : $_M['url']['site'].'app/index.php?n=dzadsod&c=select&a=doselect', - '_fiend' => [], - 'placeholder' => '', - 'fiend' => '', - 'tname' => '', - 'source' => 'search', - 'allnone' => 1, - 'condition' => '' + $this->select2 = [ + 'url' => class_exists('admin') || class_exists('app') ? $_M['url']['own_name'] . 'c=select&a=doselect' : $_M['url']['site'] . 'app/index.php?n=dzadsod&c=select&a=doselect', + '_fiend' => [], + 'placeholder' => '', + 'fiend' => '', + 'tname' => '', + 'source' => 'search', + 'allnone' => 1, + 'condition' => '' ]; } - + use tfield; - + //配置参数 - public function start($tname,$search = true,$btn = true) { - global $_M,$_YW; - $this->tname = $tname; - $this->search_bool = $search; - $this->btn_bool = $btn; + public function start($tname, $search = true, $btn = true) { + global $_M, $_YW; + $this->tname = $tname; + $this->search_bool = $search; + $this->btn_bool = $btn; //赋值结束后执行对应方法 self::{$this->tname}(); self::colspan(); return $this; } - + //头部搜索 public function search() { - global $_M,$_YW; + global $_M, $_YW; //特殊情况下的左边 - if(count($this->search['left']) > 0){ - $left = arrayto_string($this->search['left'],''); - $left = '
'.$left.'
'; + if (count($this->search['left']) > 0) { + $left = arrayto_string($this->search['left'], ''); + $left = '
' . $left . '
'; unset($this->search['left']); } //默认都是在右边 - $right = arrayto_string(array_reverse($this->search),''); - $right = '
'.$right.'
'; - $this->goret['search'] = $left.$right; + $right = arrayto_string(array_reverse($this->search), ''); + $right = '
' . $right . '
'; + $this->goret['search'] = $left . $right; return $this; } - + //只做两行 TH 处理 - private function row_datas($rowdatas,$keys) { - global $_M,$_YW; + private function row_datas($rowdatas, $keys) { + global $_M, $_YW; foreach ($rowdatas as $key => $val) { - if(is_array($val)){ - $datas[$key] = self::row_datas($val,$keys); - }else{ + if (is_array($val)) { + $datas[$key] = self::row_datas($val, $keys); + } else { $datas[$val] = $this->th_head[$val]; - if(!in_array($val, $keys,true)) unset($this->th_head[$val]); + if (!in_array($val, $keys, true)) + unset($this->th_head[$val]); } } return $datas; } - //表格头部 public function thead() { - global $_M,$_YW; + global $_M, $_YW; $keys = []; - if(count($this->rowsth) > 0){ + if (count($this->rowsth) > 0) { extract($this->rowsth); //获取默认数组维度也就是默认行数 - $rowspan = " rowspan='{$rowlevel}' "; - $keys = array_keys($rowdatas); + $rowspan = " rowspan='{$rowlevel}' "; + $keys = array_keys($rowdatas); //进行值的替换,转换 - foreach ($rowdatas as $key => $val){ - list($thtitle,$keydata) = $val; - $datas[$key] = self::row_datas($keydata,$keys); - $this->th_head[$key] = $thtitle; + foreach ($rowdatas as $key => $val) { + list($thtitle, $keydata) = $val; + $datas[$key] = self::row_datas($keydata, $keys); + $this->th_head[$key] = $thtitle; } - } - - if($this->checkall) $this->goret['thead'] = ' + + if ($this->checkall) + $this->goret['thead'] = ' '; - - foreach ($this->th_head as $key => $val){ - $rowspanb = $rowspan; - $colspanb = ''; - if(in_array($key, $keys)){ - $rowspanb = " rowspan='1' "; + + foreach ($this->th_head as $key => $val) { + $rowspanb = $rowspan; + $colspanb = ''; + if (in_array($key, $keys)) { + $rowspanb = " rowspan='1' "; //要做循环,二层tr内th - $keydata = $datas[$key]; + $keydata = $datas[$key]; foreach ($keydata as $value) { - $thead .= ''.$value.''; + $thead .= '' . $value . ''; } //计算一层的宽度 - $colslevel = count($keydata); - $colspanb = " colspan='{$colslevel}' "; + $colslevel = count($keydata); + $colspanb = " colspan='{$colslevel}' "; } - $class = $colspanb?' class="sorting_disabled text-xs-center" ':' data-table-columnclass="text-xs-center" '; + $class = $colspanb ? ' class="sorting_disabled text-xs-center" ' : ' data-table-columnclass="text-xs-center" '; //正常的th - $this->goret['thead'] .= ''.$val.''; + $this->goret['thead'] .= '' . $val . ''; } - if($this->lastbtn) $this->goret['thead'] .= '操作'; - $this->goret['thead'] = ''.$this->goret['thead'].''; - if($thead) $this->goret['thead'] .= ''.$thead.''; + if ($this->lastbtn) + $this->goret['thead'] .= '操作'; + $this->goret['thead'] = '' . $this->goret['thead'] . ''; + if ($thead) + $this->goret['thead'] .= '' . $thead . ''; return $this; } - + //表格底部按钮 // @$dvalue int 两个按钮组 的差值 public function tfoot($dvalue = 2) { - global $_M,$_YW; - if($this->btn_bool == false) return $this; - if($this->checkall) $this->goret['tfoot'] = ' + global $_M, $_YW; + if ($this->btn_bool == false) + return $this; + if ($this->checkall) + $this->goret['tfoot'] = ' '; //计算数组的维数 - if(array_level($this->btn) == 1){ - $btn = arrayto_string($this->btn,''); - $this->goret['tfoot'] .= '
'.$btn.'
'; - }else{ - list($front,$after) = $this->btn; + if (array_level($this->btn) == 1) { + $btn = arrayto_string($this->btn, ''); + $this->goret['tfoot'] .= '
' . $btn . '
'; + } else { + list($front, $after) = $this->btn; $thcol = floor($this->goret['thcol'] / 2) - $dvalue; - $btn = arrayto_string($front,''); - $this->goret['tfoot'] .= '
'.$btn.'
'; + $btn = arrayto_string($front, ''); + $this->goret['tfoot'] .= '
' . $btn . '
'; $thcol = $this->goret['thcol'] - $thcol; - $btn = arrayto_string($after,''); - $this->goret['tfoot'] .= '
'.$btn.'
'; + $btn = arrayto_string($after, ''); + $this->goret['tfoot'] .= '
' . $btn . '
'; } - $this->goret['tfoot'] = ''.$this->goret['tfoot'].''; + $this->goret['tfoot'] = '' . $this->goret['tfoot'] . ''; return $this; } - + //输出全部,需要先通过start()配置参数 public function send_all($dvalue = 2) { - global $_M,$_YW; + global $_M, $_YW; return $this->thead() - ->tfoot($dvalue) - ->search() - ->send(); + ->tfoot($dvalue) + ->search() + ->send(); } - + //输出 public function send() { - global $_M,$_YW; + global $_M, $_YW; return $this->goret; } - + //表格头部的数组信息 public function thead_arr() { - global $_M,$_YW; + global $_M, $_YW; return $this->table_fiend; } - + // +---------------------------------------------------------------------- // | 内部方法 // +---------------------------------------------------------------------- - //计算表格col protected function colspan() { - $tdcol = $this->checkall && $this->lastbtn?2:($this->checkall || $this->lastbtn?1:0); - $thcol = $this->lastbtn?1:0; - $this->goret['tdcol'] = count($this->table_fiend) + $tdcol; - $this->goret['thcol'] = count($this->table_fiend) + $thcol; + $tdcol = $this->checkall && $this->lastbtn ? 2 : ($this->checkall || $this->lastbtn ? 1 : 0); + $thcol = $this->lastbtn ? 1 : 0; + $this->goret['tdcol'] = count($this->table_fiend) + $tdcol; + $this->goret['thcol'] = count($this->table_fiend) + $thcol; } - + //删除 protected function btn_del($title = '确定要删除选中的信息吗?一旦删除将不能恢复!') { - global $_M,$_YW; + global $_M, $_YW; return ''; + data-confirm-title="' . $title . '">删除'; } - + //删除 - protected function btn_zdy($str,$color = 0,$type = 'test',$confirm = false,$title = '确定要删除选中的信息吗?一旦删除将不能恢复!') { - global $_M,$_YW; - $btncolor = ['btn-default','btn-primary','btn-success','btn-info','btn-warning','btn-danger']; - $alertify = $confirm?' data-plugin="alertify" data-type="confirm" data-label-ok="确定" data-label-cancel="取消" data-confirm-title="'.$title.'" ':''; - return ''; + protected function btn_zdy($str, $color = 0, $type = 'test', $confirm = false, $title = '确定要删除选中的信息吗?一旦删除将不能恢复!') { + global $_M, $_YW; + $btncolor = ['btn-default', 'btn-primary', 'btn-success', 'btn-info', 'btn-warning', 'btn-danger']; + $alertify = $confirm ? ' data-plugin="alertify" data-type="confirm" data-label-ok="确定" data-label-cancel="取消" data-confirm-title="' . $title . '" ' : ''; + return ''; // type="submit" 时jq的submit()才正常提交 } - + //保存 protected function btn_save() { return ''; } - + //添加 - protected function btn_add($title = '添加',$nocancel = false) { - global $_M,$_YW; - $datanocancel = $nocancel?'':'data-nocancel'; - return ''; + protected function btn_add($title = '添加', $nocancel = false) { + global $_M, $_YW; + $datanocancel = $nocancel ? '' : 'data-nocancel'; + return ''; } - + //单页按钮 - protected function btn_link($url,$name,$class) { - global $_M,$_YW; - return ''.$name.''; + protected function btn_link($url, $name, $class) { + global $_M, $_YW; + return '' . $name . ''; } //输入框搜索 - protected function input_search($_fiend,$tips) { - global $_M,$_YW; - list($name,$title,$value) = self::fiend_data($_fiend); + protected function input_search($_fiend, $tips) { + global $_M, $_YW; + list($name, $title, $value) = self::fiend_data($_fiend); return '
-
'.$title.'
- +
' . $title . '
+
'; } // 输入框搜索 protected function input_select_search() { - global $_M,$_YW; - $url = $this->select2['url']?:$_YW['url']['select']; - list($name,$title,$value) = self::fiend_data($this->select2['_fiend']); + global $_M, $_YW; + $url = $this->select2['url'] ?: $_YW['url']['select']; + list($name, $title, $value) = self::fiend_data($this->select2['_fiend']); return '
-
'.$title.'
-
'; } - + // 输入框搜索 protected function input_select_search_multiple() { - global $_M,$_YW; - $url = $this->select2['url']?:$_YW['url']['select']; - list($name,$title,$value) = self::fiend_data($this->select2['_fiend']); + global $_M, $_YW; + $url = $this->select2['url'] ?: $_YW['url']['select']; + list($name, $title, $value) = self::fiend_data($this->select2['_fiend']); return '
-
'.$title.'
- + data-condition="' . $this->select2['condition'] . '" + data-placeholder="' . $this->select2['placeholder'] . '">
'; } - + //参数下拉列表 - public function para_select($para,$_fiend,$exists = false,$option = true) { - global $_M,$_YW; - list($name,$title,$value) = self::fiend_data($_fiend); - if($option) $option = ''; + public function para_select($para, $_fiend, $exists = false, $option = true) { + global $_M, $_YW; + list($name, $title, $value) = self::fiend_data($_fiend); + if ($option) + $option = ''; foreach ($para as $key => $val) { - if($exists) { - list($p_name,$p_value) = $val; - }else{ + if ($exists) { + list($p_name, $p_value) = $val; + } else { extract($val); } - $option .= ''; + $option .= ''; } return '
-
'.$title.'
- + ' . $option . '
'; } - + //输入框搜索 - protected function date_timepicker_search($start,$end = '') { - global $_M,$_YW; - list($sname,$stitle,$svalue) = self::fiend_data($start); - list($ename,$etitle,$evalue) = self::fiend_data($end); - if($end){ - $endinput = ' - '.$etitle.' - + '; } return '
- '.$stitle.' - ' . $stitle . ' + - '.$endinput.' + ' . $endinput . '
'; } - + //输入框搜索 protected function date_time_search($start) { - global $_M,$_YW; - list($sname,$stitle,$svalue) = self::fiend_data($start); + global $_M, $_YW; + list($sname, $stitle, $svalue) = self::fiend_data($start); return '
- '.$stitle.' - ' . $stitle . ' + - '.$endinput.' + ' . $endinput . '
'; } - + /* * 获取字段信息 * @$fiend array 字段数组,包含字段名和字段标题 * @$title string 替换字段数组得到字段标题 */ + protected function fiend_data($_fiend) { - global $_M,$_YW; - list($name,$title,$value) = is_array($_fiend)?$_fiend:[$_fiend]; - $title = strlen($title) > 0?$title:$this->table_fiend[$name]; - return [$name,$title,$value]; + global $_M, $_YW; + list($name, $title, $value) = is_array($_fiend) ? $_fiend : [$_fiend]; + $title = strlen($title) > 0 ? $title : $this->table_fiend[$name]; + return [$name, $title, $value]; } - + //标题替换为排序功能 // $key 为name值 table_fiend 对应的字段名 // $name 自定义的input字段名 - protected function th_replace_order($key,$name = '',$str = ''){ - global $_M,$_YW; - $str = $str === ''?$this->table_fiend[$key]:$str; - $name = $name === ''?'order_'.$key:$name; - return ''.$str.''; + protected function th_replace_order($key, $name = '', $str = '') { + global $_M, $_YW; + $str = $str === '' ? $this->table_fiend[$key] : $str; + $name = $name === '' ? 'order_' . $key : $name; + return '' . $str . ''; } - + //给标题增加提示 // $tooltip 的参数全部通过这个数组配置 // $position 决定内容在字符的前后显示 - protected function th_tooltip($tooltip = [],$str = '',$position = true) { - global $_M,$_YW; - if(!is_array($tooltip)) $tooltip = [$tooltip]; - list($title,$placement,$trigger,$key) = $tooltip; - $placement = $placement?:'bottom'; - $trigger = $trigger?:'hover'; - $str = $str === ''?$this->table_fiend[$key]:$str; - $toolstr = ''; + return $position ? $str . $toolstr : $toolstr . $str; } - // +---------------------------------------------------------------------- // | 各表处理 // +---------------------------------------------------------------------- - //广告位列表 protected function elevator() { - global $_M,$_YW; - $this->table_fiend = self::tf_elevator(); + global $_M, $_YW; + $this->table_fiend = self::tf_elevator(); //头部 TH内容替换 - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; //搜索 - if($this->search_bool){ - $tsql = load::own_class('tsql','new'); - $this->search[] = self::input_search('e_text','输入搜索内容'); - $this->search[] = self::input_search('e_label','输入检索标签'); - $this->search[] = self::input_search('e_number','输入广告位编号'); + if ($this->search_bool) { + $tsql = load::own_class('tsql', 'new'); + $this->search[] = self::input_search('e_text', '输入搜索内容'); + $this->search[] = self::input_search('e_label', '输入检索标签'); + $this->search[] = self::input_search('e_number', '输入广告位编号'); //位置 - $para = $tsql->table('para')->where(['p_type' => 0])->all(); - $this->search[] = self::para_select($para,['e_aps','位置']); + $para = $tsql->table('para')->where(['p_type' => 0])->all(); + $this->search[] = self::para_select($para, ['e_aps', '位置']); //门口方位 - $para = $tsql->table('para')->where(['p_type' => 3])->all(); - $this->search[] = self::para_select($para,['e_bno','门口方位']); - $this->select2 = [ - '_fiend' => ['e_vid','选择场所',$_M['form']['e_vid']], - 'placeholder' => '输入场所名称', - 'fiend' => 'id', - 'tname' => 'village', - 'source' => 'search', - 'allnone' => 2 + $para = $tsql->table('para')->where(['p_type' => 3])->all(); + $this->search[] = self::para_select($para, ['e_bno', '门口方位']); + $this->select2 = [ + '_fiend' => ['e_vid', '选择场所', $_M['form']['e_vid']], + 'placeholder' => '输入场所名称', + 'fiend' => 'id', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); + $this->search[] = self::input_select_search(); //状态 - $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); + $this->search[] = self::para_select([['禁用', 0], ['启用', 1]], ['e_enable', '状态'], true); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_del(), - self::btn_zdy('启用',2,'enable_on'), - self::btn_zdy('禁用',4,'enable_off',true,'确定要选中的广告位吗?一旦将无法进行排期投放!'), + self::btn_zdy('启用', 2, 'enable_on'), + self::btn_zdy('禁用', 4, 'enable_off', true, '确定要选中的广告位吗?一旦将无法进行排期投放!'), ]; - $addtourl = $this->own_name_info.__FUNCTION__; - $this->btn[] = [ - '新增广告位' + $addtourl = $this->own_name_info . __FUNCTION__; + $this->btn[] = [ + '新增广告位' ]; } } - + // 场所统计表 protected function village() { - global $_M,$_YW; - $this->table_fiend = self::tf_village(); - $rselect = [ - 'v_totalstr' => self::th_tooltip(['广告位总数 / 禁用 / 正常','top','','v_totalstr']) + global $_M, $_YW; + $this->table_fiend = self::tf_village(); + $rselect = [ + 'v_totalstr' => self::th_tooltip(['广告位总数 / 禁用 / 正常', 'top', '', 'v_totalstr']) ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('v_text','输入搜索内容'); - $this->search[] = self::input_search('v_address','输入地址'); - $this->search[] = self::input_search('v_name','输入场所名称'); + if ($this->search_bool) { + $this->search[] = self::input_search('v_text', '输入搜索内容'); + $this->search[] = self::input_search('v_address', '输入地址'); + $this->search[] = self::input_search('v_name', '输入场所名称'); } //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_del(), - self::btn_zdy('启用',2,'enableon'), - self::btn_zdy('禁用',4,'enableoff',true,'确定要禁用场所的广告位吗?一旦将无法进行排期投放!'), + self::btn_zdy('启用', 2, 'enableon'), + self::btn_zdy('禁用', 4, 'enableoff', true, '确定要禁用场所的广告位吗?一旦将无法进行排期投放!'), ]; - $addtourl = $this->own_name_info.__FUNCTION__; - $this->btn[] = [ - '新增场所' + $addtourl = $this->own_name_info . __FUNCTION__; + $this->btn[] = [ + '新增场所' ]; } } - + // 广告合同关联表 protected function schedule() { - global $_M,$_YW; + global $_M, $_YW; //不需要最后一栏 - $this->checkall = false; - $this->lastbtn = false; - $this->table_fiend = self::tf_schedule(); + $this->checkall = false; + $this->lastbtn = false; + $this->table_fiend = self::tf_schedule(); //替换表格头部 - $rselect = [ - 'l_starttime' => self::th_replace_order('l_starttime'), - 'l_endtime' => self::th_replace_order('l_endtime'), + $rselect = [ + 'l_starttime' => self::th_replace_order('l_starttime'), + 'l_endtime' => self::th_replace_order('l_endtime'), ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('l_hnumber','输入合同编号'); - $this->search[] = self::input_search(['e_number','',$_M['form']['e_number']],'输入广告位编号'); - $this->search[] = self::date_timepicker_search(['l_starttime','时间区段'],['l_endtime','To']); - $this->select2 = [ - '_fiend' => ['id','选择投放计划',$_M['form']['l_id']], - 'placeholder' => '输入投放计划名称', - 'fiend' => 'id', - 'tname' => 'launch', - 'source' => 'search', - 'allnone' => 2 + if ($this->search_bool) { + $this->search[] = self::input_search('l_hnumber', '输入合同编号'); + $this->search[] = self::input_search(['e_number', '', $_M['form']['e_number']], '输入广告位编号'); + $this->search[] = self::date_timepicker_search(['l_starttime', '时间区段'], ['l_endtime', 'To']); + $this->select2 = [ + '_fiend' => ['id', '选择投放计划', $_M['form']['l_id']], + 'placeholder' => '输入投放计划名称', + 'fiend' => 'id', + 'tname' => 'launch', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - '_fiend' => ['e_vid','选择场所',$_M['form']['e_vid']], - 'placeholder' => '输入场所名称', - 'fiend' => 'id', - 'tname' => 'village', - 'source' => 'search', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + '_fiend' => ['e_vid', '选择场所', $_M['form']['e_vid']], + 'placeholder' => '输入场所名称', + 'fiend' => 'id', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); + $this->search[] = self::input_select_search(); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = ''; + if ($this->btn_bool) { + $this->btn[] = ''; } } - + // 合同归档 protected function contract() { - global $_M,$_YW; - $this->table_fiend = self::tf_contract(); + global $_M, $_YW; + $this->table_fiend = self::tf_contract(); //替换表格头部 - $rselect = [ - 'h_starttime' => self::th_replace_order('h_starttime'), - 'h_endtime' => self::th_replace_order('h_endtime'), + $rselect = [ + 'h_starttime' => self::th_replace_order('h_starttime'), + 'h_endtime' => self::th_replace_order('h_endtime'), ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('h_text','输入搜索内容'); - $this->select2 = [ - '_fiend' => ['h_wid','签定人员',$_M['form']['h_wid']], - 'placeholder' => '输入姓名/电话', - 'fiend' => 'id', - 'tname' => 'workers', - 'source' => 'search', - 'allnone' => 2 + if ($this->search_bool) { + $this->search[] = self::input_search('h_text', '输入搜索内容'); + $this->select2 = [ + '_fiend' => ['h_wid', '签定人员', $_M['form']['h_wid']], + 'placeholder' => '输入姓名/电话', + 'fiend' => 'id', + 'tname' => 'workers', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - '_fiend' => ['h_cid','选择企业',$_M['form']['h_cid']], - 'placeholder' => '输入企业名称', - 'fiend' => 'id', - 'tname' => 'customer', - 'source' => 'search', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + '_fiend' => ['h_cid', '选择企业', $_M['form']['h_cid']], + 'placeholder' => '输入企业名称', + 'fiend' => 'id', + 'tname' => 'customer', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->search[] = self::input_search(['h_number','',$_M['form']['h_number']],'输入合同编号'); - $this->search[] = self::date_timepicker_search(['h_starttime','时间区段'],['h_endtime','To']); + $this->search[] = self::input_select_search(); + $this->search[] = self::input_search(['h_number', '', $_M['form']['h_number']], '输入合同编号'); + $this->search[] = self::date_timepicker_search(['h_starttime', '时间区段'], ['h_endtime', 'To']); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_del() ]; - $addtourl = $this->own_name_info.__FUNCTION__; - $this->btn[] = [ - '录入订单合同' + $addtourl = $this->own_name_info . __FUNCTION__; + $this->btn[] = [ + '录入订单合同' ]; } } - + // 公司资料 protected function customer() { - global $_M,$_YW; - $this->table_fiend = self::tf_customer(); + global $_M, $_YW; + $this->table_fiend = self::tf_customer(); + + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('c_text','输入搜索内容'); - $this->search[] = self::input_search('c_address','输入地址'); - $this->search[] = self::input_search('c_allname','输入企业名称'); + if ($this->search_bool) { + $this->search[] = self::input_search('c_text', '输入搜索内容'); + $this->search[] = self::input_search('c_address', '输入地址'); + $this->search[] = self::input_search('c_allname', '输入企业名称'); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_del() ]; - $addtourl = $this->own_name_info.__FUNCTION__; - $this->btn[] = [ - '新增企业' + $addtourl = $this->own_name_info . __FUNCTION__; + $this->btn[] = [ + '新增企业' ]; } } - + // 企业联系人 protected function workers() { - global $_M,$_YW; - $this->table_fiend = self::tf_workers(); + global $_M, $_YW; + $this->table_fiend = self::tf_workers(); + + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('w_text','输入搜索内容'); - $this->search[] = self::input_search('w_tel','输入电话'); - $this->search[] = self::input_search('w_name','输入姓名'); + if ($this->search_bool) { + $this->search[] = self::input_search('w_text', '输入搜索内容'); + $this->search[] = self::input_search('w_tel', '输入电话'); + $this->search[] = self::input_search('w_name', '输入姓名'); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_del() ]; - $addtourl = $this->own_name_info.__FUNCTION__; - $this->btn[] = [ - '新增联系人' + $addtourl = $this->own_name_info . __FUNCTION__; + $this->btn[] = [ + '新增联系人' ]; } } - + // 参数统计 protected function para() { - global $_M,$_YW; - $this->table_fiend = self::tf_para(); + global $_M, $_YW; + $this->table_fiend = self::tf_para(); //头部 TH内容替换 - $rselect = [ - 'p_type' => self::th_replace_order('p_type'), - 'p_order' => self::th_replace_order('p_order'), + $rselect = [ + 'p_type' => self::th_replace_order('p_type'), + 'p_order' => self::th_replace_order('p_order'), ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $para = [ - ['广告位置',0], - ['企业职位',1], - ['投放进度',2], - ['门口方位',3], - ['投放媒介',4], - ['场所分类',6], - ['广告类型',7] + if ($this->search_bool) { + $para = [ + ['广告位置', 0], + ['企业职位', 1], + ['投放进度', 2], + ['门口方位', 3], + ['投放媒介', 4], + ['场所分类', 6], + ['广告类型', 7] ]; - $this->search['left'][] = self::para_select($para,['p_type','参数分类',$_M['form']['p_type']],true); + $this->search['left'][] = self::para_select($para, ['p_type', '参数分类', $_M['form']['p_type']], true); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_save(), self::btn_del() ]; - $_YW['url']['addlist'] .= '&p_type='.$_M['form']['p_type']; - $this->btn[] = [ + $_YW['url']['addlist'] .= '&p_type=' . $_M['form']['p_type']; + $this->btn[] = [ self::btn_add('新增参数') ]; } } - + // 投放计划 protected function launch() { - global $_M,$_YW; - $this->table_fiend = self::tf_launch(); - - $rselect = [ - 'l_starttime' => self::th_replace_order('l_starttime'), - 'l_endtime' => self::th_replace_order('l_endtime'), - 'l_totalnum' => self::th_tooltip(['排期成功个数 / 选择的个数','top','','l_totalnum']) + global $_M, $_YW; + $this->table_fiend = self::tf_launch(); + + $rselect = [ + 'l_starttime' => self::th_replace_order('l_starttime'), + 'l_endtime' => self::th_replace_order('l_endtime'), + 'l_totalnum' => self::th_tooltip(['排期成功个数 / 选择的个数', 'top', '', 'l_totalnum']) ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $this->search[] = self::input_search(['l_text'],'输入搜索内容'); - $this->search[] = self::input_search(['l_enumber','广告位编号'],'输入广告位编号'); - $this->search[] = self::input_search(['l_hnumber','',$_M['form']['l_hnumber']],'输入完整合同编号'); - $this->search[] = self::input_search(['l_title'],'输入广告标题'); - $this->search[] = self::date_timepicker_search(['l_starttime','时间区段'],['l_endtime','To']); + if ($this->search_bool) { + $this->search[] = self::input_search(['l_text'], '输入搜索内容'); + $this->search[] = self::input_search(['l_enumber', '广告位编号'], '输入广告位编号'); + $this->search[] = self::input_search(['l_hnumber', '', $_M['form']['l_hnumber']], '输入完整合同编号'); + $this->search[] = self::input_search(['l_title'], '输入广告标题'); + $this->search[] = self::date_timepicker_search(['l_starttime', '时间区段'], ['l_endtime', 'To']); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = self::btn_del(); + if ($this->btn_bool) { + $this->btn[] = self::btn_del(); } } - + // 广告位排期选择列表 protected function applan() { - global $_M,$_YW; + global $_M, $_YW; //不需要最后一栏 $this->lastbtn = false; - $this->table_fiend = self::tf_applan(); - $rselect = [ - 'e_types' => self::th_replace_order('e_types'), + $this->table_fiend = self::tf_applan(); + $rselect = [ + 'e_types' => self::th_replace_order('e_types'), ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $para = [['正常-按照广告位置排序',0],['推荐-将适合投放的提前排序',1],['选中-将选择中广告位提前排序',2]]; - $this->search['left'][] = self::para_select($para,['eaps_order','广告位排序'],true,false); - $tsql = load::own_class('tsql','new'); - $this->select2 = [ - '_fiend' => ['e_vid','选择场所',$_M['form']['e_vid']], - 'placeholder' => '输入场所名称', - 'fiend' => 'id', - 'tname' => 'village', - 'source' => 'search', - 'allnone' => 2 + if ($this->search_bool) { + $para = [['正常-按照广告位置排序', 0], ['推荐-将适合投放的提前排序', 1], ['选中-将选择中广告位提前排序', 2]]; + $this->search['left'][] = self::para_select($para, ['eaps_order', '广告位排序'], true, false); + $tsql = load::own_class('tsql', 'new'); + $this->select2 = [ + '_fiend' => ['e_vid', '选择场所', $_M['form']['e_vid']], + 'placeholder' => '输入场所名称', + 'fiend' => 'id', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search['left'][] = self::input_select_search(); + $this->search['left'][] = self::input_select_search(); //门口方位 - $para = $tsql->table('para')->where(['p_type' => 3])->all(); - $this->search['left'][] = self::para_select($para,['e_bno','门口方位']); + $para = $tsql->table('para')->where(['p_type' => 3])->all(); + $this->search['left'][] = self::para_select($para, ['e_bno', '门口方位']); //位置 - $this->select2 = [ - '_fiend' => ['e_aps','位置'], - 'placeholder' => '可选择多个位置', - 'fiend' => 'p_value', - 'tname' => 'para', - 'source' => 'search_para_eaps', - 'allnone' => 0, - 'condition' => 'p_type|||0' + $this->select2 = [ + '_fiend' => ['e_aps', '位置'], + 'placeholder' => '可选择多个位置', + 'fiend' => 'p_value', + 'tname' => 'para', + 'source' => 'search_para_eaps', + 'allnone' => 0, + 'condition' => 'p_type|||0' ]; - $this->search['left'][] = self::input_select_search_multiple(); - $this->search['left'][] = self::input_search('e_number','输入广告位编号'); + $this->search['left'][] = self::input_select_search_multiple(); + $this->search['left'][] = self::input_search('e_number', '输入广告位编号'); //状态 // $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_save() ]; - $this->btn[] = [ + $this->btn[] = [ '已选中广告位个数:0' ]; } } - + // 广告位排期统计查询 protected function elevators() { - global $_M,$_YW; - $this->table_fiend = self::tf_elevators(); + global $_M, $_YW; + $this->table_fiend = self::tf_elevators(); //替换表格头部 - $rselect = [ - 'e_address' => self::th_replace_order('e_address'), - 'e_number' => self::th_replace_order('e_number'), - 'endtime' => self::th_replace_order('endtime'), - 'e_totalnum' => self::th_replace_order('e_totalnum'), - 'endstime' => self::th_replace_order('endstime'), - 'endetime' => self::th_replace_order('endetime'), - 'nowstime' => self::th_replace_order('nowstime'), - 'nowetime' => self::th_replace_order('nowetime'), - 'nextstime' => self::th_replace_order('nextstime'), - 'nextetime' => self::th_replace_order('nextetime'), - 'etypes' => self::th_replace_order('etypes','order_etypes'), + $rselect = [ + 'e_address' => self::th_replace_order('e_address'), + 'e_number' => self::th_replace_order('e_number'), + 'endtime' => self::th_replace_order('endtime'), + 'e_totalnum' => self::th_replace_order('e_totalnum'), + 'endstime' => self::th_replace_order('endstime'), + 'endetime' => self::th_replace_order('endetime'), + 'nowstime' => self::th_replace_order('nowstime'), + 'nowetime' => self::th_replace_order('nowetime'), + 'nextstime' => self::th_replace_order('nextstime'), + 'nextetime' => self::th_replace_order('nextetime'), + 'etypes' => self::th_replace_order('etypes', 'order_etypes'), ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; + //搜索 - if($this->search_bool){ - $tsql = load::own_class('tsql','new'); - $this->search[] = self::input_search(['e_number','广告位编号',$_M['form']['e_number']],'输入广告位编号'); + if ($this->search_bool) { + $tsql = load::own_class('tsql', 'new'); + $this->search[] = self::input_search(['e_number', '广告位编号', $_M['form']['e_number']], '输入广告位编号'); //位置 - $para = $tsql->table('para')->where(['p_type' => 0])->all(); - $this->search[] = self::para_select($para,['e_aps','位置']); + $para = $tsql->table('para')->where(['p_type' => 0])->all(); + $this->search[] = self::para_select($para, ['e_aps', '位置']); //门口方位 - $para = $tsql->table('para')->where(['p_type' => 3])->all(); - $this->search[] = self::para_select($para,['e_bno','门口方位']); - $this->select2 = [ - '_fiend' => ['e_vid','选择场所',$_M['form']['e_vid']], - 'placeholder' => '输入场所名称', - 'fiend' => 'id', - 'tname' => 'village', - 'source' => 'search', - 'allnone' => 2 + $para = $tsql->table('para')->where(['p_type' => 3])->all(); + $this->search[] = self::para_select($para, ['e_bno', '门口方位']); + $this->select2 = [ + '_fiend' => ['e_vid', '选择场所', $_M['form']['e_vid']], + 'placeholder' => '输入场所名称', + 'fiend' => 'id', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - '_fiend' => ['nextid','下个排期计划'], - 'placeholder' => '输入投放计划名称', - 'fiend' => 'id', - 'tname' => 'launch', - 'source' => 'search', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + '_fiend' => ['nextid', '下个排期计划'], + 'placeholder' => '输入投放计划名称', + 'fiend' => 'id', + 'tname' => 'launch', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - '_fiend' => ['nowid','当前排期计划'], - 'placeholder' => '输入投放计划名称', - 'fiend' => 'id', - 'tname' => 'launch', - 'source' => 'search', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + '_fiend' => ['nowid', '当前排期计划'], + 'placeholder' => '输入投放计划名称', + 'fiend' => 'id', + 'tname' => 'launch', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - '_fiend' => ['endid','上个排期计划'], - 'placeholder' => '输入投放计划名称', - 'fiend' => 'id', - 'tname' => 'launch', - 'source' => 'search', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + '_fiend' => ['endid', '上个排期计划'], + 'placeholder' => '输入投放计划名称', + 'fiend' => 'id', + 'tname' => 'launch', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->search[] = self::date_time_search(['endtime','最大结束时间']); + $this->search[] = self::input_select_search(); + $this->search[] = self::date_time_search(['endtime', '最大结束时间']); //状态 - $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); + $this->search[] = self::para_select([['禁用', 0], ['启用', 1]], ['e_enable', '状态'], true); } - + //底部按钮 - if($this->btn_bool){ - $this->btn[] = ''; + if ($this->btn_bool) { + $this->btn[] = ''; } } - + // 场所统计展示 protected function villages() { - global $_M,$_YW; - $this->table_fiend = self::tf_villages(); - $this->rowsth = [ - 'rowlevel' => 2, - 'rowdatas' => [ + global $_M, $_YW; + $this->table_fiend = self::tf_villages(); + $this->rowsth = [ + 'rowlevel' => 2, + 'rowdatas' => [ //key 需要在指定的位置进行整合 //整合后的新名称 //被整合的字段 - 'v_enum' => ['资源总计',['v_enum','v_ebnonum']], - 'v_free' => [self::th_tooltip(['今天空闲或者时间区段内空闲的广告位,已去除禁用个数','top'],'闲置总计',false),['v_free','v_bno']] - ] + 'v_enum' => ['资源总计', ['v_enum', 'v_ebnonum']], + 'v_free' => [self::th_tooltip(['今天空闲或者时间区段内空闲的广告位,已去除禁用个数', 'top'], '闲置总计', false), ['v_free', 'v_bno']] + ] ]; //原来的列 除掉要转为第二行的 全部要设置为2,转为一行的设置为1 // @@ -855,141 +854,139 @@ class table_theme { //在原数组删除的地方添加一个值 //将新数组作为一个tr //头部 TH内容替换 - $rselect = [ - 'v_enum' => self::th_tooltip(['广告位总个数 / 禁用的个数','top'],self::th_replace_order('v_enum'),false), - 'v_free' => self::th_replace_order('v_free'), - 'v_lease' => self::th_replace_order('v_lease'), - 'v_endday' => self::th_tooltip(['默认7天内即将到期的广告位','top'],self::th_replace_order('v_endday'),false), - 'v_prerow' => self::th_replace_order('v_prerow'), - 'v_ebnonum' => self::th_replace_order('v_ebnonum'), - 'v_bno' => self::th_tooltip(['存在一个广告空位则所属门口方位就算有空','top'],self::th_replace_order('v_bno')), + $rselect = [ + 'v_enum' => self::th_tooltip(['广告位总个数 / 禁用的个数', 'top'], self::th_replace_order('v_enum'), false), + 'v_free' => self::th_replace_order('v_free'), + 'v_lease' => self::th_replace_order('v_lease'), + 'v_endday' => self::th_tooltip(['默认7天内即将到期的广告位', 'top'], self::th_replace_order('v_endday'), false), + 'v_prerow' => self::th_replace_order('v_prerow'), + 'v_ebnonum' => self::th_replace_order('v_ebnonum'), + 'v_bno' => self::th_tooltip(['存在一个广告空位则所属门口方位就算有空', 'top'], self::th_replace_order('v_bno')), ]; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - - //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('v_text','输入搜索内容'); - $this->search[] = self::input_search('v_address','输入地址'); - $this->search[] = self::input_search('v_name','输入场所名称'); - $this->search[] = self::date_timepicker_search(['vs_starttime','时间区段'],['vs_endtime','To']); + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; - $this->select2 = [ - '_fiend' => ['veaps','广告位置'], - 'placeholder' => '可选择多个广告位置', - 'fiend' => 'p_value', - 'tname' => 'para', - 'source' => 'search_para_eaps', - 'allnone' => 0, - 'condition' => 'p_type|||0' + //搜索 + if ($this->search_bool) { + $this->search[] = self::input_search('v_text', '输入搜索内容'); + $this->search[] = self::input_search('v_address', '输入地址'); + $this->search[] = self::input_search('v_name', '输入场所名称'); + $this->search[] = self::date_timepicker_search(['vs_starttime', '时间区段'], ['vs_endtime', 'To']); + + $this->select2 = [ + '_fiend' => ['veaps', '广告位置'], + 'placeholder' => '可选择多个广告位置', + 'fiend' => 'p_value', + 'tname' => 'para', + 'source' => 'search_para_eaps', + 'allnone' => 0, + 'condition' => 'p_type|||0' ]; - $this->search[] = self::input_select_search_multiple(); + $this->search[] = self::input_select_search_multiple(); } //底部按钮 - if($this->btn_bool){ - $this->btn[] = ''; + if ($this->btn_bool) { + $this->btn[] = ''; } - } - + // 首页统计 protected function noticeday() { - global $_M,$_YW; - $this->checkall = false; - $this->lastbtn = false; - $this->table_fiend = self::tf_noticeday(); + global $_M, $_YW; + $this->checkall = false; + $this->lastbtn = false; + $this->table_fiend = self::tf_noticeday(); + + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - //搜索 - if($this->search_bool){ + if ($this->search_bool) { + } - + //搜索 - if($this->search_bool){ - $this->search[] = self::input_search('v_text','输入搜索内容'); - $this->search[] = self::input_search('v_address','输入地址'); - $this->search[] = self::input_search('v_name','输入场所名称'); - $this->search[] = self::date_timepicker_search(['vs_starttime','时间区段'],['vs_endtime','To']); + if ($this->search_bool) { + $this->search[] = self::input_search('v_text', '输入搜索内容'); + $this->search[] = self::input_search('v_address', '输入地址'); + $this->search[] = self::input_search('v_name', '输入场所名称'); + $this->search[] = self::date_timepicker_search(['vs_starttime', '时间区段'], ['vs_endtime', 'To']); } //底部按钮 - if($this->btn_bool){ - $this->btn[] = ''; + if ($this->btn_bool) { + $this->btn[] = ''; } - } - + //前台巡查页面 protected function patrol() { - global $_M,$_YW; - $this->checkall = false; - $this->lastbtn = false; - $this->table_fiend = self::tf_patrol(); + global $_M, $_YW; + $this->checkall = false; + $this->lastbtn = false; + $this->table_fiend = self::tf_patrol(); + + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; - //搜索 - if($this->search_bool){ - $tsql = load::own_class('tsql','new'); - $this->search[] = self::input_search(['e_number','编号',$_M['form']['e_number']],'输入广告位编号'); + if ($this->search_bool) { + $tsql = load::own_class('tsql', 'new'); + $this->search[] = self::input_search(['e_number', '编号', $_M['form']['e_number']], '输入广告位编号'); //位置 - $para = $tsql->table('para')->where(['p_type' => 0])->all(); - $this->search[] = self::para_select($para,['e_aps','位置']); + $para = $tsql->table('para')->where(['p_type' => 0])->all(); + $this->search[] = self::para_select($para, ['e_aps', '位置']); //门口方位 - $para = $tsql->table('para')->where(['p_type' => 3])->all(); - $this->search[] = self::para_select($para,['e_bno','门口方位']); - $this->select2 = [ - 'url' => $_M['url']['site'].'app/index.php?n=dzadsod&c=select&a=doselect', - '_fiend' => ['e_vid','场所',$_M['form']['e_vid']], - 'placeholder' => '输入场所名称', - 'fiend' => 'id', - 'tname' => 'village', - 'source' => 'search', - 'allnone' => 2 + $para = $tsql->table('para')->where(['p_type' => 3])->all(); + $this->search[] = self::para_select($para, ['e_bno', '门口方位']); + $this->select2 = [ + 'url' => $_M['url']['site'] . 'app/index.php?n=dzadsod&c=select&a=doselect', + '_fiend' => ['e_vid', '场所', $_M['form']['e_vid']], + 'placeholder' => '输入场所名称', + 'fiend' => 'id', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - 'url' => $_M['url']['site'].'app/index.php?n=dzadsod&c=select&a=doselect', - '_fiend' => ['nowid','排期'], - 'placeholder' => '输入投放计划名称', - 'fiend' => 'id', - 'tname' => 'launch', - 'source' => 'weblaunchsearch', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + 'url' => $_M['url']['site'] . 'app/index.php?n=dzadsod&c=select&a=doselect', + '_fiend' => ['nowid', '排期'], + 'placeholder' => '输入投放计划名称', + 'fiend' => 'id', + 'tname' => 'launch', + 'source' => 'weblaunchsearch', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); - $this->select2 = [ - 'url' => $_M['url']['site'].'app/index.php?n=dzadsod&c=select&a=doselect', - '_fiend' => ['l_hnumber','订单'], - 'placeholder' => '输入合同名称', - 'fiend' => 'h_number', - 'tname' => 'contract', - 'source' => 'webcontractsearch', - 'allnone' => 2 + $this->search[] = self::input_select_search(); + $this->select2 = [ + 'url' => $_M['url']['site'] . 'app/index.php?n=dzadsod&c=select&a=doselect', + '_fiend' => ['l_hnumber', '订单'], + 'placeholder' => '输入合同名称', + 'fiend' => 'h_number', + 'tname' => 'contract', + 'source' => 'webcontractsearch', + 'allnone' => 2 ]; - $this->search[] = self::input_select_search(); + $this->search[] = self::input_select_search(); } } - + // 参数统计 protected function keylist() { - global $_M,$_YW; - $this->table_fiend = self::tf_keylist(); + global $_M, $_YW; + $this->table_fiend = self::tf_keylist(); - $this->th_head = is_array($rselect)?array_merge($this->table_fiend,$rselect):$this->table_fiend; + $this->th_head = is_array($rselect) ? array_merge($this->table_fiend, $rselect) : $this->table_fiend; //底部按钮 - if($this->btn_bool){ - $this->btn[] = [ + if ($this->btn_bool) { + $this->btn[] = [ self::btn_del() ]; - $addtourl = $this->own_name_info.__FUNCTION__; - $this->btn[] = [ - '新增巡查人员' + $addtourl = $this->own_name_info . __FUNCTION__; + $this->btn[] = [ + '新增巡查人员' ]; } } - } diff --git a/include/traits/tdata.class.php b/include/traits/tdata.class.php index c700164..852f1a3 100644 --- a/include/traits/tdata.class.php +++ b/include/traits/tdata.class.php @@ -5,84 +5,85 @@ */ trait tdata { - - //sql语句采用分组查询后调整为true 使用子查询计算总条数 - public $multi_table = false; - //搜索的input字段,用来处理表数据显示时的颜色加重问题 - private $search_input = []; - //搜索的select字段,不用考虑搜索结果 - private $search_other = []; - //带有表前缀的搜索字段,主要用于跨表联合查询,要对照上面数组合并后的顺序 - private $search_field = []; - //搜索的LIKE字段 - private $search_link = []; - //跳过替换为突出显示的字段 - private $skip_field = []; + //sql语句采用分组查询后调整为true 使用子查询计算总条数 + public $multi_table = false; + //搜索的input字段,用来处理表数据显示时的颜色加重问题 + private $search_input = []; + //搜索的select字段,不用考虑搜索结果 + private $search_other = []; + //带有表前缀的搜索字段,主要用于跨表联合查询,要对照上面数组合并后的顺序 + private $search_field = []; + //搜索的LIKE字段 + private $search_link = []; + //跳过替换为突出显示的字段 + private $skip_field = []; // 场所统计查询内的公用where private $villages_where = ''; - //表名 public function td_sqlk() { - global $_M,$_YW; + global $_M, $_YW; //当天日期时间 - $curdate = date('Y-m-d',time()); + $curdate = date('Y-m-d', time()); switch ($this->tname) { case 'applan': //判断是否可选的依据 - if(!empty($this->form['slid'])) $where = " AND nla.id != '{$this->form['slid']}' "; + if (!empty($this->form['slid'])) + $where = " AND nla.id != '{$this->form['slid']}' "; //表 - $sqlk = " {$_YW['k']['elevator']} AS el " - . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nowe_number,ANY_VALUE( nla.id ) AS nowid,ANY_VALUE( nla.l_title ) AS nowtitle,ANY_VALUE( nla.l_starttime ) AS nowstime,ANY_VALUE( nla.l_endtime ) AS nowetime,if(NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) OR nla.l_starttime > '{$curdate}',1,0) AS estate FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) AND nla.id IS NOT NULL ORDER BY nowstime ASC ) eala GROUP BY nowe_number ) ala ON ala.nowe_number = el.e_number " - . "LEFT JOIN (SELECT nel.e_number AS ende_number, max( nla.l_endtime ) AS endtime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.id IS NOT NULL GROUP BY ende_number) cla ON cla.ende_number = el.e_number " - . "LEFT JOIN ( SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nexte_number,ANY_VALUE( nla.id ) AS nextid,ANY_VALUE( nla.l_title ) AS nexttitle,ANY_VALUE( nla.l_starttime ) AS nextstime,ANY_VALUE( nla.l_endtime ) AS nextetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_starttime > '{$curdate}' AND nla.id IS NOT NULL ORDER BY nextstime ASC ) eala GROUP BY nexte_number ) bla ON bla.nexte_number = el.e_number " - . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nend_number,ANY_VALUE( nla.id ) AS endid,ANY_VALUE( nla.l_title ) AS endtitle,ANY_VALUE( nla.l_starttime ) AS endstime,ANY_VALUE( nla.l_endtime ) AS endetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_endtime < '{$curdate}' AND nla.id IS NOT NULL ORDER BY endetime DESC ) eala GROUP BY nend_number ) dla ON dla.nend_number = el.e_number " - . "LEFT JOIN (SELECT nel.e_number AS lde_number,count(nel.e_number) AS lanum FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE NOT ( nla.l_endtime < '{$this->form['l_starttime']}' OR nla.l_starttime > '{$this->form['l_endtime']}' ) {$where} GROUP BY lde_number) AS ela ON ela.lde_number = el.e_number "; + $sqlk = " {$_YW['k']['elevator']} AS el " + . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nowe_number,ANY_VALUE( nla.id ) AS nowid,ANY_VALUE( nla.l_title ) AS nowtitle,ANY_VALUE( nla.l_starttime ) AS nowstime,ANY_VALUE( nla.l_endtime ) AS nowetime,if(NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) OR nla.l_starttime > '{$curdate}',1,0) AS estate FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) AND nla.id IS NOT NULL ORDER BY nowstime ASC ) eala GROUP BY nowe_number ) ala ON ala.nowe_number = el.e_number " + . "LEFT JOIN (SELECT nel.e_number AS ende_number, max( nla.l_endtime ) AS endtime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.id IS NOT NULL GROUP BY ende_number) cla ON cla.ende_number = el.e_number " + . "LEFT JOIN ( SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nexte_number,ANY_VALUE( nla.id ) AS nextid,ANY_VALUE( nla.l_title ) AS nexttitle,ANY_VALUE( nla.l_starttime ) AS nextstime,ANY_VALUE( nla.l_endtime ) AS nextetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_starttime > '{$curdate}' AND nla.id IS NOT NULL ORDER BY nextstime ASC ) eala GROUP BY nexte_number ) bla ON bla.nexte_number = el.e_number " + . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nend_number,ANY_VALUE( nla.id ) AS endid,ANY_VALUE( nla.l_title ) AS endtitle,ANY_VALUE( nla.l_starttime ) AS endstime,ANY_VALUE( nla.l_endtime ) AS endetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_endtime < '{$curdate}' AND nla.id IS NOT NULL ORDER BY endetime DESC ) eala GROUP BY nend_number ) dla ON dla.nend_number = el.e_number " + . "LEFT JOIN (SELECT nel.e_number AS lde_number,count(nel.e_number) AS lanum FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE NOT ( nla.l_endtime < '{$this->form['l_starttime']}' OR nla.l_starttime > '{$this->form['l_endtime']}' ) {$where} GROUP BY lde_number) AS ela ON ela.lde_number = el.e_number "; break; case 'elevators': - $sqlk = " {$_YW['k']['elevator']} AS el LEFT JOIN {$_YW['k']['launch']} AS la ON find_in_set( el.e_number, la.l_enumber ) " - . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nowe_number,ANY_VALUE( nla.id ) AS nowid,ANY_VALUE( nla.l_title ) AS nowtitle,ANY_VALUE( nla.l_starttime ) AS nowstime,ANY_VALUE( nla.l_endtime ) AS nowetime,if(NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) OR nla.l_starttime > '{$curdate}',1,0) AS estate FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) AND nla.id IS NOT NULL ORDER BY nowstime ASC ) eala GROUP BY nowe_number ) ala ON ala.nowe_number = el.e_number " - . "LEFT JOIN ( SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nexte_number,ANY_VALUE( nla.id ) AS nextid,ANY_VALUE( nla.l_title ) AS nexttitle,ANY_VALUE( nla.l_starttime ) AS nextstime,ANY_VALUE( nla.l_endtime ) AS nextetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_starttime > '{$curdate}' AND nla.id IS NOT NULL ORDER BY nextstime ASC ) eala GROUP BY nexte_number ) bla ON bla.nexte_number = el.e_number " - . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nend_number,ANY_VALUE( nla.id ) AS endid,ANY_VALUE( nla.l_title ) AS endtitle,ANY_VALUE( nla.l_starttime ) AS endstime,ANY_VALUE( nla.l_endtime ) AS endetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_endtime < '{$curdate}' AND nla.id IS NOT NULL ORDER BY endetime DESC ) eala GROUP BY nend_number ) cla ON cla.nend_number = el.e_number "; + $sqlk = " {$_YW['k']['elevator']} AS el LEFT JOIN {$_YW['k']['launch']} AS la ON find_in_set( el.e_number, la.l_enumber ) " + . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nowe_number,ANY_VALUE( nla.id ) AS nowid,ANY_VALUE( nla.l_title ) AS nowtitle,ANY_VALUE( nla.l_starttime ) AS nowstime,ANY_VALUE( nla.l_endtime ) AS nowetime,if(NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) OR nla.l_starttime > '{$curdate}',1,0) AS estate FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) AND nla.id IS NOT NULL ORDER BY nowstime ASC ) eala GROUP BY nowe_number ) ala ON ala.nowe_number = el.e_number " + . "LEFT JOIN ( SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nexte_number,ANY_VALUE( nla.id ) AS nextid,ANY_VALUE( nla.l_title ) AS nexttitle,ANY_VALUE( nla.l_starttime ) AS nextstime,ANY_VALUE( nla.l_endtime ) AS nextetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_starttime > '{$curdate}' AND nla.id IS NOT NULL ORDER BY nextstime ASC ) eala GROUP BY nexte_number ) bla ON bla.nexte_number = el.e_number " + . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nend_number,ANY_VALUE( nla.id ) AS endid,ANY_VALUE( nla.l_title ) AS endtitle,ANY_VALUE( nla.l_starttime ) AS endstime,ANY_VALUE( nla.l_endtime ) AS endetime FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_endtime < '{$curdate}' AND nla.id IS NOT NULL ORDER BY endetime DESC ) eala GROUP BY nend_number ) cla ON cla.nend_number = el.e_number "; break; case 'patrol': - $sqlk = " {$_YW['k']['elevator']} AS el LEFT JOIN {$_YW['k']['launch']} AS la ON find_in_set( el.e_number, la.l_enumber ) " - . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nowe_number,ANY_VALUE( nla.id ) AS nowid,ANY_VALUE( nla.l_title ) AS nowtitle,ANY_VALUE( nla.l_starttime ) AS nowstime,ANY_VALUE( nla.l_endtime ) AS nowetime,if(NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) OR nla.l_starttime > '{$curdate}',1,0) AS estate FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_starttime <= '{$curdate}' AND nla.id IS NOT NULL ORDER BY nowstime DESC ) eala GROUP BY nowe_number ) ala ON ala.nowe_number = el.e_number "; + $sqlk = " {$_YW['k']['elevator']} AS el LEFT JOIN {$_YW['k']['launch']} AS la ON find_in_set( el.e_number, la.l_enumber ) " + . "LEFT JOIN (SELECT * FROM( SELECT DISTINCT( nel.e_number ) AS nowe_number,ANY_VALUE( nla.id ) AS nowid,ANY_VALUE( nla.l_title ) AS nowtitle,ANY_VALUE( nla.l_starttime ) AS nowstime,ANY_VALUE( nla.l_endtime ) AS nowetime,if(NOT ( nla.l_endtime < '{$curdate}' OR nla.l_starttime > '{$curdate}' ) OR nla.l_starttime > '{$curdate}',1,0) AS estate FROM {$_YW['k']['elevator']} AS nel LEFT JOIN {$_YW['k']['launch']} AS nla ON find_in_set( nel.e_number, nla.l_enumber ) WHERE nla.l_starttime <= '{$curdate}' AND nla.id IS NOT NULL ORDER BY nowstime DESC ) eala GROUP BY nowe_number ) ala ON ala.nowe_number = el.e_number "; break; case 'villages': - $son = " FROM {$_YW['k']['countela']} AS el WHERE "; + $son = " FROM {$_YW['k']['countela']} AS el WHERE "; + //判断执行默认还是时间区段 - $bool = false; - if($this->form['vs_starttime'] || $this->form['vs_endtime']){ + $bool = false; + if ($this->form['vs_starttime'] || $this->form['vs_endtime']) { $bool = true; - $this->form['vs_starttime'] = $this->form['vs_starttime']?:$curdate; - $this->form['vs_endtime'] = $this->form['vs_endtime']?:$curdate; - if(strtotime($this->form['vs_starttime']) > strtotime($this->form['vs_endtime'])){ - $vs_starttime = $this->form['vs_endtime']; - $vs_endtime = $this->form['vs_starttime']; - }else{ - $vs_starttime = $this->form['vs_starttime']; - $vs_endtime = $this->form['vs_endtime']; + $this->form['vs_starttime'] = $this->form['vs_starttime'] ?: $curdate; + $this->form['vs_endtime'] = $this->form['vs_endtime'] ?: $curdate; + if (strtotime($this->form['vs_starttime']) > strtotime($this->form['vs_endtime'])) { + $vs_starttime = $this->form['vs_endtime']; + $vs_endtime = $this->form['vs_starttime']; + } else { + $vs_starttime = $this->form['vs_starttime']; + $vs_endtime = $this->form['vs_endtime']; } } - + // 计算是否区分广告位 // 检测是否通过JS传递的广告位参数,也就是导出 - if(isset($this->form['jsadd_veaps'])) $this->form['veaps'] = stringto_array($this->form['jsadd_veaps'],','); - if(is_array($this->form['veaps'])){ - $veaps = parent::strchange(array_filter($this->form['veaps'])); - $this->villages_where = " el.e_aps IN($veaps) "; - $son .= " {$this->villages_where} AND "; + if (isset($this->form['jsadd_veaps'])) + $this->form['veaps'] = stringto_array($this->form['jsadd_veaps'], ','); + if (is_array($this->form['veaps'])) { + $veaps = parent::strchange(array_filter($this->form['veaps'])); + $this->villages_where = " el.e_aps IN($veaps) "; + $son .= " {$this->villages_where} AND "; } - + // 空置计算要排除当前排期中的广告位 - if($bool){ + if ($bool) { //加上时间区块 那就是查看在区段内的情况 //增加 s_enable 判断是为了防止过去时间 //空置 - $fwhere = " {$son} NOT EXISTS (SELECT ela.e_number FROM {$_YW['k']['countela']} AS ela WHERE NOT ( ela.l_endtime < '{$vs_starttime}' OR ela.l_starttime > '{$vs_endtime}' ) AND ela.e_number = el.e_number) AND ( (el.l_endtime < '{$vs_starttime}' OR el.l_starttime > '{$vs_endtime}' ) OR el.l_id IS NULL ) AND el.e_enable = 1 "; + $fwhere = " {$son} NOT EXISTS (SELECT ela.e_number FROM {$_YW['k']['countela']} AS ela WHERE NOT ( ela.l_endtime < '{$vs_starttime}' OR ela.l_starttime > '{$vs_endtime}' ) AND ela.e_number = el.e_number) AND ( (el.l_endtime < '{$vs_starttime}' OR el.l_starttime > '{$vs_endtime}' ) OR el.l_id IS NULL ) AND el.e_enable = 1 "; // 之前的旧代码 // $fwhere = " {$son} NOT EXISTS (SELECT ela.e_number FROM {$_YW['k']['countela']} AS ela WHERE NOT ( ela.l_endtime < '{$vs_starttime}' OR ela.l_starttime > '{$vs_endtime}' ) AND NOT(ela.l_endtime < '{$curdate}' OR ela.l_starttime > '{$curdate}' ) AND ela.e_number = el.e_number) AND ( ((el.l_endtime < '{$vs_starttime}' OR el.l_starttime > '{$vs_endtime}') AND el.l_endtime < '{$curdate}' ) OR el.l_id IS NULL ) AND el.e_enable = 1 "; //排期中的 @@ -93,7 +94,7 @@ trait tdata { $dwhere = " {$son} el.l_endtime BETWEEN '{$vs_starttime}' AND '{$vs_endtime}' "; //预排 $pwhere = " {$son} NOT(el.l_endtime < '{$vs_starttime}' OR el.l_starttime > '{$vs_endtime}') AND el.l_starttime > '{$curdate}' "; - }else{ + } else { //没有时间区段,则按照当天为准则,默认值 //空置,其他不包含当天的 $fwhere = " {$son} NOT EXISTS (SELECT ela.e_number FROM {$_YW['k']['countela']} AS ela WHERE NOT ( ela.l_endtime < '{$curdate}' OR ela.l_starttime > '{$curdate}' ) AND ela.e_number = el.e_number) AND (el.l_endtime < '{$curdate}' OR el.l_starttime > '{$curdate}' OR el.l_id IS NULL) AND el.e_enable = 1 "; @@ -104,8 +105,8 @@ trait tdata { //预排,开始时间大于当天的 $pwhere = " {$son} el.l_starttime > '{$curdate}' "; } - - $sqlk = "{$_YW['k']['village']} AS vi LEFT JOIN {$_YW['k']['elevator']} AS el ON vi.id = el.e_vid " + + $sqlk = "{$_YW['k']['village']} AS vi LEFT JOIN {$_YW['k']['elevator']} AS el ON vi.id = el.e_vid " . "LEFT JOIN (SELECT el.e_vid AS ae_vid,COUNT( DISTINCT el.e_number ) AS v_free,COUNT( DISTINCT el.e_vid, el.e_bno ) AS v_bno {$fwhere} GROUP BY ae_vid ) AS anum ON anum.ae_vid = vi.id " . "LEFT JOIN (SELECT el.e_vid AS be_vid,COUNT( DISTINCT el.e_number ) AS v_lease {$lwhere} GROUP BY be_vid ) AS bnum ON bnum.be_vid = vi.id " . "LEFT JOIN (SELECT el.e_vid AS ce_vid,COUNT( DISTINCT el.e_number ) AS v_endday {$dwhere} GROUP BY ce_vid ) AS cnum ON cnum.ce_vid = vi.id " @@ -113,25 +114,25 @@ trait tdata { break; case 'contract': - $sqlk = "{$_YW['k']['contract']} AS ch LEFT JOIN {$_YW['k']['launch']} AS la ON ch.h_number = la.l_hnumber "; + $sqlk = "{$_YW['k']['contract']} AS ch LEFT JOIN {$_YW['k']['launch']} AS la ON ch.h_number = la.l_hnumber "; break; case 'schedule': - $sqlk = "{$_YW['k']['elevator']} AS el LEFT JOIN {$_YW['k']['launch']} AS la ON find_in_set( el.e_number, la.l_enumber ) LEFT JOIN {$_YW['k']['contract']} AS ct ON la.l_hnumber = ct.h_number"; + $sqlk = "{$_YW['k']['elevator']} AS el LEFT JOIN {$_YW['k']['launch']} AS la ON find_in_set( el.e_number, la.l_enumber ) LEFT JOIN {$_YW['k']['contract']} AS ct ON la.l_hnumber = ct.h_number"; break; case 'village': - $sqlk = "{$_YW['k']['village']} AS vi LEFT JOIN {$_YW['k']['elevator']} AS el ON vi.id = el.e_vid "; + $sqlk = "{$_YW['k']['village']} AS vi LEFT JOIN {$_YW['k']['elevator']} AS el ON vi.id = el.e_vid "; break; - + default: - $sqlk = $_YW['k'][$this->tname]; + $sqlk = $_YW['k'][$this->tname]; break; } return $sqlk; } - + //字段 public function td_field() { - global $_M,$_YW; + global $_M, $_YW; switch ($this->tname) { case 'applan': $field = '*'; @@ -161,261 +162,268 @@ trait tdata { } return $field; } - + /* * 【列出】 * 同时满足条件的,非OR */ + public function td_search($link = true) { - global $_M,$_YW; + global $_M, $_YW; //默认input字段为link搜索 - if($link) $this->search_link = array_unique(array_merge($this->search_input,$this->search_link)); + if ($link) + $this->search_link = array_unique(array_merge($this->search_input, $this->search_link)); //合成得带搜索字段 - $field = array_unique(array_merge($this->search_input,$this->search_other)); + $field = array_unique(array_merge($this->search_input, $this->search_other)); //判断是否为链表查询 - $join_field = array_combine($field,count($this->search_field) > 0?$this->search_field:$field); - + $join_field = array_combine($field, count($this->search_field) > 0 ? $this->search_field : $field); + //相对独立的搜索 - $arrwhere = []; + $arrwhere = []; foreach ($field as $val) { $search = trim(strtoupper($this->form[$val])); - if(strlen($search) > 0) { - $str = $join_field[$val]; - if(in_array($val, $this->search_link)){ - $arrwhere[] = " {$str} LIKE '%{$search}%' "; + if (strlen($search) > 0) { + $str = $join_field[$val]; + if (in_array($val, $this->search_link)) { + $arrwhere[] = " {$str} LIKE '%{$search}%' "; continue; } - $arrwhere[] = " {$str} = '{$search}' "; + $arrwhere[] = " {$str} = '{$search}' "; } } - + //返回内容 $where = ''; - if(count($arrwhere) > 0){ - $where = ' AND '; - $where .= arrayto_string($arrwhere,' AND '); + if (count($arrwhere) > 0) { + $where = ' AND '; + $where .= arrayto_string($arrwhere, ' AND '); } return $where; } - + //OR 内容搜索 - public function td_search_or($orfield,$search_field = []) { - global $_M,$_YW; + public function td_search_or($orfield, $search_field = []) { + global $_M, $_YW; //判断是否为链表查询 - $join_field = array_combine($orfield,count($search_field) > 0?$search_field:$orfield); + $join_field = array_combine($orfield, count($search_field) > 0 ? $search_field : $orfield); //相对独立的搜索 - $arrwhere = []; + $arrwhere = []; foreach ($orfield as $val) { $search = trim(strtoupper($this->form[$val])); - if(strlen($search) > 0) { - $str = $join_field[$val]; - if(in_array($val, $this->search_link)){ - $arrwhere[] = " {$str} LIKE '%{$search}%' "; + if (strlen($search) > 0) { + $str = $join_field[$val]; + if (in_array($val, $this->search_link)) { + $arrwhere[] = " {$str} LIKE '%{$search}%' "; continue; } - $arrwhere[] = " {$str} = '{$search}' "; + $arrwhere[] = " {$str} = '{$search}' "; } } - + //返回内容 $where = ''; - if(count($arrwhere) > 0){ - $where .= arrayto_string($arrwhere,' OR '); + if (count($arrwhere) > 0) { + $where .= arrayto_string($arrwhere, ' OR '); } - return strlen($where) > 0 ?" AND ({$where}) ":''; + return strlen($where) > 0 ? " AND ({$where}) " : ''; } - + //时间区间 - public function td_time_search($field,$search_field = []) { - global $_M,$_YW; - list($start,$end) = $field; + public function td_time_search($field, $search_field = []) { + global $_M, $_YW; + list($start, $end) = $field; //判断是否为链表查询 - $join_field = array_combine($field,count($search_field) > 0?$search_field:$field); + $join_field = array_combine($field, count($search_field) > 0 ? $search_field : $field); //相对独立的搜索 - $arrwhere = []; + $arrwhere = []; foreach ($field as $val) { $search = trim(strtoupper($this->form[$val])); - if(strlen($search) > 0) { - $str = $join_field[$val]; - if($val == $start){ - $arrwhere[] = " {$str} >= '{$search}' "; - }else{ - $arrwhere[] = " {$str} <= '{$search}' "; + if (strlen($search) > 0) { + $str = $join_field[$val]; + if ($val == $start) { + $arrwhere[] = " {$str} >= '{$search}' "; + } else { + $arrwhere[] = " {$str} <= '{$search}' "; } } } - + //返回内容 $where = ''; - if(count($arrwhere) > 0){ - $where .= arrayto_string($arrwhere," AND "); + if (count($arrwhere) > 0) { + $where .= arrayto_string($arrwhere, " AND "); } - return strlen($where) > 0 ?" AND ({$where}) ":''; + return strlen($where) > 0 ? " AND ({$where}) " : ''; } - + //获取重叠的时间区间 // $search_field 开始时间和结束时间的字段互相调换,结束的字段在前面 - public function td_time_orsearch($field,$search_field = []) { - global $_M,$_YW; - list($start,$end) = $field; + public function td_time_orsearch($field, $search_field = []) { + global $_M, $_YW; + list($start, $end) = $field; //判断是否为链表查询 - $join_field = array_combine($field,count($search_field) > 0?$search_field:$field); + $join_field = array_combine($field, count($search_field) > 0 ? $search_field : $field); //相对独立的搜索 - $arrwhere = []; + $arrwhere = []; foreach ($field as $val) { $search = trim(strtoupper($this->form[$val])); - if(strlen($search) > 0) { - $str = $join_field[$val]; - if($val == $start){ - $arrwhere[] = " {$str} < '{$search}' "; //结束字段,搜索为开始时间 - }else{ - $arrwhere[] = " {$str} > '{$search}' "; //开始字段,搜索为结束时间 + if (strlen($search) > 0) { + $str = $join_field[$val]; + if ($val == $start) { + $arrwhere[] = " {$str} < '{$search}' "; //结束字段,搜索为开始时间 + } else { + $arrwhere[] = " {$str} > '{$search}' "; //开始字段,搜索为结束时间 } } } - + //返回内容 $where = ''; - if(count($arrwhere) > 0){ - $where .= arrayto_string($arrwhere," OR "); + if (count($arrwhere) > 0) { + $where .= arrayto_string($arrwhere, " OR "); } - return strlen($where) > 0 ?" AND NOT({$where}) ":''; + return strlen($where) > 0 ? " AND NOT({$where}) " : ''; } /* * 【列出】 * SQL判断语句$where .= $this->search(); */ + public function td_where() { - global $_M,$_YW; - $where = " 1=1 "; + global $_M, $_YW; + $where = " 1=1 "; switch ($this->tname) { case 'applan': - $this->search_input = ['e_number']; - $this->search_other = ['e_bno','e_vid','e_enable']; + $this->search_input = ['e_number']; + $this->search_other = ['e_bno', 'e_vid', 'e_enable']; $where .= self::td_search(); - if(is_array($this->form['e_aps'])) { + if (is_array($this->form['e_aps'])) { // 不考虑导出的情况 - $veaps = parent::strchange(array_filter($this->form['e_aps'])); + $veaps = parent::strchange(array_filter($this->form['e_aps'])); $where .= " AND e_aps IN($veaps) "; } break; case 'elevators': - $this->search_input = ['e_number']; - $this->search_other = ['e_aps','e_bno','e_vid','e_enable','endid','nowid','nextid']; - $this->search_field = ['el.e_number','el.e_aps','el.e_bno','el.e_vid','el.e_enable','cla.endid','ala.nowid','bla.nextid']; + $this->search_input = ['e_number']; + $this->search_other = ['e_aps', 'e_bno', 'e_vid', 'e_enable', 'endid', 'nowid', 'nextid']; + $this->search_field = ['el.e_number', 'el.e_aps', 'el.e_bno', 'el.e_vid', 'el.e_enable', 'cla.endid', 'ala.nowid', 'bla.nextid']; $where .= self::td_search(); //判断是否为备份 - if($this->bsign) parent::where_id($where); + if ($this->bsign) + parent::where_id($where); self::td_groupby($where); break; case 'patrol': - $this->search_input = ['e_number']; - $this->search_other = ['e_aps','e_bno','e_vid','e_enable','nowid','l_hnumber']; - $this->search_field = ['el.e_number','el.e_aps','el.e_bno','el.e_vid','el.e_enable','ala.nowid','la.l_hnumber']; + $this->search_input = ['e_number']; + $this->search_other = ['e_aps', 'e_bno', 'e_vid', 'e_enable', 'nowid', 'l_hnumber']; + $this->search_field = ['el.e_number', 'el.e_aps', 'el.e_bno', 'el.e_vid', 'el.e_enable', 'ala.nowid', 'la.l_hnumber']; $where .= self::td_search(); - + //不看空位 - $where .= " AND ala.nowid IS NOT NULL "; - + $where .= " AND ala.nowid IS NOT NULL "; + self::td_groupby($where); break; case 'elevator': - $this->search_input = ['e_number','e_label','e_text']; - $this->search_other = ['e_aps','e_bno','e_vid','e_enable']; + $this->search_input = ['e_number', 'e_label', 'e_text']; + $this->search_other = ['e_aps', 'e_bno', 'e_vid', 'e_enable']; $where .= self::td_search(); case 'village': - $this->search_input = ['v_name','v_text']; + $this->search_input = ['v_name', 'v_text']; $where .= self::td_search(); - - $this->search_link = ['v_province','v_city','v_district','v_address']; - $this->search_field = ['vi.v_name','vi.v_text','vi.v_province','vi.v_city','vi.v_district','vi.v_address']; - $this->form['v_province'] = $this->form['v_address']; - $this->form['v_city'] = $this->form['v_address']; - $this->form['v_district'] = $this->form['v_address']; - - $where .= self::td_search_or($this->search_link,['vi.v_province','vi.v_city','vi.v_district','vi.v_address']); + + $this->search_link = ['v_province', 'v_city', 'v_district', 'v_address']; + $this->search_field = ['vi.v_name', 'vi.v_text', 'vi.v_province', 'vi.v_city', 'vi.v_district', 'vi.v_address']; + $this->form['v_province'] = $this->form['v_address']; + $this->form['v_city'] = $this->form['v_address']; + $this->form['v_district'] = $this->form['v_address']; + + $where .= self::td_search_or($this->search_link, ['vi.v_province', 'vi.v_city', 'vi.v_district', 'vi.v_address']); self::td_groupby($where); break; case 'customer': - $this->search_input = ['c_text']; - $this->search_link = ['c_allname','c_name','c_province','c_city','c_district','c_address']; + $this->search_input = ['c_text']; + $this->search_link = ['c_allname', 'c_name', 'c_province', 'c_city', 'c_district', 'c_address']; //名称 - $this->form['c_name'] = $this->form['c_allname']; - $where .= self::td_search_or(['c_allname','c_name']); + $this->form['c_name'] = $this->form['c_allname']; + $where .= self::td_search_or(['c_allname', 'c_name']); //地址 - $this->form['c_province'] = $this->form['c_address']; - $this->form['c_city'] = $this->form['c_address']; - $this->form['c_district'] = $this->form['c_address']; - $where .= self::td_search_or(['c_province','c_city','c_district','c_address']); + $this->form['c_province'] = $this->form['c_address']; + $this->form['c_city'] = $this->form['c_address']; + $this->form['c_district'] = $this->form['c_address']; + $where .= self::td_search_or(['c_province', 'c_city', 'c_district', 'c_address']); $where .= self::td_search(); break; case 'workers': - $this->search_input = ['w_name','w_tel','w_text']; + $this->search_input = ['w_name', 'w_tel', 'w_text']; $where .= self::td_search(); break; case 'contract': - $this->search_input = ['h_number','h_text']; - $this->search_other = ['h_cid','h_wid']; - $this->search_link = ['h_wid']; - $this->search_field = ['ch.h_number','ch.h_text','ch.h_cid','ch.h_wid']; - $where .= self::td_time_orsearch(['h_starttime','h_endtime'],['ch.h_endtime','ch.h_starttime']); + $this->search_input = ['h_number', 'h_text']; + $this->search_other = ['h_cid', 'h_wid']; + $this->search_link = ['h_wid']; + $this->search_field = ['ch.h_number', 'ch.h_text', 'ch.h_cid', 'ch.h_wid']; + $where .= self::td_time_orsearch(['h_starttime', 'h_endtime'], ['ch.h_endtime', 'ch.h_starttime']); $where .= self::td_search(); self::td_groupby($where); break; case 'para': - $this->search_other = ['p_type']; + $this->search_other = ['p_type']; $where .= self::td_search(); break; case 'launch': - $this->search_input = ['l_title','l_enumber','l_text']; - $this->search_other = ['l_hnumber']; - $where .= self::td_time_orsearch(['l_starttime','l_endtime'],['l_endtime','l_starttime']); + $this->search_input = ['l_title', 'l_enumber', 'l_text']; + $this->search_other = ['l_hnumber']; + $where .= self::td_time_orsearch(['l_starttime', 'l_endtime'], ['l_endtime', 'l_starttime']); $where .= self::td_search(); break; case 'villages': - $this->search_input = ['v_name','v_text']; - $this->search_link = ['v_province','v_city','v_district','v_address']; - $this->form['v_province'] = $this->form['v_address']; - $this->form['v_city'] = $this->form['v_address']; - $this->form['v_district'] = $this->form['v_address']; - - if(is_array($this->form['veaps'])) $where .= " AND {$this->villages_where} "; + $this->search_input = ['v_name', 'v_text']; + $this->search_link = ['v_province', 'v_city', 'v_district', 'v_address']; + $this->form['v_province'] = $this->form['v_address']; + $this->form['v_city'] = $this->form['v_address']; + $this->form['v_district'] = $this->form['v_address']; + + if (is_array($this->form['veaps'])) + $where .= " AND {$this->villages_where} "; $where .= self::td_search_or($this->search_link); $where .= self::td_search(); //判断是否为备份 - if($this->bsign) parent::where_id($where); + if ($this->bsign) + parent::where_id($where); self::td_groupby($where); break; case 'schedule': - $where .= " AND la.id IS NOT NULL "; - $this->search_input = ['e_number','l_hnumber']; - $this->search_other = ['id','e_vid']; - $this->search_field = ['el.e_number','la.l_hnumber','la.id','el.e_vid']; - $where .= self::td_time_orsearch(['l_starttime','l_endtime'],['la.l_endtime','la.l_starttime']); + $where .= " AND la.id IS NOT NULL "; + $this->search_input = ['e_number', 'l_hnumber']; + $this->search_other = ['id', 'e_vid']; + $this->search_field = ['el.e_number', 'la.l_hnumber', 'la.id', 'el.e_vid']; + $where .= self::td_time_orsearch(['l_starttime', 'l_endtime'], ['la.l_endtime', 'la.l_starttime']); $where .= self::td_search(); break; case 'noticeday': - $where .= ' AND ( (endtime BETWEEN DATE_SUB( CURDATE(), INTERVAL 3 DAY ) AND CURDATE()) OR ' //到期提醒 展示3天 // DATE_SUB - . '(h_endtime BETWEEN DATE_SUB( CURDATE(), INTERVAL 3 DAY ) AND DATE_ADD( CURDATE(), INTERVAL 3 DAY ) ) )'; //订单到期前后展示3天 // DATE_ADD + $where .= ' AND ( (endtime BETWEEN DATE_SUB( CURDATE(), INTERVAL 3 DAY ) AND CURDATE()) OR ' //到期提醒 展示3天 // DATE_SUB + . '(h_endtime BETWEEN DATE_SUB( CURDATE(), INTERVAL 3 DAY ) AND DATE_ADD( CURDATE(), INTERVAL 3 DAY ) ) )'; //订单到期前后展示3天 // DATE_ADD break; default: // 如果$where 没有值 会导致计算结果出错,导致前台表格无法获取正确的值,分页显示异常 - $where = "1=1"; + $where = "1=1"; break; } - + return $where; } - + //分组查询 public function td_groupby(&$where) { global $_M; - $this->multi_table = true; + $this->multi_table = true; switch ($this->tname) { case 'elevators': $where .= " GROUP BY el.e_number "; - if($this->form['endtime']) $where .= " HAVING endtime < '{$this->form['endtime']}' "; + if ($this->form['endtime']) + $where .= " HAVING endtime < '{$this->form['endtime']}' "; break; case 'patrol': $where .= " GROUP BY el.e_number "; @@ -430,103 +438,132 @@ trait tdata { $where .= " GROUP BY vi.id "; break; default: - $this->multi_table = false; + $this->multi_table = false; break; } } - + /* * 【列出】 * SQL排序方式语句 */ + public function td_order() { global $_M; switch ($this->tname) { case 'applan': - $order = " `e_enable` DESC "; + $order = " `e_enable` DESC "; //按照正常排序,对比相邻广告位的投放广告品类 // order_e_types 按照是否可投放进行排序 - if($this->form['eaps_order'] || $this->form['order_e_types']){ - if(!$this->form['order_e_types']) $this->form['order_e_types'] = ' ASC '; - $order .= ", `lanum` {$this->form['order_e_types']} "; + if ($this->form['eaps_order'] || $this->form['order_e_types']) { + if (!$this->form['order_e_types']) + $this->form['order_e_types'] = ' ASC '; + $order .= ", `lanum` {$this->form['order_e_types']} "; } - if($this->form['eaps_order'] == 2){ + if ($this->form['eaps_order'] == 2) { // 传递进来的编号,不直接查数据是因为有些可能会出现错误,所以直接使用传递进来的,进行排序 - $array = array_filter(stringto_array($this->form['l_selectenum'],',')); - $idstr = parent::strchange($array); - if(strlen($idstr)) $order = " `e_number` IN({$idstr}) DESC, ".$order; + $array = array_filter(stringto_array($this->form['l_selectenum'], ',')); + $idstr = parent::strchange($array); + if (strlen($idstr)) + $order = " `e_number` IN({$idstr}) DESC, " . $order; } - $order .= ", `e_vid` ASC, `e_bno` ASC, `e_aps` ASC "; + $order .= ", `e_vid` ASC, `e_bno` ASC, `e_aps` ASC "; break; case 'elevators': - $order = " `etypes` DESC, endtime DESC, el.`e_vid` ASC, el.`e_bno` ASC, el.`e_aps` ASC "; - if($this->form['order_e_number']) $order = " el.e_number {$this->form['order_e_number']} "; - if($this->form['order_endtime']) $order = " endtime {$this->form['order_endtime']} "; - if($this->form['order_e_totalnum']) $order = " e_totalnum {$this->form['order_e_totalnum']} "; - if($this->form['order_etypes']) $order = " `etypes` {$this->form['order_etypes']} "; - if($this->form['order_nowstime']) $order = " nowstime {$this->form['order_nowstime']} "; - if($this->form['order_nowetime']) $order = " nowetime {$this->form['order_nowetime']} "; - if($this->form['order_nextstime']) $order = " nextstime {$this->form['order_nextstime']} "; - if($this->form['order_nextetime']) $order = " nextetime {$this->form['order_nextetime']} "; - if($this->form['order_endstime']) $order = " endstime {$this->form['order_endstime']} "; - if($this->form['order_endetime']) $order = " endetime {$this->form['order_endetime']} "; - if($this->form['order_e_address']) { - $e_address = $this->form['order_e_address']; + $order = " `etypes` DESC, endtime DESC, el.`e_vid` ASC, el.`e_bno` ASC, el.`e_aps` ASC "; + if ($this->form['order_e_number']) + $order = " el.e_number {$this->form['order_e_number']} "; + if ($this->form['order_endtime']) + $order = " endtime {$this->form['order_endtime']} "; + if ($this->form['order_e_totalnum']) + $order = " e_totalnum {$this->form['order_e_totalnum']} "; + if ($this->form['order_etypes']) + $order = " `etypes` {$this->form['order_etypes']} "; + if ($this->form['order_nowstime']) + $order = " nowstime {$this->form['order_nowstime']} "; + if ($this->form['order_nowetime']) + $order = " nowetime {$this->form['order_nowetime']} "; + if ($this->form['order_nextstime']) + $order = " nextstime {$this->form['order_nextstime']} "; + if ($this->form['order_nextetime']) + $order = " nextetime {$this->form['order_nextetime']} "; + if ($this->form['order_endstime']) + $order = " endstime {$this->form['order_endstime']} "; + if ($this->form['order_endetime']) + $order = " endetime {$this->form['order_endetime']} "; + if ($this->form['order_e_address']) { + $e_address = $this->form['order_e_address']; $order = " el.e_vid {$e_address}, el.e_bno {$e_address}, el.e_aps {$e_address} "; } break; case 'patrol': - $order = " el.`e_vid` ASC, el.`e_bno` ASC, el.`e_aps` ASC "; + $order = " el.`e_vid` ASC, el.`e_bno` ASC, el.`e_aps` ASC "; break; case 'elevator': - $order = " `id` DESC "; + $order = " `id` DESC "; break; case 'launch': - $order = " `id` DESC "; - if($this->form['order_l_starttime']) $order = " l_starttime {$this->form['order_l_starttime']} "; - if($this->form['order_l_endtime']) $order = " l_endtime {$this->form['order_l_endtime']} "; + $order = " `id` DESC "; + if ($this->form['order_l_starttime']) + $order = " l_starttime {$this->form['order_l_starttime']} "; + if ($this->form['order_l_endtime']) + $order = " l_endtime {$this->form['order_l_endtime']} "; break; case 'contract': - $order = ' ch.`id` DESC'; - if($this->form['order_h_starttime']) $order = " ch.h_starttime {$this->form['order_h_starttime']} "; - if($this->form['order_h_endtime']) $order = " ch.h_endtime {$this->form['order_h_endtime']} "; + $order = ' ch.`id` DESC'; + if ($this->form['order_h_starttime']) + $order = " ch.h_starttime {$this->form['order_h_starttime']} "; + if ($this->form['order_h_endtime']) + $order = " ch.h_endtime {$this->form['order_h_endtime']} "; break; case 'schedule': - $order = ' la.l_starttime DESC,la.`id` DESC'; + $order = ' la.l_starttime DESC,la.`id` DESC'; //备份 按照场所排序 - if($this->bsign){ - $order = " el.`e_vid` ASC, el.`e_bno` ASC, el.`e_aps` ASC "; + if ($this->bsign) { + $order = " el.`e_vid` ASC, el.`e_bno` ASC, el.`e_aps` ASC "; } - if($this->form['order_l_starttime']) $order = " la.l_starttime {$this->form['order_l_starttime']} "; - if($this->form['order_l_endtime']) $order = " la.l_endtime {$this->form['order_l_endtime']} "; + if ($this->form['order_l_starttime']) + $order = " la.l_starttime {$this->form['order_l_starttime']} "; + if ($this->form['order_l_endtime']) + $order = " la.l_endtime {$this->form['order_l_endtime']} "; break; case 'villages': - $order = ' vi.`id` DESC'; - if($this->form['order_v_enum']) $order = " v_enum {$this->form['order_v_enum']} "; - if($this->form['order_v_free']) $order = " v_free {$this->form['order_v_free']} "; - if($this->form['order_v_lease']) $order = " v_lease {$this->form['order_v_lease']} "; - if($this->form['order_v_endday']) $order = " v_endday {$this->form['order_v_endday']} "; - if($this->form['order_v_prerow']) $order = " v_prerow {$this->form['order_v_prerow']} "; - if($this->form['order_v_ebnonum']) $order = " v_ebnonum {$this->form['order_v_ebnonum']} "; - if($this->form['order_v_bno']) $order = " v_bno {$this->form['order_v_bno']} "; + $order = ' CONVERT( vi.`v_address` USING gbk ) COLLATE gbk_chinese_ci ASC '; + if ($this->form['order_v_enum']) + $order = " v_enum {$this->form['order_v_enum']} "; + if ($this->form['order_v_free']) + $order = " v_free {$this->form['order_v_free']} "; + if ($this->form['order_v_lease']) + $order = " v_lease {$this->form['order_v_lease']} "; + if ($this->form['order_v_endday']) + $order = " v_endday {$this->form['order_v_endday']} "; + if ($this->form['order_v_prerow']) + $order = " v_prerow {$this->form['order_v_prerow']} "; + if ($this->form['order_v_ebnonum']) + $order = " v_ebnonum {$this->form['order_v_ebnonum']} "; + if ($this->form['order_v_bno']) + $order = " v_bno {$this->form['order_v_bno']} "; + break; case 'para': - $order = ' `id` DESC'; - if($this->form['order_p_type']) $order = " `p_type` {$this->form['order_p_type']} "; - if($this->form['order_p_order']) $order = " `p_order` {$this->form['order_p_order']} "; + $order = ' `id` DESC'; + if ($this->form['order_p_type']) + $order = " `p_type` {$this->form['order_p_type']} "; + if ($this->form['order_p_order']) + $order = " `p_order` {$this->form['order_p_order']} "; break; case 'noticeday': - $order = ' `endtime` ASC, `h_endtime` ASC '; + $order = ' `endtime` ASC, `h_endtime` ASC '; break; case 'village': - $order = ' vi.`id` DESC'; + $order = ' vi.`id` DESC'; break; default: - $order = ' `id` DESC'; + $order = ' `id` DESC'; break; } return $order; } - + }