diff --git a/.appignore b/.appignore new file mode 100644 index 0000000..8695741 --- /dev/null +++ b/.appignore @@ -0,0 +1,16 @@ +{ + "notes":[ + "skipfile 需要跳过的文件,不分目录", + "skipdir 需要跳过的文件,需要路径正确", + "skipdl 指定的目录仅下载dllist内所有,这里设置的目录 只能是相对应用版本的根目录也就是一级目录", + "coredir 需要检出的核心目录,按照目录来跳过", + "endirfile 需要加密的文件", + "sourcefile 源文件需要删除,不提供给客户端下载的" + ], + "skipfile": [], + "skipdir": [], + "skipdl": [], + "coredir": [], + "endirfile": [], + "sourcefile": [] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..88a5e10 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# ---> NetBeans +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ +/config/ \ No newline at end of file diff --git a/README.md b/README.md index a399d71..2bf34ff 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # dzadsod -道闸广告位管理 \ No newline at end of file +场所门口道闸广告位运营管理 diff --git a/admin/ajax.class.php b/admin/ajax.class.php new file mode 100644 index 0000000..9387527 --- /dev/null +++ b/admin/ajax.class.php @@ -0,0 +1,211 @@ +cloud->citydata(); + } + + //查询广告位编号是否重复 + public function doenumber() { + global $_M,$_YW; + $array = $this->tsql->table('elevator')->where(['e_number' => $_M['form']['e_number'] ])->one(); + $result['valid'] = $array == false?true:($array['id'] == $_M['form']['id']?true:false); + //再判断一个排期内是否存在此编号 + echo parent::jsoncallback($result); + } + + //查询广告位编号是否重复 + public function dohnumber() { + global $_M,$_YW; + $array = $this->tsql->table('contract')->where(['h_number' => $_M['form']['h_number'] ])->one(); + $result['valid'] = $array == false?true:($array['id'] == $_M['form']['id']?true:false); + echo parent::jsoncallback($result); + } + + //查询投放标题 + public function dolatitle() { + global $_M,$_YW; + $ids = stringto_array($_M['form']['ids'],','); + if(count($ids)){ + $url = $_M['url']['own_name'].'c=table_on&a=doschedule&s_lid='; + $strid = arrayto_string($ids,','); + $launch = $this->tsql->table('launch')->where(" id IN({$strid}) ")->all('id'); + list($eid,$nid) = $ids; + $eslid = $eid?''.$launch[$eid]['l_title'].'':''; + $ntslid = $nid?''.$launch[$nid]['l_title'].'':''; + } + echo parent::jsoncallback(['eslid' => $eslid,'ntslid' => $ntslid ]); + } + + //广告位排期入库【重要】 + public function doapplan() { + global $_M,$_YW; + $form = $_M['form']; + $ap_enumber = $_M['form']['ap_enumber']; + $slid = $form['slid']; + //检查投放订单是否存在 + $retarray = ['code' => false,'text' => '投放计划不存在!']; + $launch = $this->tsql->table('launch') + ->where(['id' => $slid]) + ->one(); + if($launch == false) { + echo parent::jsoncallback($retarray); + exit; + } + //检查广告位排期时间是否可用,是否合法 + $l_starttime = strtotime($form['l_starttime']); + $l_endtime = strtotime($form['l_endtime']); + $daystr = strtotime(date('Y-m-d',time())); + if($l_starttime > $l_endtime && (empty($l_starttime) || empty($l_endtime)) ){ + $retarray['text'] = "【{$ap_enumber}】投放结束时间({$form['l_starttime']})不能小于开始时间({$form['l_endtime']})!"; + echo parent::jsoncallback($retarray); + exit; + } + + //根据广告位编号查询对应广告位信息 e_enable + $elevator = $this->tsql->table('elevator') + ->where(['e_number' => $ap_enumber]) + ->one(); + $elstr = $error = false; + // 判断广告位是否存在 + if($elevator != false){ + //进行排期处理 + $field = [ + 's_lid' => $slid, + 's_enumber' => $ap_enumber, + 's_hnumber' => $form['l_hnumber'], + 's_starttime' => $form['l_starttime'], + 's_endtime' => $form['l_endtime'], + ]; + + // 不可通过唯一索引新增和更新数据,因为他会先触发新增的触发器 + // 先查询是否存在相应的广告位排期,存在则修改,相反为新增 + $enum = $this->tsql->table('schedule') + ->qfield('id') + ->where(['s_lid' => $slid, 's_enumber' => $ap_enumber ]) + ->one(); + $query1 = $this->tsql->query(); + if($enum == false){ + //判断广告位是否停用 + if($elevator['e_enable']){ + //新增 + $field['id'] = 'UUID()'; + $this->tsql->table('schedule') + ->special('UUID()') + ->field($field) + ->add(); + $query = $this->tsql->query(); + }else{ + //表示广告位已停用 + $elstr = '已禁用'; + } + }else{ + //修改 + $this->tsql->table('schedule') + ->field($field) + ->where(['id' => $enum['id']]) + ->upd(); + $query = $this->tsql->query(); + } + //获取sql执行结果,查看是否存在错误 + $elstr = $this->tsql->error(); + + //广告位地址 + $e_address = parent::e_address($elevator); + }else{ + // 删除此广告位之前保存的排期记录 + $this->tsql->table('schedule') + ->where(['s_enumber' => $ap_enumber ]) + ->del(); + // 记录不存在的广告位,保留到最后删除掉相关的选择广告位 + $session = load::sys_class('session','new'); + $senumber = $session->get('schedule_eid'.$slid); + $senumber[] = $ap_enumber; + $session->set('schedule_eid'.$slid,$senumber); + $e_address = "({$ap_enumber})"; + $elstr = '广告位不存在或者已删除,'; + } + + $array = $error || $elstr + ?['code' => false,'text' => "{$e_address},{$elstr}排期失败。",'eid' =>$ap_enumber,$query,$enum,$field,$query1,$senumber] + :['code' => true,'text' => "{$e_address},排期成功。",'eid' =>$ap_enumber,$senumber]; + + echo parent::jsoncallback($array); + exit; + } + + //选中排期的成功广告位保存 + public function dolenumber() { + global $_M,$_YW; + + $slid = $_M['form']['slid']; + // 删除不存在的已选择广告位 + $session = load::sys_class('session','new'); + $schedule_eid = $session->get('schedule_eid'.$slid)?:[]; + $session->del('schedule_eid'); + $session->del('schedule_eid'.$slid); + $launch = $this->tsql->table('launch') + ->where(['id' => $slid]) + ->one(); + $l_selectenum = arrayto_string(array_unique(array_diff(stringto_array($launch['l_selectenum'],','),$schedule_eid)),','); + // 排期保存 + //查询出所有的 + $schedule = $this->tsql->table('schedule') + ->where(['s_lid' => $slid]) + ->all(); + $idarr = array_column($schedule, 's_enumber'); + $idstr = arrayto_string($idarr,','); + $this->tsql->table('launch') + ->field(['l_selectenum' => $l_selectenum,'l_enumber' => $idstr ]) + ->where(['id' => $slid]) + ->upd(); + $error = $this->tsql->error(); + $num = count($idarr); + $array = $error + ?['code' => false,'text' => "选中广告位保存失败,导致排期失败!",'idstr' => $idstr,$schedule_eid] + :['code' => true,'text' => "选中的({$num})个广告位排期记录保存成功。",'idstr' => $idstr,$schedule_eid]; + echo parent::jsoncallback($array); + } + + //处理序列表,让他始终大于广告位的总个数 + public function dosequence() { + global $_M,$_YW; + $counta = $this->tsql->table('elevator')->count(); + $countb = $this->tsql->table('sequence')->count(); + $count = $counta + 10 - $countb; + if($count > 0){ + for($i = 0; $i < $count; $i++){ + $this->tsql->table('sequence')->field(['seq' => null])->add(); + } + } + echo parent::jsoncallback([$counta,$countb,$count]); + } + +} + +?> \ No newline at end of file diff --git a/admin/backups.class.php b/admin/backups.class.php new file mode 100644 index 0000000..ecc14c2 --- /dev/null +++ b/admin/backups.class.php @@ -0,0 +1,196 @@ +form = $_M['form']; + if($this->form['tname']){ + $this->tname = $this->form['tname']; + $this->sqlk = $_YW['k'][$this->tname]; + } + $this->own_name_info = $_M['url']['own_name'].'c=info_on&a=do'; + } + + use tdata; + use tfield; + use tlist; + + //表格数据 + public function doindex() { + global $_M; + self::csvtitle(); + $this->bacname = '广告位'; + self::csvname(); + + //输出头部 + header("Content-type:text/csv"); + header("Content-Disposition:attachment;filename=" . $this->csvname); + header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); + header('Expires:0'); + header('Pragma:public'); + //刷新buffer + ob_flush(); + flush(); + $file = fopen('php://output', 'a'); + + //先将标题写入文件 + $title = self::arrzbm($this->title, 'utf-8', 'GBK'); + fputcsv($file, $title); + ob_flush(); + flush(); + + # 初始化mysql需要的参数 + self::bactable(); + # 获取数据总条数 + $total = self::tabletotal(); + $pages = ceil($total/$this->bacpages); + for ($i = 0; $i < $pages; $i++){ + $data = self::tabledata($i); + $y = 0; + $listnum = 1000; + foreach ($data as $val) { + //返回数据 + $y++; + # 每隔$listnum行,刷新一下输出buffer,大数据量时处理 + # 刷新一下输出buffer,防止由于数据过多造成问题 + if ($listnum == $y) { + ob_flush(); + # 刷新buffer + flush(); + $y = 0; + } + $arr = self::arrzbm($val,'utf-8' , 'GBK'); + fputcsv($file, $arr); + } + } + fclose($file); + } + + //判断语句组合 + protected function bactable() { + global $_M; + $this->bactable = self::td_sqlk(); + $this->bacfield = self::td_field(); + + $where = self::td_where(); + parent::where_id($where); + + if($where){ + $where = trim($where); + if (strtolower(substr($where, 0, 5)) != 'where' && $where) $this->bacconds = " WHERE {$where} "; + } + //排序 + if($this->bacconds){ + $order = self::td_order(); + $this->bacconds .= " ORDER BY {$order} "; + } + return $this; + } + + //计算总数 + protected function tabletotal() { + global $_M; + $countsql = " SELECT COUNT(*) FROM {$this->bactable} {$this->bacconds} "; + if($this->multi_table) $countsql = " SELECT count(*) FROM (SELECT {$this->bacfield} FROM {$this->bactable} {$this->bacconds}) num "; + $result = DB::query($countsql); + $fetch_row = DB::fetch_row($result); + return $fetch_row[0]; + } + + //获取获取 + protected function tabledata($pages) { + global $_M; + $cursize = $pages* $this->bacpages; + //SQL查询 + $result = DB::query("SELECT {$this->bacfield} FROM {$this->bactable} {$this->bacconds} LIMIT {$cursize},{$this->bacpages}"); + while($val = DB::fetch_array($result)){ + $data[] = $val; + } + + //处理数组结果 + foreach ($data as $val) { + $lists = self::{$this->tname}($val); + $baclist[] = array_intersect_key(self::striptags($lists),$this->title); + } + return $baclist; + } + + /* * ******************************************************************************* + * + * 导入导出公用函数 + * + * ****************************************************************************** */ + + + # 导入导出数组(保持和导入格式一样) + protected function csvtitle() { + global $_M, $_YW; + $this->title = self::{'tf_'.$this->tname}(); + $this->keys = array_keys($this->title); + return $this; + } + + //生成文件名 + public function csvname() { + global $_M, $_YW; + $date = date('Ymd', time()); + $filename = iconv("utf-8", "GBK", $this->bacname . $_M['lang'] . $date); + $this->csvname = $filename . '.csv'; + return $this; + } + + //对数组的值进行转码并返回(一维数组) + public function arrzbm($arr, $u, $g) { + global $_M, $_YW; + foreach ($arr as $k => $v) { + $newarr[$k] = iconv($u, $g, $v); + } + return $newarr; + } + + //删除html元素 + public function striptags($array = []) { + global $_M, $_YW; + $ret = []; + foreach ($array as $key => $str) { + $ret[$key] = strip_tags($str); + } + return $ret; + } + +} + +?> \ No newline at end of file diff --git a/admin/config.class.php b/admin/config.class.php new file mode 100644 index 0000000..cee073f --- /dev/null +++ b/admin/config.class.php @@ -0,0 +1,68 @@ +tname = $_M['form']['tname']; + } + + public function __destruct() { + global $_M,$_YW; + if($this->destruct){ + if(empty($this->appshow)) $this->appshow = 'app/'.$this->tname; + require $this->show($this->appshow,$this->input); + } + } + + //页初始化 + public function doindex(){ + global $_M,$_YW; + parent::point('config','doconfig','config'); + parent::appurl('index'); + parent::appnav(['config__doindex','基础配置']); + $this->input = $this->input + $_YW; + } + + //API配置信息保存 + public function doconfig(){ + global $_M,$_YW; + $form = $_M['form']; + $form['openid'] = arrayto_string($form['openids'],','); + + self::configsql($form); + $this->destruct = false; + turnover($_M['url']['own_form'] . 'a=do'.$this->tname, '操作成功'); + } + + //配置信息保存 + private function configsql($form = [],$lang = '') { + global $_M; + if(empty($lang)) $lang = $_M['lang']; + //程序运行必备 + $para_a = ['tem_ida','tem_idb','tem_idc','openid']; + $para_b = []; + $para = array_merge($para_a,$para_b); + $arrs = array_intersect_key($form, array_combine($para,$para)); //对比数组 + foreach ($arrs as $k => $v) { + $array[] = [$k,$_M['form']['n'],$v,$lang]; + } + $this->tsql->table('cloud_config',false) + ->qfield('name,m_name,value,lang') + ->unique('value=VALUES(value)') + ->adup($array); + + } + +} + +?> \ No newline at end of file diff --git a/admin/dzadsod.class.php b/admin/dzadsod.class.php new file mode 100644 index 0000000..280bb18 --- /dev/null +++ b/admin/dzadsod.class.php @@ -0,0 +1,38 @@ +destruct){ + if(empty($this->appshow)) $this->appshow = 'app/'.$this->tname; + require $this->show($this->appshow,$this->input); + } + } + + /** + * 综合设置 + */ + public function dodzadsod() { + global $_M; + //统计总数 + $this->input['num'] = $this->cloud->summary(); + //到期数据 + parent::point('table_off','doindex','table'); + parent::appurl('noticeday');//endcontract + $this->input['table'] = load::own_class('table_theme','new')->start($this->tname)->send_all(1); + $this->appshow = 'app/dzadsod'; + } + +} +?> \ No newline at end of file diff --git a/admin/index.class.php b/admin/index.class.php new file mode 100644 index 0000000..a8371fa --- /dev/null +++ b/admin/index.class.php @@ -0,0 +1,1555 @@ +time = time(); + $this->ac_appcore = new appcore(); + //应用入口 + $this->ac_get_url = $this->ac_appcore->get_app_url(); + } + + /** + * 检测入口 + */ + public function doindex() { + global $_M; + if(!file_exists(INS_LOCK_FILE) || $_M['form']['check']){ + //应用信息 + $this->input['app'] = $this->ac_appcore->met_app(); + $this->input['app']['icon'] = $_M['url']['app'].M_NAME.'/icon.png'; + $this->input['app']['appname'] = get_word($this->input['app']['appname']); + $this->input['app']['addtime'] = date('Y-m-d H:i:s',$this->input['app']['addtime']); + //整理检查项 + if(!file_exists(INS_LOCK_FILE) || file_exists(UPD_LOCK_FILE) ){ + define("CHECK_ITEM", "server|system|accredit|appfile|weqrcode|appcheck"); + }else{ + define("CHECK_ITEM", "server|system|accredit|appfile|weqrcode|update|appcheck"); + } + //页面检查项 + $this->input['ckitem'] = CHECK_ITEM; + require $this->show('app/index',$this->input); + }else{ + turnover($this->ac_get_url,'No prompt'); + } + } + + /* + + Ajax 各种数据校验 +  +------------------------------------------------------------------------------------------- +  + doappcheck : 用来进行应用的各项检测入口 +  +------------------------------------------------------------------------------------------- + */ + public function doappcheck() { + global $_M; + $this->ac_session = new session(); + $this->method = $_M['form']['type']; + //格式掉之前的旧数据 + if($this->method == 'server') self::del_cache(); + // 大于 PHP5.4 + self::{$this->method}(); + self::result(); + + echo $this->ac_appcore->resmsg(false); + } + + /* + + Ajax 下载更新应用文件 +  +------------------------------------------------------------------------------------------- +  + download : 应用文件的下载入口 +  +------------------------------------------------------------------------------------------- + */ + public function download() { + global $_M; + (new download($this->ac_appcore))->download($_M['form']['data']); + echo $this->ac_appcore->resmsg(false); + } + + /* + + Ajax modal body区域 +  +------------------------------------------------------------------------------------------- +  + domodal : 应用模态框数据处理入口 +  +------------------------------------------------------------------------------------------- + */ + public function domodal() { + global $_M; + $this->ac_session = new session(); + switch ($_M['form']['type']) { + case 'appfile': + $modal = self::appfile_modal(); + break; + case 'weqrcode': + $modal = self::weqrcode_modal(); + break; + case 'wechat': + $modal = self::wechat_modal(); + break; + case 'update': + $modal = self::update_modal(); + break; + default: + break; + } + echo $this->ac_appcore->jsoncallback($modal); + } + + /* + + Ajax +  +------------------------------------------------------------------------------------------- +  + doajax : 应用最终验证结果核对,以及应用程序使用过程中的应用校验数据延迟访问入口 +  +------------------------------------------------------------------------------------------- + */ + + public function doajax() { + global $_M; + /* + * 查询API访问时间 + * 若当天没有访问则访问API + * 若已访问则跳过执行下面 + * + */ + + //sign + $bool = false; + //wechat、update 值若为1 则是通过,0 为需要执行的,2为忽略的 + if($_M['form']['sign'] == 'appcheck'){ + $time = date('Y-m-d H:i:s',$this->time); + $ac_session = new session(); + $cache = [ + //记录时间 + 'time' => strtotime("{$time} +1 day"), + //授权结果 + 'check' => $ac_session->get('check'), + //公众号结果 + 'wechat' => (int) $ac_session->get('wechat'), + //是否有最新版本 + 'update' => (int) $ac_session->get('update') + ]; + + $listkey = $ac_session->get('ckitem'); + $ckitem = stringto_array(CHECK_ITEM,'|'); + // 后期根据情况再进行具体处理 + if(!in_array(0, $listkey)){ + $bool = true; + if(file_exists(INS_LOCK_FILE)){ + $msgtext = '进入应用'; + }else{ + $msgtext = ''; + } + } + $ac_session->del('ckitem'); + }else{ + //清除缓存 + $this->ac_session = new session(); + self::del_cache(); + //进行检测 + $ac_cache = $this->ac_appcore->mysql_config(array('ac_cache')); + //解密后的数组 + $cache = (new curls($this->ac_appcore))->postr($ac_cache,'',false)->resdata(); + $post = $this->ac_appcore->met_all(); + //判断是否超时 + if(empty($ac_cache) || $cache['time'] < strtotime("+1 hour") ){ + //API获取 + $this->method = 'check'; + $ajax = self::curljson($post,false,25); + $cache = $ajax['code']?$ajax['cache']:[]; + } + //查看本地是否存在禁止更新锁 + if(file_exists(UPD_LOCK_FILE)) $cache['update'] = 1; + //需要对比数据 + if(!empty($cache)){ + $check = (new curls($this->ac_appcore)) + ->apikey_decode([$cache['check'],$post['web']['met_weburl'],$post['app']['m_name'],$post['app']['addtime'] ]); + $state = $check['state'] && $check['app']['v_m_name'] == M_NAME?true:false; + if($state){ + if($check['vatime']['minute'] > 0){ + //对有效时间计算 + $time = date('Y-m-d H:i:s',$check['vatime']['stime']); + $endtime = strtotime("{$time} +{$check['vatime']['minute']} minute"); + if($endtime <= $this->time ) $state = false; + } + //最终结果判断 + $bool = $state && !empty($cache['wechat']) && !empty($cache['update'])?true:false; + } + } + //版本号 + if($bool){ + $vertype = ['Y','S','D']; + $msgtext = "版本号:{$vertype[$check['app']['v_vertype']]}.{$check['app']['v_ver']}"; + if($check['vatime']['minute'] > 0){ + //体验版本结束日期 + $endtime = date('Y-m-d H:i:s',$endtime); + $msgtext .= " ({$endtime})"; + } + } + } + + $ac_cache['exetime'] = $this->time; + //缓存记录 + $ac_cache = (new curls($this->ac_appcore))->apipost($cache)->resdata(true); + $this->ac_appcore->mysql_config(['ac_cache',$ac_cache],false); + //返回 + $bool?$this->ac_appcore->msgkey(1)->msgmeet($msgtext,true):$this->ac_appcore->locmsg(4012); + echo $this->ac_appcore->resmsg(false); + } + +// +---------------------------------------------------------------------- +// | 应用主方法 限制内部调用 +// +---------------------------------------------------------------------- + + /* + + 内部调用 +  +------------------------------------------------------------------------------------------- +  + server : 进行进行服务通信的验证,提供站点信息,站点应用信息给服务端, + + 从服务端获取当前应用版本的详细信息,以及系统环境的检测结果并缓存到session +  +------------------------------------------------------------------------------------------- +  + system : 直接获取缓存的session 直接将环境结果处理返回 +  +------------------------------------------------------------------------------------------- +  + accredit : 提供APP信息给服务端,从服务端获取验证结果 +  +------------------------------------------------------------------------------------------- +  + appfile : 根据APP版本信息,从服务端获取对应的对比指纹 + + 核心文件出现问题,会直接从服务端自动更新, + + 非核心文件会提供手动处理方法,必须修复 + + 暂时不提供非应用文件进行删除处理。 +  +------------------------------------------------------------------------------------------- +  + weqrcode : 根据站点信息和用户信息,从服务端查询是否符合微信公众号关注要求 +  +------------------------------------------------------------------------------------------- +  + update : 应用在线更新功能 +  +------------------------------------------------------------------------------------------- + */ + + # 服务端通信检测 + # 通过加密进行处理可防止数据丢失,防止某些敏感参数被过滤掉 + protected function server() { + global $_M; + //数据准备 + $server = self::curljson($this->ac_appcore->met_web_app()); + //进行结果处理 + if($server['code']){ + $this->ac_appcore->sucmsg($server['text']); + }else{ + $this->ac_appcore->errmsg($server['errcode'],$server['errmsg']); + } + + //缓存app版本以及环境检测结果 + $this->ac_session->set('applist',$server['applist']); + $this->ac_session->set('system',$server['system']); + } + + # 网站环境检测 + # 环境不存在中间值,要么支持,要么不支持 + protected function system() { + global $_M; + //读取缓存 + $system = $this->ac_session->get('system'); + //进行结果处理 + $metver = $system['metver']['code']; + $phpver = $system['phpver']['code']; + + $text = [ + [$phpver,$system['phpver']['text']], + [$metver,$system['metver']['text']] + ]; + $this->ac_appcore->vagmsg($metver && $phpver?1:0,$text); + //清空缓存 + $this->ac_session->del('system'); + } + + # 应用授权检测 + protected function accredit() { + global $_M; + //数据准备 + $post = $this->ac_appcore->met_web_app(); + $accredit = self::curljson($post,false,20); + //进行结果处理 + if($accredit['code']){ + //解密 + $apikey = (new curls($this->ac_appcore))->apikey_decode([$accredit['codekey'],$post['web']['met_weburl'],$post['app']['m_name'],$post['app']['addtime']]); + //校验 + if(!empty($apikey['state']) && $apikey['vatime']['minute'] > 0){ + //对有效时间计算 + $time = date('Y-m-d H:i:s',$apikey['vatime']['stime']); + $text = '体验结束时间:'.date('Y-m-d H:i:s',strtotime("{$time} +{$apikey['vatime']['minute']} minute")); + } + $apikey['state']?$this->ac_appcore->sucmsg($accredit['text'].$text):$this->ac_appcore->locmsg(4024); + }else{ + $this->ac_appcore->errmsg($accredit['errcode'],$accredit['errmsg']); + } + + //记录授权结果 + $this->ac_session->set('check',$accredit['codekey']); + } + + #文件指纹对比 + protected function appfile() { + global $_M; + //清空需要删的参数 + $this->ac_session->del('repair'); + //获取缓存 + $appfile = $this->ac_session->get('appfile'); + if(!$appfile){ + $appfile = self::curljson($this->ac_appcore->met_web_app()); + //进行结果处理 + if($appfile['code']) { + $this->ac_session->set('appfile',$appfile); + }else{ + return $this->ac_appcore->errmsg($appfile['errcode'],$appfile['errmsg']); + } + } + + //文件修复 + $dirfinger = new dirfinger(); + $corelist = $dirfinger->fingers($appfile['corelist']); + //先自动修复核心框架,再强制让用户修复有问题的文件。 + if(count($corelist['dllist']) > 0){ + //核心文件异常则启动自动修复,若修复失败再进行提示 + $this->ac_session->set('dllist',$corelist['dllist']); + $modal = $this->ac_appcore->msgkey()->msgtext(4004)->resmsg(); + $modal['suc'] = false; + $modal['data'] = 'core|check'; + return $this->ac_appcore->newres()->modalmsg($modal, 4001); + } + + $fingers = $dirfinger->fingers($appfile['fingers']); + //删除应用多余的文件 + //$dirfinger->del_appfile($appfile['fingers']); + //判断是否需要文件修复 + $inslock = (int) file_exists(INS_LOCK_FILE); //安装锁不存在说明新安装,不需要执行文件修复 + $dllock = count($fingers['dllist']) == 0?1:0; //需要修复的文件为0 说明不需要修复 + if(!$inslock || $dllock) { + //清理掉不再需要的缓存 + $this->ac_session->del('repair'); + $this->ac_session->del('appfile'); + //删除下载的缓存文件 + $this->ac_appcore->del_update_dir(); + return $this->ac_appcore->sucmsg()->msgtext(4003); + } + + //非强制更新和非安装状态 且$fingers 大于0时才执行文件修复 + if(count($fingers['dllist']) > 0){ + $this->ac_session->set('dllist',$fingers['dllist']); + $this->ac_session->set('repair',$fingers); + $modal = [ + 'suc' => true, + 'title' => '应用文件修复', + 'body' => '
', + 'url' => $_M['url']['own_form'].'a=domodal&type=appfile' + ]; + $text = '修复异常文件'; + return $this->ac_appcore->modalmsg($modal, [4002,$text]); + } + } + + # 微信公众号 + protected function weqrcode() { + global $_M; + //缓存 + $wechat = $this->ac_session->get('wechat'); + if($wechat !== '') sleep(1); + //验证 + $weqrcode = self::curljson($this->ac_appcore->met_all()); + if($weqrcode['code']){ + if($weqrcode['wx']['key'] == 1 ){ + $this->ac_appcore->sucmsg($weqrcode['text']); + }else{ + $modal = [ + 'suc' => true, + 'title' => '关注微信公众号', + 'body' => '
', + 'url' => $_M['url']['own_form'].'a=domodal&type=weqrcode', + ]; + $text = '关注公众号'; + $this->ac_appcore->modalmsg($modal) + ->sucmsg($weqrcode['wx']['ret']['info'].$text,$weqrcode['wx']['key']); + } + }else{ + $this->ac_appcore->errmsg($weqrcode['errcode'],$weqrcode['errmsg']); + } + $this->ac_session->set('wechat',$weqrcode['wx']['key']); + } + + # 在线更新检测 + protected function update() { + global $_M; + $this->ac_session->del('dllist'); + $this->ac_session->del('newapp'); + $applist = $this->ac_session->get('applist'); + //当前版本禁止检测升级 直接报已是最新 + //下个版本禁止升级,直接报已是最新 + // UPD_LOCK_FILE 存在直接报最新 + if(file_exists(UPD_LOCK_FILE) || empty($applist['v_ckupdate'])){ + // 1 为无须无法升级 + // 0、2 有升级 + $this->ac_session->set('update',1); + return $this->ac_appcore->sucmsg('已是最新版。'); + } + + //直接检测 + $update = self::curljson($this->ac_appcore->met_web_app()); + if($update['code']){ + //判断是否有指纹需要处理 + if($update['code'] == 8002){ + $this->ac_session->set('update',1); + return $this->ac_appcore->sucmsg($update['text']); + } + //升级文件处理 + $this->ac_session->set('newapp',$update['newapp']); + $modal = [ + 'suc' => true, + 'title' => $update['newapp']['v_ver'].' 更新内容', + 'body' => '
', + 'url' => $_M['url']['own_form'].'a=domodal&type=update' + ]; + $text = '在线更新'; + $upkey = $update['newapp']['v_update'] == 1?0:2; + $this->ac_appcore->modalmsg($modal) + ->sucmsg($update['text'].$text,$upkey); + }else{ + $upkey = 1; + $this->ac_appcore->errmsg($update['errcode'],$update['errmsg']); + if(empty($update['system'])){ + $phpver = arrayto_string($update['newapp']['v_phpver'],' -- '); + $metver = arrayto_string($update['newapp']['v_metver'],' -- '); + + $phpli = count($update['newapp']['v_phpver']) == 1?'最低':''; + $metli = count($update['newapp']['v_metver']) == 1?'最低':''; + $text = "
+
".$update['newapp']['v_ver']." 版本环境要求:
+
  1. 应用".$phpli."支持PHP ".$phpver." 版本;
  2. 应用".$metli."支持MetInfo ".$metver." 版本;
+
".$update['newapp']['v_ver']." 版本环境检测结果:
+
    ".$update['system']['text']."
+
"; + $this->ac_appcore->msgmeet($text); + } + } + //需要缓存的结果 + $this->ac_session->set('update',$upkey); + } + +// +---------------------------------------------------------------------- +// | 应用主方法 限制内部调用,主要处理模态框数据的交互 +// +---------------------------------------------------------------------- + + // 文件修复列表 + protected function appfile_modal() { + global $_M; + $download = new download($this->ac_appcore); + $download->download('filelist|check'); + $dllist = $download->app_get_file(); + if(count($dllist['dllist']) == 0){ + return '
用文件不存在异常。
'; + } + $resmsg = $this->ac_appcore->resmsg(); + if($resmsg > 0){ + $fingers = $this->ac_session->get('repair'); + foreach ($dllist['dllist'] as $key => $val) { + $text = ''; + if($fingers['updlist'][$val]) $text = '文件被修改'; + if($fingers['dowlist'][$val]) $text = '文件不存在'; + $html .=<< + {$text} + {$val} + 点击下载 +

+EOT; + } + $html = [ + 'body' => "
{$html}
", + 'foot' => '' + ]; + }else{ + $html = ['body' => $resmsg['text'] ]; + } + return $html; + } + + //微信公众号二维码 + protected function weqrcode_modal() { + global $_M; + $this->method = 'qrcode'; + $weqrcode = self::curljson($this->ac_appcore->met_all(),false,25,'wx'); + if($weqrcode['code']){ + $wehtml = [ + 'body' => '
', + 'foot' => $weqrcode['qrcode']['text']['info'], + 'callback' => 'wechat_qrcode' + ]; + }else{ + $wehtml = [ + 'body' => "

({$weqrcode['errcode']}){$weqrcode['errmsg']}

" + ]; + } + return $wehtml; + } + + //微信公众号轮询 + protected function wechat_modal() { + global $_M; + $sign = random(6); + sleep(1); + $this->method = 'check'; + $weqrcode = self::curljson($this->ac_appcore->met_all(),false,20,'wx'); + //结果返回 + if($weqrcode['code']){ + $this->ac_appcore->sucmsg($weqrcode['wx']['ret']['info'],$weqrcode['wx']['key']); + }else{ + $this->ac_appcore->errmsg($weqrcode['errcode'],$weqrcode['errmsg']); + } + + //计算2分钟超时 + if(empty($_M['form']['endtime'])){ + $time = date('Y-m-d H:i:s', $this->time); + $endtime = strtotime("{$time} +2 minute"); + }else{ + if($_M['form']['endtime'] < $this->time){ + $text = '刷新二维码'; + $this->ac_appcore->locmsg([4023,$text]); + }else{ + $endtime = $_M['form']['endtime']; + } + } + + $resmsg = $this->ac_appcore->resmsg(); + $resmsg['endtime'] = $endtime; + $resmsg['sign'] = $sign; + return $resmsg; + } + + //在线更新 + protected function update_modal() { + global $_M; + $newapp = $this->ac_session->get('newapp'); + return [ + 'body' => strlen($newapp['v_daily']) > 0?"

{$newapp['v_daily']}
":'

没有更新说明。

', + 'foot' => '' + ]; + } + +// +---------------------------------------------------------------------- +// | 辅助方法 +// +---------------------------------------------------------------------- + + # 需要格式化掉的数据防止二次使用时错误 + private function del_cache() { + global $_M; + $this->ac_session->del('applist'); + $this->ac_session->del('system'); + $this->ac_session->del('check'); + $this->ac_session->del('appfile'); + $this->ac_session->del('repair'); + $this->ac_session->del('dllist'); + $this->ac_session->del('wechat'); + $this->ac_session->del('update'); + $this->ac_session->del('ckitem'); + } + + # 记录各项检查结果 + private function result() { + global $_M; + $code = false; + $ckitem = $this->ac_session->get('ckitem'); + if($this->method != 'appcheck'){ + $key = $this->ac_appcore->resmsg(); + $ckitem[$this->method] = $key['key']; + $this->ac_session->set('ckitem',$ckitem); + } + } + + # 将返回信息转为JSON数据 + private function curljson($post = [],$type = false,$timeout = 15,$sign = 'ck' ) { + global $_M; + return (new curls($this->ac_appcore))->apiurl($this->method,$sign) + ->apipost($post) + ->curls($timeout) + ->resdata($type); + } + + # 应用内容呈现 + protected function show($file, $data){ + global $_M; + $view =load::sys_class('engine','new'); + require_once $view->dodisplay($file, $data); + } + +} + +// +---------------------------------------------------------------------- +// | class appcore 应用客户端核心处理方法 +// +---------------------------------------------------------------------- +// | Copyright: 1.0 +// +---------------------------------------------------------------------- +// | Author site: www.metinfo.wang,www.metinfo.cc +// +---------------------------------------------------------------------- +// | Author QQ: 415420792 +// +---------------------------------------------------------------------- +class appcore{ + + # 应用文件名 + private $m_name; + # 站点信息 + private $web = []; + # 应用信息 + private $app = []; + # 管理员权限 + private $aop = []; + # 错误信息的提示 + private $tipmsg = []; + # 返回的信息结果 + private $resmsg = []; + + # 初始化 + public function __construct() { + global $_M; + $this->m_name = M_NAME; + } + + # 获取应用入口 + public function get_app_url() { + global $_M; + $settings = file_exists(INS_LOCK_FILE)?json_decode(file_get_contents(INS_LOCK_FILE),true):[]; + if(empty($settings['url'])){ + unset($settings['url'],$settings['time']); + $get_url = $_M['url']['own_name'].http_build_query($settings); + }else{ + $get_url = $settings['url']; + } + return $get_url; + } + + # 站点信息和应用信息 + public function met_web_app() { + global $_M; + return [ + 'web' => self::met_web(), + 'app' => self::met_app() + ]; + } + + # 获取站点信息以及权限查询 + public function met_all() { + global $_M; + $met = self::met_web_app(); + $met['aop'] = self::met_aop(); + return $met; + } + + # 站点信息查询 + public function met_web() { + global $_M; + // 站点信息 + $name = ['met_weburl','met_webname','metcms_v','met_keywords','met_description','met_skin_user']; + foreach ($name as $val) { + $lang = $val == 'metcms_v'?'metinfo':$_M['lang']; + $met = DB::get_one("SELECT value FROM {$_M['table']['config']} WHERE name = '{$val}' AND lang = '{$lang}' "); + $this->web[$val] = $met['value']; + } + $this->web['webip'] = $_SERVER['SERVER_ADDR']; + $this->web['sysver'] = php_uname('s').' '.php_uname('r'); + $this->web['phpver'] = PHP_VERSION; + $this->web['sqlver'] = DB::version(); + $this->web['webver'] = str_replace("PHP/{$this->web['phpver']}","",$_SERVER['SERVER_SOFTWARE']); + $this->web['lang'] = $_M['lang']; + return $this->web; + } + + # 应用信息查询 + public function met_app() { + global $_M; + //应用信息 + if(!empty($this->m_name)) { + $this->app = DB::get_one("SELECT no,ver,addtime,m_name,appname FROM {$_M['table']['applist']} WHERE m_name='{$this->m_name}' "); + } + $this->app['client_ip'] = self::get_client_ip(); + return $this->app; + } + + # 下载权限处理需求 + public function met_adl() { + global $_M; + //应用信息 + if(!empty($this->m_name)) { + $this->adl = DB::get_one("SELECT no,ver,addtime,m_name FROM {$_M['table']['applist']} WHERE m_name='{$this->m_name}' "); + } + //域名 + $met = DB::get_one("SELECT value FROM {$_M['table']['config']} WHERE name = 'met_weburl' AND lang = '{$_M['lang']}' "); + $this->adl['met_weburl'] = $met['value']; + return $this->adl; + } + + # 公众号关注管理员权限 + public function met_aop() { + global $_M; + $admin = admin_information(); + //管理员权限 + $this->aop = [ + 'admin_id' => $admin['admin_id'], + 'admin_op' => $admin['admin_op'], + 'admin_ip' => $admin['admin_modify_ip'], + 'admin_time' => $admin['admin_modify_date'], + ]; + return $this->aop; + } + + # 对resmsg 初始化 + public function newres() { + global $_M; + $this->resmsg = []; + return $this; + } + + # 提示信息返回 + # $type true 为数组,false 为json + # $unset true 清空避免重复使用出现问题 false 暂时不清空 + public function resmsg($type = true,$unset = false) { + global $_M; + //检测值是否存在 + if(strlen($this->resmsg['key']) == 0) self::locmsg(4012); + //检测项的值 + $this->resmsg['eqkey'] = $_M['form']['eqkey']; + //返回值 + $resmsg = $type?$this->resmsg: self::jsoncallback($this->resmsg); + //注销 + if($unset) unset($this->resmsg); + return $resmsg; + } + + # 正确结果返回 + public function sucmsg($msg,$code = 1) { + global $_M; + $this->resmsg['key'] = $code; + $this->resmsg['text'] = self::fontcolor($code,$msg); + return $this; + } + + # 多种结果返回 + public function vagmsg($code,$msg = []) { + global $_M; + $text = ''; + foreach ($msg as $val) { + list($k,$v) = $val; + $text .= self::fontcolor($k,$k?$v['info']:"({$v['coding']}){$v['info']}"); + } + $this->resmsg['key'] = $code; + $this->resmsg['text'] = $text; + return $this; + } + + # 错误结果返回 + # $code 这个是错误的编码 + # $msg 错误的信息提示 + public function errmsg($coding,$msg,$code = 0) { + global $_M; + $this->resmsg['key'] = $code; + $this->resmsg['text'] = self::fontcolor(0,"({$coding}){$msg}"); + return $this; + } + + # 返回本地编码信息 + # $code 状态 + # $msg 错误的信息提示 + public function locmsg($msg = [],$code = 0) { + global $_M; + if(!empty($msg)) self::codemsg($msg); + $this->resmsg['key'] = $code; + $this->resmsg['text'] = self::fontcolor($code,"({$this->tipmsg['errcode']}){$this->tipmsg['errmsg']}"); + return $this; + } + + # 错误结果返回 + # $modal 模态框的内容 + # $code 校验结果状态 + # $error 错误信息提示 提示码以及需要增加的文字 + public function modalmsg($modal = [], $error = [],$code = 0) { + global $_M; + self::locmsg($error,$code); + $this->resmsg['modal'] = $modal; + return $this; + } + + # 替换key + public function msgkey($key = 4) { + global $_M; + $this->resmsg['key'] = $key; + return $this; + } + + # 使用本地错误代码替换返回信息内的text + public function msgtext($error = []) { + global $_M; + self::codemsg($error); + $this->resmsg['text'] = self::fontcolor($this->resmsg['key'],$this->tipmsg['errmsg']); + return $this; + } + + # text + # $type true 覆盖,false 为拼接 + public function msgmeet($text,$type = false) { + global $_M; + $this->resmsg['text'] = $type?$text:$this->resmsg['text'].$text; + return $this; + } + + # 对提示文字的HTML处理 + private function fontcolor($code,$text) { + global $_M; + // 红、绿、黄 + $color = ['#E9595B','#36AB7A','#EC9940','#76838f','#2a333c']; + return ''.$text.''; + } + + # 错误提示语返回字符串格式 + # $type true 字符串,false 为JSON + public function coderes($type = true) { + global $_M; + return $type?$this->tipmsg['errmsg']:json_encode($this->tipmsg,JSON_UNESCAPED_UNICODE); + } + + # 错误代码信息 + public function codemsg($coding,$text = '') { + global $_M; + if(is_array($coding)) list($coding,$text) = $coding; + $msg = [ + '4000' => "当前环境缺少CURL支持!", + '4001' => "核心文件存在异常,准备自动修复核心文件...", //修复文件 + '4002' => "应用文件存在异常请点击 {$text} !", //修复文件 + '4003' => "应用文件正常!", + '4004' => "文件权限检测中...", + '4005' => " {$text} 不存在,请手动创建!", + '4006' => " {$text} 权限不足,请修改为[777/775]增加写入权限!", + '4007' => " {$text} 数据写入错误,请自行检测权限!", + '4008' => "下载权限不足(请检查【网站网址】是否为购买应用的域名)!", + '4009' => "应用文件下载中...", + '4010' => "应用文件下载中...{$text} (正在进行下载,请不要操作页面!)", + '4011' => "服务端异常[{$text}],通信失败!", + '4012' => "系统异常!", + '4013' => "应用文件,开始修复...", + '4014' => "[核心文件自动修复] 修复完成。", + '4015' => "应用文件修复完成。", + '4016' => "[{$text}] 下载失败!", + '4017' => "修复失败!", + '4018' => "安装失败!", + '4019' => "安装成功!", + '4020' => "应用文件,开始安装...", + '4021' => "[{$text}] 写入失败!", + '4022' => "未检测到文件!", + '4023' => "微信公众号二维码扫描超时!{$text}", + '4024' => "域名未获得授权!", + '4025' => "安装锁权限不足!", + ]; + + $this->tipmsg = ['errcode' => $coding,'errmsg' => $msg[$coding]]; + return $this; + } + + # 密钥获取和保存 + # $mode true是读取 false是保存 + public function mysql_config($arr = [],$mode = true) { + global $_M; + list($key,$val) = $arr; + $table = $_M['table']['cloud_config']; + $lang = 'cloud'; + if($mode){ + $config = DB::get_one("select value from {$table} where name = '{$key}' AND m_name = '{$this->m_name}' AND lang = '{$lang}' "); + $val = $config['value']; + }else{ + DB::query("INSERT INTO {$table} (name,lang,m_name,value) VALUES ('{$key}','{$lang}','{$this->m_name}','{$val}') ON DUPLICATE KEY UPDATE value='{$val}' "); + } + return $val; + } + + // 获取客户端IP + public function get_client_ip(){ + $arr_ip_header = [ + // 非常见 + 'HTTP_CDN_SRC_IP', + 'HTTP_PROXY_CLIENT_IP', + 'HTTP_WL_PROXY_CLIENT_IP', + // 一般用下面三个 + 'HTTP_CLIENT_IP', + 'HTTP_X_FORWARDED_FOR', + 'REMOTE_ADDR' + ]; + $client_ip = 'unknown'; + foreach ($arr_ip_header as $key){ + if (!empty($_SERVER[$key]) && strtolower($_SERVER[$key]) != 'unknown' && filter_var($_SERVER[$key], FILTER_VALIDATE_IP)){ + $client_ip = $_SERVER[$key]; + break; + } + } + return $client_ip; + } + + /* + * 把数组转成JSON,用于ajax返回,可以用于普通json请求返回,也可以用于跨域的ajax的jsonp格式的数据请求返回。 + * @param array $back 输出字符串或数组 + * @param string $callback ajax的回调函数的名称 + */ + public function jsoncallback($back, $callback = 'callback') { + global $_M; + header('Content-type: application/x-javascript'); + $callback = $_M['form'][$callback]; + $json = json_encode($back,JSON_UNESCAPED_UNICODE); + echo $callback?$callback . '(' . $json . ')':$json; + } + + //删除更新文件夹 + public function del_update_dir() { + global $_M; + @clearstatcache(); + //检测文件是否存在,删除缓存的file + if(is_dir(APP_UPDATE_DIR) && file_exists(APP_UPDATE_DIR)) deldir(APP_UPDATE_DIR); + } + +} + +// +---------------------------------------------------------------------- +// | class curls 应用CURL +// +---------------------------------------------------------------------- +// | Copyright: 1.0 +// +---------------------------------------------------------------------- +// | Author site: www.metinfo.wang,www.metinfo.cc +// +---------------------------------------------------------------------- +// | Author QQ: 415420792 +// +---------------------------------------------------------------------- +class curls{ + + # 应用主方法 + private $appcore; + # 应用APIURL + private $urlarr = []; + # 应用API + private $apiurl = []; + # 网址协议 + private $scheme; + # 提交数据和返回数据的缓存 + private $data; + # 默认密钥 + private $apikey; + # 信息 + private $headers = []; + + # 初始化 + public function __construct($appcore) { + global $_M; + $this->appcore = $appcore; + // 选择执行URL,提交的数据,对数据的处理,提交服务端,数据的处理,返回结果 + $this->urlarr = [ + // 应用信息验证URL + 'ck' => 'https://app.muban.net.cn/api/appcheck.php?a=do', + // 应用下载更新URL + 'dl' => 'https://app.muban.net.cn/api/download.php?a=do', + //公众号 + 'wx' => 'https://app.muban.net.cn/api/wechat.php?a=do' + ]; + $this->apikey = md5($_M['config']['met_weburl']); + $this->headers = [ + 'METWEBURL:' . $_M['config']['met_weburl'], + 'AUTHORIZATION:' . $this->apikey + ]; + } + + # URL选择 + public function apiurl($method,$type = 'ck') { + global $_M; + $this->apiurl = $this->urlarr[$type].$method; + $this->scheme = self::purl($this->apiurl,'scheme'); + return $this; + } + + # 数据处理 + # $ende true加密 false 不执行加密 + public function apipost($post,$ende = true) { + global $_M; + $this->data = $post; + // 若要采用非默认密钥这里设置false,单独调用加密方法 + if($ende) self::auth_encode(); + return $this; + } + + # 对数据加密 + # $str 加密数据 $key 加密密钥 + public function auth_encode($key = null) { + global $_M; + if(!empty($key)) $this->apikey = $key; + if(is_array($this->data)) self::arrjson(false); + $this->data = authcode($this->data,'ENCODE', $this->apikey); + return $this; + } + + # 授权查询 授权代码结束 + public function curls($timeout = 15) { + global $_M; + if (get_extension_funcs('curl') && function_exists('curl_init') && function_exists('curl_setopt') && function_exists('curl_exec') && function_exists('curl_close')) { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $this->apiurl); + if($this->scheme === 'https') { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //不做服务器认证 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); //不做客户端认证 + } + curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_setopt($curl, CURLOPT_REFERER, $_SERVER["HTTP_HOST"]); + curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers); + curl_setopt($curl, CURLOPT_FAILONERROR, 1); //返回http >= 400的错误代码 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout); + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, ['dense' => $this->data]); + $data = curl_exec($curl); + $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); //http响应码 + $errno = curl_errno($curl); //错误码 + curl_close($curl); + $this->data = empty($errno)?$data:$this->appcore->codemsg(4011,"{$code}-{$errno}")->coderes(false); + }else{ + $this->data = $this->appcore->codemsg(4000)->coderes(false); + } + return $this; + } + + # 对数据解密 + # $str 加密数据 $key 加密密钥 + public function auth_decode($key = null) { + global $_M; + if(!empty($key)) $this->apikey = $key; + $this->data = authcode($this->data,'DECODE', $this->apikey); + return $this; + } + + # 数据格式转换 + # $type true 转为数组 false 转为json + public function arrjson($type = true) { + global $_M; + $this->data = $type?json_decode($this->data,true):json_encode($this->data,JSON_UNESCAPED_UNICODE); + return $this; + } + + # 返回的数据处理 + # $type true 返回源数据,false 返回数组 + public function resdata($type = false) { + global $_M; + if($type == false) self::arrjson(); + return $this->data; + } + + # 单独处理数据的加密和解密 + # $type true 加密,false 解密 + # $post 有数据则执行,无数据则直接返回postr + public function postr($post = null,$key = null,$type = true) { + global $_M; + self::apipost($post,false); + if($type){ + self::auth_encode($key); + }else{ + self::auth_decode($key); + } + return $this; + } + + # 授权密钥解密 + public function apikey_decode($appkey = []) { + global $_M; + list($apikey,$domian,$m_name,$addtime) = $appkey; + $domian = self::purl($domian); + return self::postr($apikey, md5($domian.md5($m_name.$addtime)),false)->resdata(); + } + + # 分析网址 + public function purl($url,$type = 'host') { + global $_M; + $url = url_standard($url); + $array = parse_url($url); + return $type == 'arr'?$array:$array[$type]; + } + +} + + +// +---------------------------------------------------------------------- +// | class session 应用检测会话缓存 +// +---------------------------------------------------------------------- +// | Copyright: 1.0 +// +---------------------------------------------------------------------- +// | Author site: www.metinfo.wang,www.metinfo.cc +// +---------------------------------------------------------------------- +// | Author QQ: 415420792 +// +---------------------------------------------------------------------- +class session{ + + # 应用文件名 + private $se_m_name = M_NAME; + + public function __construct() { + global $_M; + self::start(); + } + + public function start(){ + $ip = self::getip(); + session_id(md5($_SERVER['HTTP_USER_AGENT'].$this->se_m_name.$ip)); + session_start(); + } + + public function set($name, $value){ + self::start(); + $_SESSION[$name] = $value; + } + + public function get($name){ + self::start(); + return $_SESSION[$name]; + } + + public function del($name){ + self::start(); + unset($_SESSION[$name]); + } + + public function getip() { + $unknown = 'unknown'; + if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] && strcasecmp($_SERVER['HTTP_X_FORWARDED_FOR'], $unknown)){ + $pro = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); + $ip = $pro[0]; + }elseif(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], $unknown)) { + $ip = $_SERVER['REMOTE_ADDR']; + } + return $ip; + } + +} + +// +---------------------------------------------------------------------- +// | class dirfinger 应用检测指纹校对 +// +---------------------------------------------------------------------- +// | Copyright: 1.0 +// +---------------------------------------------------------------------- +// | Author site: www.metinfo.wang,www.metinfo.cc +// +---------------------------------------------------------------------- +// | Author QQ: 415420792 +// +---------------------------------------------------------------------- +class dirfinger { + + # 应用所在目录 + private $appfile; + # 需要跳过的文件,不分目录 + private $skipfile = []; + # 需要跳过的目录以及按照目录跳过文件 + private $skipdir = []; + # 跟服务端指纹不同的文件路径 + private $updlist = []; + # 需要从服务器下载的文件 + private $dllist = []; + + # 初始化 + public function __construct() { + global $_M; + $this->appfile = PATH_APP_FILE; + $this->skipfile = []; + $this->skipdir = [ + 'config/install.lock', + 'config/update.lock', + 'config/uninstall.lock', + 'config/table' + ]; + @clearstatcache(); + } + + # 对比指纹入口 + public function fingers($fingers = []) { + global $_M; + //指纹对比 + self::fingerprint_check($fingers); + //记录已经进行过指纹对比 + return [ + 'updlist' => $this->updlist, //需要更新的文件,跟服务端不同的文件 + 'dowlist' => $this->dowlist, //需要下载的文件,客户端不存在,而服务端存在的 + 'dllist' => $this->dllist //需要从服务器下载的文件,包含更新和下载 + ]; + } + + //删除应用文件以外的文件 + public function del_appfile($fingers = [], $dir = '') { + global $_M; + $files = scandir($this->appfile.$dir); + foreach ($files as $file) { + $dirfile = $dir.$file; + if(stristr(PHP_OS, "WIN")){ + $dirfiles = iconv("GBK","UTF-8", $dirfile); + $file = iconv("GBK","UTF-8", $file); + }else{ + $dirfiles = $dirfile; + } + if(in_array($dirfiles,$this->skipdir) || in_array($file,$this->skipfile)) continue; + if(is_dir($this->appfile.$dirfile)){ + self::del_appfile($fingers,$dirfile.'/'); + }else{ + //判断文件是否存在 + if(!array_key_exists($dirfiles,$fingers) ) delfile($dirfile); + } + } + } + + # 应用指纹校验 + private function fingerprint_check($flist = ''){ + global $_M; + foreach ($flist as $key => $val) { + //文件路径 + $dirfile = $this->appfile.$key; + if(stristr(PHP_OS, "WIN")) $dirfile = iconv("UTF-8","GBK", $dirfile); + //检查文件是否存在 + if(file_exists($dirfile)){ + //比对MD5 + if(md5_file($dirfile) != $val){ + $this->updlist[$key] = $val; + $this->dllist[$key] = $val; + } + }else{ + //需要下载的 + $this->dowlist[$key] = $val; + $this->dllist[$key] = $val; + } + } + } + +} + +// +---------------------------------------------------------------------- +// | class download 应用文件下载更新 +// +---------------------------------------------------------------------- +// | Copyright: 1.0 +// +---------------------------------------------------------------------- +// | Author site: www.metinfo.wang,www.metinfo.cc +// +---------------------------------------------------------------------- +// | Author QQ: 415420792 +// +---------------------------------------------------------------------- +class download{ + + #传送的数据 + private $modal; + #远端接口 + private $method; + # 应用主方法 + public $ac_appcore; + private $ac_session; + # 应用文件 + private $appfile; + # 应用下载缓存文件夹 + private $appupdir; + # 下载的文件存放目录,方便迁移 + private $appupfile; + # 应用下载缓存文件 + private $appdllist; + + # 下载需要的网站应用数据 + private $met_adl; + # 当前执行的状态 + private $cksign; + + # 初始化 + public function __construct($appcore) { + global $_M; + $this->appfile = PATH_APP_FILE; + $this->appupdir = APP_UPDATE_DIR; + $this->appupfile = APP_UPDATE_DIR.'/file/'; + $this->appdllist = APP_UPDATE_DIR.'/dllist.json'; + $this->ac_appcore = $appcore; + $this->ac_session = new session(); + $this->met_adl = $this->ac_appcore->met_adl(); + } + + # 下载更新入口 + public function download($data) { + global $_M; + //执行方法,进度 + list($cksign,$method,$step,$rate,$total) = explode('|', $data); + //正确时的回调值 + $this->cksign = $cksign; + $this->method = $method; + //回调传送的数据 + $this->modal = [ + 'suc' => false, + 'data' => ['cksign' => $this->cksign, 'method' => $this->method, 'step' => $step] + ]; + //若是更新则获取最新版本的版本号 + if($this->cksign == 'update') { + $this->met_adl['oldver'] = $this->met_adl['ver']; + $this->met_adl['ver'] = self::app_update_ver(); + } + switch ($method) { + case 'check': + self::app_file_check(); + break; + case 'dl': + self::app_file_dl($step); + break; + case 'core': + self::app_file_core(); + break; + case 'repair': + self::app_file_repair(); + break; + case 'dlfile': + $this->method = 'dl'; + //单个文件下载并更新,只要返回的结果 + self::app_file_dl($step); + self::app_file_repair(); + $resmsg = $this->ac_appcore->resmsg(); + if($resmsg['key'] == 4) $this->ac_appcore->msgkey(1); + break; + case 'update': + case 'install': + //全新安装 + self::app_file_install(); + break; + + default: + break; + } + } + + # 检测应用版本是否存在 + public function app_file_check() { + global $_M; + //检测文件是否存在,删除缓存的file + if(file_exists($this->appupdir)){ + deldir($this->appupdir,1); + modifydirpower($this->appupdir,0777); + }else{ + modifydirpower($this->appfile,0777); + makedir($this->appupdir); + } + + //在这里查看文件是否存在 + $dir = str_replace(PATH_WEB,'',$this->appupdir); + if(!file_exists($this->appupdir)) return $this->ac_appcore->locmsg([4005,$dir]); + + //验证文件是否可写 + if(!getdirpower($this->appupdir)) return $this->ac_appcore->locmsg([4006,$dir]); + + //检查授权 + $statekey = self::statekey(); + if(empty($statekey)) return $this->ac_appcore->locmsg(4008); + + //获取下载指纹列表 + if(in_array($this->cksign,['install','update'])){ + $check = self::curljson(['adl' => $this->met_adl]); + if($check['code']){ + $dllist = $check['dllist']; + }else{ + return $this->ac_appcore->errmsg($check['errcode'],$check['errmsg']); + } + }else{ + $dllist = $this->ac_session->get('dllist'); + $this->ac_session->del('dllist'); + } + + if(count($dllist) > 0){ + //写入指纹文件 + $phpcode = json_encode(['dllist' => array_keys($dllist),'fingers' => $dllist ],JSON_UNESCAPED_UNICODE); + if(file_put_contents($this->appdllist,$phpcode) === false){ + $file = str_replace(PATH_WEB,'',$this->appdllist); + return $this->ac_appcore->locmsg([4007,$file]); + } + //返回开始下载文件 + $this->ac_appcore->modalmsg(self::modal(0,'dl'))->msgkey()->msgtext(4009); + }else{ + $this->ac_appcore->locmsg(4022); + } + + } + + # APP文件下载 + public function app_file_dl($step) { + global $_M; + //获取缓存信息 + $filelist = self::app_get_file(); + if(count($filelist['dllist']) == $step){ + $this->ac_appcore->modalmsg(self::modal($step,$this->cksign)) + ->msgkey() + ->msgtext(in_array($this->cksign,['install','update'])?4020:4013); + }else{ + set_time_limit(60); + //数据整理 + $this->met_adl['dirfile'] = $filelist['dllist'][$step]; + $this->met_adl['filehash'] = $filelist['fingers'][$this->met_adl['dirfile']]; + $file = self::curljson(['adl' => $this->met_adl]); + //处理结果 + if($file['code']){ + $dirfile = $this->appupfile.$this->met_adl['dirfile']; + if (stristr(PHP_OS, "WIN")) $dirfile = iconv("UTF-8","GBK", $dirfile); + if (!file_exists($dirfile)) makefile($dirfile); + + //写入文件 + $defile = base64_decode($file['file']); + if(file_put_contents($dirfile, $defile) == false && strlen($defile) > 0){ + $this->ac_appcore->locmsg([4021,$this->met_adl['dirfile']]); + }else{ + //检查指纹 + if($this->met_adl['filehash'] != md5_file($dirfile)){ + $this->ac_appcore->locmsg([4016,$this->met_adl['dirfile']]); + }else{ + $step++; + $text = floor((($step)/count($filelist['dllist']))*100)."%"; + $this->ac_appcore->modalmsg(self::modal($step))->msgkey()->msgtext([4010,$text]); + } + } + } else { + $this->ac_appcore->errmsg($file['errcode'],$file['errmsg']); + } + + } + } + + # 自动更新处理 + public function app_file_core() { + global $_M; + //进行文件移动覆盖,成功则返回相关信息 + if(movedir($this->appupfile, $this->appfile)){ + @clearstatcache(); + unset($this->modal['data']); + $this->ac_appcore->modalmsg(self::modal()) + ->msgkey(1) + ->msgtext(4014); + }else{ + $this->ac_appcore->locmsg(4017); + } + + } + + # 手动文件更新 + public function app_file_repair() { + global $_M; + //进行文件复制,成功则返回相关信息 + if(copydir($this->appupfile, $this->appfile)){ + @clearstatcache(); + unset($this->modal['data']); + $this->ac_appcore->modalmsg(self::modal()) + ->msgkey(1) + ->msgtext(4015); + }else{ + $this->ac_appcore->locmsg(4017); + } + } + + # 文件全新安装 + public function app_file_install() { + global $_M; + $bool = false; + //文件移动 + if(file_exists($this->appupfile)){ + $bool = movedir($this->appupfile, $this->appfile); + @clearstatcache(); + } + if($bool){ + //对升级文件处理 + self::_require(); + //检查安装锁 + !file_exists(INS_LOCK_FILE)?$this->ac_appcore->locmsg(4025):$this->ac_appcore->msgkey(1)->msgtext(4019); + }else{ + $this->ac_appcore->locmsg(4018); + } + } + + # 读取本地文件 + public function app_get_file() { + global $_M; + return file_exists($this->appdllist)?json_decode(file_get_contents($this->appdllist),true):[]; + } + + # 读取本地文件 + public function app_update_ver() { + global $_M; + $newapp = $this->ac_session->get('newapp'); + return $newapp['v_ver']; + } + + # 获取下载权限 + private function statekey() { + global $_M; + $state = false; + //解密 + $apikey = $this->ac_session->get('check'); + $retkey = (new curls($this->ac_appcore))->apikey_decode([$apikey,$this->met_adl['met_weburl'],$this->met_adl['m_name'],$this->met_adl['addtime']]); + //校验 + if(!empty($retkey['state'])){ + $state = true; + if($retkey['vatime']['minute'] > 0){ + //对有效时间计算 + $time = date('Y-m-d H:i:s',$retkey['vatime']['stime']); + if(strtotime("{$time} +{$retkey['vatime']['minute']} minute") <= time()) $state = false; + } + } + return $state; + } + + # 模态框数据 modal + private function modal($step = '',$method) { + global $_M; + if(strlen($step) > 0) $this->modal['data']['step'] = $step; + if(strlen($method) > 0) $this->modal['data']['method'] = $method; + $modal = $this->modal; + if(count($this->modal['data']) > 0) $modal['data'] = arrayto_string($modal['data'],'|'); + return $modal; + } + + # CURL + private function curljson($post = [],$type = false,$timeout = 60,$sign = 'dl') { + global $_M; + return (new curls($this->ac_appcore))->apiurl($this->method,$sign) + ->apipost($post) + ->curls($timeout) + ->resdata($type); + } + + # 文件导入 + private function _require() { + global $_M; + $dir = $this->appupdir.'/update.class.php'; + $para = []; + if(file_exists($dir)){ + $update = load::own_class('update/update','new'); + $update->set($this->met_adl)->start(); + } + //检测文件是否存在,删除缓存的file + $this->ac_appcore->del_update_dir(); + } +} + + +?> \ No newline at end of file diff --git a/admin/info_off.class.php b/admin/info_off.class.php new file mode 100644 index 0000000..56c8769 --- /dev/null +++ b/admin/info_off.class.php @@ -0,0 +1,354 @@ +form = $_M['form']; + $this->tname = $_M['form']['tname']; + $this->timedate = date('Y-m-d H:i:s', time()); + } + + public function __destruct() + { + global $_M,$_YW; + if($this->destruct){ + turnover(empty($this->returl)?$_M['url']['own_name'] . 'c=table_on&a=do'.$this->tname:$this->returl, $this->tips); + } + } + + public function doindex() { + global $_M,$_YW; + switch ($this->tname) { + case 'village': + self::village(); + case 'elevator': + $e_bno = stringto_array($this->form['e_bno'],'#@met@#'); + $e_uno = stringto_array($this->form['e_uno'],'#@met@#'); + $e_eno = stringto_array($this->form['e_eno'],'#@met@#'); + $e_aps = stringto_array($this->form['e_aps'],'#@met@#'); + foreach ($e_bno as $bno) { + foreach ($e_uno as $uno) { + foreach ($e_eno as $eno) { + foreach ($e_aps as $aps) { + self::elevator($bno,$uno,$eno,$aps); + } + } + } + } + break; + + default: + self::{$this->tname}(); + break; + } + } + + //小区 + private function village() { + global $_M,$_YW; + + $field = [ + 'v_name' => $this->form['v_name'], + 'v_type' => $this->form['v_type'], + 'v_province' => $this->form['v_province'], + 'v_city' => $this->form['v_city'], + 'v_district' => $this->form['v_district'], + 'v_address' => $this->form['v_address'], + 'v_wid' => arrayto_string($this->form['v_wid'],','), + 'v_price' => $this->form['v_price'], + 'v_psize' => $this->form['v_psize'], + 'v_text' => $this->form['v_text'] + ]; + + if($this->form['id']){ + $field['v_updatetime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->where(['id'=>$this->form['id']]) + ->upd(); + $this->tips = '更新成功'; + }else{ + $field['v_addtime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->add(); + $this->tips = '新增成功'; + } + // 检测sql是否有错误 + $error = $this->tsql->error(); + if($error) $this->tips = '操作失败:'.$error; + } + + //企业 + private function customer() { + global $_M,$_YW; + + $field = [ + 'c_allname' => $this->form['c_allname'], + 'c_name' => $this->form['c_name'], + 'c_province' => $this->form['c_province'], + 'c_city' => $this->form['c_city'], + 'c_district' => $this->form['c_district'], + 'c_address' => $this->form['c_address'], + 'c_wid' => arrayto_string($this->form['c_wid'],','), + 'c_text' => $this->form['c_text'] + ]; + + if($this->form['id']){ + $field['c_updatetime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->where(['id'=>$this->form['id']]) + ->upd(); + $this->tips = '更新成功'; + }else{ + $field['c_addtime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->add(); + $this->tips = '新增成功'; + } + // 检测sql是否有错误 + $error = $this->tsql->error(); + if($error) $this->tips = '操作失败:'.$error; + } + + //企业联系人 + private function workers() { + global $_M,$_YW; + + $field = [ + 'w_jid' => $this->form['w_jid'], + 'w_name' => $this->form['w_name'], + 'w_tel' => $this->form['w_tel'], + 'w_text' => $this->form['w_text'] + ]; + + if($this->form['id']){ + $field['w_updatetime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->where(['id'=>$this->form['id']]) + ->upd(); + $this->tips = '更新成功'; + }else{ + $field['w_addtime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->add(); + $this->tips = '新增成功'; + } + // 检测sql是否有错误 + $error = $this->tsql->error(); + if($error) $this->tips = '操作失败:'.$error; + } + + //广告位 + private function elevator($e_bno,$e_uno,$e_eno,$e_aps) { + global $_M,$_YW; + $e_number = $this->form['e_number']; + if(!$this->form['id']) parent::e_number($e_number,$e_bno.$e_uno.$e_eno.$e_aps); + $field = [ + 'e_number' => $e_number, + 'e_vid' => $this->form['e_vid'], + 'e_bno' => $e_bno, + 'e_uno' => $e_uno, + 'e_eno' => $e_eno, + 'e_aps' => $e_aps, + 'e_size' => $this->form['e_size'], + 'e_enable' => $this->form['e_enable'], + 'e_label' => $this->form['e_label'], + 'e_text' => $this->form['e_text'] + ]; + + if($this->form['id']){ + $this->tsql->table($this->tname) + ->field($field) + ->where(['id'=>$this->form['id']]) + ->upd(); + $this->tips = '更新成功'; + }else{ + $this->tsql->table($this->tname) + ->field($field) + ->add(); + $this->tips = '新增成功'; + } + // 检测sql是否有错误 + $error = $this->tsql->error(); + + //判断为修改编号则需要清理掉旧的编号 + $olde_number = $this->form['olde_number']; + $enumber = $this->form['e_number']; + if(!$error && $this->form['id'] && $olde_number != $enumber ){ + $this->tsql->table('schedule')->where(['s_enumber' => $olde_number ])->del(); + //清理掉缓存排期表 met_dzadsod_ + // olde_number + //替换掉旧的投放表内的编号 met_dzadsod_ + // ['l_enumber' => '','l_selectenum'] + $launch = $this->tsql->table('launch')->where(" find_in_set( '{$olde_number}', l_enumber ) OR find_in_set( '{$olde_number}', l_selectenum ) ")->all(); + foreach ($launch as $val) { + $lenumber = arrayto_string(array_unique(stringto_array($val['l_enumber'],',')),','); + $l_enumber = preg_replace(["/^{$olde_number}$/","/^{$olde_number},/","/,{$olde_number},/","/,{$olde_number}$/"],[$enumber,"{$enumber},",",{$enumber},",",{$enumber}"],$lenumber); + $lselectenum = arrayto_string(array_unique(stringto_array($val['l_selectenum'],',')),','); + $l_selectenum = preg_replace(["/^{$olde_number}$/","/^{$olde_number},/","/,{$olde_number},/","/,{$olde_number}$/"],[$enumber,"{$enumber},",",{$enumber},",",{$enumber}"],$lselectenum); + //修改 + $this->tsql->table('launch')->field(['l_enumber' => $l_enumber, 'l_selectenum' => $l_selectenum ])->where(['id' => $val['id'] ])->upd(); + } + } + + if($error) $this->tips = '操作失败:'.$error; + } + + //合同录入 + private function contract() { + global $_M,$_YW; + //报错 + if(strtotime($this->form['h_starttime']) > strtotime($this->form['h_endtime'])){ + $this->destruct = false; + parent::scriptgo("投放结束时间({$this->form['h_starttime']})不能小于开始时间({$this->form['h_endtime']})!"); + } + + $field = [ + 'h_number' => $this->form['h_number'], + 'h_signtime' => $this->form['h_signtime'], + 'h_cid' => $this->form['h_cid'], + 'h_wid' => arrayto_string($this->form['h_wid'],','), + 'h_tprice' => $this->form['h_tprice'], + 'h_starttime' => $this->form['h_starttime'], + 'h_endtime' => $this->form['h_endtime'], + 'h_noticeday' => arrayto_string(array_unique(stringto_array($this->form['h_noticeday'],',')),','), //对数组进行去重处理 + 'h_text' => $this->form['h_text'] + ]; + + if($this->form['id']){ + $field['h_updatetime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->where(['id'=>$this->form['id']]) + ->upd(); + $this->tips = '更新成功'; + }else{ + $field['h_addtime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->add(); + $this->tips = '新增成功'; + } + // 检测sql是否有错误 + $error = $this->tsql->error(); + if($error) $this->tips = '操作失败:'.$error; + } + + //投放计划保存 + private function launch() { + global $_M,$_YW; + $this->destruct = false; + + // 每次保存都要计算时间是否合法 + if(strtotime($this->form['l_starttime']) > strtotime($this->form['l_endtime'])){ + echo parent::jsoncallback([ + 'slid' => $this->form['slid'], + 'code' => false, + 'text' => "投放结束时间({$this->form['l_starttime']})不能小于开始时间({$this->form['l_endtime']})!"]); + exit; + } + //不让他包含广告位选中字符 + //l_enable 状态字符也暂时不采用 + $field = [ + 'l_hnumber' => $this->form['l_hnumber'], + 'l_title' => $this->form['l_title'], + 'l_schedule' => $this->form['l_schedule'], + 'l_starttime' => $this->form['l_starttime'], + 'l_endtime' => $this->form['l_endtime'], + 'l_selectenum' => $this->form['l_selectenum'], + 'l_type' => $this->form['l_type'], + 'l_text' => $this->form['l_text'] + ]; + + if($this->form['slid']){ + $field['l_updatetime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->where(['id' => $this->form['slid']]) + ->upd(); +// $query = $this->tsql->query(); + $slid = $this->form['slid']; + }else{ + $field['l_addtime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->add(); + +// $query = $this->tsql->query(); + $slid = $this->tsql->id(); + } + //查看是否执行错误 + $error = $this->tsql->error(); + + //清理掉非选中的广告位排期,实际执行的是广告位选中后的删除操作,其他地方执行的只有新增和修改 + $schedule = $this->tsql->table('schedule') + ->where(['s_lid' => $slid]) + ->all(); + $enumber = stringto_array($this->form['l_selectenum'],','); + foreach ($schedule as $val) { + if(!in_array($val['s_enumber'], $enumber)){ + $this->tsql->table('schedule') + ->where(['id' => $val['id'] ]) + ->del(); + } + } + + //返回结果 + $array = $error || $slid == 0 + ?['slid' => $slid,'code' => false,'text' => "投放信息处理失败,广告位没有执行排期!错误提示({$error})",$this->form] + :['slid' => $slid,'code' => true,'text' => '投放信息处理成功。']; + echo parent::jsoncallback($array); + exit; + } + + private function keylist() { + global $_M,$_YW; + $field = [ + 'k_passkey' => md5($this->form['k_passkey']), + 'k_basekey' => base64_encode($this->form['k_passkey']), + 'k_wid' => $this->form['k_wid'], + 'k_state' => $this->form['k_state'], + 'k_text' => $this->form['k_text'] + ]; + + if($this->form['id']){ + $field['k_updatetime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->where(['id'=>$this->form['id']]) + ->upd(); + $this->tips = '更新成功'; + }else{ + $field['k_addtime'] = $this->timedate; + $this->tsql->table($this->tname) + ->field($field) + ->add(); + $this->tips = '新增成功'; + } + // 检测sql是否有错误 + $error = $this->tsql->error(); + if($error) $this->tips = '操作失败:'.$error; + } + +} +?> \ No newline at end of file diff --git a/admin/info_on.class.php b/admin/info_on.class.php new file mode 100644 index 0000000..ea91918 --- /dev/null +++ b/admin/info_on.class.php @@ -0,0 +1,259 @@ +destruct){ + if(empty($this->appshow)) $this->appshow = 'app/'.$this->tname; + require $this->show($this->appshow,$this->input); + } + } + + //小区 + public function dovillage() + { + global $_M,$_YW; + parent::appnav(['table_on__dovillage','小区资料']); + parent::appurl(parent::tname(),['id'=>$_M['form']['id']]); + if($_M['form']['id']){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$_M['form']['id']]) + ->one(); + }else{ + //默认值 + $this->input['data']['v_province'] = '山东省'; + $this->input['data']['v_city'] = '泰安市'; + $this->input['data']['v_district'] = '泰山区'; + } + //小区分类 + $para = $this->tsql->table('para')->where(['p_type' => 6])->all(); + parent::para_radio($para,'v_type',$this->input['data']['v_type'],$this->input['para']['v_type_radio']) + ->setparahtml(6,$this->input['para']['v_type_radio']); + + //城市json + $this->input['url']['city'] = $this->cloud->city_url(); + } + + //企业 + public function docustomer() + { + global $_M,$_YW; + parent::appnav(['table_on__docustomer','企业资料']); + parent::appurl(parent::tname(),['id'=>$_M['form']['id']]); + if($_M['form']['id']){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$_M['form']['id']]) + ->one(); + }else{ + //默认值 + $this->input['data']['c_province'] = '山东省'; + $this->input['data']['c_city'] = '泰安市'; + $this->input['data']['c_district'] = '泰山区'; + } + + //城市json + $this->input['url']['city'] = $this->cloud->city_url(); + } + + //企业 + public function doworkers() + { + global $_M,$_YW; + parent::appnav(['table_on__doworkers','企业资料']); + parent::appurl(parent::tname(),['id'=>$_M['form']['id']]); + if($_M['form']['id']){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$_M['form']['id']]) + ->one(); + } + + //职务选择 + $para = $this->tsql->table('para')->where(['p_type' => 1])->all(); + parent::para_radio($para,'w_jid',$this->input['data']['w_jid'],$this->input['para']['radio']) + ->setparahtml(1,$this->input['para']['radio']); + } + + //广告位 + public function doelevator() + { + global $_M,$_YW; + parent::appnav(['table_on__doelevator','广告位']); + parent::appurl(parent::tname(),['id'=>$_M['form']['id']]); + if($_M['form']['id']){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$_M['form']['id']]) + ->one(); + $this->input['data']['e_number_readonly'] = 'readonly'; + + // 二次编辑时采用单选 + //楼号 + $para = $this->tsql->table('para')->where(['p_type' => 3])->all(); + parent::para_radio($para,'e_bno',$this->input['data']['e_bno'],$this->input['para']['e_bno_radio']) + ->setparahtml(3,$this->input['para']['e_bno_radio']); + //单元号 + $para = $this->tsql->table('para')->where(['p_type' => 4])->all(); + parent::para_radio($para,'e_uno',$this->input['data']['e_uno'],$this->input['para']['e_uno_radio']) + ->setparahtml(4,$this->input['para']['e_uno_radio']); + //电梯号 + $para = $this->tsql->table('para')->where(['p_type' => 5])->all(); + parent::para_radio($para,'e_eno',$this->input['data']['e_eno'],$this->input['para']['e_eno_radio']) + ->setparahtml(5,$this->input['para']['e_eno_radio']); + //广告位置 + $para = $this->tsql->table('para')->where(['p_type' => 0])->all(); + parent::para_radio($para,'e_aps',$this->input['data']['e_aps'],$this->input['para']['e_aps_radio']) + ->setparahtml(0,$this->input['para']['e_aps_radio']); + + }else{ + //默认值 + $this->input['data']['e_vid'] = $_M['form']['e_vid']; + $this->input['data']['e_enable'] = 1; + + // 新增编辑时采用多选 + //楼号 + $para = $this->tsql->table('para')->where(['p_type' => 3])->all(); + parent::para_checkbox($para,'e_bno',$this->input['data']['e_bno'],$this->input['para']['e_bno_radio']) + ->setparahtml(3,$this->input['para']['e_bno_radio']); + //单元号 + $para = $this->tsql->table('para')->where(['p_type' => 4])->all(); + parent::para_checkbox($para,'e_uno',$this->input['data']['e_uno'],$this->input['para']['e_uno_radio']) + ->setparahtml(4,$this->input['para']['e_uno_radio']); + //电梯号 + $para = $this->tsql->table('para')->where(['p_type' => 5])->all(); + parent::para_checkbox($para,'e_eno',$this->input['data']['e_eno'],$this->input['para']['e_eno_radio']) + ->setparahtml(5,$this->input['para']['e_eno_radio']); + //广告位置 + $para = $this->tsql->table('para')->where(['p_type' => 0])->all(); + parent::para_checkbox($para,'e_aps',$this->input['data']['e_aps'],$this->input['para']['e_aps_radio']) + ->setparahtml(0,$this->input['para']['e_aps_radio']); + } + + //小区名称URL + $this->input['remote_url'] = $_M['url']['own_name'].'c=ajax&a=doenumber&id='.$_M['form']['id']; + + } + + //录入合同 + public function docontract() + { + global $_M,$_YW; + parent::appnav(['table_on__docontract','合同详情']); + parent::appurl(parent::tname(),['id'=>$_M['form']['id']]); + if($_M['form']['id']){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$_M['form']['id']]) + ->one(); + $this->input['data']['h_number_readonly'] = 'readonly'; + }else{ + //默认值 + $this->input['data']['e_vid'] = $_M['form']['e_vid']; + $this->input['data']['h_noticeday'] = 7; + } + + $this->input['remote_url'] = $_M['url']['own_name'].'c=ajax&a=dohnumber&id='.$_M['form']['id']; + } + + //广告投放 + public function dolaunch() + { + global $_M,$_YW; + $slid = $_M['form']['slid']; + parent::appnav(['table_on__dolaunch','广告投放']); + parent::appurl(parent::tname(),['slid'=>$slid]); + + if($slid){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$slid]) + ->one(); + $contract = $this->tsql->table('contract') + ->where(['h_number' => $this->input['data']['l_hnumber']]) + ->one(); + }else{ + //获取合同的值 + $contract = $this->tsql->table('contract') + ->where(['id' => $_M['form']['cid']]) + ->one(); + //默认值 + $this->input['data']['l_hnumber'] = $contract['h_number']; + $this->input['data']['l_starttime'] = $contract['h_starttime']; + $this->input['data']['l_endtime'] = $contract['h_endtime']; + } + + //合同订单的时间 + $this->input['data']['h_starttime'] = $contract['h_starttime']; + $this->input['data']['h_endtime'] = $contract['h_endtime']; + //获取公司名称 + $this->input['data']['h_cid'] = parent::customerlist($contract['h_cid']); + + //合同状态 + $para = parent::paralist(2); + parent::para_radio($para,'l_schedule',$this->input['data']['l_schedule'],$this->input['para']['l_schedule_radio']) + ->setparahtml(2,$this->input['para']['l_schedule_radio']); + + //广告分类 + $para = parent::paralist(7); + parent::para_radio($para,'l_type',$this->input['data']['l_type'],$this->input['para']['l_type_radio']) + ->setparahtml(7,$this->input['para']['l_type_radio']); + + //表格数据 + // ap_plan + $this->input['table'] = load::own_class('table_theme','new')->start('applan')->send_all(); + $this->input['table']['ajaxurl'] = $_M['url']['own_name']."c=table_ajax&a=doindex&tname=applan&slid=".$slid; + + } + + //新增巡查人员 + public function dokeylist() + { + global $_M,$_YW; + parent::appnav(['table_on__dokeylist','巡查人员']); + parent::appurl(parent::tname(),['id'=>$_M['form']['id']]); + if($_M['form']['id']){ + $this->input['data'] = $this->tsql->table($this->tname) + ->where(['id'=>$_M['form']['id']]) + ->one(); + + $this->input['data']['k_passkey'] = base64_decode($this->input['data']['k_basekey']); + }else{ + $this->input['data']['k_state'] = 1; + } + } + + // 调整广告位投放计划 + public function douplaunch() + { + global $_M,$_YW; + parent::appnav(['info_on__douplaunch','调整投放计划']); +// parent::appnav(['info_on__doelevators','调整投放计划']); + parent::appurl(parent::tname(),['e_number'=>$_M['form']['e_number']]); + // 先获取广告位编号,获取对应的位置信息 + // 再获取 前 中 后排期 + // 过期的只要最后一期,当前排期的,按照当天计算,然后罗列出预排的排期 + // 选择目标排期计划 + + // 先查询是否满足对应条件 + // 满足入库前先删除原有计划,再新增到目标计划(要清除排期缓存表,以及投放计划表,防止冲突) + // 不满足条件,则返回对应提示,是否要强制修改,若是强制修改,可给予修改建议,供管理选择 + + // 广告位编号,采用下拉选择 + // 订单,采用下拉选择 + // 投放计划采用下拉选择 + } + +} +?> \ No newline at end of file diff --git a/admin/install.class.php b/admin/install.class.php new file mode 100644 index 0000000..fb9ad07 --- /dev/null +++ b/admin/install.class.php @@ -0,0 +1,106 @@ +appno = mt_rand(2001,9999); //应用编号 + } while (self::sqlone('applist') != false); + + $this->appver = '1.0'; //应用版本号 + $this->m_name = 'dzadsod'; + $this->m_class = 'index'; + $this->m_action = 'doindex'; + $this->appname = '道闸广告位管理'; //应用名称 + $this->info = '场所门口道闸广告位运营管理'; //应用描述 + $this->depend = ''; //应用依赖 + $this->target = 1; //是否支新窗口打开 + $this->display = 1; //是否显示应用图标 + $this->mlangok = 1; //是否支持多语言 + } + + //安装主方法 + public function dosql() { + global $_M; + $stall = self::sqlone('applist'," m_name='{$this->m_name}' "); + if(!$stall){ + //系统表 + self::appsql(); + }else{ + + } + return 'complete'; + } + + //执行APP相关的表数据插入 + private function appsql() { + global $_M; + $time = time(); + //注册应用 + $field = " + `no`='{$this->appno}', + `ver` = {$this->appver}, + `m_name` = '{$this->m_name}', + `m_class`='{$this->m_class}', + `m_action`='{$this->m_action}', + `appname`='{$this->appname}', + `info`='{$this->info}', + `addtime`='{$time}', + `updatetime`='{$time}', + `target`='{$this->target}', + `display`='{$this->display}', + `depend`='{$this->depend}', + `mlangok`='{$this->mlangok}' "; + self::addsql('applist',$field); + + /** + * 1、增加新表 + * name 配置名称 + * id 添加信息自动增加, + * value 配置名称值 + * lang 语言[后台] + **/ + $field = " `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(150) NOT NULL, + `m_name` varchar(100) NOT NULL, + `value` text, + `lang` varchar(50) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_lang` (`name`,`m_name`,`lang`)"; + DB::query("CREATE TABLE `".$_M['config']['tablepre']."cloud_config` ( {$field} ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8"); + add_table('cloud_config'); + } + + //公共查询方法 + private function sqlone($tname,$where = '') { + global $_M; + $table = $_M['table'][$tname]; + if(!$where){ + $where = "no='{$this->appno}'"; + } + return DB::get_one("select * from {$table} where {$where}"); + } + + //公共写入方法 + private function addsql($tname,$field = '') { + global $_M; + $table = $_M['table'][$tname]; + DB::query("INSERT INTO {$table} SET {$field}"); + } + +} +?> \ No newline at end of file diff --git a/admin/select.class.php b/admin/select.class.php new file mode 100644 index 0000000..09bf359 --- /dev/null +++ b/admin/select.class.php @@ -0,0 +1,289 @@ +tname = $_M['form']['tname']; + //搜索内容 + $this->querys = $_M['form']['querys']; + //以指定字段为值 + $this->fiend = $_M['form']['fiend']?:'id'; + //来源 + $this->source = $_M['form']['source']; + //是否显示全部 + $this->allnone = $_M['form']['allnone']; + //判断条件 + $this->condition = $_M['form']['condition']; + //默认值 + $this->default = $_M['form']['default']; + //默认值分隔符 + $this->division = $_M['form']['division']; + } + + # select2 选项字段处理 + private function select_fiend($val) { + global $_M,$_YW; + $strarr = stringto_array($this->fiend,'|'); + foreach ($strarr as $value) { + $arrstr[] = $val[$value]; + } + return arrayto_string($arrstr,'|'); + } + + # allnone 默认选项全部处理 + private function allnone() { + global $_M,$_YW; + // 若不需要显示‘全部’值,则直接返回空 + // 0 为不显示‘全部’,同时也在未搜索到结果的情况下 不 设置为可选值 + // 1 为显示 显示‘全部’,同时也在未搜索结果的情况下 设置可选值 + // 2 只显示‘全部’ + // 3 只将未搜索到结果的情况下设置为可选值 + if(empty($this->allnone) || $this->allnone == '3') return false; + //然后可根据来源标记进行处理 + switch ($this->source) { +// case 'githooks': +// $initial[] = ['id' => 'newver','text'=>'自动部署至最新版本']; +// break; + default: + $initial[] = [ 'id' => '','text' => '全部' ]; + break; + } + $this->data[] = ["text" => '',"children" => $initial ]; + } + + # 当未搜索到值是否将搜索结果设置为可选值 + private function children() { + global $_M,$_YW; + // 判断是否要将搜索内容设置为可选值 + if(empty($this->allnone) || $this->allnone == '2' || strlen($this->querys) == 0) return false; + // 要注意id的是否为可写入数据库 误区,若有些字段为数字 则会导致无法录入成功 + // 后期可增加一个判断方式来处理这个误区 + $this->data[] = [ + "text" => '', + "children" => [ + ['id'=> $this->querys,'text' => $this->querys] + ] + ]; + } + + # querys 处理 + private function querys() { + global $_M,$_YW; + if(strlen($this->querys) == 0) return false; + switch ($this->tname) { + case 'village': + $this->where = " v_name LIKE '%{$this->querys}%' "; + break; + case 'customer': + $this->where = " c_allname LIKE '%{$this->querys}%' "; + break; + case 'workers': + $this->where = " w_name LIKE '%{$this->querys}%' OR w_tel LIKE '%{$this->querys}%' "; + break; + case 'contract': + $this->where = " h_number LIKE '%{$this->querys}%' "; + break; + case 'launch': + $this->where = " l_title LIKE '%{$this->querys}%' "; + break; + case 'weuser': + $nickname = urlencode($this->querys); + $this->where = " nickname LIKE '%{$nickname}%' "; + break; + case 'para': + $this->where = " p_name LIKE '%{$this->querys}%' OR p_value LIKE '%{$this->querys}%' "; + break; + default: + break; + } + } + + # condition 处理 + private function condition() { + global $_M,$_YW; + if(empty($this->condition)) return false; + // 进行处理 + $condition = stringto_array($this->condition,'|||','$$$'); + foreach ($condition as $value) { + list($key,$val) = $value; + $valstr[] = " {$key} = '{$val}' "; + } + $valstr = arrayto_string($valstr,' AND '); + if(strlen($valstr) > 0){ + if(!empty($this->where)) $this->where = " ({$this->where}) AND "; + $this->where .= $valstr; + } + } + + # 选项值的组成样式 + private function valuet($val) { + global $_M,$_YW; + switch ($this->tname) { + case 'village': + $fiend = [$val['v_name'],$val['v_province'].$val['v_city'].$val['v_district'].$val['v_address']]; + break; + case 'customer': + $fiend = [$val['c_name'],$val['c_allname'],$val['c_province'].$val['c_city'].$val['c_district'].$val['c_address']]; + break; + case 'workers': + $fiend = [$val['w_name'],$val['w_tel']]; + break; + case 'contract': + $fiend = [$val['h_number']]; + break; + case 'launch': + $fiend = [$val['l_title'],$val['l_hnumber']]; + break; + case 'weuser': + $sex = ['未知','男','女']; + $fiend = [$val['nickname'],$sex[$val['sex']] ]; + break; + case 'para': + $fiend = [$val['p_name']]; +// $fiend = [$val['p_value']]; + break; + default: + break; + } + + $text = arrayto_string($fiend,' / '); + return $text; + } + + //编号字段,根据此字段进行编号处理 + private function charter() { + global $_M,$_YW; + switch ($this->tname) { + case 'village': + $fiend = 'v_name'; + break; + case 'customer': + $fiend = 'c_name'; + break; + case 'workers': + $fiend = 'w_name'; + break; + case 'contract': + $fiend = 'h_number'; + break; + case 'launch': + $fiend = 'l_title'; + break; + case 'weuser': + $fiend = 'nickname'; + break; + case 'para': + $fiend = 'p_name'; + break; + + default: + break; + } + return $fiend; + } + + + // 查看小区名称列表 + public function doselect() { + global $_M,$_YW; + //判断条件 + self::querys(); + //带入的判断条件 + self::condition(); + //编号的字段 + $fiend = self::charter(); + + //查询 + $array = $this->tsql->table($this->tname)->where($this->where)->order('id DESC')->all('id'); +// $sqltsr = $this->tsql->query(); + foreach ($array as $val) { + if($this->tname == 'weuser'){ + $val['nickname'] = urldecode($val['nickname']); + } + $letter = getstrcharter($val[$fiend]); + $selectlist[$letter][] = $val; + } + + //是否显示全部 + self::allnone(); + //是否将搜索内容作为结果 + self::children(); + + //处理结果 + foreach ($selectlist as $key => $val){ + $arr = []; + foreach ($val as $v) { + $valid = self::select_fiend($v); + //判断是否只输出默认值 + if(strlen($this->default) > 0){ + $default = stringto_array($this->default, $this->division); + if(!in_array($valid, $default,true)) continue; + } + //组成选项 + $arr[] = ['id' => $valid, 'text' => self::valuet($v)]; + } + $this->data[] = ["text" => $key,"children" => $arr]; + } + + //当值不存在时 + if(!count($this->data)){ + //输出没有搜索到结果 + $this->data = [["text" => $this->querys == ''?'检索不到相关信息':"检索不到 {$this->querys} 相关信息","children" => [] ]]; + }else{ + //对数组排序A-ZZ + $text = array_column($this->data, 'text'); + array_multisort($text,SORT_ASC,$this->data); + } + + echo jsoncallback(['results' => $this->data]); + } + + +} + +?> \ No newline at end of file diff --git a/admin/table_ajax.class.php b/admin/table_ajax.class.php new file mode 100644 index 0000000..d7c000e --- /dev/null +++ b/admin/table_ajax.class.php @@ -0,0 +1,126 @@ +form = $_M['form']; + if($this->form['tname']){ + $this->tname = $this->form['tname']; + $this->sqlk = $_YW['k'][$this->tname]; + } + $this->own_name_info = $_M['url']['own_name'].'c=info_on&a=do'; + $this->own_name_table = $_M['url']['own_name'].'c=table_on&a=do'; + } + + //表格数据 + public function doindex() { + global $_M; + //加载表格数据获取类 + $table = load::own_class('tabledata', 'new'); + + $field = self::td_field(); + $sqlk = self::td_sqlk(); + $where = self::td_where(); + $order = self::td_order(); + /*查询表*/ + if($where){ + $conds .= " WHERE {$where} "; + } + if($order){ + $conds .= " ORDER BY {$order} "; + } + //整理查询条件 + $query = "SELECT {$field} FROM {$sqlk} {$conds} "; + + //获取数据 + $data = $table->getdata($sqlk, $field, $where, $order,$query,$this->multi_table); + //数据整理 + $array = self::sqlarr($data); + //返回数据 + $table->rdata($array); + } + + use tdata; + + /* + * 【列出】 + * 返回数据数组 + */ + private function sqlarr($data = []) { + global $_M; +// if(in_array($this->tname,$this->k_name)){ + foreach ($data as $val) { + self::output($val); + $array[] = $this->list; + } + return $array; +// }else{ +// return false; +// } + } + + /* + * 【新行】 + * 新增行分发 + */ + public function do_table_add_list(){ + global $_M; + $val = ['id' => 'new-'.$this->form['new_id'], 'p_type' => $this->form['p_type']]; + if(in_array($this->tname,$this->k_name)){ + self::output($val,'checked=""'); + } + self::addlist($val); + } + + /* + * 【新行】 + * 生成文件新增行 + */ + private function addlist($val) { + global $_M; + $metinfo = ''; + foreach ($this->list as $v){ + $metinfo .= ''.$v.''; + } + echo "{$metinfo}"; + } + + use tfield; + use tlist; + + //公用的输出 + protected function output($val,$checked = '') { + global $_M,$_YW; + $array = self::{$this->tname}($val,$checked); + $this->list = array(); + foreach ($array as $value) { + $this->list[] = $value; + } + } + +} + +?> \ No newline at end of file diff --git a/admin/table_off.class.php b/admin/table_off.class.php new file mode 100644 index 0000000..145ab73 --- /dev/null +++ b/admin/table_off.class.php @@ -0,0 +1,286 @@ +tname = $_M['form']['tname']; + $this->sqlk = $_YW['k'][$this->tname]; + } + + public function __destruct() + { + global $_M,$_YW; + if($this->destruct){ + switch ($this->tname) { + case 'para': + $this->para = [ + 'p_type' => $_M['form']['p_type'] + ]; + break; + + default: + break; + } + if(count($this->para)) $para = '&'.http_build_query($this->para); + turnover($this->returl?:$_M['url']['own_name'] . 'c=table_on&a=do'.$this->tname.$para, $this->tips); + } + } + + //主方法 + public function doindex(){ + global $_M,$_YW; + $this->allid = array_filter(explode(',', $_M['form']['all_id'])); + switch ($_M['form']['submit_type']) { + case 'delet': + self::delet(); + break; + case 'save': + self::save(); + break; + case 'enableon': + case 'enableoff': + self::enable(); + break; + case 'enable_on': + case 'enable_off': + self::enable(false); + break; + case 'typeonoff': + self::typeonoff(); + break; + default: + break; + } + + if($_M['form']['method'] == 'ajax') { + $this->destruct = false; + echo jsoncallback(['code' => $this->tsql->error()?1:0 ]); + } + } + + //保存 + private function save() { + global $_M,$_YW; + foreach ($this->allid as $id) { + if($id){ + $field = self::info($id); + if(is_number($id)){ + $this->tsql->table($this->tname) + ->field($field) + ->where(" id = '{$id}' ") + ->upd(); + } else { + $this->tsql->table($this->tname) + ->field($field) + ->add(); + } + } + } + } + + //删除 + private function delet() { + global $_M,$_YW; + foreach ($this->allid as $id) { + if($id){ + //删除关联表 + $ret = self::todel($id); + if($ret == false) continue; + //删除本表 + $where = " id = '{$id}' "; + $this->tsql->table($this->tname) + ->where($where) + ->del(); + + } + } + } + + //调整广告位状态 + private function enable($type = true) { + global $_M,$_YW; + $enable = $_M['form']['submit_type'] == 'enableon' || $_M['form']['submit_type'] == 'enable_on'?1:0; + $fid = $type?'e_vid':'id'; + foreach ($this->allid as $id) { + if($id){ + $this->tsql->table('elevator') + ->field(['e_enable' => $enable]) + ->where([$fid => $id]) + ->upd(); + } + } + } + + //ajax单独调整 + private function typeonoff() { + global $_M,$_YW; + $field = $_M['form']['field']; + $special = "ABS({$field}-1)"; + + $array = [$field => $special]; + $field_id = 'id'; + foreach ($this->allid as $id) { + if($id){ + $this->tsql->table($this->tname) + ->special($special) + ->field($array) + ->where([$field_id => $id]) + ->upd(); + } + } + } + + //保存信息 + private function info($id) { + global $_M,$_YW; + $lang = ''; + switch ($this->tname) { + case 'para': + $info = [ + 'p_type' => $_M['form']['p_type-'.$id], + 'p_order' => $_M['form']['p_order-'.$id], + 'p_name' => $_M['form']['p_name-'.$id], + 'p_value' => $_M['form']['p_value-'.$id], + 'p_text' => $_M['form']['p_text-'.$id] + ]; + break; + default: + break; + } + return $info; + } + + //删除其他的关联表 + private function todel($id) { + global $_M,$_YW; + $ret = true; + switch ($this->tname) { + case 'contract': + //获取合同编号 + $contract = $this->tsql->table('contract') + ->where(['id' => $id]) + ->one(); + //删除相关计划 + $this->tsql->table('launch') + ->where(['l_hnumber' => $contract['h_number'] ]) + ->del(); + //删除相关排期 + $this->tsql->table('schedule') + ->where(['s_hnumber' => $contract['h_number'] ]) + ->del(); + break; + case 'launch': + //删除相关排期 + $this->tsql->table('schedule') + ->where(['s_lid' => $id ]) + ->del(); + break; + case 'para': + //删除相关的光广告位 + if($_M['form']['p_num-'.$id] > 0) $ret = false; + break; + case 'village': + //查询需要删除的广告位编号 + $elevator = $this->tsql->table('elevator') + ->where(['e_vid' => $id]) + ->all(); + + $e_number = array_column($elevator, 'e_number'); + self::del_elevator($e_number); + break; + case 'elevator': + $elevator = $this->tsql->table('elevator') + ->where(['id' => $id]) + ->one(); + //删除相关排期广告位编号 + self::del_elevator($elevator['e_number']); + break; + + default: + break; + } + return $ret; + } + + // 删除排期广告位编号 + private function del_elevator($num) { + $dellist = []; + if(!is_array($num)) $num = [$num]; + $num = array_unique($num); + if(count($num) == 0) return false; + // 广告位数组 + + foreach ($num as $e_number){ + // 删除广告位 + $this->tsql->table('elevator') + ->where(['e_number' => $e_number ]) + ->del(); + //删除相关排期缓存 + $this->tsql->table('schedule') + ->where(['s_enumber' => $e_number ]) + ->del(); + // 整理数据 + $launch = false; + + // 选择的广告位 + $launch = $this->tsql->table('launch') + ->where(" find_in_set( '{$e_number}', l_selectenum ) ") + ->all(); + + // 处理的核心函数 + $col = function($launch,$field) use(&$dellist,$e_number){ + foreach ($launch as $val){ + $dellist[$val['id']]['info'] = $val; + $dellist[$val['id']][$field][] = $e_number; + } + }; + if($launch != false) $col($launch,'l_selectenum'); + + // 排期成功的广告位 + $launch = $this->tsql->table('launch') + ->where(" find_in_set( '{$e_number}', l_enumber ) ") + ->all(); + if($launch != false) $col($launch,'l_enumber'); + } + + if(count($dellist) == 0) return false; + // 对值进行统计并修改 + foreach ($dellist as $id => $la){ + // 处理的核心函数 + $enum = function($field) use($la){ + // 拿到la内需要去掉的值 数组 + // 再通过对比获得差异值,并去重,再转成字符串 + return is_array($la[$field])?arrayto_string(array_unique(array_diff(stringto_array($la['info'][$field],','),$la[$field])),','):$la['info'][$field]; + }; + + //mysql + $this->tsql->table('launch') + ->field(['l_selectenum' => $enum('l_selectenum'), 'l_enumber' => $enum('l_enumber')]) + ->where(['id' => $id]) + ->upd(); + } + + } + +} +?> \ No newline at end of file diff --git a/admin/table_on.class.php b/admin/table_on.class.php new file mode 100644 index 0000000..31cf228 --- /dev/null +++ b/admin/table_on.class.php @@ -0,0 +1,135 @@ +table_theme = load::own_class('table_theme','new'); + } + + + //输出模板内容 + public function __destruct() + { + global $_M,$_YW; + if($this->destruct){ + if(empty($this->appshow)) $this->appshow = 'app/'.$this->tname; + require $this->show($this->appshow,$this->input); + } + } + + //广告位统计 + public function doelevator() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + //小区统计 + public function dovillage() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + //广告合同关联表 + public function doschedule() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(); + } + + //合同统计 + public function docontract() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(); + } + + //企业资料 + public function docustomer() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + //企业联系人 + public function doworkers() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + //投放计划单 + public function dolaunch() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + //参数配置 + public function dopara() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(); + } + + // 小区统计 + public function dovillages() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $vs_daytime = date('Y-m-d',time()); + $this->input['top']['tips'] = ' +

+

闲置个数、排期中的个数、到期个数、预排的个数计算说明

+
    +
  1. 若选择时间区段,若两者缺少其中一个则自动补全为当天时间('.$vs_daytime.'
  2. +
  3. 闲置:默认计算当天('.$vs_daytime.')的广告位闲置个数,选择时间区段后,计算的可以满足时间区段的广告位个数。(仅计算启用的广告位)
  4. +
  5. 排期中:默认计算当天('.$vs_daytime.')排期中的个数,选择时间区段后,计算的在时间区段内有排期的广告位个数。
  6. +
  7. 到期:默认以当天('.$vs_daytime.')为准,计算7天后到期的个数,选择时间区段后,计算的在时间区段内到期的广告位个数。
  8. +
  9. 预排:默认计算当天('.$vs_daytime.')以后才开始的排期广告位个数,选择时间区段后,计算的是时间区段内排期状态为预排的广告位个数。
  10. +
+
'; + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + // 小区统计 + public function doelevators() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(1); + } + + // 巡查密钥列表 + public function dokeylist() + { + global $_M,$_YW; + parent::appurl(parent::tname()); + $this->input['table'] = $this->table_theme->start($this->tname)->send_all(); + } + + + +} + +?> \ No newline at end of file diff --git a/admin/templates/config.php b/admin/templates/config.php new file mode 100644 index 0000000..2ced840 --- /dev/null +++ b/admin/templates/config.php @@ -0,0 +1,79 @@ + + +
+
+ + {$data.nav_sub} +
+

微信通知

+
+
+
+
+ +
+ IT科技-互联网|电子商务-预约提醒,推送为模板为那些还未到期的合同 +
+
+
+
+
+
+ +
+ IT科技-互联网|电子商务-合同到期提醒,合同已经到期的 +
+
+
+
+
+
+ +
+ IT科技-互联网|电子商务-统计结果通知,合同提醒汇总结果 +
+
+
+
+
+ + 可设置多个管理员微信,设置后每个合同到期都会收到微信通知 +
+
+ +
+
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/admin/templates/contract.php b/admin/templates/contract.php new file mode 100644 index 0000000..c6f6bc4 --- /dev/null +++ b/admin/templates/contract.php @@ -0,0 +1,129 @@ + + +
+
+ + {$data.nav_sub} +
+

{$data.met_title}

+
+
+
+ + 保存后不可二次修改,合同唯一编号,方便后期查询处理 +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ 开始时间 + + 结束时间 + +
+ 影响后期的投放计划时间区间 +
+
+
+
+
+ + 可设置多个通知天数,输入完成一个回车后再输入下一个 +
+
+
+
+
+
+ + +
+ 合同总额方便后期统计 +
+
+
+
+
+ + 简短文字描述备注。 +
+
+
+
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/admin/templates/css/appcheck.min.css b/admin/templates/css/appcheck.min.css new file mode 100644 index 0000000..d1f2791 --- /dev/null +++ b/admin/templates/css/appcheck.min.css @@ -0,0 +1 @@ +@charset "UTF-8";.appcheck .panel-info{border:1px solid #57c7d4;}.appcheck .topimg{text-align:left;display:inline-block;}.appcheck .topimg>div{float:left;}.appcheck .topimg .topimg-image{position:relative;margin-right:10px;}.appcheck .topimg .topimg-image .avatar{width:100px;}.appcheck .topimg .topimg-image .avatar img{border-radius:50%;border:1px solid #e4eaec;}.appcheck .img-bordered-info{border-color:#79D1C9!important;}.appcheck .topimg .topimg-body>span{display:block;font-size:1rem;}.appcheck .topimg .topimg-body .topimg-author{font-size:20px;font-weight:600;}.appcheck .topimg .topimg-body .topimg-company{opacity:.8;}.appcheck .list-group .media .media-heading{font-size:1.1rem;color:#37474f;}.appcheck .list-group li h4{font-weight:600;}.appcheck .media-body small{font-size:98%;color:#76838f;}.appcheck .loader-circle{width:0.45em;height:0.45em;border-width:.08em;}.appcheck .icon{margin-right:0px;font-size:20px;}.appcheck .icon.fa-check-circle{color:#46be8a;}.appcheck .icon.fa-times-circle{color:#f96868;}.appcheck .icon.fa-exclamation-circle{color:#f2a654;}.appcheck .icon.fa-clock-o{color:#ccd5db;}.appcheck .modal{background:rgba(0,0,0,.8);}.appcheck .modal .close{opacity:1;font-weight:900;font-size:1.9rem;}.appcheck .modal .close:focus,.appcheck .modal .close:hover{cursor:pointer;text-decoration:none;opacity:.5;}.appcheck .modal .modal-header{border-bottom:1px solid #e4eaec;}.appcheck .modal .modal-footer{padding:15px 20px;border-top:1px solid #e4eaec;}.appcheck .modal .modal-body .ov-body{overflow-y:auto;}.appcheck .modal .ov-body span{color:#76838f;} \ No newline at end of file diff --git a/admin/templates/css/metinfo.css b/admin/templates/css/metinfo.css new file mode 100644 index 0000000..0ed4bcc --- /dev/null +++ b/admin/templates/css/metinfo.css @@ -0,0 +1,1212 @@ +@charset "UTF-8"; +/*UI样式*/ + +.panel { + position: relative; + margin-bottom: 1.875rem; + background-color: #fff; + border: 0 solid transparent; + border-radius: .286rem; + -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05); + box-shadow: 0 1px 1px rgba(0,0,0,.05) +} + +.panel-content>.row { + padding-left: 30px; + padding-right: 30px +} + +.panel-content>.row>[class*=col-] { + padding-left: 30px; + padding-right: 30px +} + +.panel-heading { + position: relative; + padding: 0; + border-bottom: 1px solid transparent; + border-top-right-radius: .214rem; + border-top-left-radius: .214rem +} + +.panel-heading+.alert { + border-radius: 0 +} + +.panel-heading>.nav-tabs { + border-bottom: none +} + +.panel-heading-tab { + padding: 10px 30px 0; + background-color: #62a8ea +} + +.panel-heading-tab>.nav-tabs .nav-link { + color: #fff +} + +.panel-heading-tab>.nav-tabs .nav-link.hover,.panel-heading-tab>.nav-tabs .nav-link:hover { + color: #76838f +} + +.panel-heading-tab>.nav-tabs .nav-link.active,.panel-heading-tab>.nav-tabs .nav-link:active { + color: #76838f; + background-color: #fff +} + +.panel-heading+.nav-tabs { + margin-top: -.715rem +} + +.panel-heading>.dropdown .dropdown-toggle { + color: inherit +} + +.panel-body { + position: relative; + padding: 30px 30px +} + +.panel-body::after { + content: ""; + display: table; + clear: both +} + +.panel-heading+.panel-body { + padding-top: 0 +} + +.panel-body .h1:first-child,.panel-body .h2:first-child,.panel-body .h3:first-child,.panel-body .h4:first-child,.panel-body .h5:first-child,.panel-body .h6:first-child,.panel-body h1:first-child,.panel-body h2:first-child,.panel-body h3:first-child,.panel-body h4:first-child,.panel-body h5:first-child,.panel-body h6:first-child { + margin-top: 0 +} + +.panel-body>:last-child { + margin-bottom: 0 +} + +.panel-body>.list-group-dividered:only-child>.list-group-item:last-child { + border-bottom-color: transparent +} + +.panel-footer { + padding: 0 30px 15px; + border-top: 1px solid transparent; + background-color: transparent; + border-bottom-right-radius: .214rem; + border-bottom-left-radius: .214rem +} + +.table+.panel-footer { + padding-top: 15px; + border-color: #e4eaec +} + +.panel-title { + display: block; + margin-top: 0; + margin-bottom: 0; + padding: 20px 30px; + font-size: 18px; + color: #37474f +} + +.panel-title>.icon { + margin-right: 10px +} + +.panel-title>.tag { + margin-left: 10px +} + +.panel-title .small,.panel-title small { + color: #76838f +} + +.panel-title>.small>a,.panel-title>a,.panel-title>small>a { + color: inherit +} + +.panel-desc { + display: block; + padding: 5px 0 0; + margin: 0; + font-size: 1rem; + color: #76838f +} + +.panel-actions { + position: absolute; + right: 30px; + top: 50%; + -webkit-transform: translate(0,-50%); + -ms-transform: translate(0,-50%); + -o-transform: translate(0,-50%); + transform: translate(0,-50%); + margin: auto; + z-index: 1 +} + +@media (max-width: 479px) { + .panel-actions { + right:20px + } +} + +ul .panel-actions { + list-style: none +} + +ul .panel-actions>li { + display: inline-block; + margin-left: 8px +} + +ul .panel-actions>li:first-child { + margin-left: 0 +} + +.panel-actions a.dropdown-toggle { + text-decoration: none +} + +.panel-actions .dropdown { + display: inline-block +} + +.panel-actions .dropdown-toggle { + display: inline-block +} + +.panel-actions .panel-action { + display: inline-block; + padding: 8px 10px; + color: #a3afb7; + text-decoration: none; + cursor: pointer; + background-color: transparent +} + +.panel-actions .panel-action:hover { + color: #526069 +} + +.panel-actions .panel-action:active { + color: #526069 +} + +.panel-actions .progress { + width: 100px; + margin: 0 +} + +.panel-actions .pagination { + margin: 0 +} + +ul.panel-actions { + list-style: none +} + +ul.panel-actions>li { + display: inline-block; + margin-left: 8px +} + +ul.panel-actions>li:first-child { + margin-left: 0 +} + +.panel-toolbar { + padding: 5px 15px; + margin: 0; + background-color: transparent; + border-bottom: 1px solid #e4eaec; + border-top: 1px solid #e4eaec +} + +.panel-bordered .panel-toolbar { + border-top-color: transparent +} + +.panel-toolbar .btn { + color: #a3afb7; + padding: 5px 10px +} + +.panel-toolbar .btn.icon { + width: 1em; + text-align: center +} + +.panel-toolbar .btn.active,.panel-toolbar .btn:active,.panel-toolbar .btn:hover { + color: #76838f +} + +.panel-loading { + position: absolute; + top: 0; + left: 0; + z-index: 6; + display: none; + width: 100%; + height: 100%; + border-radius: .286rem; + opacity: .6 +} + +.panel-loading .loader { + position: absolute; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%,-50%); + -ms-transform: translate(-50%,-50%); + -o-transform: translate(-50%,-50%); + transform: translate(-50%,-50%) +} + +.panel>:not(.panel-loading):not(.collapsing) { + -webkit-transition: opacity .3s; + -o-transition: opacity .3s; + transition: opacity .3s +} + +.panel.is-loading>:not(.panel-loading) { + opacity: .3 +} + +.panel.is-loading .panel-loading { + display: block; + opacity: 1 +} + +.panel-footer-chart { + padding: 0 +} + +.panel-control { + padding: 0; + border: none; + border-radius: 0; + -webkit-box-shadow: none; + box-shadow: none +} + +.panel-body.scrollable-vertical { + padding-left: 0!important; + padding-right: 0!important +} + +.panel-body.scrollable-vertical>.scrollable-container>.scrollable-content { + padding-left: 30px; + padding-right: 30px +} + +@media (max-width: 479px) { + .panel-body.scrollable-vertical>.scrollable-container>.scrollable-content { + padding-left:20px; + padding-right: 20px + } +} + +.panel-body.scrollable-vertical>.scrollable-bar { + margin-top: 0; + margin-bottom: 30px; + height: -webkit-calc(100% - 30px); + height: calc(100% - 30px); + -webkit-transform: translateX(-26px); + -ms-transform: translateX(-26px); + -o-transform: translateX(-26px); + transform: translateX(-26px) +} + +.panel-bordered>.panel-body.scrollable-vertical>.scrollable-bar { + margin-bottom: 30px; + height: -webkit-calc(100% - 60px); + height: calc(100% - 60px) +} + +.panel-body.scrollable-horizontal { + padding-top: 0!important; + padding-bottom: 0!important +} + +.panel-body.scrollable-horizontal>.scrollable-container>.scrollable-content { + padding-top: 0; + padding-bottom: 30px +} + +.panel-bordered>.panel-body.scrollable-horizontal>.scrollable-container>.scrollable-content { + padding-top: 30px; + padding-bottom: 30px +} + +.panel-body.scrollable-horizontal>.scrollable-bar { + margin-left: 0; + margin-right: 30px; + width: -webkit-calc(100% - 60px); + width: calc(100% - 60px); + -webkit-transform: translateY(-26px); + -ms-transform: translateY(-26px); + -o-transform: translateY(-26px); + transform: translateY(-26px) +} + +@media (max-width: 479px) { + .panel-body.scrollable-horizontal>.scrollable-bar { + margin-right:20px; + width: -webkit-calc(100% - 40px); + width: calc(100% - 40px) + } +} + +.panel-bordered>.panel-body.scrollable-horizontal>.scrollable-bar { + -webkit-transform: translateY(-26px); + -ms-transform: translateY(-26px); + -o-transform: translateY(-26px); + transform: translateY(-26px) +} + +.panel-bordered>.panel-heading { + border-bottom: 1px solid #e4eaec +} + +.panel-bordered>.panel-heading>.panel-title { + padding-bottom: 20px +} + +.panel-bordered>.panel-footer { + border-top: 1px solid #e4eaec; + padding-top: 15px +} + +.panel-bordered>.panel-body { + padding-top: 30px +} + +.panel-bordered>.table>tbody:first-child>tr:first-child td,.panel-bordered>.table>tbody:first-child>tr:first-child th { + border-top: 0 +} + +.panel.is-dragging { + opacity: .8 +} + +.panel.is-dragging { + cursor: move +} + +.panel>.nav-tabs-vertical .nav-tabs { + margin-left: -1px +} + +.panel>.nav-tabs-vertical .nav-tabs>li>a { + border-left: none; + border-radius: 0 +} + +.panel>.nav-tabs-vertical .nav-tabs.nav-tabs-reverse { + margin-right: -1px +} + +.panel>.nav-tabs-vertical .nav-tabs.nav-tabs-reverse>li>a { + border-right: none; + border-radius: 0 +} + +.panel:hover .panel-actions .show-on-hover { + display: inline-block +} + +.panel .panel-actions .show-on-hover { + display: none +} + +.panel.is-fullscreen { + position: fixed; + top: 0; + left: 0; + z-index: 9999; + width: 100%; + height: 100%; + border-radius: 0 +} + +.panel.is-fullscreen .panel-loading { + border-radius: 0 +} + +.panel.is-fullscreen .panel-actions [data-toggle=collapse] { + display: none +} + +.panel.is-close { + display: none +} + +.panel.is-collapse .panel-body { + display: none; + height: 0 +} + +.panel>.alert { + padding-left: 30px; + padding-right: 30px +} + +.panel>.alert-dismissible { + padding-right: 50px +} + +@media (max-width: 479px) { + .panel>.alert { + padding-left:20px; + padding-right: 20px + } + + .panel>.alert-dismissible { + padding-right: 40px + } +} + +.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table { + margin-bottom: 0 +} + +.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption { + padding-left: 30px 30px; + padding-right: 30px 30px +} + +.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child { + border-top-right-radius: .214rem; + border-top-left-radius: .214rem +} + +.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child { + border-top-left-radius: .214rem; + border-top-right-radius: .214rem +} + +.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child { + border-top-left-radius: .214rem +} + +.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child { + border-top-right-radius: .214rem +} + +.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child { + border-bottom-right-radius: .214rem; + border-bottom-left-radius: .214rem +} + +.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child { + border-bottom-left-radius: .214rem; + border-bottom-right-radius: .214rem +} + +.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child { + border-bottom-left-radius: .214rem +} + +.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child { + border-bottom-right-radius: .214rem +} + +.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body { + border-top: 1px solid #e4eaec +} + +.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th { + border-top: 0 +} + +.panel>.table-bordered,.panel>.table-responsive>.table-bordered { + border: 0 +} + +.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child { + border-left: 0 +} + +.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child { + border-right: 0 +} + +.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th { + border-bottom: 0 +} + +.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th { + border-bottom: 0 +} + +.panel>.table-responsive { + border: 0; + margin-bottom: 0 +} + +.panel>.table-responsive .table>tbody>tr>td:first-child,.panel>.table-responsive .table>tbody>tr>th:first-child,.panel>.table-responsive .table>tfoot>tr>td:first-child,.panel>.table-responsive .table>tfoot>tr>th:first-child,.panel>.table-responsive .table>thead>tr>td:first-child,.panel>.table-responsive .table>thead>tr>th:first-child,.panel>.table-responsive .table>tr>td:first-child,.panel>.table-responsive .table>tr>th:first-child,.panel>.table>tbody>tr>td:first-child,.panel>.table>tbody>tr>th:first-child,.panel>.table>tfoot>tr>td:first-child,.panel>.table>tfoot>tr>th:first-child,.panel>.table>thead>tr>td:first-child,.panel>.table>thead>tr>th:first-child,.panel>.table>tr>td:first-child,.panel>.table>tr>th:first-child { + padding-left: 30px +} + +@media (max-width: 479px) { + .panel>.table-responsive .table>tbody>tr>td:first-child,.panel>.table-responsive .table>tbody>tr>th:first-child,.panel>.table-responsive .table>tfoot>tr>td:first-child,.panel>.table-responsive .table>tfoot>tr>th:first-child,.panel>.table-responsive .table>thead>tr>td:first-child,.panel>.table-responsive .table>thead>tr>th:first-child,.panel>.table-responsive .table>tr>td:first-child,.panel>.table-responsive .table>tr>th:first-child,.panel>.table>tbody>tr>td:first-child,.panel>.table>tbody>tr>th:first-child,.panel>.table>tfoot>tr>td:first-child,.panel>.table>tfoot>tr>th:first-child,.panel>.table>thead>tr>td:first-child,.panel>.table>thead>tr>th:first-child,.panel>.table>tr>td:first-child,.panel>.table>tr>th:first-child { + padding-left:20px + } +} + +.panel>.table-responsive .table>tbody>tr>td:last-child,.panel>.table-responsive .table>tbody>tr>th:last-child,.panel>.table-responsive .table>tfoot>tr>td:last-child,.panel>.table-responsive .table>tfoot>tr>th:last-child,.panel>.table-responsive .table>thead>tr>td:last-child,.panel>.table-responsive .table>thead>tr>th:last-child,.panel>.table-responsive .table>tr>td:last-child,.panel>.table-responsive .table>tr>th:last-child,.panel>.table>tbody>tr>td:last-child,.panel>.table>tbody>tr>th:last-child,.panel>.table>tfoot>tr>td:last-child,.panel>.table>tfoot>tr>th:last-child,.panel>.table>thead>tr>td:last-child,.panel>.table>thead>tr>th:last-child,.panel>.table>tr>td:last-child,.panel>.table>tr>th:last-child { + padding-right: 30px +} + +@media (max-width: 479px) { + .panel>.table-responsive .table>tbody>tr>td:last-child,.panel>.table-responsive .table>tbody>tr>th:last-child,.panel>.table-responsive .table>tfoot>tr>td:last-child,.panel>.table-responsive .table>tfoot>tr>th:last-child,.panel>.table-responsive .table>thead>tr>td:last-child,.panel>.table-responsive .table>thead>tr>th:last-child,.panel>.table-responsive .table>tr>td:last-child,.panel>.table-responsive .table>tr>th:last-child,.panel>.table>tbody>tr>td:last-child,.panel>.table>tbody>tr>th:last-child,.panel>.table>tfoot>tr>td:last-child,.panel>.table>tfoot>tr>th:last-child,.panel>.table>thead>tr>td:last-child,.panel>.table>thead>tr>th:last-child,.panel>.table>tr>td:last-child,.panel>.table>tr>th:last-child { + padding-right:20px + } +} + +.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th { + border-top: 1px solid #e4eaec +} + +.panel>.list-group,.panel>.panel-collapse>.list-group { + margin-bottom: 0 +} + +.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item { + border-width: 1px 0; + border-radius: 0 +} + +.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child { + border-top: 0; + border-top-right-radius: .214rem; + border-top-left-radius: .214rem +} + +.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child { + border-bottom: 0; + border-bottom-right-radius: .214rem; + border-bottom-left-radius: .214rem +} + +.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child { + border-top-right-radius: 0; + border-top-left-radius: 0 +} + +.panel>.list-group .list-group-item { + padding-right: 30px; + padding-left: 30px +} + +@media (max-width: 479px) { + .panel>.list-group .list-group-item { + padding-left:20px; + padding-right: 20px + } +} + +.panel-heading+.list-group .list-group-item:first-child { + border-top-width: 0 +} + +.list-group+.panel-footer { + border-top-width: 0 +} + +.panel.panel-transparent { + background: 0 0; + border-color: transparent; + -webkit-box-shadow: none; + box-shadow: none +} + +.panel.panel-transparent>.panel-footer,.panel.panel-transparent>.panel-heading { + border-color: transparent +} + +.panel-default .panel-heading { + color: #76838f; + background-color: #e4eaec; + border: none +} + +.panel-default .panel-heading+.panel-collapse>.panel-body { + border-top-color: #e4eaec +} + +.panel-default .panel-heading .tag-pill { + color: #e4eaec; + background-color: #76838f +} + +.panel-default .panel-title { + color: #76838f +} + +.panel-default .panel-action { + color: #76838f +} + +.panel-default .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #e4eaec +} + +.panel-default .panel-title { + color: #37474f +} + +.panel-primary .panel-heading { + color: #fff; + background-color: #62a8ea; + border: none +} + +.panel-primary .panel-heading+.panel-collapse>.panel-body { + border-top-color: #62a8ea +} + +.panel-primary .panel-heading .tag-pill { + color: #62a8ea; + background-color: #fff +} + +.panel-primary .panel-title { + color: #fff +} + +.panel-primary .panel-action { + color: #fff +} + +.panel-primary .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #62a8ea +} + +.panel-success .panel-heading { + color: #fff; + background-color: #46be8a; + border: none +} + +.panel-success .panel-heading+.panel-collapse>.panel-body { + border-top-color: #3dae6a +} + +.panel-success .panel-heading .tag-pill { + color: #46be8a; + background-color: #fff +} + +.panel-success .panel-title { + color: #fff +} + +.panel-success .panel-action { + color: #fff +} + +.panel-success .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #3dae6a +} + +.panel-info .panel-heading { + color: #fff; + background-color: #57c7d4; + border: none +} + +.panel-info .panel-heading+.panel-collapse>.panel-body { + border-top-color: #3bcdc4 +} + +.panel-info .panel-heading .tag-pill { + color: #57c7d4; + background-color: #fff +} + +.panel-info .panel-title { + color: #fff +} + +.panel-info .panel-action { + color: #fff +} + +.panel-info .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #3bcdc4 +} + +.panel-warning .panel-heading { + color: #fff; + background-color: #f2a654; + border: none +} + +.panel-warning .panel-heading+.panel-collapse>.panel-body { + border-top-color: #f18246 +} + +.panel-warning .panel-heading .tag-pill { + color: #f2a654; + background-color: #fff +} + +.panel-warning .panel-title { + color: #fff +} + +.panel-warning .panel-action { + color: #fff +} + +.panel-warning .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #f18246 +} + +.panel-danger .panel-heading { + color: #fff; + background-color: #f96868; + border: none +} + +.panel-danger .panel-heading+.panel-collapse>.panel-body { + border-top-color: #f85974 +} + +.panel-danger .panel-heading .tag-pill { + color: #f96868; + background-color: #fff +} + +.panel-danger .panel-title { + color: #fff +} + +.panel-danger .panel-action { + color: #fff +} + +.panel-danger .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #f85974 +} + +.panel-dark .panel-heading { + color: #fff; + background-color: #526069; + border: none +} + +.panel-dark .panel-heading+.panel-collapse>.panel-body { + border-top-color: #526069 +} + +.panel-dark .panel-heading .tag-pill { + color: #526069; + background-color: #fff +} + +.panel-dark .panel-title { + color: #fff +} + +.panel-dark .panel-action { + color: #fff +} + +.panel-dark .panel-footer+.panel-collapse>.panel-body { + border-bottom-color: #526069 +} + +.panel-line .panel-heading { + background: 0 0; + border: none; + border-top: 3px solid transparent +} + +.panel-line.panel-default .panel-heading { + color: #e4eaec; + border-top-color: #e4eaec; + background: 0 0 +} + +.panel-line.panel-default .panel-title { + color: #e4eaec +} + +.panel-line.panel-default .panel-action { + color: #e4eaec +} + +.panel-line.panel-default .panel-title { + color: #37474f +} + +.panel-line.panel-default .panel-action { + color: #a3afb7 +} + +.panel-line.panel-primary .panel-heading { + color: #62a8ea; + border-top-color: #62a8ea; + background: 0 0 +} + +.panel-line.panel-primary .panel-title { + color: #62a8ea +} + +.panel-line.panel-primary .panel-action { + color: #62a8ea +} + +.panel-line.panel-success .panel-heading { + color: #46be8a; + border-top-color: #46be8a; + background: 0 0 +} + +.panel-line.panel-success .panel-title { + color: #46be8a +} + +.panel-line.panel-success .panel-action { + color: #46be8a +} + +.panel-line.panel-info .panel-heading { + color: #57c7d4; + border-top-color: #57c7d4; + background: 0 0 +} + +.panel-line.panel-info .panel-title { + color: #57c7d4 +} + +.panel-line.panel-info .panel-action { + color: #57c7d4 +} + +.panel-line.panel-warning .panel-heading { + color: #f2a654; + border-top-color: #f2a654; + background: 0 0 +} + +.panel-line.panel-warning .panel-title { + color: #f2a654 +} + +.panel-line.panel-warning .panel-action { + color: #f2a654 +} + +.panel-line.panel-danger .panel-heading { + color: #f96868; + border-top-color: #f96868; + background: 0 0 +} + +.panel-line.panel-danger .panel-title { + color: #f96868 +} + +.panel-line.panel-danger .panel-action { + color: #f96868 +} + +.panel-line.panel-dark .panel-heading { + color: #526069; + border-top-color: #526069; + background: 0 0 +} + +.panel-line.panel-dark .panel-title { + color: #526069 +} + +.panel-line.panel-dark .panel-action { + color: #526069 +} + +@media (max-width: 767px) { + .panel-actions { + position:relative; + top: auto; + right: auto; + display: block; + margin: auto; + padding: 0 30px 15px; + -webkit-transform: none; + -ms-transform: none; + -o-transform: none; + transform: none + } + + .panel-actions-keep { + position: absolute; + top: 50%; + right: 30px; + padding: 0; + -webkit-transform: translate(0,-50%); + -ms-transform: translate(0,-50%); + -o-transform: translate(0,-50%); + transform: translate(0,-50%) + } +} + +@media (max-width: 479px) { + .panel-actions { + padding-left:20px + } + + .panel-actions-keep { + right: 15px + } + + .panel-actions .progress { + min-width: 80px + } + + .panel-actions .show-on-hover { + display: none + } + + .panel-body,.panel-footer,.panel-title { + padding-left: 20px; + padding-right: 20px + } +} + +.panel-group { + margin-bottom: 22px +} + +.panel-group .panel { + margin-bottom: 0; + border-radius: .286rem; + -webkit-box-shadow: none; + box-shadow: none +} + +.panel-group .panel+.panel { + margin-top: 10px +} + +.panel-group .panel-title { + position: relative; + padding: 15px 30px; + font-size: 1rem +} + +.panel-group .panel-title:after,.panel-group .panel-title:before { + position: absolute; + top: 15px; + right: 30px; + font-family: "Web Icons"; + -webkit-transition: all .3s linear 0s; + -o-transition: all .3s linear 0s; + transition: all .3s linear 0s +} + +.panel-group .panel-title:before { + content: "" +} + +.panel-group .panel-title:after { + content: "" +} + +.panel-group .panel-title[aria-expanded=false]:before { + opacity: .4 +} + +.panel-group .panel-title[aria-expanded=false]:after { + opacity: 0; + -webkit-transform: rotate(-180deg); + -ms-transform: rotate(-180deg); + -o-transform: rotate(-180deg); + transform: rotate(-180deg) +} + +.panel-group .panel-title[aria-expanded=true]:before { + opacity: 0; + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -o-transform: rotate(180deg); + transform: rotate(180deg) +} + +.panel-group .panel-title[aria-expanded=true]:after { + opacity: 1 +} + +.panel-group .panel-title:focus,.panel-group .panel-title:hover { + color: #76838f; + text-decoration: none +} + +.panel-group .panel-title:focus { + outline: 0 +} + +.panel-group .panel-heading { + border-bottom: 0 +} + +.panel-group .panel-heading+.panel-collapse { + margin: 0 +} + +.panel-group .panel-heading+.panel-collapse>.list-group { + border-top: 1px solid #e4eaec +} + +.panel-group .panel-collapse .panel-body { + padding: 15px 30px +} + +.panel-group .panel-footer { + border-top: 0 +} + +.panel-group .panel-footer+.panel-collapse .panel-body { + border-bottom: 1px solid #e4eaec +} + +.panel-group-continuous .panel { + border-radius: 0 +} + +.panel-group-continuous .panel:first-child { + border-radius: .286rem .286rem 0 0 +} + +.panel-group-continuous .panel:last-child { + border-radius: 0 0 .286rem .286rem +} + +.panel-group-continuous .panel+.panel { + margin-top: 0; + border-top: 1px solid #e4eaec +} + +.panel-group-simple .panel { + background: 0 0 +} + +.panel-group-simple .panel-title { + padding-left: 0; + padding-bottom: 10px +} + +.panel-group-simple .panel-title:after,.panel-group-simple .panel-title:before { + right: 5px +} + +.panel-group-simple .panel-collapse .panel-body { + padding-left: 0; + padding-right: 0; + padding-top: 10px +} + +.panel-group-simple .panel+.panel { + margin-top: 0 +} + + + +/*自定义样式*/ +.app-sub-nav .nav-tabs{border-bottom:none;} +.btn-cursor-pointer{cursor:pointer;} +/*把脑残替换的恢复过来*/ +.form-inline .form-group { + margin-right: 20px; +} +@media (min-width: 480px){ + .form-inline .form-group, .form-inline .form-control { + display: inline-block; + margin-bottom: 0; + width: auto; + vertical-align: middle; + } +} +/*在帮脑残修复一下*/ +table .form-inline .form-group { + margin-right: 0px; +} +@media (min-width: 480px){ + table .form-inline .form-group, table .form-inline .form-control { + display: block; + width: 100%; + } +} + +/*CSS*/ +@media (min-width: 767px){ + .metadmin-fmbx dl .city-css .form-control{ + width: auto; + } +} + +.launch_affix_save { + position: fixed; + bottom: 0px; + z-index: 999999; + height: 60px; + margin-left: -15px; + width: 100%; + margin-bottom:0; +} + +.line_through{ + text-decoration: line-through; +} + + +/*统计总页面*/ +.page-profile .card-shadow { + -webkit-box-shadow:none; + box-shadow:none; +} +.page-profile .card-footer { + padding: 0px; + border-radius: .215rem; + background-color: #f6f9fd; + border-top: none; +} + +.page-profile .card-footer>div>div{ + padding: 10px 0px; +} + +.page-profile .profile-stat-count { + display: block; + margin-bottom: 3px; + color: #526069; + font-size: 20px; + font-weight: 300; +} + +.page-profile .profile-stat-count + span { + color: #a3afb7; +} + +/*表格头部排序样式*/ +.orderby-arrow.desc:before{ content: '\2193'; font-weight: bold; margin-left: 5px;} +.orderby-arrow.asc:before{ content: '\2191'; font-weight: bold; margin-left: 5px;} + +.metadmin-main table td .loader-ellipsis{ + width: 0.45em; + height: 0.45em; + font-size: 15px; +} + +.h-700{ + height: 700px; +} diff --git a/admin/templates/customer.php b/admin/templates/customer.php new file mode 100644 index 0000000..f204a73 --- /dev/null +++ b/admin/templates/customer.php @@ -0,0 +1,87 @@ + + +
+
+ + {$data.nav_sub} +
+

{$data.met_title}

+
+
+
+ +
+
+
+
+
+ + 企业简短名称 +
+
+
+
+
+
+ + + +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ + 简短文字描述备注。 +
+
+
+
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/admin/templates/dzadsod.php b/admin/templates/dzadsod.php new file mode 100644 index 0000000..afef7b6 --- /dev/null +++ b/admin/templates/dzadsod.php @@ -0,0 +1,119 @@ + + + + {$data.nav_sub} +
+
+ +
+
+
+ +
+
+
+

订单到期提醒 + 包含根据设置的到期提醒天数内的订单,以及订单投放结束到期的订单,符合条件的数据展示3天 +

+
+ + {$data.table.thead} + + + + + + {$data.table.tfoot} +
+
+
+
+
+
+ \ No newline at end of file diff --git a/admin/templates/elevator.php b/admin/templates/elevator.php new file mode 100644 index 0000000..3b83bcb --- /dev/null +++ b/admin/templates/elevator.php @@ -0,0 +1,117 @@ + + +
+
+ + {$data.nav_sub} +
+

{$data.met_title}

+
+
+
+ + + 广告位唯一编号,方便后期查询处理。 +
+
+
+
+
+ +
+
+ +
+
+
+ {$data.para.e_bno_radio} +
+
+
+
+
+ {$data.para.e_uno_radio} +
+
+
+
+
+ {$data.para.e_eno_radio} +
+
+
+
+
+ {$data.para.e_aps_radio} +
+
+ +
+
+
+ + 示例:300*500。 +
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
+ + 自定义广告位相关标签,可设置多个 +
+
+
+
+
+ + 简短文字描述备注。 +
+
+
+
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/admin/templates/index.php b/admin/templates/index.php new file mode 100644 index 0000000..f23dd64 --- /dev/null +++ b/admin/templates/index.php @@ -0,0 +1,52 @@ + + + +
+
+
+ +
+
+
+
+
+ image +
+
+
+ {$data.app.appname} + 版本号:{$data.app.ver} + {$data.app.addtime} +
+
+
+
    +
    + 应用进行逐项检测,状态: 时会暂停检测,待处理问题后再继续执行检测。 +
    +
    + +
    +
    + + + +
    + \ No newline at end of file diff --git a/admin/templates/js/app.js b/admin/templates/js/app.js new file mode 100644 index 0000000..19856f1 --- /dev/null +++ b/admin/templates/js/app.js @@ -0,0 +1,18 @@ +//应用JS后期语法框架 +(function($){ + + //内部初始化入口 + var appmap = function(){ + + }; + + //扩展方法 + appmap.prototype = { + + }; + + //外部入口 + $.fn.maps = function () { + + }; +})(jQuery); diff --git a/admin/templates/js/appcheck.min.js b/admin/templates/js/appcheck.min.js new file mode 100644 index 0000000..0f875ef --- /dev/null +++ b/admin/templates/js/appcheck.min.js @@ -0,0 +1 @@ +(function($){var ckitem,ckcheret={},prootdom,appuldom,modaldom,modaltype=null,ckkey=0;var check=function(){var self=this;this.url=M.url.own_form+'a=doappcheck&lang='+M.lang;this.dlurl=M.url.own_form+'a=download&lang='+M.lang;this.icon=['icon fa-times-circle','icon fa-check-circle','icon fa-exclamation-circle','icon fa-clock-o','loader vertical-align-middle loader-circle'];$('#appmodal').on('show.bs.modal',function(event){modaltype=$(event.relatedTarget).data('type');self.modalshow()});$("#appmodal").on("hidden.bs.modal",function(){self.checkint(modaltype);modaltype=null});$(document).on('click','.apprepair',function(){$(this).attr('disabled','disabled').removeClass('apprepair').text('Loading...');$(this).parent().append('(状态: 表示文件修复失败,可点击重新修复。)');modaldom.find("span.download_file").each(function(){self.filedl($(this))})});$(document).on('click','.download_file',function(){self.filedl($(this))});$(document).on('click','.appupdate',function(){self.appinstall($(this).parent(),{'data':'update|check'})});$(document).on('click','.appinstall',function(){self.appinstall($(this).parent(),{'data':'install|check'})});$(document).on('click','.weqrcode',function(){modaltype=$(this).data('type');self.modalshow()});$(document).on('click','.retry',function(){self.checkint($(this).data('type'))})};check.prototype={item:{server:{title:'服务通信',text:'服务通信检测中...',},system:{title:'系统环境',text:'网站系统环境检测中...',},accredit:{title:'应用授权',text:'应用授权检测中...',},appfile:{title:'应用安全',text:'应用文件安全检测...',},weqrcode:{title:'微信公众号',text:'检测微信公众号关注情况...',},update:{title:'版本信息',text:'检测应用版本更新...',},appcheck:{text:' 核验检测结果...',}},domli:function(id,value,num){num++;var len=ckitem.length-1;return'
  • ('+num+'/'+len+') '+value.title+'

    等待检测...
  • '},dom:function(){var self=this;$.each(this.item,function(key,value){var num=$.inArray(key,ckitem);if(key!='appcheck'&&num!='-1')appuldom.append(self.domli(key,value,num))})},result:function(res){var self=this;appuldom.find('li .media-right i').eq(res.eqkey).removeClass().addClass(self.icon[res.key]);appuldom.find('li .media-body small').eq(res.eqkey).html(res.text)},modal:function(res){if(res.hasOwnProperty('title'))modaldom.find('.modal-title').text(res.title);if(res.hasOwnProperty('body'))modaldom.find('.modal-body').html(res.body);res.hasOwnProperty('foot')?modaldom.find('.modal-footer').html(res.foot).show():modaldom.find('.modal-footer').empty().hide()},resbody:function(text){prootdom.find('.panel-body').html(text)},check:function(){var self=this,type=ckitem[ckkey];if(type=='appcheck'){self.resbody(self.item[type].text);self.appcheck(type,self)}else{self.checkint(type)}},checkint:function(type){var self=this,eqkey=ckkey,ckout=true;if(ckcheret.hasOwnProperty(type)){eqkey=ckcheret[type].eqkey;if(ckcheret[type].key==2)ckout=false}self.result({eqkey:eqkey,key:4,text:self.item[type].text});$.getJSON(self.url,{type:type,eqkey:eqkey},function(json){self.result(json);ckcheret[type]=json;if(ckout&&(json.key==1||json.key==2)){ckkey++;self.check()}if(json.hasOwnProperty('modal')&&type=='appfile'){if(json.modal.suc==false){self.result(json.modal);self.aurepair(json)}}}).error(function(){self.result({eqkey:eqkey,key:0,text:'程序发生异常!点击重试'})})},aurepair:function(ret){var self=this,eqkey=ret.hasOwnProperty('eqkey')?ret.eqkey:ckkey;$.getJSON(self.dlurl,{data:ret.modal.data,eqkey:eqkey},function(json){self.result(json);if(json.key==1)self.check();if(json.key==4)self.aurepair(json)})},filedl:function(_this_){var self=this;_this_.html('');$.getJSON(self.dlurl,{type:'download',data:_this_.data('download')},function(json){var key=json.key;if(key==1)_this_.removeClass('download_file');_this_.find('i').removeClass().addClass(self.icon[key]);self.dlfiledom()})},dlfiledom:function(){if(modaldom.find("span.download_file").length==0){var html='(文件全部修复)';modaldom.find('.modal-footer').html(html)}},appinstall:function(_this_,ret){var self=this;$.getJSON(self.dlurl,{data:ret.data},function(json){_this_.html(json.text);if(json.key==1){if(ckitem[ckkey]=='appcheck'&&modaltype==null)window.location.replace(window.location.href+'&check=1');if(modaltype=='update')$("#appmodal").modal('hide')}else{self.appinstall(_this_,json.modal)}})},wechat_qrcode:function(endtime,sign){var self=this,url=M.url.own_form+'a=domodal&type=wechat&lang='+M.lang;if(modaltype!='weqrcode')return null;$.getJSON(url,{cache:false,endtime:endtime,sign:sign}).done(function(json){switch(json.key){case 0:modaldom.find('.modal-body').html('
    '+json.text+'
    ');break;case 1:$("#appmodal").modal('hide');break;default:self.wechat_qrcode(json.endtime,json.sign);break}})},modalshow:function(){var self=this,modal=ckcheret[modaltype].modal;self.modal(modal);if(modal.hasOwnProperty('url'))self.modalajax(modal.url)},modalajax:function(url){var self=this;$.getJSON(url,function(json){self.modal(json);if(json.hasOwnProperty('callback'))self[json.callback]('')})},appcheck:function(type,_this_){var self=this,url=M.url.own_name+'c=index&a=doajax&lang='+M.lang;$.getJSON(url,{sign:type},function(json){if(type=='ajax'){if(json.key==1){var text='';_this_.find('.stat-list').append(text)}else{window.location.replace(url.replace('a=doajax','a=doindex&check=1'))}}if(type=='appcheck'&&json.key==1){self.resbody(json.text)}}).error(function(){if(type=='ajax')window.location.replace(url.replace('a=doajax','a=doindex&check=1'))})}};$.fn.appcheck=function(){prootdom=this;ckitem=this.data('ckitem').split('|');appuldom=this.find('ul');modaldom=this.find('div.modal');var appck=new check();appck.dom();appck.check()};$.fn.ajaxcheck=function(){var appck=new check();appck.appcheck('ajax',this)};$.ajaxSetup({cache:false});$('.appcheck').length?$('.appcheck').appcheck():$('.metadmin-main').ajaxcheck()})(jQuery); \ No newline at end of file diff --git a/admin/templates/js/applan.js b/admin/templates/js/applan.js new file mode 100644 index 0000000..f742a55 --- /dev/null +++ b/admin/templates/js/applan.js @@ -0,0 +1,243 @@ +//应用JS后期语法框架 +(function($){ + + //内部初始化入口 + var applan = function(){ + var $self = this, + strArr = $self.aparr(); + //计算选中广告位个数 + $self.addnum(strArr); + + //提交处理 + $(document).on('submit', '.add_ap_list form', function(event) { + event.preventDefault(); //阻止默认提交 + }) + + //修改form提交方式 + $(document).on('click', '.add_ap_list form button[type="submit"]', function(event) { + event.preventDefault(); //阻止默认提交 + var $form = $(this).parents('form'); + //手动触发全部验证 +// $form.data('formValidation').resetForm(); + $form.data('formValidation').validate({debug:true}); + //查看验证结果,若为false 则阻止 + var flag = $form.data("formValidation").isValid(); + //验证时间是否合法 + if(flag != false){ + //执行入库操作,返回ID + $self.laaajx($form.attr('action'),$self.formdata($form)); + } + //修改表格按钮禁止操作 +// $(this).attr("disabled",true); + }); + + //解决被禁用前选中的,点击取消后则不能再勾选 + $('table tbody').on('click', '.ap-one-disabled', function(event) { + $(this).removeClass('ap-one-disabled'); + $(this).find('input').attr("disabled",true); + }) +// $(document).on('change',"[data-table-search]",function(){ +// return false; +// }) + + //全选 + $(document).on('click','.ap-all input',function(){ + var idArr = []; + //选中值 + var table = $(this).parents('table').find('tbody'); + table.find('.ap-one').each(function(index,element){ + var oneid = $(this).find('input[name="id"]').val(), + disabled = $(this).find('input[name="id"]').prop('disabled'); + if(APPFUN.isEmpty(disabled)) idArr.push(oneid); + }) + this.checked === true?$self.addap(idArr):$self.apdelall(idArr); + }); + + //必须定位到 table tbody on方法才生效 + $('table tbody').on('click','.ap-one input',function(){ + var idStr = $(this).val(); + this.checked === true?$self.addap(idStr):$self.delap(idStr); + }); + }; + + //扩展方法 + applan.prototype = { + addnum:function(strArr){ + var $self = this; + strArr = $.unique(strArr); + $('.addnum').text(strArr.length); + }, + apdelall:function(idArr){ + var $self = this; + $.each(idArr,function(i,idStr){ + $self.delap(idStr); + }) + }, + addap:function(idStrArr){ + //新增选中值 + var $self = this, + strArr = $self.aparr(); + //新增选中的元素 + strArr = strArr.concat(idStrArr); + //排序 + strArr.sort(); + //去重 + strArr =$.unique(strArr); + $self.apinput(strArr.join(","),true); + //选中个数 + $self.addnum(strArr); + }, + delap:function(idStr){ + //删除选中值 + var $self = this, + strArr = $self.aparr(), + strlen = $.inArray(idStr, strArr); + //删除选中值 + if(strlen != '-1') strArr.splice(strlen, 1); + //排序 + strArr.sort(); + //重新写会 + $self.apinput(strArr.join(","),true); + //选中个数 + $self.addnum(strArr); + }, + apinput:function(str,type){ + //获取或者写入 + //true 为写入 false为获取 + var input = $('input[name="l_selectenum"]'); + return APPFUN.isEmpty(type)?input.val():input.val(str); + }, + aparr:function(){ + //选中广告位编号 + var $self = this, + str = $self.apinput(); + return !APPFUN.isEmpty(str)?str.split(","):[]; + }, + formdata:function(form){ + var Array = form.serializeArray(), + dataOjb = {}; + //转成一对一 + $.each(Array,function(key,val){ + dataOjb[val.name] = val.value; + }); + return dataOjb; + }, + laaajx:function(url,data){ + var $self = this, + scrollable_this = $('[data-plugin="scrollable"]'); + //点击保存后,先处理保存,再执行点位 + $.post(url,data,function(json){ + if(json.code){ +// // 执行成功,则自动跳转到下一步 + window.location.replace(window.location.href + '&slid='+json.slid+'&nextstep=1'); + }else{ + $self.addappend(scrollable_this,json.text,0); + $self.alerthtml(false,json.text); + } + },'json'); + }, + nextstep:function(){ + var $self = this, + scrollable_this = $('[data-plugin="scrollable"]'), + //获取广告位数组 + strArr = $self.aparr(), + //提交的URL + url = M.url.own_name + 'c=ajax&a=doapplan&lang=' + M.lang, + //获取form数据 + data = $self.formdata($('form')), + falsei = 0, + truei = 0; + + $self.scrollable(scrollable_this); //先重新初始化显示 + //去重 + strArr =$.unique(strArr); + $.each(strArr,function(i,idStr){ + data['ap_enumber'] = idStr; + $.post(url,data,function(json){ + // 将操作结果反馈给页面 + $self.addappend(scrollable_this,json.text,json.code?1:2); + var inputid = $('input[value="'+json.eid+'"]').parent('.ap-one'); + if(json.code){ + truei++; + inputid.removeClass('checkbox-danger').addClass('checkbox-success'); + }else{ + falsei++; + inputid.removeClass('checkbox-success').addClass('checkbox-danger'); + } + //输出最终结果 + if(strArr.length == truei*1 + falsei*1){ + //再执行,将最终的结果保存到对应的投放ID内 + var urls = M.url.own_name + 'c=ajax&a=dolenumber&lang=' + M.lang; + // 将缓存表内保存的排期成功数据保存到表内 + $.post(urls,data,function(dajson){ + var text = '本次广告投放计划共涉及('+strArr.length+')个广告位,排期成功的('+truei+')个广告位,排期失败的('+falsei+')个广告位。', + falseicode = falsei == 0?true:false; + if(dajson.code == false){ + falseicode = false; + text += dajson.text; + } + //同步给排期成功的字段 + if(dajson.code) $('input[name="l_enumber"]').val(dajson.idstr); + //信息反馈页面 + $self.addappend(scrollable_this,dajson.text,dajson.code?0:2); + $self.addappend(scrollable_this,text,0); + $self.alerthtml(falseicode,text); + scrollable_this.asScrollable('scrollTo','vertical','100%'); + },'json'); + } + },'json'); + }); + }, + alerthtml:function(bool,text){ + var color = bool?'alert-success':'alert-danger', + url = M.url.own_name + 'c=table_on&a=dolaunch', + alert = ''; + $('.launch_affix_save').remove(); + $('form').append(alert); + $(document).on('click','.launchlist',function(e){ + window.location.replace(url); + }) + }, + addappend:function(_this_,text,code){ + var color = ['blue-600','green-600','red-600'], + icon = ['wb-bell','wb-check','wb-close'], + litext = '
  • ' + text + '
  • '; + $('.launchshow').append(litext); + _this_.asScrollable('scrollTo','vertical','100%'); + }, + scrollable:function(_this_){ + M['plugin']['asscrollable']=[ + // M['url']['static2_vendor']+'asscrollable/asScrollable.min.css', + M['url']['static2_vendor']+'asscrollbar/jquery-asScrollbar.min.js', + M['url']['static2_vendor']+'asscrollable/jquery-asScrollable.min.js', + ]; + $.include(M['plugin']['asscrollable'], function () { + _this_.asScrollable('destroy'); + _this_.asScrollable({ + namespace: "scrollable", + contentSelector: "> [data-role='content']", + containerSelector: "> [data-role='container']" + }); + }); + }, + scrollToEnd:function(){ + //滚动到底部 + var h = $(document).height()-$(window).height(); + $(document).scrollTop(h); + } + }; + + //外部入口 + $.fn.aplist = function () { + var naplan = new applan(); + if( !APPFUN.isEmpty($('input[name="nextstep"]').val()) ) { + $('#tables-list').on( 'draw.dt', function ( e,settings ) { + naplan.scrollToEnd(); + }) + naplan.nextstep(); + } + }; + //启动 + $(".add_ap_list").aplist(); + +})(jQuery); diff --git a/admin/templates/js/elevator.js b/admin/templates/js/elevator.js new file mode 100644 index 0000000..0a60492 --- /dev/null +++ b/admin/templates/js/elevator.js @@ -0,0 +1,18 @@ +//用来阻止广告位重复添加的 +(function($){ + + //内部初始化入口 + var appmap = function(){ + + }; + + //扩展方法 + appmap.prototype = { + + }; + + //外部入口 + $.fn.maps = function () { + + }; +})(jQuery); diff --git a/admin/templates/js/own.js b/admin/templates/js/own.js new file mode 100644 index 0000000..e052bfa --- /dev/null +++ b/admin/templates/js/own.js @@ -0,0 +1,311 @@ +/*! + * M['weburl'] 网站网址 + * M['lang'] 网站语言 + * M['tem'] 模板目录路径 + * M['user_name'] 页面登录用户名 + * met_prevarrow, + met_nextarrow slick插件翻页按钮自定义html + * M['device_type'] 客户端判断(d:PC端,t:平板端,m:手机端) + * M['n'] 当前模块名称 + * M['c'] 当前类 + * M['a'] 当前方法 + * M['langtxt'] 当前语言文字 + * M['langset'] 当前后台语言 + * M['anyid'] 当前模块id + * M['met_editor'] 当前系统编辑器名称 + * M['met_keywords'] 页面关键词 + * M['url']['admin'] 后台文件夹路径 + * M['url']['static'] + * M['url']['static_vendor'] + * M['url']['static2'] + * M['url']['static2_vendor'] + * M['url']['static2_plugin'] + * M['url']['uiv2'] 模板框架v2路径 + * M['url']['uiv2_css'] + * M['url']['uiv2_js'] + * M['url']['app'] 应用文件夹路径 + * M['url']['pub'] 后台模块公用文件夹路径 + * M['url']['epl'] 后台模块公用示例文件夹路径 + * M['url']['ui'] 应用前后台公用UI文件app/system/include/piblic/ui/里面 + * M['url']['own_form'] 当前页面程序地址 + * M['url']['own_name'] 当前模块地址 + * M['url']['own'] 当前模块后台路径 + * M['url']['own_tem'] 当前页面模板路径 + * M['url']['api'] app站点地址 + * M['url']['editor'] 当前编辑器应用文件夹路径 + */ +$(function(){ + var myDate=new Date().getTime() + $.include(M.url.own_tem + 'js/appcheck.min.js?'+myDate); + + $.ajax({ + type: "GET", + url: M.url.own_name + 'c=ajax&a=doajaxcl&lang=' + M['langset'], + dataType: "jsonp", + async: false + }).done(function (data) { + CL = data; + }); + + var appfun = function () { + var $self = this; + //有序表处理 + $.getJSON(M.url.own_name + 'c=ajax&a=dosequence&lang=' + M['langset'],{},function(json){}); + //select2 + if($('[data-plugin="select2"]').length) $self.select2(true); + //排期广告位选择 + if($('.add_ap_list').length) $.include(M.url.own_tem + 'js/applan.js?'+myDate); + //表格重绘后回调 + $('#tableslist').on( 'draw.dt', function ( e,settings ) { + if($('[data-plugin="alertify"]').length) $self.select2(false); + }) + //单个时间初始化 + if($('[data-plugin="alonetime"]').length) $self.alonetime(); + //时间区段选择 + if($('[data-plugin="datetosearch"]').length) $self.datepicker(); + //导出功能 + $(document).on('click','.backups',function (event) { + var my = $(this); + event.preventDefault(); + my.parents('form').metSubmit(0); + var obj = my.parents("form").serialize(),href = my.data('url'),veaps = $('select[name="veaps"]').val(); + // 单独给get传递增加veaps的值 + if(!$self.isEmpty(veaps)) obj += '&jsadd_veaps=' + veaps.join(','); + window.location.href = href + '&' + obj; + }) + //表格底部自定义按钮 + $(document).on('click','[table-zdybtn]',function (event) { + var my = $(this), + $form = my.parents('form'), + typestr = my.data('submit_type'); + event.preventDefault(); + $self.ownsubmit($form,typestr); + if(my.data('plugin') != 'alertify'){ + $form.submit(); + return true; + } + }) + //排序功能 + if($('a.orderby-link').length) $self.orders(); + //状态更改 + // http://bsify.admui.com/alertify/ 中文说明 + $(document).on('click','.btn-cursor-pointer', function () { + var self = $(this); + $.include(M['url']['static2_vendor'] + 'alertify/alertify.js', function () { + alertify + .okBtn("确定") + .cancelBtn("取消") + .confirm('确定更改状态吗?',function () { + $.getJSON(self.data('href'), function(json){ + window.location.reload(); + }) + }) + }) + }); + }; + + appfun.prototype = { + isEmpty: function (val) { + switch (typeof val) { + case 'undefined': + return true; + case 'string': + if (val.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) + return true; + break; + case 'boolean': + if (!val) + return true; + break; + case 'number': + if (0 === val || isNaN(val)) + return true; + break; + case 'object': + if (null === val || val.length === 0) + return true; + for (var i in val) { + return false; + } + return true; + } + return false; + }, + select2:function(drawdt){ + // drawdt true 执行默认操作 false 不执行 + var $self = this,select = []; + //选择器 + M['plugin']['select2'] = [ + M['url']['static2_vendor'] + 'select2/select2.min.css', + M['url']['static2_vendor'] + 'select2/select2.full.min.js', + M['url']['static2_vendor'] + 'select2/i18n/zh-CN.js', + ]; + $.include(M['plugin']['select2'],function(){ + $('[data-plugin="select2"]').each(function(indexs,item){ + var _self = $(this), + defaults = _self.data('default'), + select2url = _self.data('select2-url') + '&'+ myDate; + + select[indexs] = _self.select2({ + placeholder: '输入搜索内容', //提示语 + ajax: { + url: select2url, + dataType: 'jsonp', + delay: 500, + data: function (params) { + return { + querys: params.term, //search term + tname: _self.data('tname'), //指定简短表 + fiend: _self.data('fiend'), //指定字段值 + allnone: _self.data('allnone'), //是否只显示应用的值 + source: _self.data('source'), //查看来源标记 + condition: _self.data('condition') //查询限制条件 + }; + }, + results: function (data, page) { + return {results: data.results}; + } + } + }); + + //默认值处理 + if(!$self.isEmpty(defaults) && drawdt == true){ + $.getJSON( + select2url, + { + tname: _self.data('tname'), //指定简短表 + fiend: _self.data('fiend'), //指定字段值 + allnone: _self.data('allnone'), //是否只显示应用的值 + source: _self.data('source'), //查看来源标记 + condition: _self.data('condition'), //查询限制条件 + default: defaults, //默认值 + division: _self.data('division') //默认值分隔符 + }, + function(obj){ + $.each(obj.results, function(index, ele) { + $.each(ele.children, function(indexop, eleop) { + var option = new Option(eleop.text, eleop.id, true, true); + select[indexs].append(option).trigger('change'); + }) + }); + } + ) + } + + }); + }); + }, + datepicker:function(){ + var $self = this; + M['plugin']['datetimepicker']=[ + M['url']['epl']+'time/jquery.datetimepicker.css', + M['url']['epl']+'time/jquery.datetimepicker.js' + ]; + $.include(M['plugin']['datetimepicker'], function () { + var starttime = $('#date_timepicker_start'), + endtime = $('#date_timepicker_end'); + starttime.datetimepicker({ + lang:M.synchronous=='cn'?'ch':'en', + timepicker:starttime.attr("data-day-type")==2?true:false, + format:starttime.attr("data-day-type")==2?'Y-m-d H:i:s':'Y-m-d', +// value:starttime.val()?starttime.val():'', +// onShow:function( ct ){ +// this.setOptions({ +// maxDate:endtime.val()?endtime.val():false +// }) +// }, + onSelectDate:function(ct,$i){ + $self.tableaajx(starttime); + } + }); + endtime.datetimepicker({ + lang:M.synchronous=='cn'?'ch':'en', + timepicker:endtime.attr("data-day-type")==2?true:false, + format:endtime.attr("data-day-type")==2?'Y-m-d H:i:s':'Y-m-d', +// value:endtime.val()?endtime.val():'', +// onShow:function( ct ){ +// this.setOptions({ +// minDate:starttime.val()?starttime.val():false +// }) +// }, + onSelectDate:function(ct,$i){ + $self.tableaajx(endtime); + } + }); + }) + }, + alonetime:function(){ + var $self = this; + M['plugin']['datetimepicker']=[ + M['url']['epl']+'time/jquery.datetimepicker.css', + M['url']['epl']+'time/jquery.datetimepicker.js' + ]; + $.include(M['plugin']['datetimepicker'], function () { + var alonetime = $('[data-plugin="alonetime"]'); + alonetime.datetimepicker({ + lang:M.synchronous=='cn'?'ch':'en', + timepicker:alonetime.attr("data-day-type")==2?true:false, + format:alonetime.attr("data-day-type")==2?'Y-m-d H:i:s':'Y-m-d', + onSelectDate:function(ct,$i){ + $self.tableaajx(alonetime); + } + }); + }); + }, + tableaajx:function(timedom){ + if(typeof datatable != 'undefined'){ + var $this_datatable=timedom.parents('.dataTable'), + datatable_index=$this_datatable.index('.dataTable'); + if(datatable_index<0) datatable_index=0; + datatable[datatable_index].ajax.reload(); + } + }, + orders:function(){ + var $self = this; + $(document).on('click','a.orderby-link',function (event) { + var $this = $(this), arrow = $this.find(".orderby-arrow"); + if(arrow.length){ + if($this.find(".desc").length){ + $self.orderby($this,'asc'); + }else{ + //还原 + $self.orderby($this,''); + } + }else{ + $self.orderby($this,'desc'); + } + }); + }, + orderby(dom,type){ + var $self = this; + //清楚所有排序 + $("a.orderby-link").find(".orderby-arrow").remove(); + $("a.orderby-link").next().val(''); + //操作当前排序 + if(type) dom.append(''); + dom.next().val(type); + $self.tableaajx(dom); + }, + ownsubmit:function($form,typestr){ + // 插入submit_type字段 + if($form.find('[name="submit_type"]').length) $form.append(''); + $form.find('[name="submit_type"]').val(typestr); + // 插入表格的all_id字段 + if($form.find('.dataTable').length){ + var $table = $form.find('.dataTable'), + $checkbox = $table.find('tbody input[type="checkbox"][name="id"]:checked'), + all_id=''; + $checkbox.each(function(index, el) { + all_id += all_id?','+$(this).val():$(this).val(); + }) + if(!$form.find('[name="all_id"]').length) $form.append(''); + $form.find('[name="all_id"]').val(all_id); + } + } + }; + + APPFUN = new appfun(); + + //缓存 + $.ajaxSetup({cache:false}); +}); diff --git a/admin/templates/keylist.php b/admin/templates/keylist.php new file mode 100644 index 0000000..642236a --- /dev/null +++ b/admin/templates/keylist.php @@ -0,0 +1,72 @@ + + +
    +
    + + {$data.nav_sub} +
    +

    {$data.met_title}

    +
    +
    +
    +
    + +
    + 巡查人员密钥验证凭证 +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    + + 简短文字描述备注。 +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + \ No newline at end of file diff --git a/admin/templates/launch.php b/admin/templates/launch.php new file mode 100644 index 0000000..3dbaa58 --- /dev/null +++ b/admin/templates/launch.php @@ -0,0 +1,117 @@ + + +
    +
    + + {$data.nav_sub} +
    +

    订单信息:{$data.data.h_cid}({$data.data.l_hnumber})

    +
    +
    +
    + + 主要用来做标记区别 +
    +
    + +
    +
    +
    + + + + +
    + 开始时间 + + 结束时间 + +
    + 广告时间段不能超过订单时间段 +
    +
    + +
    +
    +
    + {$data.para.l_schedule_radio} +
    +
    +
    +
    +
    + {$data.para.l_type_radio} +
    +
    +
    +
    +
    + + 简短文字描述备注。 +
    +
    +

    广告位选择

    +
    + +
    +
    +
    + + + + + + + + + + {$data.table.search} +
    + + {$data.table.thead} + + + + + + {$data.table.tfoot} +
    +
    +
    +
    +
    + +
    +

    广告投放结果

    +
    +
    +
    +
      +
      +
      +
      +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/admin/templates/table.php b/admin/templates/table.php new file mode 100644 index 0000000..2529590 --- /dev/null +++ b/admin/templates/table.php @@ -0,0 +1,26 @@ + + +
      + + {$data.nav_sub} +
      + {$data.top.tips} + + {$data.table.search} +
      + + {$data.table.thead} + + + + + + {$data.table.tfoot} +
      +
      +
      +
      + \ No newline at end of file diff --git a/admin/templates/uplaunch.php b/admin/templates/uplaunch.php new file mode 100644 index 0000000..723f097 --- /dev/null +++ b/admin/templates/uplaunch.php @@ -0,0 +1,22 @@ + + +
      +
      + + {$data.nav_sub} +
      +

      {$data.met_title}

      + +
      +
      +
      + +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/admin/templates/village.php b/admin/templates/village.php new file mode 100644 index 0000000..748fa60 --- /dev/null +++ b/admin/templates/village.php @@ -0,0 +1,101 @@ + + +
      +
      + + {$data.nav_sub} +
      +

      {$data.met_title}

      +
      +
      +
      + +
      +
      +
      +
      +
      + {$data.para.v_type_radio} +
      +
      +
      +
      +
      +
      + + + +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + + 简短文字描述备注。 +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/admin/templates/workers.php b/admin/templates/workers.php new file mode 100644 index 0000000..1c49b73 --- /dev/null +++ b/admin/templates/workers.php @@ -0,0 +1,50 @@ + + +
      +
      + + {$data.nav_sub} +
      +

      {$data.met_title}

      +
      +
      +
      + {$data.para.radio} +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + + 可备注多个联系电话,输入完成一个回车后再输入下一个 +
      +
      +
      +
      +
      + + 简短文字描述备注。 +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/admin/uninstall.class.php b/admin/uninstall.class.php new file mode 100644 index 0000000..9428252 --- /dev/null +++ b/admin/uninstall.class.php @@ -0,0 +1,168 @@ +appno = $_M['form']['no']; //获取NO + + //需要删除的文件名 + $this->del_dirs[] = self::firstsql(); + $this->del_dirs[] = $this->m_name?'app/app/'.$this->m_name:''; + + //判断是否允许卸载 + if(file_exists(PATH_ALL_APP. $this->m_name."/config/uninstall.lock")){ + turnover("{$_M['url']['own_form']}a=doindex","禁止卸载"); + } + + } + + public function dodel() { + global $_M; + //删除一些提前删除的内容 + + //删除自定义表 + self::zdysql(); + + //删除固定的app表 + self::appsql(); + + //删除应用文件 +// $this->delfile(); + } + + //优先执行代码[推荐] + private function firstsql() { + global $_M; + //查询应用的文件夹 + $mname = self::sqlone('applist'); + $this->m_name = $mname['m_name']; + //查询应用是否使用栏目 + $file = self::sqlone('column'," module='{$this->appno}' "); + return $file['foldername']; + } + + //删除自定义表 + private function zdysql() { + global $_M; + //公用表 + $cloud = ['cloud_config']; + //自定义表 + $table = file_get_contents(PATH_ALL_APP.$this->m_name.'/config/table'); + $table = stringto_array($table,','); + //自定义表删除 + $zdy = array_diff($table,$cloud); + $zdys = []; + foreach ($zdy as $val){ + $zdys[] = $this->m_name.'_'.$val; + } + //删除公用表对应应用数据,并查询是否符合删除表的要求 + foreach ($cloud as $val) { + //判断是否要删除 + if(in_array($val, $table)) $zdys[] = self::cloud($val); + } + //删除表 + foreach ($zdys as $val){ + self::deltablesql($val); + } + //删除配置文件 + del_table(arrayto_string($zdys,'|')); + } + + //删除固定的app表 + private function appsql() { + global $_M; + //删除栏目接口表 + self::delsql('ifcolumn'); + + //删除应用生成文件所调用事件的信息表 + self::delsql('ifcolumn_addfile'); + + //删除会员侧导航信息表 + self::delsql('ifmember_left'); + + //删除应用插件表 + self::delsql('app_plugin'); + + //删除网站后台栏目信息表 + $where = "field='{$this->appno}'"; + self::delsql('admin_column',$where); + + //删除网站栏目信息表 + $where = "module='{$this->appno}'"; + self::delsql('column',$where); + + //删除语言表 + $where = "app='{$this->appno}'"; + self::delsql('language',$where); + + //删除应用注册表 + self::delsql('applist'); + } + + //删除应用文件夹 + private function delfile() { + foreach ($this->del_dirs as $dir){ + if(file_exists(PATH_WEB.$dir) && $dir != null) deldir(PATH_WEB.$dir); + } + } + + //对公用配置表卸载处理 + private function cloud($tname) { + global $_M; + $where = "m_name='{$this->m_name}'"; + if(self::sqlcounter($tname,$where) > 0){ + self::delsql($tname,$where); + } + if(self::sqlcounter($tname) == 0){ + return $tname; + } + } + + //公共查询方法 + private function sqlone($tname,$where = '') { + global $_M; + $table = $_M['table'][$tname]; + if(!$where){ + $where = "no='{$this->appno}'"; + } + return DB::get_one("select * from {$table} where {$where}"); + } + + //公共查询方法 + private function sqlcounter($tname,$where = '') { + global $_M; + $table = $_M['table'][$tname]; + if($where){ + $where = 'WHERE '.$where; + } + return DB::counter("{$table} {$where}"); + } + + //公共删除数据 + private function delsql($tname,$where = '') { + global $_M; + $table = $_M['table'][$tname]; + if(!$where){ + $where = "no='{$this->appno}'"; + } + DB::query("DELETE FROM {$table} WHERE {$where}"); + } + + //公共删除表 + private function deltablesql($tname) { + global $_M; + $table = $_M['table'][$tname]; + DB::query("DROP TABLE `{$table}`"); + } + +} +?> \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..b561ac1 Binary files /dev/null and b/icon.png differ diff --git a/include/class/appadmin.class.php b/include/class/appadmin.class.php new file mode 100644 index 0000000..4856960 --- /dev/null +++ b/include/class/appadmin.class.php @@ -0,0 +1,454 @@ +false,'add'=>false,'del'=>false]; + + // 调用类 + public $tsql; + public $cloud; + + # 初始化 + public function __construct() { + global $_M,$_YW; + parent::__construct(); + + //调试使用 + ini_set("display_errors", "On"); + error_reporting(E_ERROR); + + $this->tsql = load::own_class('tsql','new'); + self::cmp_load(); + self::adminop(); + $this->cloud = load::own_class('cloud','new'); + } + + use appcmp; + + //调试使用 + public function bug() { + $this->destruct = false; + } + + # 后台导航 + /* + * @$select string 最终菜单选项 + * @$title string 当前页面标题 + */ + public function appnav($select = '',$title = '') { + global $_M, $_YW; + if(is_array($select)) list($select,$title) = $select; + //当前的CA组合 + $select = empty($select)?$_M['form']['c'].'__'.$_M['form']['a']:$select; + //导航公用参数 + $glpara = [ + 'navon'=> $_M['form']['navon'], + ]; + + /* + * 导航规则 + */ + //key 为c值和a值组成,可实现自动选择 + //val 第一位是导航名称,第二位为传递的参数(array) 若第三位跳转的外链 + $nav = [ + 'dzadsod__dodzadsod' => [ + ['统计中心'], + [ + 'dzadsod__dodzadsod' => ['总计界面'], + 'table_on__dovillages' => ['小区统计'], + 'table_on__doelevators' => ['广告位统计'], + 'table_on__doschedule' => ['排期查询'], + ] + ], + 'table_on__docontract' => [ + ['运营中心'], + [ + + 'table_on__docontract' => ['订单管理'], + 'table_on__dolaunch' => ['投放计划'], +// 'info_on__douplaunch' => ['调整投放'], + 'table_on__docustomer' => ['合作企业'], + 'table_on__doworkers' => ['企业联系人'], + 'table_on__dokeylist' => ['巡查人员'], + ] + ], + + 'table_on__doelevator' => [ + ['资源管理'], + [ + 'table_on__doelevator' => ['广告位'], + 'table_on__dovillage' => ['合作小区'] + ] + ], + + 'config__doindex' => [ + ['配置参数'], + [ + 'config__doindex' => ['基础配置'], + 'table_on__dopara' => ['参数列表'] + ] + ], + 'index__doindex' => [ + ['更新检测',['check' => 1] ] + ] + ]; + + $i = 0; + foreach ($nav as $key => $val) { + list($info,$sub) = $val; + //判断是否执行当前二级目录 + $li = ''; + if(is_array($info) && ($select == $key || array_key_exists($select, $sub)) ){ + //执行二级目录的操作 + $sub = array_merge([$key => $info ],$sub); + foreach ($sub as $skey => $sval){ + if($key == $skey) $sval = array_replace($info,$sval); + //执行一级目录的操作 + list($sname,$surl) = self::nav_para($skey,$sval,$glpara); + //二级选项和页面title + $active = ''; + if($select == $skey) { + $select = $key; + $active = 'active'; + $this->input['met_title'] = empty($title)?$sname:$title; + } + //二级导航HTML + $li .= ""; + } + $this->input['nav_sub'] = empty($li)?'':'
      '; + } + + //执行一级目录的操作 + if(!is_array($info)) $info = $val; + list($name,$url) = self::nav_para($key,$info,$glpara); + //填充HTML + nav::set_nav($i, $name, $url); + $select_nav[$key] = $i; + + //页面title + if($select == $key && empty($this->input['met_title'])) $this->input['met_title'] = empty($title)?$name:$title; + $i++; + } + + //指定当前方法属于哪个主导航 + if(array_key_exists($select, $nav)) nav::select_nav($select_nav[$select]); + } + + //导航NAME和URL + private function nav_para($key,$info,$glpara){ + global $_M,$_YW; + //合并c和a + list($c,$a) = stringto_array($key,'__'); + //合并默认参数值 + $arr = array_merge(['c' => $c, 'a' => $a ],$glpara); + list($name,$para,$links) = $info; + //判断是否有设置单独的参数,有则增加 + if(is_array($para)) $arr = array_merge($arr,$para); + //生成URL + $url = empty($links)?$_M['url']['own_name']:$links; + return [$name, self::http_build_query($url,$arr)]; + } + + #URL上c的值 a的值 + #$appshow 全局模板文件,指整个文件的模板 + public function point($c,$a,$appshow = '') { + global $_M,$_YW; + $this->u_urlc = $c; + $this->u_urla = $a; + if(!empty($appshow)) $this->appshow = 'app/'.$appshow; + } + + #URL处理 + #$appshow 单独定义模板 某个方法内定义 + public function appurl($tname = '',$query = [],$appshow = '') { + global $_M,$_YW; + //数据库表简写 + $this->tname = empty($tname)?self::tname():$tname; + //URL参数 + if(!is_array($query)) $query = [$query]; + $query['tname'] = $this->tname; + $this->u_para = '&'.http_build_query($query); + //URL + $this->input['url'] = [ + 'action' => $_M['url']['own_name']."c={$this->u_urlc}&a={$this->u_urla}".$this->u_para, // 表单提交URL + 'ajaxurl' => $_M['url']['own_name']."c=table_ajax&a={$this->u_urla}".$this->u_para, // table数据获取URL + 'addlist' => $_M['url']['own_name'].'c=table_ajax&a=do_table_add_list'.$this->u_para, // table新增行URL + 'backup' => $_M['url']['own_name'].'c=backups&a=doindex'.$this->u_para, // table备份URL + 'select' => $_M['url']['own_name'].'c=select&a=doselect' // 下拉选择器 + ]; + $this->input['tname'] = $this->tname; + $_YW['url'] = $this->input['url']; + if(!empty($appshow)) $this->appshow = 'app/'.$appshow; + } + + //权限 + private function adminop() { + global $_M,$_YW; + $admin_op = background_privilege(); + $adminop = array_filter(explode('-',$admin_op['admin_op'])); + //1查看 【不勾选任何的操作即可实现】 + //2编辑 不含删除 【不勾选删除权限即可实现】 + //3不限制权限 【全部勾选即可】 + if(in_array('metinfo', $adminop)){ + $this->adop = ['met'=>true,'add'=>true,'del'=>true]; + }else{ + if(in_array('add', $adminop) || in_array('editor', $adminop)){ + $this->adop['add'] = true; + } + if(in_array('del', $adminop)){ + $this->adop['del'] = true; + } + if($this->adop['add'] && $this->adop['del']){ + $this->adop['met'] = true; + } + } + $_YW['aop'] = $this->adop; + } + + //添加设置参数HTML + public function setparahtml($ptype = 0,&$html) { + global $_M,$_YW; + $addparaurl = $_M['url']['own_name'].'c=table_on&a=dopara&p_type='.$ptype; + $html .= '设置选项'; + } + + //参数单选组成 + public function para_radio($para,$name,$checked,&$html,$exists = false) { + global $_M,$_YW; + $html = ''; + $first = 'data-checked="'.$checked.'" required data-fv-notEmpty-message="不能为空"'; + foreach ($para as $key => $val) { + if($exists) { + list($p_name,$p_value,$p_text) = $val; + }else{ + extract($val); + } + $html .= '
      + + + '.$p_text.' +
      '; + $first = ''; + } + return $this; + } + + //参数单选组成 + public function para_checkbox($para,$name,$checked,&$html,$exists = false) { + global $_M,$_YW; + $html = ''; + $first = 'data-checked="'.$checked.'" required data-fv-notEmpty-message="不能为空" '; // data-delimiter="," 因为暂时无效 + foreach ($para as $key => $val) { + if($exists) { + list($p_name,$p_value,$p_text) = $val; + }else{ + extract($val); + } + $html .= '
      + + + '.$p_text.' +
      '; + $first = ''; + } + return $this; + } + + //参数处理 + public function translate($p_type = 0) { + global $_M,$_YW; + $para = self::paralist($p_type); + return array_combine(array_column($para,'p_value'), array_column($para,'p_name')); + } + + //小区名称 + public function villagelist($id,$key = 'v_name') { + global $_M,$_YW; + $village = $this->tsql->table('village')->where(['id' => $id])->one(); + return $village[$key]; + } + + //公司名称 + public function customerlist($id,$key = 'c_allname') { + global $_M,$_YW; + $customer = $this->tsql->table('customer')->where(['id' => $id])->one(); + return $customer[$key]; + } + + //相关人员 + public function workerslist($id,$key = 'w_name') { + global $_M,$_YW; + $workers = $this->tsql->table('workers')->where(['id' => $id])->one(); + return $key == false?$workers:$workers[$key]; + } + + //返回广告位对照地址 + public function e_address($elevator) { + global $_M,$_YW; + //楼号 + $e_bno = self::paralist(['p_type' => 3, 'p_value' => $elevator['e_bno'] ]); + //单元号 + $e_uno = self::paralist(['p_type' => 4, 'p_value' => $elevator['e_uno'] ]); + //电梯号 + $e_eno = self::paralist(['p_type' => 5, 'p_value' => $elevator['e_eno'] ]); + //广告位置 + $e_aps = self::paralist(['p_type' => 0, 'p_value' => $elevator['e_aps'] ]); + //小区 + $e_vid = self::villagelist($elevator['e_vid']); + return "({$elevator['e_number']})".$e_vid.$e_bno['p_name'].$e_uno['p_name'].$e_eno['p_name'].$e_aps['p_name']; + } + + //字段颜色 + public function state_color($state,$array = []) { + global $_M,$_YW; + $color = ['red-600','green-600','purple-600']; + $str = count($array) > 0?$array:['无效','有效']; + return ''.$str[$state].''; + } + + //字体颜色 + public function str_color($state,$str,$weight = 'unset') { + global $_M,$_YW; + $color = ['red-600','green-600','cyan-600','blue-600']; + return ''.$str.''; + } + + //标签形式的分割显示 + public function tab_tokenfield($ver,$type = 0,$decollator = ',',$length = 0) { + global $_M,$_YW; + $class = ['tag-default','tag-primary','tag-warning']; + $array = stringto_array($ver,$decollator); + $i = 0; + foreach ($array as $val) { + $html .= ''.$val.' '; + $i++; + if($length > 0 && $length == $i) break; + } + return $html; + } + + //广告位的合同编号 + public function e_state($title) { + global $_M,$_YW; + $class = ['tag-danger','tag-primary']; + $title = $title > 0?'已租赁':'空置'; + $type = $title > 0?1:0; + return ''.$title.' '; + } + + //参数的对应值获取 + public function paralist($p_type = 0) { + global $_M,$_YW; + $this->tsql->table('para') + ->where(is_array($p_type)?$p_type:['p_type' => $p_type]) + ->order('p_order DESC'); + + return is_array($p_type)?$this->tsql->one():$this->tsql->all(); + } + + //转化字符串形式 + public function strchange($strarr = []) { + global $_M,$_YW; + foreach($strarr as $val) { + if($val != null) $idstr[] = "'{$val}'"; + } + return arrayto_string($idstr,','); + } + + //广告位状态变更 + public function type_onoff($field,$value,$id,$array = ['无效','有效']) { + global $_M,$_YW; + $color = ['tag-danger','tag-success']; + $url = $_M['url']['own_name']."c=table_off&a=doindex&submit_type=typeonoff&field={$field}&all_id={$id}&tname={$this->tname}&method=ajax"; + return ''.$array[$value].''; + } + + //处理多选的ID + public function where_id(&$where) { + global $_M,$_YW; + $allid = array_filter(stringto_array($_M['form']['all_id'],',')); + if($allid){ + if($where) $where .= " AND "; + $idstr = self::strchange($allid); + switch ($this->tname) { + case 'elevators': + $where .= " el.e_number IN({$idstr}) "; + break; + case 'villages': + $where .= " vi.id IN({$idstr}) "; + break; + default: + break; + } + } + } + + // 对现有广告位进行裂变,已经不再需要 + public function fission() { + global $_M,$_YW; + //获取所有广告位 + $elevator = $this->tsql->table('elevator')->all(); + //划定什么位置裂变成什么 1裂变出2 + $e_aps = [ + '1' => 4, + '2' => 5, + '3' => 6, + ]; + + //拼装数据 + foreach ($elevator as $val) { + //计算广告位编号 + $neweaps = $e_aps[$val['e_aps']]; + self::e_number($val['e_number'],$neweaps); + $field = [ + 'e_number' => $val['e_number'], + 'e_vid' => $val['e_vid'], + 'e_bno' => $val['e_bno'], + 'e_uno' => $val['e_uno'], + 'e_eno' => $val['e_eno'], + 'e_aps' => $neweaps, + 'e_size' => $val['e_size'], + 'e_enable' => $val['e_enable'], + 'e_label' => $val['e_label'], + 'e_text' => $val['e_text'] + ]; + + $this->tsql->table('elevator') + ->field($field) + ->add(); + } + } + + //对字符串处理 + public function e_number(&$num,$neweaps,$type = false) { + global $_M,$_YW; + if($type) $neweaps++; + //新的编号 + $enum = $num.$neweaps; + //验证 + $elevator = $this->tsql->table('elevator')->where(['e_number' => $enum ])->one(); + if($elevator == false){ + $num = $enum; + }else{ + self::e_number($num,$neweaps,true); + } + } + +} + +?> \ No newline at end of file diff --git a/include/class/appweb.class.php b/include/class/appweb.class.php new file mode 100644 index 0000000..7444d57 --- /dev/null +++ b/include/class/appweb.class.php @@ -0,0 +1,365 @@ +time = time(); + $this->datetime = self::data_time($this->time); + $this->tsql = load::own_class('tsql','new'); + $this->cloud = load::own_class('cloud','new'); +// self::basics(); + + ini_set("display_errors", "On"); + error_reporting(E_ERROR); + } + + use appcmp; + + //生成CSS + public function metcss() { + global $_M,$_YW; + $metcss = PATH_APP_FILE.'web/templates/met/css/metinfo.css'; + if(!file_exists($metcss)) self::merge_css(); + } + + //前台常用信息 + protected function basics() { + global $_M,$_YW; + $this->input['appcore'] .= ' data-m_name="'.$this->m_name.'" '; + $this->input['appcore'] .= ' data-own_name="'.$_M['url']['own_name'].'" '; + } + + //合同内容 + public function postdata($type,$arr) { + global $_M, $_YW; + //清理缓存 + $this->postdata = []; + $this->tem_id = ''; + //微信模板 + switch ($type) { + case 1: + //预约到期提醒 + //模板ID + $this->tem_id = $_YW['c']['tem_ida']; + //内容 + $this->postdata = [ + //开头 提醒的内容 + 'first' => ['value' => $arr['first']['value'], 'color' => $arr['first']['color'] ], + // 合同开始日期 + 'keyword1' => ['value' => $arr['h_starttime'] ], + // 合同结束日期 + 'keyword2' => ['value' => $arr['h_endtime'] ], + //结尾 + 'remark' => ['value' => + "合同编号:{$arr['h_number']}".PHP_EOL + ."签定企业:{$arr['c_allname']}".PHP_EOL + ."相关人员:{$arr['wnamestr']}".PHP_EOL + ."提醒时间:{$this->datetime}" + ], + ]; + break; + case 2: + //合同到期提醒 + //模板ID + $this->tem_id = $_YW['c']['tem_idb']; + //内容 + $this->postdata = [ + //开头 提醒的内容 + 'first' => ['value' => $arr['first']['value'], 'color' => $arr['first']['color'] ], + // 合同编号 + 'keyword1' => ['value' => $arr['h_number'] ], + // 合同开始日期 + 'keyword2' => ['value' => $arr['h_starttime'] ], + // 合同结束日期 + 'keyword3' => ['value' => $arr['h_endtime'] ], + //结尾 + 'remark' => ['value' => + "签定企业:{$arr['c_allname']}".PHP_EOL + ."相关人员:{$arr['wnamestr']}".PHP_EOL + ."通知时间:{$this->datetime}" + ], + ]; + break; + case 3: + //汇总数据通知 + //模板ID + $this->tem_id = $_YW['c']['tem_idc']; + //内容 + $this->postdata = [ + //开头 提醒的内容 + 'first' => ['value' => '合同提醒汇总结果,请登录后台查看详情', 'color' => '#BDBDBD'], + // 合同编号 + 'keyword1' => ['value' => '山东梯美广告有限公司' ], + // 合同开始日期 + 'keyword2' => ['value' => $this->datetime ], + // 合同结束日期 + 'keyword3' => ['value' => array_sum($arr) ], + //结尾 + 'remark' => ['value' => + "定时提醒:{$arr['daya']}".PHP_EOL + ."三天到期:{$arr['dayb']}".PHP_EOL + ."今天到期:{$arr['dayc']}".PHP_EOL + ."今天投放开始总数:{$arr['dayd']}" + ], + ]; + break; + + default: + break; + } + return $this; + + } + + + //微信模板消息发送wesend + public function openid($openid = '') + { + global $_M, $_YW; + $openid .= ','.$_YW['c']['openid']; + $openid = stringto_array($openid,','); + foreach ($openid as $id) { + if($id) self::temmsg($id); + } + return $this; + } + + //微信合同到期提醒 + private function temmsg($openid) + { + global $_M, $_YW; + $return = ['errcode' => -1, 'errmsg' => "系统错误,用户openid:{$openid},消息模板Tem_id:{$this->tem_id}"]; + if($openid && $this->tem_id){ + $return = $this->webase->post_template_msg($openid, $this->tem_id, '', $this->postdata); + } + $json = is_array($return)?json_encode($return,JSON_UNESCAPED_UNICODE):$return; + //发送记录 + $field = [ + 'openid' => $openid, + 'text' => $this->postdata['first']['value'], + 'content' => json_encode($this->postdata,JSON_UNESCAPED_UNICODE), + 'returntext' => $json, + 'state' => $return['errcode'] == 0?1:0, + 'exetime' => $this->datetime, + 'addtime' => $this->datetime + ]; + $this->tsql->table('welog')->field($field)->add(); + return $return; + } + + + + + + + //参数处理 + public function translate($p_type = 0) { + global $_M,$_YW; + $para = self::paralist($p_type); + return array_combine(array_column($para,'p_value'), array_column($para,'p_name')); + } + + //小区名称 + public function villagelist($id,$key = 'v_name') { + global $_M,$_YW; + $village = $this->tsql->table('village')->where(['id' => $id])->one(); + return $village[$key]; + } + + //公司名称 + public function customerlist($id,$key = 'c_allname') { + global $_M,$_YW; + $customer = $this->tsql->table('customer')->where(['id' => $id])->one(); + return $customer[$key]; + } + + //相关人员 + public function workerslist($id,$key = 'w_name') { + global $_M,$_YW; + $workers = $this->tsql->table('workers')->where(['id' => $id])->one(); + return $key == false?$workers:$workers[$key]; + } + + //返回广告位对照地址 + public function e_address($elevator) { + global $_M,$_YW; + //楼号 + $e_bno = self::paralist(['p_type' => 3, 'p_value' => $elevator['e_bno'] ]); + //单元号 + $e_uno = self::paralist(['p_type' => 4, 'p_value' => $elevator['e_uno'] ]); + //电梯号 + $e_eno = self::paralist(['p_type' => 5, 'p_value' => $elevator['e_eno'] ]); + //广告位置 + $e_aps = self::paralist(['p_type' => 0, 'p_value' => $elevator['e_aps'] ]); + //小区 + $e_vid = self::villagelist($elevator['e_vid']); + return "({$elevator['e_number']})".$e_vid.$e_bno['p_name'].$e_uno['p_name'].$e_eno['p_name'].$e_aps['p_name']; + } + + //字段颜色 + public function state_color($state,$array = []) { + global $_M,$_YW; + $color = ['red-600','green-600','purple-600']; + $str = count($array) > 0?$array:['无效','有效']; + return ''.$str[$state].''; + } + + //字体颜色 + public function str_color($state,$str,$weight = 'unset') { + global $_M,$_YW; + $color = ['red-600','green-600','cyan-600','blue-600']; + return ''.$str.''; + } + + //标签形式的分割显示 + public function tab_tokenfield($ver,$type = 0,$decollator = ',',$length = 0) { + global $_M,$_YW; + $class = ['tag-default','tag-primary','tag-warning']; + $array = stringto_array($ver,$decollator); + $i = 0; + foreach ($array as $val) { + $html .= ''.$val.' '; + $i++; + if($length > 0 && $length == $i) break; + } + return $html; + } + + //广告位的合同编号 + public function e_state($title) { + global $_M,$_YW; + $class = ['tag-danger','tag-primary']; + $title = $title > 0?'已租赁':'空置'; + $type = $title > 0?1:0; + return ''.$title.' '; + } + + //参数的对应值获取 + public function paralist($p_type = 0) { + global $_M,$_YW; + $this->tsql->table('para') + ->where(is_array($p_type)?$p_type:['p_type' => $p_type]) + ->order('p_order DESC'); + + return is_array($p_type)?$this->tsql->one():$this->tsql->all(); + } + + //转化字符串形式 + public function strchange($strarr = []) { + global $_M,$_YW; + foreach($strarr as $val) { + if($val != null) $idstr[] = "'{$val}'"; + } + return arrayto_string($idstr,','); + } + + //广告位状态变更 + public function type_onoff($field,$value,$id,$array = ['无效','有效']) { + global $_M,$_YW; + $color = ['tag-danger','tag-success']; + $url = $_M['url']['own_name']."c=table_off&a=doindex&submit_type=typeonoff&field={$field}&all_id={$id}&tname={$this->tname}&method=ajax"; + return ''.$array[$value].''; + } + + //处理多选的ID + public function where_id(&$where) { + global $_M,$_YW; + $allid = array_filter(stringto_array($_M['form']['all_id'],',')); + if($allid){ + if($where) $where .= " AND "; + $idstr = self::strchange($allid); + switch ($this->tname) { + case 'elevators': + $where .= " el.e_number IN({$idstr}) "; + break; + case 'villages': + $where .= " vi.id IN({$idstr}) "; + break; + default: + break; + } + } + } + + // 对现有广告位进行裂变,已经不再需要 + public function fission() { + global $_M,$_YW; + //获取所有广告位 + $elevator = $this->tsql->table('elevator')->all(); + //划定什么位置裂变成什么 1裂变出2 + $e_aps = [ + '1' => 4, + '2' => 5, + '3' => 6, + ]; + + //拼装数据 + foreach ($elevator as $val) { + //计算广告位编号 + $neweaps = $e_aps[$val['e_aps']]; + self::e_number($val['e_number'],$neweaps); + $field = [ + 'e_number' => $val['e_number'], + 'e_vid' => $val['e_vid'], + 'e_bno' => $val['e_bno'], + 'e_uno' => $val['e_uno'], + 'e_eno' => $val['e_eno'], + 'e_aps' => $neweaps, + 'e_size' => $val['e_size'], + 'e_enable' => $val['e_enable'], + 'e_label' => $val['e_label'], + 'e_text' => $val['e_text'] + ]; + + $this->tsql->table('elevator') + ->field($field) + ->add(); + } + } + + //对字符串处理 + public function e_number(&$num,$neweaps,$type = false) { + global $_M,$_YW; + if($type) $neweaps++; + //新的编号 + $enum = $num.$neweaps; + //验证 + $elevator = $this->tsql->table('elevator')->where(['e_number' => $enum ])->one(); + if($elevator == false){ + $num = $enum; + }else{ + self::e_number($num,$neweaps,true); + } + } + +} + +?> \ No newline at end of file diff --git a/include/class/cloud.class.php b/include/class/cloud.class.php new file mode 100644 index 0000000..f3cbe5c --- /dev/null +++ b/include/class/cloud.class.php @@ -0,0 +1,121 @@ +tsql = load::own_class('tsql','new'); + } + + /* + * 把数组转成JSON,用于ajax返回,可以用于普通json请求返回,也可以用于跨域的ajax的jsonp格式的数据请求返回。 + * @param array $back 输出字符串或数组 + * @param string $callback ajax的回调函数的名称 + */ + public function jsoncallback($back, $callback = 'callback') { + global $_M; + header('Content-type: application/x-javascript'); + $callback = $_M['form'][$callback]; + $json = json_encode($back,JSON_UNESCAPED_UNICODE); + echo $callback?$callback . '(' . $json . ')':$json; + } + + //城市信息 + public function citydata() { + global $_M,$_YW; + $dirfile = PATH_APP_FILE.'public/js/city/city.min.json'; + if (!file_exists($dirfile)){ + $citys = json_decode(file_get_contents(PATH_SYS."include/static2/vendor/select-linkage/citydata.min.json"),true); + $i = 0; + $array = []; + foreach ($citys['citylist'] as $key => $val) { + if(version_compare($_M['config']['metcms_v'],'6.2.0','>=')){ + $val['p'] = substr($val['p'],0,stripos($val['p'],'(')); + $array[$key] = $val; + }else{ + foreach ($val as $pkey => $pval) { + array_unshift($pval,['n'=>'请选择']); + if(array_level($pval) == 4){ + foreach ($pval as $akey => $aval) { + if(array_level($aval['a']) == 2) array_unshift($aval['a'],['s'=>'请选择']); + $array[$key][$pkey][$akey] = $aval; + } + //跳过 + continue; + } + $array[$key][$pkey] = $pval; + } + } + } + $citydata = ['citylist'=>$array]; + //生成缓存 + $jsonstr = json_encode($citydata,JSON_UNESCAPED_UNICODE); + load::sys_func('file'); + makefile($dirfile); + file_put_contents($dirfile, $jsonstr); + $citystr = self::jsoncallback($citydata); + }else{ + $citystr = file_get_contents($dirfile); + } + //返回信息 + echo $citystr; + } + + public function city_url() { + global $_M,$_YW; + $dirfile = PATH_APP_FILE.'public/js/city/city.min.json'; + if(file_exists($dirfile)){ + $url = $_M['url']['app']."{$_YW['n']}/public/js/city/city.min.json"; + }else{ + $url = class_exists('appadmin')?$_M['url']['own_name']."c=ajax&a=docitys":$_M['url']['own_name']."c=index&a=docitys"; + } + return $url; + } + + //计算时间相差天数 + public function summary() { + global $_M,$_YW; + $summoney = $this->tsql->table('contract')->qfield(" Sum(h_tprice) as tprice ")->where(" h_tprice IS NOT NULL ")->one(); + return [ + 'village' => $this->tsql->table('village')->count(), + 'elevator' => $this->tsql->table('elevator')->count(), + 'vfree' => $this->tsql->table_unset() + ->tables(['elevator','el'], 'LEFT JOIN') + ->tables(['launch','la'], 'ON find_in_set( el.e_number, la.l_enumber )') + ->where(" la.l_endtime < CURDATE() OR la.l_starttime > CURDATE() OR la.id IS NULL ") + ->count(" distinct e_number "), + 'vlease' => $this->tsql->table_unset() + ->tables(['elevator','el'], 'LEFT JOIN') + ->tables(['launch','la'], 'ON find_in_set( el.e_number, la.l_enumber )') + ->where(" NOT(la.l_endtime < CURDATE() OR la.l_starttime > CURDATE() ) ") + ->count(" distinct e_number "), + 'vendday' => $this->tsql->table_unset() + ->tables(['elevator','el'], 'LEFT JOIN') + ->tables(['launch','la'], 'ON find_in_set( el.e_number, la.l_enumber )') + ->where(" la.l_endtime BETWEEN CURDATE( ) AND date_add( CURDATE( ), INTERVAL 7 DAY ) ") + ->count(" distinct e_number "), + 'vprerow' => $this->tsql->table_unset() + ->tables(['elevator','el'], 'LEFT JOIN') + ->tables(['launch','la'], 'ON find_in_set( el.e_number, la.l_enumber )') + ->where(" la.l_starttime > CURDATE() ") + ->count(" distinct e_number "), + 'contract' => $this->tsql->table('contract')->count(), + 'launch' => $this->tsql->table('launch')->count(), + 'endcontract' => $this->tsql->table('contract')->where(" h_endtime < CURDATE() ")->count(), + 'endlaunch' => $this->tsql->table('launch')->where(" l_endtime < CURDATE() ")->count(), + 'customer' => $this->tsql->table('customer')->count(), +// 'workers' => $this->tsql->table('workers')->count(), + 'summoney' => intval($summoney['tprice']), + ]; + } + + + +} + +?> \ No newline at end of file diff --git a/include/class/table_theme.class.php b/include/class/table_theme.class.php new file mode 100644 index 0000000..0c931ed --- /dev/null +++ b/include/class/table_theme.class.php @@ -0,0 +1,1014 @@ +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 + ]; + } + + use tfield; + + //配置参数 + 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; + //特殊情况下的左边 + 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; + return $this; + } + + //只做两行 TH 处理 + 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{ + $datas[$val] = $this->th_head[$val]; + if(!in_array($val, $keys,true)) unset($this->th_head[$val]); + } + } + return $datas; + } + + + //表格头部 + public function thead() { + global $_M,$_YW; + $keys = []; + if(count($this->rowsth) > 0){ + extract($this->rowsth); + //获取默认数组维度也就是默认行数 + $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; + } + + } + + if($this->checkall) $this->goret['thead'] = ' + + + + + '; + + foreach ($this->th_head as $key => $val){ + $rowspanb = $rowspan; + $colspanb = ''; + if(in_array($key, $keys)){ + $rowspanb = " rowspan='1' "; + //要做循环,二层tr内th + $keydata = $datas[$key]; + foreach ($keydata as $value) { + $thead .= ''.$value.''; + } + //计算一层的宽度 + $colslevel = count($keydata); + $colspanb = " colspan='{$colslevel}' "; + } + $class = $colspanb?' class="sorting_disabled text-xs-center" ':' data-table-columnclass="text-xs-center" '; + //正常的th + $this->goret['thead'] .= ''.$val.''; + } + 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'] = ' + + + + + '; + //计算数组的维数 + 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.'
      '; + $thcol = $this->goret['thcol'] - $thcol; + $btn = arrayto_string($after,''); + $this->goret['tfoot'] .= '
      '.$btn.'
      '; + } + $this->goret['tfoot'] = ''.$this->goret['tfoot'].''; + return $this; + } + + //输出全部,需要先通过start()配置参数 + public function send_all($dvalue = 2) { + global $_M,$_YW; + return $this->thead() + ->tfoot($dvalue) + ->search() + ->send(); + } + + //输出 + public function send() { + global $_M,$_YW; + return $this->goret; + } + + //表格头部的数组信息 + public function thead_arr() { + 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; + } + + //删除 + protected function btn_del($title = '确定要删除选中的信息吗?一旦删除将不能恢复!') { + global $_M,$_YW; + 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_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); + return '
      +
      +
      '.$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']); + 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']); + return '
      +
      +
      '.$title.'
      + +
      +
      '; + } + + //参数下拉列表 + 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{ + extract($val); + } + $option .= ''; + } + return '
      +
      +
      '.$title.'
      + +
      +
      '; + } + + //输入框搜索 + 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.' + + '.$endinput.' +
      +
      '; + } + + //输入框搜索 + protected function date_time_search($start) { + global $_M,$_YW; + list($sname,$stitle,$svalue) = self::fiend_data($start); + return '
      +
      + '.$stitle.' + + '.$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]; + } + + //标题替换为排序功能 + // $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.''; + } + + //给标题增加提示 + // $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(); + //头部 TH内容替换 + $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','输入广告位编号'); + //位置 + $para = $tsql->table('para')->where(['p_type' => 0])->all(); + $this->search[] = self::para_select($para,['e_aps','位置']); + //电梯号 + $para = $tsql->table('para')->where(['p_type' => 5])->all(); + $this->search[] = self::para_select($para,['e_eno','电梯号']); + //单元号 + $para = $tsql->table('para')->where(['p_type' => 4])->all(); + $this->search[] = self::para_select($para,['e_uno','单元号']); + //楼号 + $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::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = [ + self::btn_del(), + self::btn_zdy('启用',2,'enable_on'), + self::btn_zdy('禁用',4,'enable_off',true,'确定要选中的广告位吗?一旦将无法进行排期投放!'), + ]; + $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']) + ]; + $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->btn_bool){ + $this->btn[] = [ + self::btn_del(), + self::btn_zdy('启用',2,'enableon'), + self::btn_zdy('禁用',4,'enableoff',true,'确定要禁用小区的广告位吗?一旦将无法进行排期投放!'), + ]; + $addtourl = $this->own_name_info.__FUNCTION__; + $this->btn[] = [ + '新增小区' + ]; + } + } + + // 广告合同关联表 + protected function schedule() { + global $_M,$_YW; + //不需要最后一栏 + $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'), + ]; + $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 + ]; + $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(); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = ''; + } + } + + // 合同归档 + protected function 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'), + ]; + $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 + ]; + $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']); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = [ + self::btn_del() + ]; + $addtourl = $this->own_name_info.__FUNCTION__; + $this->btn[] = [ + '录入订单合同' + ]; + } + } + + // 公司资料 + protected function 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; + + //搜索 + 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[] = [ + self::btn_del() + ]; + $addtourl = $this->own_name_info.__FUNCTION__; + $this->btn[] = [ + '新增企业' + ]; + } + } + + // 企业联系人 + protected function 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; + + //搜索 + 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[] = [ + self::btn_del() + ]; + $addtourl = $this->own_name_info.__FUNCTION__; + $this->btn[] = [ + '新增联系人' + ]; + } + } + + // 参数统计 + protected function 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'), + ]; + $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], + ['电梯编号',5], + ['小区分类',6], + ['广告类型',7] + ]; + $this->search['left'][] = self::para_select($para,['p_type','参数分类',$_M['form']['p_type']],true); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = [ + self::btn_save(), + self::btn_del() + ]; + $_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']) + ]; + $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->btn_bool){ + $this->btn[] = self::btn_del(); + } + } + + // 广告位排期选择列表 + protected function applan() { + global $_M,$_YW; + //不需要最后一栏 + $this->lastbtn = false; + $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; + + //搜索 + 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(); + //楼号 + $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' => 4])->all(); + $this->search['left'][] = self::para_select($para,['e_uno','单元号']); + //电梯号 + $para = $tsql->table('para')->where(['p_type' => 5])->all(); + $this->search['left'][] = self::para_select($para,['e_eno','电梯号']); + //位置 + $para = $tsql->table('para')->where(['p_type' => 0])->all(); + $this->search['left'][] = self::para_select($para,['e_aps','位置']); + $this->search['left'][] = self::input_search('e_number','输入广告位编号'); + //状态 +// $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = [ + self::btn_save() + ]; + $this->btn[] = [ + '已选中广告位个数:0' + ]; + } + } + + // 广告位排期统计查询 + protected function 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'), + ]; + $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']],'输入广告位编号'); + //位置 + $para = $tsql->table('para')->where(['p_type' => 0])->all(); + $this->search[] = self::para_select($para,['e_aps','位置']); + //电梯号 + $para = $tsql->table('para')->where(['p_type' => 5])->all(); + $this->search[] = self::para_select($para,['e_eno','电梯号']); + //单元号 + $para = $tsql->table('para')->where(['p_type' => 4])->all(); + $this->search[] = self::para_select($para,['e_uno','单元号']); + //楼号 + $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' => ['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->search[] = self::date_time_search(['endtime','最大结束时间']); + //状态 + $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = ''; + } + } + + // 小区统计展示 + protected function villages() { + global $_M,$_YW; + $this->table_fiend = self::tf_villages(); + $this->rowsth = [ + 'rowlevel' => 2, + 'rowdatas' => [ + //key 需要在指定的位置进行整合 + //整合后的新名称 + //被整合的字段 + 'v_enum' => ['资源总计',['v_enum','v_ebnonum','v_eunonum','v_eenonum']], + 'v_free' => [self::th_tooltip(['今天空闲或者时间区段内空闲的广告位,已去除禁用个数','top'],'闲置总计',false),['v_free','v_bno','v_uno','v_eno']] + ] + ]; + //原来的列 除掉要转为第二行的 全部要设置为2,转为一行的设置为1 + // + //将选中的数组转为二级,并给二级添加一级 + // + //查找到某些元素存放到指定数组,并在原数组上删除 + //在原数组删除的地方添加一个值 + //将新数组作为一个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_eunonum' => self::th_replace_order('v_eunonum'), + 'v_eenonum' => self::th_replace_order('v_eenonum'), + 'v_bno' => self::th_tooltip(['存在一个广告空位则所属楼号就算有空','top'],self::th_replace_order('v_bno')), + 'v_uno' => self::th_tooltip(['存在一个广告空位则所属单元就算有空','top'],self::th_replace_order('v_uno')), + 'v_eno' => self::th_tooltip(['存在一个广告空位则所属电梯就算有空','top'],self::th_replace_order('v_eno')), + ]; + $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->select2 = [ + '_fiend' => ['veaps','广告位置'], + 'placeholder' => '可选择多个广告位置', + 'fiend' => 'p_value', + 'tname' => 'para', + 'source' => 'search_para_eaps', + 'allnone' => 0 + ]; + $this->search[] = self::input_select_search_multiple(); + } + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = ''; + } + + } + + // 首页统计 + protected function 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; + + //搜索 + 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->btn_bool){ + $this->btn[] = ''; + } + + } + + //前台巡查页面 + protected function 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; + + //搜索 + 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' => 5])->all(); + $this->search[] = self::para_select($para,['e_eno','电梯']); + //单元号 + $para = $tsql->table('para')->where(['p_type' => 4])->all(); + $this->search[] = self::para_select($para,['e_uno','单元']); + //楼号 + $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' => ['l_hnumber','订单'], + 'placeholder' => '输入合同名称', + 'fiend' => 'h_number', + 'tname' => 'contract', + 'source' => 'webcontractsearch', + 'allnone' => 2 + ]; + $this->search[] = self::input_select_search(); + } + } + + // 参数统计 + protected function 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; + + //底部按钮 + if($this->btn_bool){ + $this->btn[] = [ + self::btn_del() + ]; + $addtourl = $this->own_name_info.__FUNCTION__; + $this->btn[] = [ + '新增巡查人员' + ]; + } + } + + +} diff --git a/include/class/tabledata.class.php b/include/class/tabledata.class.php new file mode 100644 index 0000000..5a82b71 --- /dev/null +++ b/include/class/tabledata.class.php @@ -0,0 +1,111 @@ +error = $query . "
      " . $error; + } else { + $this->error = ''; + } + $total = DB::counter($table, $conds, '*'); //获取总数量,计算总页数 + } else { + //用来解决sql语句复杂的情况下 无法正确计算总条数的BUG + $query = $sql . " LIMIT {$start},{$length}"; + $array = DB::get_all($query); + $error = DB::error(); + $this->error = $error?$query . "
      " . $error:0; + //总数 + $where = trim($where); + if (strtolower(substr($where, 0, 5)) != 'where' && $where) $where = "WHERE " . $where; + $countsql = " SELECT COUNT(*) FROM {$table} {$where} "; + if($multi_table) $countsql = " SELECT count(*) FROM ($sql) num "; + $result = DB::query($countsql); + $fetch_row = DB::fetch_row($result); + $total = $fetch_row[0]; + } + + /* 回传数组处理 */ + $this->rarray = array(); + $this->rarray['draw'] = $draw; //回传执行次数 + $this->rarray['recordsTotal'] = $total; //回传总数量 + $this->rarray['recordsFiltered'] = $total; //回传筛选过的总数量,暂无作用,但必须回传 + +// if(class_exists('admin') || class_exists('app')){ + $this->rarray['sql'] = $query; //返回sql语句 + $this->rarray['array'] = $array; //返回sql语句 + $this->rarray['form'] = $_M['form']; //返回sql语句 + $this->rarray['sqlse'] = $sql; //返回sql语句 + $this->rarray['sqltotal'] = $countsql; //返回sql语句 +// } + return $array; + } + + /** + * 把处理后的数组已json方式输出到页面上,供AJAX读取。 + * @param array $rdata 需要转成json的数组 + */ + public function rdata($rdata) { + if ($rdata) { + $this->rarray['data'] = $rdata; + } else { + $this->rarray['data'][''] = ''; + } + jsoncallback($this->rarray); //回传json格式 + } + +} + +# This program is an open source system, commercial use, please consciously to purchase commercial license. +# Copyright (C) MetInfo Co., Ltd. (http://www.metinfo.cn). All rights reserved. +?> diff --git a/include/class/tsql.class.php b/include/class/tsql.class.php new file mode 100644 index 0000000..8386436 --- /dev/null +++ b/include/class/tsql.class.php @@ -0,0 +1,387 @@ +sql, $this->special,$this->ufield); + return $this; + } + + # 数据库 + # $sign false 不添加应用文件名前缀 + public function table($tname,$sign = true) { + global $_M; + self::table_unset(); + $this->sql['table'] = self::full_table_name($tname,$sign); + return $this; + } + + # 多表联合查询数据库,制作表的联合方式,通过多次调用来实现 + # $tname 包含缩写数据名和 缩写名 + # $join 数据库连接方式 + # $sign false 不添加应用文件名前缀 + # + public function tables($tname = [],$join = '',$sign = true) { + global $_M; + list($name,$ab) = $tname; + $table = self::full_table_name($name,$sign); + $this->sql['table'] .= $table." AS {$ab} {$join} "; + return $this; + } + + # 需要特殊处理的值,例如:counts+1 等类似的 或者执行函数 + # 传入的为特殊处理的值,并 非字段名 + public function special($_special) { + global $_M; + $this->special = is_array($_special)?$_special:[$_special]; + return $this; + } + + # 需要删除的字段,仅支持约束条件下 + # 目前仅用于adup()时的 unique() 方法 + public function ufield($_field = '') { + global $_M; + $this->ufield = is_array($_field)?$_field:[$_field]; + return $this; + } + + # 查询字段 + # 查询或者多条插入信息 + public function qfield($_field = '*') { + global $_M; + if(is_array($_field)) $_field = arrayto_string($_field, ','); + $this->sql['field'] = $_field; + return $this; + } + + # 插入更新字段 + # $sign 单条插入或者更新设置其他值,查询或者多条插入信息时使用qfield() + public function field($_field = '') { + global $_M; + if(is_array($_field)) $_field = self::field_arr($_field); + $this->sql['field'] = $_field; + return $this; + } + + # 分组查询 $_having 同where 一样 + public function group($_group = '',$_having = '') { + global $_M; + + if(is_array($_group)) $_group = arrayto_string($_group, ','); + if(!empty($_group)) $this->sql['group'] = " GROUP BY " . $_where; + if($_group){ + $this->multi_table = true; + if(is_array($_having)) $_having = self::where_arr($_having); + if(!empty($_having)) $this->sql['group'] .= " HAVING " . $_having; + } + return $this; + } + + # 查询条件 + public function where($_where = '1=1') { + global $_M; + if(is_array($_where)) $_where = self::where_arr($_where); + if(!empty($_where)) $this->sql['where'] = " WHERE " . $_where; + return $this; + } + + # 排序条件 + public function order($_order = 'id DESC') { + global $_M; + $this->sql['order'] = " ORDER BY " . $_order; + return $this; + } + + # 单独值,用于 多条信息插入,或者约束插入更新 + public function values($_values = '') { + global $_M; + if(is_array($_values)) $_values = self::values_arr($_values); + $this->sql['values'] = $_values; + return $this; + } + + # 约束条件下的UPDATE + public function unique($_unique = '') { + global $_M; + if(is_array($_unique)) { + $_unique = self::field_del($_unique); + $_unique = self::unique_arr($_unique); + } + $this->sql['unique'] = " ON DUPLICATE KEY UPDATE " . $_unique; + return $this; + } + + # 查询条数限制 + public function limit($_limit = '30',$_start = '0') { + global $_M; + $this->sql['limit'] = " LIMIT {$_start}," . $_limit; + return $this; + } + + # 删除 + public function del($_where) { + global $_M; + if(empty($this->sql['table'])) return false; + if(!empty($_where) && empty($this->sql['where'])) self::where($_where); + $this->query = "DELETE FROM {$this->sql['table']} {$this->sql['where']} "; + unset($this->sql); + DB::query($this->query); + return $this; + } + + # 单条修改 + public function upd() { + global $_M; + if(empty($this->sql['table']) || empty($this->sql['field'])) return false; + $this->query = "UPDATE {$this->sql['table']} SET {$this->sql['field']} {$this->sql['where']} "; + unset($this->sql); + DB::query($this->query); + return $this; + } + + # 单条新增 + public function add($_field) { + global $_M; + if(!empty($_field) && empty($this->sql['field'])) self::field($_field); + if(empty($this->sql['table']) || empty($this->sql['field'])) return false; + $this->query = "INSERT INTO {$this->sql['table']} SET {$this->sql['field']} "; + unset($this->sql); + DB::query($this->query); + return $this; + } + + # 约束字段新增,更新,unique 值不存在即可实现多条信息插入 + # field 字段需要查询类型的 qfield() + # $data 一维二维都可以,key = field + # $sign false 并且也没有单独调用unique()是多条信息插入, true 为是约束更新插入 + public function adup($data = [],$sign = true) { + global $_M; + if(empty($this->sql['table'])) return false; + if(is_array($data)){ + $arr = array_level($data) == 1?$data:reset($data); + $qfield = array_keys($arr); + if(empty($this->sql['field'])) self::qfield($qfield); + if(empty($this->sql['values'])) self::values($data); + if($sign == true && empty($this->sql['unique'])) { + $unique = []; + $arr = self::field_del($arr); + foreach ($arr as $key => $val) { + if(in_array($val, $this->special,true)){ + $unique[$key] = $val; + }else{ + $unique[] = $key; + } + } + self::unique($unique); + } + } + $this->query = "INSERT INTO {$this->sql['table']} ({$this->sql['field']}) VALUES {$this->sql['values']} {$this->sql['unique']} "; + unset($this->sql); + DB::query($this->query); + return $this; + } + + # 查询单条 + public function one() { + global $_M; + if(empty($this->sql['table'])) return false; + if(empty($this->sql['field'])) $this->sql['field'] = '*'; + $this->query = "SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} {$this->sql['group']} {$this->sql['order']} {$this->sql['limit']} "; + unset($this->sql); + return DB::get_one($this->query); + } + + # 查询更多条数 + public function all($key = 'id') { + global $_M; + if(empty($this->sql['table'])) return false; + if(empty($this->sql['field'])) $this->sql['field'] = '*'; + $this->query = "SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} {$this->sql['group']} {$this->sql['order']} {$this->sql['limit']} "; + unset($this->sql); + $res = []; + $result = DB::query($this->query); + while ($val = DB::fetch_array($result)) { + $res[$val[$key]] = $val; + } + return $res; + } + + # 获取表结构 + public function show() { + global $_M; + if(empty($this->sql['table'])) return false; + $this->query = "SHOW FULL COLUMNS FROM .{$this->sql['table']}"; + unset($this->sql); + $res = []; + $rescolumns = DB::query($this->query) ; + while($row = DB::fetch_array($rescolumns)){ + $res[] = $row; + } + return $res; + } + + # 条数统计 + # field 采用查询方法 qfield + # $multi_table 若是采用分组了计算方式要调整为 子查询计算总条数 + public function count($_field = '*') { + global $_M; + if(empty($this->sql['table'])) return 0; + if(empty($this->sql['field'])) $this->sql['field'] = "COUNT({$_field})"; + + $this->query = " SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} "; + if($this->multi_table) $this->query = " SELECT count(*) FROM ($this->query) num "; + $result = DB::query($this->query); + $fetch_row = DB::fetch_row($result); + return $fetch_row[0]; + } + + # 获取刚才插入的信息ID + public function id() { + global $_M; + return DB::insert_id(); + } + + # 错误信息(对查询是无效的) + public function error() { + global $_M; + return DB::error(); + } + + # 返回完整数据库名 + public function full_table_name($tname,$sign = true) { + global $_M; + return $sign == true?$_M['table'][$this->m_name.'_'.$tname]:$_M['table'][$tname]; + } + + # 字段删除方法 + public function field_del($array = []) { + global $_M; + foreach ($this->ufield as $val) { + unset($array[$val]); + } + return $array; + } + + # where条件的转换 + # 仅是值等于的处理,例如某个字段判断为不等于或者其他的方法,切勿使用数组传递 + public function where_arr($arr) { + global $_M; + $and = []; + foreach ($arr as $key => $val) { + // 函数的使用 数字键名采用函数模式 + if(is_numeric($key)) { + $and[] = $val; + continue; + } + // 仅是值等于的处理 + if(is_array($val)){ + $or = []; + foreach ($val as $ky => $kv) { + $or[] = " {$key} = '{$kv}' "; + // 函数的使用,非数字则采用函数模式 + if(!is_numeric($ky)) { + $or[] = $val; + continue; + } + } + $orstr = arrayto_string($or, ' OR '); + $and[] = " ({$orstr}) "; + }else{ + $and[] = " {$key} = '{$val}' "; + } + } + return arrayto_string($and, ' AND '); + } + + # 入库字段转换 + public function field_arr($arr) { + global $_M; + $str = []; + foreach ($arr as $k => $v) { + if (strstr($v, "'")) $v = str_replace("'", "\'", $v); + if(in_array($v, $this->special,true)){ + $str[] = " {$k} = {$v} "; + }else{ + $str[] = " {$k} = '{$v}' "; + } + } + return arrayto_string($str, ','); + } + + # 单独值的字符串转换 + public function values_arr($arr) { + global $_M; + $str = []; + foreach ($arr as $val) { + if(is_array($val)){ + $str[] = self::values_arr($val); + }else{ + if(in_array($val, $this->special,true)){ + $str[] = " $val "; + }else{ + $str[] = " '$val' "; + } + } + } + $arrtostr = arrayto_string($str, ','); + return array_level($arr) == 1?"({$arrtostr})":$arrtostr; + } + + # 约束条件新增的语句更新值的规则(最后一段) + # 数组key值为字段名非数字 说明是要单独处理的值 + public function unique_arr($arr) { + global $_M; + $str = []; + foreach ($arr as $k => $v) { + if(is_numeric($k)){ + $str[] = " $v = VALUES($v) "; + }else{ + $str[] = " $k = $v "; + } + } + return arrayto_string($str, ','); + } + + # 通过数据库整理出该数据库的字段一般是净化form提交的字段,避免一个一个组装 + public function tfield($form,$tablename = '') { + global $_M; + if(!empty($tablename)){ + if(is_array($tablename)) $tablename = [$tablename,true]; + list($name,$sign) = array_values($tablename); + self::table($name,$sign); + } + $karr = DB::get_all("DESC {$this->sql['table']}"); + foreach ($karr as $v) { + $arr[$v['Field']] = $v['Field']; + } + #根据数据库字段提炼 + return array_intersect_key($form, $arr); + } + + # 查看刚才执行过的sql语句,方便核查sql语句 + public function query() { + global $_M; + return $this->query; + } + + +} + +?> \ No newline at end of file diff --git a/include/function/appcmp.func.php b/include/function/appcmp.func.php new file mode 100644 index 0000000..9fe900d --- /dev/null +++ b/include/function/appcmp.func.php @@ -0,0 +1,124 @@ + $row) { + if ($columnKeyIsNumber) { + $tmp = array_slice($row, $columnKey, 1); + $tmp = (is_array($tmp) && !empty($tmp)) ? current($tmp) : NULL; + } else { + $tmp = isset($row[$columnKey]) ? $row[$columnKey] : NULL; + } + if (!$indexKeyIsNull) { + if ($indexKeyIsNumber) { + $key = array_slice($row, $indexKey, 1); + $key = (is_array($key) && !empty($key)) ? current($key) : NULL; + $key = is_null($key) ? 0 : $key; + } else { + $key = isset($row[$indexKey]) ? $row[$indexKey] : 0; + } + } + $result[$key] = $tmp; + } + return $result; + } +} + +# 计算时间差 +# $begin_time 起始日期 +# $end_time 结束日期 一般指当前日期 +function timediff($begin_time, $end_time,$type) { + $time = $end_time - $begin_time; + switch ($type) { + case 'year': + //总的年 + $timestr = intval($time / 60 / 60 / 24 / 365); + break; + case 'month': + //总的月 + $timestr = intval($time / 60 / 60 / 24 / 30); + break; + case 'week': + $timestr = intval($time / 60 / 60 / 24 / 7); + break; + case 'day': + $timestr = intval($time / 60 / 60 / 24); + break; + case 'hour': + $timestr = intval($time / 60 / 60); + break; + case 'min': + $timestr = intval($time / 60); + break; + case 'sec': + $timestr = $time; + break; + default: + //总的年 + $year = intval($time / 60 / 60 / 24 / 365); + //总的月 + $month = intval($time / 60 / 60 / 24 / 30); + //总的周 + $week = intval($time / 60 / 60 / 24 / 7); + //总的天数 + $day = intval($time / 60 / 60 / 24); + //总的小时 + $hour = intval($time / 60 / 60); + //总的分钟数 + $minute = intval($time / 60); + //总的秒数 + $second = $time; + $timestr = [ + 'year' =>$year, //总的年 + 'month'=>$month, //总的月 + 'week'=>$week, //总的周 + 'day'=>$day, //总的天数 + 'hour'=>$hour, //总的小时 + 'min'=>$minute, //总的分钟数 + 'sec'=>$second //总的秒数 + ]; + break; + } + return $timestr; +} + +//获取汉子的首字母 +function getstrcharter($str) { + global $_M, $_YW; + if (empty($str)) return ''; + $fchar = ord($str{0}); + if ($fchar >= ord('A') && $fchar <= ord('z')) return strtoupper($str{0}); + $s1 = iconv('UTF-8', 'gb2312', $str); + $s2 = iconv('gb2312', 'UTF-8', $s1); + $s = $s2 == $str ? $s1 : $str; + $asc = ord($s{0}) * 256 + ord($s{1}) - 65536; + if ($asc >= -20319 && $asc <= -20284) return 'A'; + if ($asc >= -20283 && $asc <= -19776) return 'B'; + if ($asc >= -19775 && $asc <= -19219) return 'C'; + if ($asc >= -19218 && $asc <= -18711) return 'D'; + if ($asc >= -18710 && $asc <= -18527) return 'E'; + if ($asc >= -18526 && $asc <= -18240) return 'F'; + if ($asc >= -18239 && $asc <= -17923) return 'G'; + if ($asc >= -17922 && $asc <= -17418) return 'H'; + if ($asc >= -17417 && $asc <= -16475) return 'J'; + if ($asc >= -16474 && $asc <= -16213) return 'K'; + if ($asc >= -16212 && $asc <= -15641) return 'L'; + if ($asc >= -15640 && $asc <= -15166) return 'M'; + if ($asc >= -15165 && $asc <= -14923) return 'N'; + if ($asc >= -14922 && $asc <= -14915) return 'O'; + if ($asc >= -14914 && $asc <= -14631) return 'P'; + if ($asc >= -14630 && $asc <= -14150) return 'Q'; + if ($asc >= -14149 && $asc <= -14091) return 'R'; + if ($asc >= -14090 && $asc <= -13319) return 'S'; + if ($asc >= -13318 && $asc <= -12839) return 'T'; + if ($asc >= -12838 && $asc <= -12557) return 'W'; + if ($asc >= -12556 && $asc <= -11848) return 'X'; + if ($asc >= -11847 && $asc <= -11056) return 'Y'; + if ($asc >= -11055 && $asc <= -10247) return 'Z'; + return 'ZZ'; +} \ No newline at end of file diff --git a/include/traits/appcmp.class.php b/include/traits/appcmp.class.php new file mode 100644 index 0000000..7019773 --- /dev/null +++ b/include/traits/appcmp.class.php @@ -0,0 +1,8 @@ + +XgmmbjbJGzsaxJpH6mfPrCmf5rrJjZ=vgj0UPjabPXgPXHUPjabPXgPXsbGABGCvwX1GzsaxJpHmGwxpv0JHPrJBHaBHapZPfxsaz1gs0BKpHZgP=aqpvsCMws0zPbX0qpvmjamvZaav0s0LAGBa1mm1KpaZZrwqpUmGwK5GZ=Pa0ZaJpHgPBq5fHGBmAXssrJpHmHK5oCbGZ0PPwUBH+a6omgpJ=ZJpHo5CbX01GxAjbmdAK5Xs+mHPrCgPjaKpJpHz0JLZGrJpHxPACv0Js1fosxHaKsjsxHaKpHoPXwmwPoxgsrwmCbwHdL5HX=6LrAX0PxfZgPGwmwPmBawpKCXjCJsaZKssomGBH1KdomX5drUJZZ0jGsHsrUs0xgJKCvxgsXBbsCJL5gPAJpHxPAwsa6CJL+Xs+mHProbKpHxPAwsa6CJL+XsaPaMsgPjaXjXzXsaPgPjaXjpvmasa6CKmXsAPNJLgwa0PsrAmgssrAXsaPxgsxgqpdHrHdrwqp6LrAGxAGsGomXKpHo5w0UZawXjjXja0BPXjGZbwmCUPjKpHgsa1q5f6mfPrUX0jwmbXjjXHPrwmCKC=GwaK5XmHaJLXsAPNP1sCJpZJpHxgsxgjwmbXjjXBo0UPjaXj5XHAgm6ZjoZ650GwaZazGBHsrMza6XBsa6CP6gPfjsrwmCvhJLvMvsa6Cv0JsHsrAXj6CjJdg51Xba6XBsa6CP1sa6CK5XsUHPrC1XBHPrAJwsa6mKBa6XBsa6CP6gPfjsrwmmPaUmHaJzJsaZKpHaZHgPjaJLb0JpHaMsgPjaJpXmHaJLZGrJXsXbCvGBHsrXzJP6GHfKpHxPAwxgsXjJpZJpamMCxgsXBbsCK50GwaZa0JgPAJCHz0KCmXUBaGzmjXBpPfoZ6CqzxPaUs+XZd0s0ZHaMpxgsxg1=Xbw5Z8GXmXJGzsaxJsjZgP0UJs=PHbKpH1JCvwXMws0zPbX0qpvmjamvmXJLmbs0CzqpJXGzJsGZKpHGwJmXpM1P=ZxAZKpJoCbPXgPwUBH+jbm=PAKCJsXpvmJpHoPGJasZ=PHbKpxmog=xmo=xmopG0JjZ=ZPfxsazxmogJ=ZJpHo5CbX01XsXHZ=aZ6Cv0Jw=PHo0UZawXjJpHPXPfPrCZgP=ama0xfPfGHJm50rvUXHAgm6ZjoZ6C+wqZ0PXCGvsGhgj0UPjaJLmXmaosaZz1XZj0GwXMCszsUPjaqpGXXsXHZ=aZ6CJsGZKpHgsa1q5fNmfPrmXpMvmjamPNXjjXCvmjXBHZ=aXjjXHAgm6ZjoZ6CvUJpoXvUJpHP=0JsGZKpHws0zP=PXPfPrmXpMvmjamPNXjjXCvmjXBHZ=aXjjXJoCbPXgPwUBH+jbmAXs=ZGCvwXMws0zPbX0qpvmjamvmjamPUXjCvsGh0UPjazvAPjbAXs=ZGKCvsUv0JpHo5wsUvGZ1P=JLHdJwjmXfKpX1P=aBZ6C=P=jCZGZ06JmjXBHZ=aXjjXBmZoCBgsC6mfPrCvwMHgsa1q5f6mfP0X5Ks=ZGCvwMHPfwoCG5jJsUv0Jpxs0jpGJpJBgsaCvAXpv0JdHpxZmHxg0GwXMCGZ1P=KCMvmjamPxXjjXwZ6CmCv0JpHP=XBaXjJgPA=GBomGBH1KpsjzGJ=8Jsm1m+gmGwmbXJasZAPNmjsAK5oCbPXgPwUBH+jbmdAKCJsXpvmJpHoPGJpHoPXbGpJLHdJZa0ZrAJa5dLpvJdC5MHo5wszsrwmwmbsa1poCmCdCHC6mfPr0XBsGh0UPjaoCGJzJGzsaxJsjZgP0UJs6G0J=ZJpHo5CbX01X0jwmbXjjX6zJLHdJZa0ZrAJa5dLpvJdC5MHo5wszsrwmw0PjUXjj0JJHXJsj5wMHoPXbGpPUoCGrfdJs=ZG0XBmjX=ZGwmmwJpJ0JjZ=ZPfxsazxmopJ=ZJpHo5CbX01XssrCHJmr0sCr=Jp+X=ZGXvUJpHo5wsUJp+XfbgvwzvAJPsomGBH1KpHZgP=aKCMvZaCv0JdomX5drqzvwsU0xzfbgvw0JsaZJpZgP=am+gmGZaCJXaGmGZofxCZaCJGzsaxJsjZgP0UJssw=pZ6CbXpv0JpGwqpHPfwKCJsXpvmJpHoPGJsaZJpamMCsUJpHPfwJLX0PPfwXjJdHpx=PMCzCrf5HXrJdad8MHo5wszsrwmw=PHo0UZawXjj0JpUPjaqs=ZG0UPjaqaKCPr=HKpXsfP0XbwMHPfwoCGXBsGh0UPjaoCGXBZoCGJd0JdHrd=XrHCqHdHJaCXwJpJ0JjZ=ZPfxsaz1BXGHwgPfZMws0zPbX0vsGhs1XjBCZP=15PAvzxGZabLfspwMHZoCGGBHGwU8Aq5d1bGgmzJJs+gmApJGzsaxJsjZgP0UJHUPjaKpMws0zPbX0qpvmjammHjGZ+GBzGBHKpHo5wZ0CPXjzJGzsaxJsjZgP0UJsHsosa6Csa6CMws0zPbX0qpHoPGJXazvsa650mHaKpqP6pJZGGJpHgPjaK5AwX1oCbPXgPwUBH+GBzmBGzGBHKCJsXpvmX01GZmXUJGZ=azGBHKCvhJLvuGBzGBHKpH1JpbpUX+UqzGXGJGzsaxJsjZgP0UJs1fxP=ZxgZxgbXss=zPNJLXs=zPNXMws0zPbX0APmJAXwHaw6ab5AmbsaxmH+MpjmGgmXJpHxP=Zxgv0JpHo5wZ0CPHxP=ZxgjJpHG0UJLgwa0aZsrAXsXCa5a055HrHorfX0dHCJsxgs8Xss=zPNHxP=ZxgvUJpGAXvUJpHG0UJp+XwzHG0U0JjZ=ZPfxsazbmX10jGZbAXpbabCv0JpABXMws0zPbX0vmXJLmXmBPfmXKpHjGZbvmXmCbmX10jGZbAXpJXazvabCv0CvwmXX18mXmXsGZfPHMmam5oCbPXgPwUBH+gHG0zPa0=PMCmXqpHGwJJ=ZJpHo5CbX01gPAJPaUmGZfKjwGzmXqp=KCbPGZXbwKCXpvUCvwXzGJXazvmXqZowsHoGmaGwAXsGzJGzsaxJsjZgP0UJsjaGZam1GPHB1JLXGJ=ZJpHo5CbX01Xs1GsrCHJmr0sCr=qzbPXgPB1qBaZ1GfxGBwzZa0aMsa1AXs1GsrKCmHjGZ+ZGrJpHxGBCZgP=ama0xfPfGB1ZaCJpHgmaxGBCHJmr0sCr=qzbPXgPB1qHMP1GfxGBwzZgP=am+gmGsafB1KCXs1GvUCCoHr0qZsomwHawH1KpHgmaxGBzamMCPHB1KCXss1Gv0JpHoPXwmwsafB1XjJXazZgP=amBj0xfPfGHJmr0sCr=qzBPJs6Gs=s1qjap0xGBPgPfZfxGBwqpvB1qaJr05bUXss1GJo33 \ No newline at end of file diff --git a/include/traits/tdata.class.php b/include/traits/tdata.class.php new file mode 100644 index 0000000..c9d763c --- /dev/null +++ b/include/traits/tdata.class.php @@ -0,0 +1,530 @@ +tname) { + case 'applan': + //判断是否可选的依据 + 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 "; + 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 "; + 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 "; + break; + case 'villages': + $son = " FROM {$_YW['k']['countela']} AS el WHERE "; + //判断执行默认还是时间区段 + $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']; + } + } + + // 计算是否区分广告位 + // 检测是否通过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($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 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 "; + //排期中的 + $lwhere = " {$son} NOT(el.l_endtime < '{$vs_starttime}' OR el.l_starttime > '{$vs_endtime}') "; + // 之前的旧代码 +// $lwhere = " {$son} NOT(el.l_endtime < '{$vs_starttime}' OR el.l_starttime > '{$vs_endtime}') AND NOT(el.l_endtime < '{$curdate}' OR el.l_starttime > '{$curdate}' ) "; + //多少天到期的 + $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{ + //没有时间区段,则按照当天为准则,默认值 + //空置,其他不包含当天的 + $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 "; + //排期中的,日期包含当天的 + $lwhere = " {$son} NOT(el.l_endtime < '{$curdate}' OR el.l_starttime > '{$curdate}' ) "; + //多少天到期的 + $dwhere = " {$son} el.l_endtime BETWEEN '{$curdate}' AND date_add( '{$curdate}', INTERVAL 7 DAY ) "; + //预排,开始时间大于当天的 + $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 " + . "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,COUNT( DISTINCT el.e_vid, el.e_bno,el.e_uno ) AS v_uno,COUNT( DISTINCT el.e_vid, el.e_bno,el.e_uno,el.e_eno ) AS v_eno {$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 " + . "LEFT JOIN (SELECT el.e_vid AS de_vid,COUNT( DISTINCT el.e_number ) AS v_prerow {$pwhere} GROUP BY de_vid ) AS dnum ON dnum.de_vid = vi.id "; + + break; + case 'contract': + $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"; + break; + case 'village': + $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]; + break; + } + return $sqlk; + } + + //字段 + public function td_field() { + global $_M,$_YW; + switch ($this->tname) { + case 'applan': + $field = '*'; + break; + case 'elevators': + $field = ' el.*,max( la.l_endtime ) AS endtime,count( DISTINCT la.id ) AS e_totalnum,ala.*,if(ala.estate,1,0) AS etypes,bla.*,cla.* '; + break; + case 'patrol': + $field = ' el.*,la.l_hnumber,ala.* '; + break; + case 'contract': + $field = 'ch.*, count(la.id) AS h_totalnum '; + break; + case 'schedule': + $field = 'el.e_enable,el.e_number,el.e_vid,el.e_bno,el.e_uno,el.e_eno,el.e_aps,la.*,ct.h_cid'; + break; + case 'villages': + $field = " vi.*, COUNT( DISTINCT el.e_number) AS v_enum,COUNT(DISTINCT el.e_vid, el.e_bno) AS v_ebnonum,COUNT(DISTINCT el.e_vid, el.e_bno,el.e_uno) AS v_eunonum,COUNT(DISTINCT el.e_vid, el.e_bno,el.e_uno,el.e_eno) AS v_eenonum,COUNT( el.e_enable = 0 OR NULL ) AS noban,ANY_VALUE(anum.v_free) AS v_free,ANY_VALUE ( anum.v_bno ) AS v_bno,ANY_VALUE ( anum.v_uno ) AS v_uno,ANY_VALUE ( anum.v_eno ) AS v_eno,ANY_VALUE(bnum.v_lease) AS v_lease,ANY_VALUE(cnum.v_endday) AS v_endday,ANY_VALUE(dnum.v_prerow) AS v_prerow "; + break; + case 'village': + $field = " vi.*, count( el.e_number ) AS total,count( el.e_enable = 0 OR NULL ) AS noban,count( el.e_enable = 1 OR NULL ) AS normal "; + break; + + default: + $field = '*'; + break; + } + return $field; + } + + /* + * 【列出】 + * 同时满足条件的,非OR + */ + public function td_search($link = true) { + global $_M,$_YW; + //默认input字段为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)); + //判断是否为链表查询 + $join_field = array_combine($field,count($this->search_field) > 0?$this->search_field:$field); + + //相对独立的搜索 + $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}%' "; + continue; + } + $arrwhere[] = " {$str} = '{$search}' "; + } + } + + //返回内容 + $where = ''; + 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; + //判断是否为链表查询 + $join_field = array_combine($orfield,count($search_field) > 0?$search_field:$orfield); + //相对独立的搜索 + $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}%' "; + continue; + } + $arrwhere[] = " {$str} = '{$search}' "; + } + } + + //返回内容 + $where = ''; + if(count($arrwhere) > 0){ + $where .= arrayto_string($arrwhere,' OR '); + } + return strlen($where) > 0 ?" AND ({$where}) ":''; + } + + //时间区间 + 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); + //相对独立的搜索 + $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}' "; + } + } + } + + //返回内容 + $where = ''; + if(count($arrwhere) > 0){ + $where .= arrayto_string($arrwhere," AND "); + } + return strlen($where) > 0 ?" AND ({$where}) ":''; + } + + //获取重叠的时间区间 + // $search_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); + //相对独立的搜索 + $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}' "; //开始字段,搜索为结束时间 + } + } + } + + //返回内容 + $where = ''; + if(count($arrwhere) > 0){ + $where .= arrayto_string($arrwhere," OR "); + } + return strlen($where) > 0 ?" AND NOT({$where}) ":''; + } + + /* + * 【列出】 + * SQL判断语句$where .= $this->search(); + */ + public function td_where() { + global $_M,$_YW; + $where = " 1=1 "; + switch ($this->tname) { + case 'applan': + $this->search_input = ['e_number']; + $this->search_other = ['e_aps','e_eno','e_uno','e_bno','e_vid','e_enable']; + $where .= self::td_search(); + break; + case 'elevators': + $this->search_input = ['e_number']; + $this->search_other = ['e_aps','e_eno','e_uno','e_bno','e_vid','e_enable','endid','nowid','nextid']; + $this->search_field = ['el.e_number','el.e_aps','el.e_eno','el.e_uno','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); + self::td_groupby($where); + break; + case 'patrol': + $this->search_input = ['e_number']; + $this->search_other = ['e_aps','e_eno','e_uno','e_bno','e_vid','e_enable','nowid','l_hnumber']; + $this->search_field = ['el.e_number','el.e_aps','el.e_eno','el.e_uno','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 "; + + self::td_groupby($where); + break; + case 'elevator': + $this->search_input = ['e_number','e_label','e_text']; + $this->search_other = ['e_aps','e_eno','e_uno','e_bno','e_vid','e_enable']; + $where .= self::td_search(); + case 'village': + $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']); + 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->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']); + $where .= self::td_search(); + break; + case 'workers': + $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']); + $where .= self::td_search(); + self::td_groupby($where); + break; + case 'para': + $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']); + $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} "; + $where .= self::td_search_or($this->search_link); + $where .= self::td_search(); + //判断是否为备份 + 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 .= 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 + break; + default: + // 如果$where 没有值 会导致计算结果出错,导致前台表格无法获取正确的值,分页显示异常 + $where = "1=1"; + break; + } + + return $where; + } + + //分组查询 + public function td_groupby(&$where) { + global $_M; + $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']}' "; + break; + case 'patrol': + $where .= " GROUP BY el.e_number "; + break; + case 'contract': + $where .= " GROUP BY ch.id "; + break; + case 'villages': + $where .= " GROUP BY vi.id "; + break; + case 'village': + $where .= " GROUP BY vi.id "; + break; + default: + $this->multi_table = false; + break; + } + } + + /* + * 【列出】 + * SQL排序方式语句 + */ + public function td_order() { + global $_M; + switch ($this->tname) { + case 'applan': + $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'] == 2){ + // 传递进来的编号,不直接查数据是因为有些可能会出现错误,所以直接使用传递进来的,进行排序 + $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_uno` ASC, `e_eno` ASC, `e_aps` ASC "; + break; + case 'elevators': + $order = " `etypes` DESC, endtime DESC, el.`e_vid` ASC, el.`e_bno` ASC, el.`e_uno` ASC, el.`e_eno` 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_uno {$e_address}, el.e_eno {$e_address}, el.e_aps {$e_address} "; + } + break; + case 'patrol': + $order = " el.`e_vid` ASC, el.`e_bno` ASC, el.`e_uno` ASC, el.`e_eno` ASC, el.`e_aps` ASC "; + break; + case 'elevator': + $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']} "; + 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']} "; + break; + case 'schedule': + $order = ' la.l_starttime DESC,la.`id` DESC'; + //备份 按照小区排序 + if($this->bsign){ + $order = " el.`e_vid` ASC, el.`e_bno` ASC, el.`e_uno` ASC, el.`e_eno` 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']} "; + 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_eunonum']) $order = " v_eunonum {$this->form['order_v_eunonum']} "; + if($this->form['order_v_eenonum']) $order = " v_eenonum {$this->form['order_v_eenonum']} "; + if($this->form['order_v_bno']) $order = " v_bno {$this->form['order_v_bno']} "; + if($this->form['order_v_uno']) $order = " v_uno {$this->form['order_v_uno']} "; + if($this->form['order_v_eno']) $order = " v_eno {$this->form['order_v_eno']} "; + 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']} "; + break; + case 'noticeday': + $order = ' `endtime` ASC, `h_endtime` ASC '; + break; + case 'village': + $order = ' vi.`id` DESC'; + break; + default: + $order = ' `id` DESC'; + break; + } + + return $order; + } + +} diff --git a/include/traits/tfield.class.php b/include/traits/tfield.class.php new file mode 100644 index 0000000..3b01955 --- /dev/null +++ b/include/traits/tfield.class.php @@ -0,0 +1,277 @@ + '状态', + 'e_number' => '广告位编号', + 'e_vid' => '小区名称', + 'e_bno' => '楼号', + 'e_uno' => '单元号', + 'e_eno' => '电梯号', + 'e_aps' => '广告位位置', + 'e_size' => '广告位规格', + 'e_label' => '相关标签', + 'e_text' => '备注' + ]; + } + + //小区统计 + protected function tf_village($sign = true) { + global $_M,$_YW; + return [ + 'v_name' => '小区名称', + 'v_type' => '小区分类', + 'v_totalstr' => '广告状态', + 'v_address' => '小区地址', + 'v_wid' => '联系人', + 'v_price' => '小区均价', + 'v_psize' => '居住规模', + 'v_addtime' => '录入时间', + 'v_updatetime' => '修改时间', + 'v_text' => '备注' + ]; + } + + //广告合同关联表 + protected function tf_schedule($sign = '') { + global $_M,$_YW; + //Table + $array = [ + 'e_enable' => '状态', + 'e_number' => '广告位编号', + 'l_address' => '广告位地址', + 'h_cid' => '签定的公司', + 'l_hnumber' => '合同编号', + 'l_title' => '投放名称', + 'l_starttime' => '开始时间', + 'l_endtime' => '结束时间', + 'ltype' => '投放状态' //标记是否已经结束 + ]; + // 导出专用 + $barray = [ + 'e_enable' => '状态', + 'e_number' => '广告位编号', + 'e_vid' => '小区名称', + 'e_bno' => '楼号', + 'e_uno' => '单元号', + 'e_eno' => '电梯号', + 'e_aps' => '广告位位置', + 'h_cid' => '签定的公司', + 'l_hnumber' => '合同编号', + 'l_title' => '投放名称', + 'l_starttime' => '开始时间', + 'l_endtime' => '结束时间', + 'ltype' => '投放状态' //标记是否已经结束 + ]; + return $sign || $this->bsign?$barray:$array; + } + + //合同 + protected function tf_contract($sign = true) { + global $_M,$_YW; + return [ + 'h_number' => '合同编号', + 'h_signtime' => '签订日期', + 'h_cid' => '签定公司', + 'h_tprice' => '合同总额', + 'h_wid' => '签定人员', + 'h_totalnum' => '投放次数', + 'h_starttime' => '订单开始时间', + 'h_endtime' => '订单结束时间', + 'h_noticeday' => '提前通知天数', + 'h_addtime' => '录入时间', + 'h_updatetime' => '修改时间', + 'h_text' => '备注' + ]; + } + + //企业资料 + protected function tf_customer($sign = true) { + global $_M,$_YW; + return [ + 'c_allname' => '公司名称', + 'c_name' => '公司简称', + 'c_address' => '公司地址', + 'c_wid' => '联系人', + 'c_addtime' => '录入时间', + 'c_updatetime' => '修改时间', + 'c_text' => '备注', + ]; + } + + //企业联系人 + protected function tf_workers($sign = true) { + global $_M,$_YW; + return [ +// 'w_cid' => '隶属公司', + 'w_jid' => '职务id', + 'w_name' => '姓名', + 'w_tel' => '联系电话', + 'w_addtime' => '录入时间', + 'w_updatetime' => '修改时间', + 'w_text' => '备注', + ]; + } + + //参数 + protected function tf_para($sign = true) { + global $_M,$_YW; + return [ + 'p_type' => '参数分类', + 'p_value' => '参数值', + 'p_name' => '参数名', + 'p_num' => '有多少数据在使用', + 'p_order' => '排序', + 'p_text' => '备注' + ]; + } + + // 投放页面选择广告位 + protected function tf_launch($sign = true) { + global $_M,$_YW; + return [ + 'l_title' => '名称', + 'l_hnumber' => '合同编号', + 'l_schedule' => '投放进度', + 'l_totalnum' => '广告位个数', + 'l_starttime' => '广告开始时间', + 'l_endtime' => '广告结束时间', + 'l_type' => '广告类型', + 'l_text' => '备注', + 'l_enumber' => '广告位编组(最多显示6个)', + 'l_addtime' => '录入时间', + 'l_updatetime' => '修改时间' + ]; + } + + // 投放页面选择广告位 + protected function tf_applan($sign = true) { + global $_M,$_YW; + return [ + 'e_enable' => '状态', + 'e_number' => '广告位编号', + 'e_address' => '广告位地址', //虚拟字段 + 'endtitle' => '上个计划名称', + 'endstime' => '上个开始时间', + 'endetime' => '上个结束时间', + 'nowtitle' => '当前计划名称', + 'nowstime' => '当前开始时间', + 'nowetime' => '当前结束时间', + 'nexttitle' => '下个计划名称', + 'nextstime' => '下个开始时间', + 'nextetime' => '下个结束时间', + 'endtime' => '最大结束时间', + 'e_types' => '状态提示' + ]; + } + + //广告位查询统计 + protected function tf_elevators($sign = true) { + global $_M,$_YW; + return [ + 'e_enable' => '状态', + 'e_number' => '广告位编号', + 'e_address' => '广告位地址', //虚拟字段 + 'e_size' => '广告位规格', + 'endtitle' => '上个计划名称', + 'endstime' => '上个开始时间', + 'endetime' => '上个结束时间', + 'nowtitle' => '当前计划名称', + 'nowstime' => '当前开始时间', + 'nowetime' => '当前结束时间', + 'nexttitle' => '下个计划名称', + 'nextstime' => '下个开始时间', + 'nextetime' => '下个结束时间', + 'endtime' => '最大结束时间', + 'e_totalnum' => '投放次数', + 'etypes' => '排期状态' + ]; + } + + //广告位查询统计 + protected function tf_villages($sign = true) { + global $_M,$_YW; + $array = [ + 'v_name' => '小区名称', + 'v_type' => '小区分类', + 'v_district' => '所属区域', + 'v_address' => '小区地址', + 'v_enum' => '广告位', + 'v_ebnonum' => '楼号', + 'v_eunonum' => '单元', + 'v_eenonum' => '电梯', + 'v_free' => '广告位', + 'v_bno' => '楼号', + 'v_uno' => '单元', + 'v_eno' => '电梯', + 'v_lease' => '排期中的个数', + 'v_endday' => '到期个数', + 'v_prerow' => '预排的个数', + 'v_text' => '备注' + ]; + if($this->bsign){ + $array['v_free'] = '闲置广告位总数'; + $array['v_bno'] = '闲置楼号'; + $array['v_uno'] = '闲置单元'; + $array['v_eno'] = '闲置电梯'; + $array['v_enum'] = '广告位总数'; + $array['v_ebnonum'] = '楼号总数'; + $array['v_eunonum'] = '单元总数'; + $array['v_eenonum'] = '电梯总数'; + $array['v_price'] = '小区均价'; + $array['v_psize'] = '居住规模'; + }else{ + unset($array['v_district']); + } + return $array; + } + + //广告位查询统计 + protected function tf_noticeday($sign = true) { + global $_M,$_YW; + return [ + 'h_number' => '合同编号', + 'h_signtime' => '签订日期', + 'h_cid' => '签定公司', + 'h_tprice' => '合同总额', + 'h_wid' => '签定人员', + 'h_starttime' => '投放开始时间', + 'h_endtime' => '投放结束时间', + 'h_text' => '备注', +// 'endtime' => '提醒时间', + 'htypes' => '提示说明' + ]; + } + + //前台巡查页面 + protected function tf_patrol($sign = true) { + global $_M,$_YW; + return [ + 'e_number' => '编号', + 'e_address' => '地址', //虚拟字段 + 'nowtitle' => '名称', +// 'nowstime' => '开始时间', +// 'nowetime' => '剩余', + ]; + } + + //巡查列表 + protected function tf_keylist($sign = true) { + global $_M,$_YW; + return [ +// 'k_passkey' => '密钥密码', + 'k_basekey' => '密文密码', + 'k_wid' => '相关联系人', + 'k_state' => '密钥状态', + 'k_addtime' => '新增时间', + 'k_updatetime' => '修改时间', + 'k_text' => '备注' + ]; + } + +} diff --git a/include/traits/tlist.class.php b/include/traits/tlist.class.php new file mode 100644 index 0000000..1107b46 --- /dev/null +++ b/include/traits/tlist.class.php @@ -0,0 +1,716 @@ + 'table_off', + 'a' => 'doindex', + 'submit_type' => 'delet', + 'all_id' => $val['id'], + 'tname' => $this->tname, + ]; + $query = array_merge($para,$query); + $href = parent::http_build_query($_M['url']['own_name'],$query); + $this->btn[] = '删除'; + } + }else{ + $this->btn[] = ''; + + } + if(count($this->btn) > 0){ + $btnstr = arrayto_string($this->btn,''); + unset($this->btn); + return '
      '.$btnstr.'
      '; + } + } + + //整合 + private function assemble($key,$base,$val,$checked,$query = []) { + global $_M,$_YW; + //搜索处理 + foreach ($this->search_input as $vs){ + if(in_array($vs, $this->skip_field,true)) continue; + $search = trim(strtoupper($this->form[$vs])); + if($search != null) $val[$vs] = str_ireplace($search, ''.$search.'', $val[$vs]); + } + //按钮组处理 + $operation = []; + if($this->banbtn == false) $operation['__operation'] = self::btn_group($val,$checked,$query); + //结果整合处理 + return array_merge($base,$key,array_intersect_key($val,$key),$operation); + } + + //广告位详细地址转换 + protected function eaddress(&$val,$_address = 'e_address',$sign = false){ + global $_M,$_YW; + //楼号 + if(empty(self::$para['e_bno'])) self::$para['e_bno'] = parent::translate(3); + //单元号 + if(empty(self::$para['e_uno'])) self::$para['e_uno'] = parent::translate(4); + //电梯号 + if(empty(self::$para['e_eno'])) self::$para['e_eno'] = parent::translate(5); + //广告位置 + if(empty(self::$para['e_aps'])) self::$para['e_aps'] = parent::translate(); + //小区 + if(empty(self::$village[$val['e_vid']])) self::$village[$val['e_vid']] = parent::villagelist($val['e_vid']); + + if($sign){ + $val['e_vid'] = self::$village[$val['e_vid']]; + $val['e_bno'] = self::$para['e_bno'][$val['e_bno']]; + $val['e_uno'] = self::$para['e_uno'][$val['e_uno']]; + $val['e_eno'] = self::$para['e_eno'][$val['e_eno']]; + $val['e_aps'] = self::$para['e_aps'][$val['e_aps']]; + }else{ + $villages = [ + self::$village[$val['e_vid']], + self::$para['e_bno'][$val['e_bno']], + self::$para['e_uno'][$val['e_uno']], + self::$para['e_eno'][$val['e_eno']], + self::$para['e_aps'][$val['e_aps']] + ]; + $val[$_address] = arrayto_string($villages,' '); + } + + } + + +// +---------------------------------------------------------------------- +// | 各表处理 +// +---------------------------------------------------------------------- + + //广告位统计 + protected function elevator($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_elevator(); + + //列表前段 + $base[] = ' + + + '; + //对字段处理 + //楼号 + if(empty(self::$para['e_bno'])) self::$para['e_bno'] = parent::translate(3); + //单元号 + if(empty(self::$para['e_uno'])) self::$para['e_uno'] = parent::translate(4); + //电梯号 + if(empty(self::$para['e_eno'])) self::$para['e_eno'] = parent::translate(5); + //广告位置 + if(empty(self::$para['e_aps'])) self::$para['e_aps'] = parent::translate(); + //小区 + if(empty(self::$village[$val['e_vid']])) self::$village[$val['e_vid']] = parent::villagelist($val['e_vid']); + + $scheduleurl = $this->own_name_table.'elevators&e_number='.$val['e_number']; + + $val['e_number'] = ' '.$val['e_number'].''; + $val['e_enable'] = parent::type_onoff('e_enable',$val['e_enable'],$val['id'],['禁用','启用']); + + $val['e_vid'] = self::$village[$val['e_vid']]; + $val['e_bno'] = self::$para['e_bno'][$val['e_bno']]; + $val['e_uno'] = self::$para['e_uno'][$val['e_uno']]; + $val['e_eno'] = self::$para['e_eno'][$val['e_eno']]; + $val['e_aps'] = self::$para['e_aps'][$val['e_aps']]; + $val['e_state'] = parent::e_state(); + $val['e_label'] = parent::tab_tokenfield($val['e_label'],2); + + //执行操作按钮 + if(empty($checked)){ + $addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id']; + $this->btn[] = '编辑'; + } + //跳过标记突出处理 + $this->skip_field = ['e_number']; + return self::assemble($key,$base,$val,$checked); + } + + //小区统计 + protected function village($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_village(); + + //列表前段 + $base[] = ' + + + '; + //对字段处理 + $workerswid = stringto_array($val['v_wid'],','); + foreach ($workerswid as $vwid) { + if(empty(self::$workers[$vwid])) self::$workers[$vwid] = parent::workerslist($vwid); + $workersstr[] = self::$workers[$vwid]; + } + + //小区分类 + if(empty(self::$para['v_type'])) self::$para['v_type'] = parent::translate(6); + + $vnameurl = $this->own_name_table.'elevator&e_vid='.$val['id']; + $totalstr = arrayto_string([$val['total'],$val['noban'],$val['normal']],' / '); + + $val['v_name'] = ' '.$val['v_name'].''; + $val['v_type'] = self::$para['v_type'][$val['v_type']]; + $val['v_wid'] = parent::tab_tokenfield(arrayto_string($workersstr),1); + $val['v_address'] = $val['v_province'].$val['v_city'].$val['v_district'].$val['v_address']; + + $val['v_totalstr'] = $val['noban'] > 0?parent::str_color(0,$totalstr,600):$totalstr; + + //执行操作按钮 + if(empty($checked)){ + $this->btn[] = '查看广告位'; + $addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id']; + $this->btn[] = '编辑'; + } + + return self::assemble($key,$base,$val,$checked); + } + + //广告合同关联表 + protected function schedule($val,$checked = '',$base = []) { + global $_M,$_YW; + //获取字段 + $key = self::tf_schedule(); + //对字段处理 + //公司名称 + if(empty(self::$customer[$val['h_cid']])) self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']); + + $s_type = strtotime($val['l_endtime']) >= strtotime(date('Y-m-d',time()))?1:0; + if(empty(self::$para['ltype']) && $s_type) self::$para['ltype'] = parent::translate(2); + + $val['ltype'] = parent::state_color($s_type,['已经结束',self::$para['ltype'][$val['l_schedule']]]); + $val['h_cid'] = self::$customer[$val['h_cid']]; + $val['e_enable'] = $val['e_enable'] == 0 || $this->bsign == false?parent::state_color($val['e_enable'],['禁用','启用']):''; + self::eaddress($val,'l_address',$this->bsign); + return self::assemble($key,$base,$val,$checked,false); + } + + //合同归档 + protected function contract($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_contract(); + + //列表前段 + $base[] = ' + + + '; + //对字段处理 + //公司名称 + if(empty(self::$customer[$val['h_cid']])) self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']); + + //相关人员 + $workerswid = stringto_array($val['h_wid'],','); + foreach ($workerswid as $hwid) { + if(empty(self::$workers[$hwid])) self::$workers[$hwid] = parent::workerslist($hwid); + $workersstr[] = self::$workers[$hwid]; + } + //内连接 + $h_number = $val['h_number']; //避免后面采用 + $launchurl = $this->own_name_table.'launch&l_hnumber='.$h_number; + $curdate = date('Y-m-d',time()); + + $val['h_number'] = ' '.$h_number.''; + $val['h_cid'] = self::$customer[$val['h_cid']]; + $val['h_wid'] = parent::tab_tokenfield(arrayto_string($workersstr),1); + $val['h_noticeday'] = parent::tab_tokenfield($val['h_noticeday'],2); + + $val['h_starttime'] = strtotime($val['h_starttime']) > strtotime($curdate)?parent::str_color(2,$val['h_starttime'],600):$val['h_starttime']; + $val['h_endtime'] = strtotime($val['h_endtime']) < strtotime($curdate)?parent::str_color(0,$val['h_endtime'],600):$val['h_endtime']; + + //执行操作按钮 + if(empty($checked)){ + $addtourl = $this->own_name_info.'launch&cid='.$val['id']; + $this->btn[] = '新增投放'; + $this->btn[] = '查看投放'; + $addtourl = $_M['url']['own_name'].'c=backups&a=doindex&tname=schedule&l_hnumber='.$h_number; + $this->btn[] = '导出排期'; + $addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id']; + $this->btn[] = '编辑'; + } + //跳过标记突出处理 + $this->skip_field = ['h_number']; + return self::assemble($key,$base,$val,$checked); + } + + //公司资料 + protected function customer($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_customer(); + + //列表前段 + $base[] = ' + + + '; + //对字段处理 + //相关人员 + $workerswid = stringto_array($val['c_wid'],','); + foreach ($workerswid as $cwid) { + if(empty(self::$workers[$cwid])) self::$workers[$cwid] = parent::workerslist($cwid); + $workersstr[] = self::$workers[$cwid]; + } + + $hcidurl = $this->own_name_table.'contract&h_cid='.$val['id']; + $val['c_allname'] = ' '.$val['c_allname'].''; + $val['c_wid'] = parent::tab_tokenfield(arrayto_string($workersstr),1); + $val['c_address'] = $val['c_province'].$val['c_city'].$val['c_district'].$val['c_address']; + + //执行操作按钮 + if(empty($checked)){ + $addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id']; + $this->btn[] = '编辑'; + } + return self::assemble($key,$base,$val,$checked); + } + + //企业联系人 + protected function workers($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_workers(); + + //列表前段 + $base[] = ' + + + '; + + //拿到对应的ID + //职务 + if(empty(self::$para)) self::$para = parent::translate(1); + + //对字段处理 + $val['w_jid'] = self::$para[$val['w_jid']]; + $val['w_tel'] = parent::tab_tokenfield($val['w_tel'],1); + + //执行操作按钮 + if(empty($checked)){ + $addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id']; + $this->btn[] = '编辑'; + } + return self::assemble($key,$base,$val,$checked); + } + + //参数统计 + protected function para($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_para(); + + //列表前段 + $base[] = ' + + + '; + + //对字段处理 + //优先计算 + switch ($val['p_type']) { + case 0: + $p_num = $this->tsql->table('elevator')->where(['e_aps' => $val['p_value']])->count(); + break; + case 1: + $p_num = $this->tsql->table('workers')->where(['w_jid' => $val['p_value']])->count(); + break; + case 2: + $p_num = $this->tsql->table('launch')->where(['l_schedule' => $val['p_value']])->count(); + break; + case 3: + $p_num = $this->tsql->table('elevator')->where(['e_bno' => $val['p_value']])->count(); + break; + case 4: + $p_num = $this->tsql->table('elevator')->where(['e_uno' => $val['p_value']])->count(); + break; + case 5: + $p_num = $this->tsql->table('elevator')->where(['e_eno' => $val['p_value']])->count(); + break; + case 6: + $p_num = $this->tsql->table('village')->where(['v_type' => $val['p_value']])->count(); + break; + case 7: + $p_num = $this->tsql->table('launch')->where(['l_type' => $val['p_value']])->count(); + break; + + default: + break; + } + + //有数据后不允许再修改参数值,可修改参数名,且不是在新增情况下 + if($p_num > 0 && empty($checked)){ + $readonly = ' readonly="readonly" '; + } + + $inputp_num = ''; + $val['p_num'] = $checked?$inputp_num:$p_num.' 条'.$inputp_num; + $val['p_type'] = '
      + +
      '; + $val['p_order'] = '
      + +
      '; + $val['p_name'] = '
      + +
      '; + $val['p_value'] = '
      + +
      '; + $val['p_text'] = ''; + + //执行操作按钮 + return self::assemble($key,$base,$val,$checked,$p_num > 0?false:[]); + } + + //投放计划 + protected function launch($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_launch(); + + //列表前段 + $base[] = ' + + + '; + //对字段处理 + if(empty(self::$para['l_schedule'])) self::$para['l_schedule'] = parent::translate(2); + if(empty(self::$para['l_type'])) self::$para['l_type'] = parent::translate(7); + $enum = count(array_filter(stringto_array($val['l_enumber'],','))); + $snum = count(array_filter(stringto_array($val['l_selectenum'],','))); + $esstr = " {$enum} / {$snum} "; + $curdate = date('Y-m-d',time()); + + $l_titleurl = $this->own_name_table.'schedule&l_id='.$val['id']; + $val['l_totalnum'] = $enum == $snum?$esstr:parent::state_color(0,[$esstr]); //放在最前面,防止后面对l_enumber 字段的处理 + $val['l_title'] = ' '.$val['l_title'].''; + $val['l_enumber'] = parent::tab_tokenfield($val['l_enumber'],1,',',6); + $val['l_schedule'] = parent::tab_tokenfield(self::$para['l_schedule'][$val['l_schedule']],1); + $val['l_type'] = self::$para['l_type'][$val['l_type']]; + + $val['l_starttime'] = strtotime($val['l_starttime']) > strtotime($curdate)?parent::str_color(2,$val['l_starttime'],600):$val['l_starttime']; + $val['l_endtime'] = strtotime($val['l_endtime']) < strtotime($curdate)?parent::str_color(0,$val['l_endtime'],600):$val['l_endtime']; + + //执行操作按钮 + if(empty($checked)){ + $this->btn[] = '查看排期'; + $addtourl = $_M['url']['own_name'].'c=backups&a=doindex&tname=schedule&id='.$val['id']; + $this->btn[] = '导出排期'; + $addtourl = $this->own_name_info.__FUNCTION__.'&slid='.$val['id']; + $this->btn[] = '编辑'; + } + return self::assemble($key,$base,$val,$checked); + } + + //广告位统计 + protected function applan($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_applan(); + + //列表前段 + $e_number = $val['e_number']; + //判断之前是否已经选中 + $ebool = in_array($e_number, array_filter(stringto_array($this->form['l_selectenum'],',')),true); + //给予选中标识 + $class = ' checkbox-primary '; //刚选择默认颜色 + //$val['lanum'] 大于0 说明重复,不可投放 + if($ebool) { + $apchecked = ' checked '; + $slid = $this->form['slid']; + //判断排期表内是否存在 + if(!empty($this->form['slid'])){ + if(empty(self::$para[$slid])) self::$para[$slid] = $this->tsql->table('launch')->where(['id' => $slid])->one(); + $l_hnumber = stringto_array(self::$para[$slid]['l_enumber'],','); + $class = in_array($e_number,$l_hnumber,true)?' checkbox-success ':' checkbox-danger '; //刚选择默认颜色 + } + } + + // 判断广告位是否可排期 + if(empty($val['e_enable'])){ + $e_types = parent::str_color(0,'禁止投放'); + if($apchecked) { + $class .= ' ap-one-disabled '; + }else{ + $disabled = ' disabled '; + } + }else{ + $s_starttime = $_M['form']['l_starttime']; + $s_endtime = $_M['form']['l_endtime']; + if($s_starttime && $s_endtime && strtotime($s_starttime) <= strtotime($s_endtime)){ + //判断是否可排期成功 + if($val['lanum'] > 0){ + $e_types = parent::str_color(0,'禁止投放'); + if($apchecked) { + $class .= ' ap-one-disabled '; + }else{ + $disabled = ' disabled '; + } + }else{ + $e_types = parent::str_color(1,'可投放'); + } + }else{ + $e_types = parent::str_color(3,'无法判断'); + } + } + + // checkbox-danger 没有在排期库的显示为红色 checkbox-primary 正常的显示蓝色 checkbox-success 绿色 + $base[] = ' + + + '; + + //对字段处理 + $curtime = strtotime(date('Y-m-d',time())); + //上个排期 + if(strtotime($val['endetime']) < $curtime){ + $val['endtitle'] = ''.$val['endtitle'].''; + $val['endstime'] = ''.$val['endstime'].''; + $val['endetime'] = ''.$val['endetime'].''; + } + + $val['endtime'] = strtotime($val['endtime']) < $curtime + ?''.$val['endtime'].'' + :$val['endtime']; + $val['e_types'] = $e_types; + $val['e_enable'] = parent::state_color($val['e_enable'],['禁用','启用']); + self::eaddress($val,'e_address'); + //比较每个广告位的结束时间 和 现在设置的投放订单的开始时间 大小 + + //禁用最后的按钮 + $this->banbtn = true; + return self::assemble($key,$base,$val,$checked,false); + } + + //广告位统计 + protected function elevators($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_elevators(); + + //列表前段 + $base[] = ' + + + '; + //对字段处理 + $curtime = strtotime(date('Y-m-d',time())); + $scheduleurl = $this->own_name_table.'schedule&e_number='.$val['e_number']; + $uplaunchurl = $this->own_name_info.'uplaunch&e_number='.$val['e_number']; + + $val['e_number'] = ' '.$val['e_number'].''; + $val['etypes'] = parent::state_color($val['etypes'],[$val['e_enable']?'空位':'已禁用','排期中']); + $val['e_enable'] = parent::state_color($val['e_enable'],['禁用','启用']); + + $scheduleurlid = $this->own_name_table.'schedule&l_id='; + $val['endtitle'] = $val['endtitle']?''.$val['endtitle'].'':''; + $val['nowtitle'] = $val['nowtitle']?''.$val['nowtitle'].'':''; + $val['nexttitle'] = $val['nexttitle']?''.$val['nexttitle'].'':''; + self::eaddress($val,'e_address'); + + $val['endtime'] = strtotime($val['endtime']) < $curtime + ?''.$val['endtime'].'' + :$val['endtime']; + //上个排期 + if(strtotime($val['endetime']) < $curtime){ + $val['endstime'] = ''.$val['endstime'].''; + $val['endetime'] = ''.$val['endetime'].''; + } + + //执行操作按钮 + if(empty($checked)){ +// $this->btn[] = '调整排期'; + $this->btn[] = '查看排期'; + } + //跳过标记突出处理 + $this->skip_field = ['e_number']; + return self::assemble($key,$base,$val,$checked,false); + } + + //小区统计展示 + protected function villages($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_villages(); + + //列表前段 + $base[] = ' + + + '; + + //小区分类 + if(empty(self::$para['v_type'])) self::$para['v_type'] = parent::translate(6); + //对字段处理 + $scheduleurl = $this->own_name_table.'schedule&e_vid='.$val['id']; + + $val['v_name'] = ' '.$val['v_name'].''; + $val['v_type'] = self::$para['v_type'][$val['v_type']]; + $val['v_free'] = $val['v_free']?''.$val['v_free'].'':$val['v_free']; + $val['v_lease'] = $val['v_lease']?''.$val['v_lease'].'':$val['v_lease']; + $val['v_endday'] = $val['v_endday']?''.$val['v_endday'].'':$val['v_endday']; + $val['v_prerow'] = $val['v_prerow']?''.$val['v_prerow'].'':$val['v_prerow']; + if($val['noban'] > 0){ + $val['v_enum'] = ''.$val['v_enum'].''; + if($this->bsign) $val['v_enum'] .= ' -- '; + $val['v_enum'] .= ''.$val['noban'].''; + }else{ + $val['v_enum'] = $val['v_enum']?:''.$val['v_enum'].''; + } + // $val['v_province'].$val['v_city'] 去掉省市 + if(!$this->bsign) $val['v_address'] = $val['v_district'].' '.$val['v_address']; + + //执行操作按钮 + if(empty($checked)){ + $addtourl = $this->own_name_table.'elevators&e_vid='.$val['id']; + $this->btn[] = '广告位统计'; + } + return self::assemble($key,$base,$val,$checked,false); + } + + //小区统计展示 + protected function noticeday($val,$checked = '',$base = []) { + global $_M,$_YW; + //获取字段 + $key = self::tf_noticeday(); + + //列表前段 + + //对字段处理 + //公司 + if(empty(self::$customer[$val['h_cid']])) self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']); + + //相关人员 + $workerswid = stringto_array($val['h_wid'],','); + foreach ($workerswid as $hwid) { + if(empty(self::$workers[$hwid])) self::$workers[$hwid] = parent::workerslist($hwid); + $workersstr[] = self::$workers[$hwid]; + } + + $h_endtime = strtotime($val['h_endtime']); + $curdate = strtotime(date('Y-m-d',time())); + //首先判断当前这条信息是属于到期前台3天的 还是属于设置的提醒 + //那就是判断订单结束时间和今天的相差天数 + $day = abs(($h_endtime - $curdate) / 86400); + if($day > 3){ + //按照设置的提醒来计算 + $str = parent::str_color(0,$val['noticeday'],800); + $htypes = "{$str} 天后到期提醒"; + }else{ + //按照前后3天来设置 + if($h_endtime > $curdate){ + $str = parent::str_color(0,$day,800); + //说明还没到期 + $htypes = "{$str} 天后到期"; + }else{ + //说明已经到期或者过期 + $htypes = $day == 0?parent::str_color(0,'今天到期',800):parent::str_color(0,"已过期 {$day} 天",800); + } + } + + //设置的到期提醒 + //订单到期前后3天提醒 + + $val['h_cid'] = self::$customer[$val['h_cid']]; + $val['h_wid'] = parent::tab_tokenfield(arrayto_string($workersstr),1); + $val['htypes'] = $htypes; + + $numberurl = $this->own_name_table.'contract&h_number='.$val['h_number']; + $val['h_number'] = ' '.$val['h_number'].''; + + return self::assemble($key,$base,$val,$checked,false); + } + + //前台巡查 + protected function patrol($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_patrol(); + + //列表前段 + //对字段处理 + //计算剩余时间 + $nowetime = strtotime($val['nowetime']); + $curdate = strtotime(date('Y-m-d',time())); + $day = $val['nowetime']?abs(($nowetime - $curdate) / 86400):0; + + $val['e_number'] = parent::state_color($val['e_enable'],[$val['e_number'],$val['e_number']]); + self::eaddress($val,'e_address'); + $val['nowtitle'] = parent::state_color($curdate > $nowetime ?0:($day > 2?1:2),[$val['nowtitle'],$val['nowtitle'],$val['nowtitle']]); + + return self::assemble($key,[],$val,$checked,false); + } + + //参数统计 + protected function keylist($val,$checked = '') { + global $_M,$_YW; + //获取字段 + $key = self::tf_keylist(); + + //列表前段 + $base[] = ' + + + '; + + //对字段处理 + if(empty(self::$workers[$val['k_wid']])) { + $k_wid = parent::workerslist($val['k_wid'],false); + self::$workers[$val['k_wid']] = $k_wid['w_name'].','.$k_wid['w_tel']; + } + + $val['k_basekey'] = base64_decode($val['k_basekey']); + $val['k_state'] = parent::state_color($val['k_state'],['禁用','启用']); + $val['k_wid'] = parent::tab_tokenfield(self::$workers[$val['k_wid']],1); + + //执行操作按钮 + if(empty($checked)){ + $addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id']; + $this->btn[] = '编辑'; + } + //执行操作按钮 + return self::assemble($key,$base,$val,$checked); + } + +} diff --git a/met_public/js/basic_admin.js b/met_public/js/basic_admin.js new file mode 100644 index 0000000..285ec4f --- /dev/null +++ b/met_public/js/basic_admin.js @@ -0,0 +1,1086 @@ +/*app/system/include/static2/vendor/babel-external-helpers/babel-external-helpers.min.js*/ +(function(root,factory){if(typeof define==="function"&&define.amd){define(["exports"],factory);}else if(typeof exports==="object"){factory(exports);}else{factory(root.babelHelpers={});}})(this,function(global){var babelHelpers=global;babelHelpers.typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};babelHelpers.jsx=function(){var REACT_ELEMENT_TYPE=typeof Symbol==="function"&&Symbol.for&&Symbol.for("react.element")||0xeac7;return function createRawReactElement(type,props,key,children){var defaultProps=type&&type.defaultProps;var childrenLength=arguments.length-3;if(!props&&childrenLength!==0){props={};}if(props&&defaultProps){for(var propName in defaultProps){if(props[propName]===void 0){props[propName]=defaultProps[propName];}}}else if(!props){props=defaultProps||{};}if(childrenLength===1){props.children=children;}else if(childrenLength>1){var childArray=Array(childrenLength);for(var i=0;i=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;};babelHelpers.possibleConstructorReturn=function(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;};babelHelpers.selfGlobal=typeof global==="undefined"?self:global;babelHelpers.set=function set(object,property,value,receiver){var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent!==null){set(parent,property,value,receiver);}}else if("value"in desc&&desc.writable){desc.value=value;}else{var setter=desc.set;if(setter!==undefined){setter.call(receiver,value);}}return value;};babelHelpers.slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"])_i["return"]();}finally{if(_d)throw _e;}}return _arr;}return function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i);}else{throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();babelHelpers.slicedToArrayLoose=function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){var _arr=[];for(var _iterator=arr[Symbol.iterator](),_step;!(_step=_iterator.next()).done;){_arr.push(_step.value);if(i&&_arr.length===i)break;}return _arr;}else{throw new TypeError("Invalid attempt to destructure non-iterable instance");}};babelHelpers.taggedTemplateLiteral=function(strings,raw){return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));};babelHelpers.taggedTemplateLiteralLoose=function(strings,raw){strings.raw=raw;return strings;};babelHelpers.temporalRef=function(val,name,undef){if(val===undef){throw new ReferenceError(name+" is not defined - temporal dead zone");}else{return val;}};babelHelpers.temporalUndefined={};babelHelpers.toArray=function(arr){return Array.isArray(arr)?arr:Array.from(arr);};babelHelpers.toConsumableArray=function(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);ia?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c; +}catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length",""],thead:[1,"","
      "],col:[2,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,la=/\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("