全局代码进行格式优化

This commit is contained in:
cloud 2020-12-07 02:16:43 +08:00
parent fe837f0df5
commit 7d2668700b
51 changed files with 3925 additions and 3532 deletions

View File

@ -134,10 +134,10 @@ class ajax extends appadmin
// 不可通过唯一索引新增和更新数据,因为他会先触发新增的触发器
// 先查询是否存在相应的广告位排期,存在则修改,相反为新增
$enum = $this->tsql->table('schedule')
->qfield('id')
->where(['s_lid' => $slid, 's_enumber' => $ap_enumber])
->one();
$enum = $this->tsql->table('schedule')
->qfield('id')
->where(['s_lid' => $slid, 's_enumber' => $ap_enumber])
->one();
if ($enum == false) {
//判断广告位是否停用
if ($elevator['e_enable']) {

View File

@ -7,7 +7,8 @@ load::own_class('../traits/tlist');
load::own_class('../traits/tfield');
//表格
class backups extends appadmin {
class backups extends appadmin
{
//备份字段
private $bsign = true;
@ -18,30 +19,31 @@ class backups extends appadmin {
private $sqlk;
//form数组
private $form = [];
//info_on 快速URL
private $own_name_info;
private $bacname = ''; //默认开头
private $csvname = ''; //文件名
private $title = []; //表格标头
private $keys = []; //表格标头对应的键值
private $title = []; //表格标头
private $keys = []; //表格标头对应的键值
private $bactable = ''; //数据库名
private $bacconds = ''; //查询项以及排序
private $bacfield = ''; //查询字段
private $bacpages = 500; //每页查询条数
public function __construct() {
global $_M,$_YW;
public function __construct()
{
global $_M, $_YW;
parent::__construct();
$this->form = $_M['form'];
if($this->form['tname']){
$this->tname = $this->form['tname'];
$this->sqlk = $_YW['k'][$this->tname];
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_info = $_M['url']['own_name'] . 'c=info_on&a=do';
}
use tdata;
@ -49,10 +51,11 @@ class backups extends appadmin {
use tlist;
//表格数据
public function doindex() {
public function doindex()
{
global $_M;
self::csvtitle();
$this->bacname = '广告位';
$this->bacname = '广告位';
self::csvname();
//输出头部
@ -75,11 +78,11 @@ class backups extends appadmin {
# 初始化mysql需要的参数
self::bactable();
# 获取数据总条数
$total = self::tabletotal();
$pages = ceil($total/$this->bacpages);
for ($i = 0; $i < $pages; $i++){
$data = self::tabledata($i);
$y = 0;
$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) {
//返回数据
@ -92,7 +95,7 @@ class backups extends appadmin {
flush();
$y = 0;
}
$arr = self::arrzbm($val,'utf-8' , 'GBK');
$arr = self::arrzbm($val, 'utf-8', 'GBK');
fputcsv($file, $arr);
}
}
@ -100,50 +103,53 @@ class backups extends appadmin {
}
//判断语句组合
protected function bactable() {
protected function bactable()
{
global $_M;
$this->bactable = self::td_sqlk();
$this->bacfield = self::td_field();
$this->bactable = self::td_sqlk();
$this->bacfield = self::td_field();
$where = self::td_where();
$where = self::td_where();
parent::where_id($where);
if($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();
if ($this->bacconds) {
$order = self::td_order();
$this->bacconds .= " ORDER BY {$order} ";
}
return $this;
}
//计算总数
protected function tabletotal() {
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);
$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) {
protected function tabledata($pages)
{
global $_M;
$cursize = $pages* $this->bacpages;
$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;
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);
$lists = self::{$this->tname}($val);
$baclist[] = array_intersect_key(self::striptags($lists), $this->title);
}
return $baclist;
}
@ -153,40 +159,44 @@ class backups extends appadmin {
* 导入导出公用函数
*
* ****************************************************************************** */
# 导入导出数组(保持和导入格式一样)
protected function csvtitle() {
protected function csvtitle()
{
global $_M, $_YW;
$this->title = self::{'tf_'.$this->tname}();
$this->keys = array_keys($this->title);
$this->title = self::{'tf_' . $this->tname}();
$this->keys = array_keys($this->title);
return $this;
}
//生成文件名
public function csvname() {
public function csvname()
{
global $_M, $_YW;
$date = date('Ymd', time());
$filename = iconv("utf-8", "GBK", $this->bacname . $_M['lang'] . $date);
$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) {
public function arrzbm($arr, $u, $g)
{
global $_M, $_YW;
foreach ($arr as $k => $v) {
$newarr[$k] = iconv($u, $g, $v);
$newarr[ $k ] = iconv($u, $g, $v);
}
return $newarr;
}
//删除html元素
public function striptags($array = []) {
public function striptags($array = [])
{
global $_M, $_YW;
$ret = [];
$ret = [];
foreach ($array as $key => $str) {
$ret[$key] = strip_tags($str);
$ret[ $key ] = strip_tags($str);
}
return $ret;
}

View File

@ -59,7 +59,7 @@ class config extends appadmin
if (empty($lang)) $lang = $_M['lang'];
//程序运行必备
$para_a = ['tem_ida', 'tem_idb', 'tem_idc', 'openid'];
$para_b = ['mapkey','mapprov','mapcity','mapdist','maplng','maplat'];
$para_b = ['mapkey', 'mapprov', 'mapcity', 'mapdist', 'maplng', 'maplat'];
$para = array_merge($para_a, $para_b);
$arrs = array_intersect_key($form, array_combine($para, $para)); //对比数组
foreach ($arrs as $k => $v) {

View File

@ -1,38 +1,44 @@
<?php
defined('IN_MET') or exit('No permission');
load::own_class('appadmin');
//接口初始化
class dzadsod extends appadmin {
public function __construct() {
global $_M,$_YW;
//接口初始化
class dzadsod extends appadmin
{
public function __construct()
{
global $_M, $_YW;
parent::__construct();
parent::appnav();
parent::point('dzadsod','dodzadsod');
parent::point('dzadsod', 'dodzadsod');
}
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 __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 dodzadsod() {
public function dodzadsod()
{
global $_M;
//统计总数
$this->input['num'] = $this->cloud->summary();
$this->input['num'] = $this->cloud->summary();
//到期数据
parent::point('table_off','doindex','table');
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';
$this->input['table'] = load::own_class('table_theme', 'new')->start($this->tname)->send_all(1);
$this->appshow = 'app/dzadsod';
}
}
?>

View File

@ -3,69 +3,69 @@ defined('IN_MET') or exit ('No permission');
load::own_class('appadmin');
class info_on extends appadmin
class info_on extends appadmin
{
//设置参数
protected $addparaurl = '';
public function __construct()
protected $addparaurl = '';
public function __construct()
{
global $_M,$_YW;
global $_M, $_YW;
parent::__construct();
parent::point('info_off','doindex');
parent::point('info_off', 'doindex');
}
public function __destruct()
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);
global $_M, $_YW;
if ($this->destruct) {
if (empty($this->appshow)) $this->appshow = 'app/' . $this->tname;
require $this->show($this->appshow, $this->input);
}
}
//场所
public function dovillage()
public function dovillage()
{
global $_M,$_YW;
parent::appnav(['table_on__dovillage','场所资料']);
parent::appurl(parent::tname(),['id'=>$_M['form']['id']]);
if($_M['form']['id']){
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{
->where(['id' => $_M['form']['id']])
->one();
} else {
//默认值
$this->input['data']['v_province'] = '山东省';
$this->input['data']['v_city'] = '泰安市';
$this->input['data']['v_district'] = '泰山区';
$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']);
$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']);
// 百度地图
$this->input['mapkey'] = $_YW['c']['mapkey'];
$this->input['mapkey'] = $_YW['c']['mapkey'];
//城市json
$this->input['url']['city'] = $this->cloud->city_url();
}
//企业
public function docustomer()
public function docustomer()
{
global $_M,$_YW;
parent::appnav(['table_on__docustomer','企业资料']);
parent::appurl(parent::tname(),['id'=>$_M['form']['id']]);
if($_M['form']['id']){
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{
->where(['id' => $_M['form']['id']])
->one();
} else {
//默认值
$this->input['data']['c_province'] = '山东省';
$this->input['data']['c_city'] = '泰安市';
$this->input['data']['c_district'] = '泰山区';
$this->input['data']['c_province'] = '山东省';
$this->input['data']['c_city'] = '泰安市';
$this->input['data']['c_district'] = '泰山区';
}
//城市json
@ -73,176 +73,176 @@ class info_on extends appadmin
}
//企业
public function doworkers()
public function doworkers()
{
global $_M,$_YW;
parent::appnav(['table_on__doworkers','企业资料']);
parent::appurl(parent::tname(),['id'=>$_M['form']['id']]);
if($_M['form']['id']){
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();
->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']);
$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()
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';
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' => 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' => 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']);
$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{
} else {
//默认值
$this->input['data']['e_vid'] = $_M['form']['e_vid'];
$this->input['data']['e_enable'] = 1;
$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' => 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' => 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']);
$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'];
$this->input['remote_url'] = $_M['url']['own_name'] . 'c=ajax&a=doenumber&id=' . $_M['form']['id'];
}
//录入合同
public function docontract()
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{
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['data']['e_vid'] = $_M['form']['e_vid'];
$this->input['data']['h_noticeday'] = 7;
}
$para = $this->tsql->table('para')->where(['p_type' => 4])->all();
parent::para_checkbox($para,'h_medium',$this->input['data']['h_medium'],$this->input['para']['h_medium_radio'])
->setparahtml(4,$this->input['para']['h_medium_radio']);
$this->input['remote_url'] = $_M['url']['own_name'].'c=ajax&a=dohnumber&id='.$_M['form']['id'];
$para = $this->tsql->table('para')->where(['p_type' => 4])->all();
parent::para_checkbox($para, 'h_medium', $this->input['data']['h_medium'], $this->input['para']['h_medium_radio'])
->setparahtml(4, $this->input['para']['h_medium_radio']);
$this->input['remote_url'] = $_M['url']['own_name'] . 'c=ajax&a=dohnumber&id=' . $_M['form']['id'];
}
//广告投放
public function dolaunch()
public function dolaunch()
{
global $_M,$_YW;
$slid = $_M['form']['slid'];
parent::appnav(['table_on__dolaunch','广告投放']);
parent::appurl(parent::tname(),['slid'=>$slid]);
global $_M, $_YW;
$slid = $_M['form']['slid'];
parent::appnav(['table_on__dolaunch', '广告投放']);
parent::appurl(parent::tname(), ['slid' => $slid]);
$fzid = $_M['form']['fzid'];
$fzid = $_M['form']['fzid'];
if($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();
}elseif($fzid){
->where(['id' => $slid])
->one();
$contract = $this->tsql->table('contract')
->where(['h_number' => $this->input['data']['l_hnumber']])
->one();
} elseif ($fzid) {
// 复制功能
$this->input['data'] = $this->tsql->table($this->tname)
->where(['id' => $fzid])
->one();
$contract = $this->tsql->table('contract')
->where(['h_number' => $this->input['data']['l_hnumber']])
->one();
->where(['id' => $fzid])
->one();
$contract = $this->tsql->table('contract')
->where(['h_number' => $this->input['data']['l_hnumber']])
->one();
// 注销掉不需要的属性
unset($this->input['data']['id'],$this->input['data']['l_enumber'],$this->input['data']['l_schedule'],$this->input['data']['l_enable'],$this->input['data']['l_updatetime'],$this->input['data']['l_addtime']);
}else{
unset($this->input['data']['id'], $this->input['data']['l_enumber'], $this->input['data']['l_schedule'], $this->input['data']['l_enable'], $this->input['data']['l_updatetime'], $this->input['data']['l_addtime']);
} else {
//获取合同的值
$contract = $this->tsql->table('contract')
->where(['id' => $_M['form']['cid']])
->one();
->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']['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_starttime'] = $contract['h_starttime'];
$this->input['data']['h_endtime'] = $contract['h_endtime'];
//获取公司名称
$this->input['data']['h_cid'] = parent::customerlist($contract['h_cid']);
$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(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']);
$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;
$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()
public function dokeylist()
{
global $_M,$_YW;
parent::appnav(['table_on__dokeylist','巡查人员']);
parent::appurl(parent::tname(),['id'=>$_M['form']['id']]);
if($_M['form']['id']){
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();
->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;
$this->input['data']['k_passkey'] = base64_decode($this->input['data']['k_basekey']);
} else {
$this->input['data']['k_state'] = 1;
}
}
// 调整广告位投放计划
public function douplaunch()
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']]);
global $_M, $_YW;
parent::appnav(['info_on__douplaunch', '调整投放计划']);
// parent::appnav(['info_on__doelevators','调整投放计划']);
parent::appurl(parent::tname(), ['e_number' => $_M['form']['e_number']]);
// 先获取广告位编号,获取对应的位置信息
// 再获取 前 中 后排期
// 过期的只要最后一期,当前排期的,按照当天计算,然后罗列出预排的排期
@ -258,4 +258,5 @@ class info_on extends appadmin
}
}
?>

View File

@ -1,5 +1,6 @@
<?php
defined('IN_MET') or exit ('No permission');
//2.0
class install
{
@ -15,43 +16,46 @@ class install
private $display;
private $mlangok;
public function __construct() {
public function __construct()
{
global $_M;
do{
$this->appno = mt_rand(2001,9999); //应用编号
do {
$this->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; //是否支持多语言
$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() {
public function dosql()
{
global $_M;
$stall = self::sqlone('applist'," m_name='{$this->m_name}' ");
if(!$stall){
$stall = self::sqlone('applist', " m_name='{$this->m_name}' ");
if (!$stall) {
//系统表
self::appsql();
}else{
} else {
}
return 'complete';
return 'complete';
}
//执行APP相关的表数据插入
private function appsql() {
private function appsql()
{
global $_M;
$time = time();
$time = time();
//注册应用
$field = "
$field = "
`no`='{$this->appno}',
`ver` = {$this->appver},
`m_name` = '{$this->m_name}',
@ -65,15 +69,15 @@ class install
`display`='{$this->display}',
`depend`='{$this->depend}',
`mlangok`='{$this->mlangok}' ";
self::addsql('applist',$field);
self::addsql('applist', $field);
/**
* 1、增加新表
* name 配置名称
* id 添加信息自动增加,
* value 配置名称值
* lang 语言[后台]
**/
* 1、增加新表
* name 配置名称
* id 添加信息自动增加,
* value 配置名称值
* lang 语言[后台]
**/
$field = " `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
`m_name` varchar(100) NOT NULL,
@ -81,26 +85,29 @@ class install
`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");
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 = '') {
private function sqlone($tname, $where = '')
{
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->appno}'";
$table = $_M['table'][ $tname ];
if (!$where) {
$where = "no='{$this->appno}'";
}
return DB::get_one("select * from {$table} where {$where}");
}
//公共写入方法
private function addsql($tname,$field = '') {
private function addsql($tname, $field = '')
{
global $_M;
$table = $_M['table'][$tname];
$table = $_M['table'][ $tname ];
DB::query("INSERT INTO {$table} SET {$field}");
}
}
?>

View File

@ -9,7 +9,9 @@ load::own_func('appcmp');
* 配置
* 包含其他功能初始化
*/
class select extends appadmin {
class select extends appadmin
{
/*
* @$querys string 搜索内容
@ -25,7 +27,7 @@ class select extends appadmin {
*/
//搜索内容
private $querys = '';
private $querys = '';
//指定字段为值
private $fiend;
//来源页面标记
@ -40,250 +42,259 @@ class select extends appadmin {
private $division;
//sql判断条件
private $where = '';
private $where = '';
//返回的数组
private $data = [];
public function __construct() {
global $_M,$_YW;
private $data = [];
public function __construct()
{
global $_M, $_YW;
parent::__construct();
//指定表
$this->tname = $_M['form']['tname'];
$this->tname = $_M['form']['tname'];
//搜索内容
$this->querys = $_M['form']['querys'];
$this->querys = $_M['form']['querys'];
//以指定字段为值
$this->fiend = $_M['form']['fiend']?:'id';
$this->fiend = $_M['form']['fiend'] ?: 'id';
//来源
$this->source = $_M['form']['source'];
$this->source = $_M['form']['source'];
//是否显示全部
$this->allnone = $_M['form']['allnone'];
$this->allnone = $_M['form']['allnone'];
//判断条件
$this->condition = $_M['form']['condition'];
$this->condition = $_M['form']['condition'];
//默认值
$this->default = $_M['form']['default'];
$this->default = $_M['form']['default'];
//默认值分隔符
$this->division = $_M['form']['division'];
}
# select2 选项字段处理
private function select_fiend($val) {
global $_M,$_YW;
$strarr = stringto_array($this->fiend,'|');
private function select_fiend($val)
{
global $_M, $_YW;
$strarr = stringto_array($this->fiend, '|');
foreach ($strarr as $value) {
$arrstr[] = $val[$value];
$arrstr[] = $val[ $value ];
}
return arrayto_string($arrstr,'|');
return arrayto_string($arrstr, '|');
}
# allnone 默认选项全部处理
private function allnone() {
global $_M,$_YW;
private function allnone()
{
global $_M, $_YW;
// 若不需要显示‘全部’值,则直接返回空
// 0 为不显示‘全部’,同时也在未搜索到结果的情况下 不 设置为可选值
// 1 为显示 显示‘全部’,同时也在未搜索结果的情况下 设置可选值
// 2 只显示‘全部’
// 3 只将未搜索到结果的情况下设置为可选值
if(empty($this->allnone) || $this->allnone == '3') return false;
if (empty($this->allnone) || $this->allnone == '3') return false;
//然后可根据来源标记进行处理
switch ($this->source) {
// case 'githooks':
// $initial[] = ['id' => 'newver','text'=>'自动部署至最新版本'];
// break;
// case 'githooks':
// $initial[] = ['id' => 'newver','text'=>'自动部署至最新版本'];
// break;
default:
$initial[] = [ 'id' => '','text' => '全部' ];
$initial[] = ['id' => '', 'text' => '全部'];
break;
}
$this->data[] = ["text" => '',"children" => $initial ];
$this->data[] = ["text" => '', "children" => $initial];
}
# 当未搜索到值是否将搜索结果设置为可选值
private function children() {
global $_M,$_YW;
private function children()
{
global $_M, $_YW;
// 判断是否要将搜索内容设置为可选值
if(empty($this->allnone) || $this->allnone == '2' || strlen($this->querys) == 0) return false;
if (empty($this->allnone) || $this->allnone == '2' || strlen($this->querys) == 0) return false;
// 要注意id的是否为可写入数据库 误区,若有些字段为数字 则会导致无法录入成功
// 后期可增加一个判断方式来处理这个误区
$this->data[] = [
"text" => '',
"text" => '',
"children" => [
['id'=> $this->querys,'text' => $this->querys]
]
['id' => $this->querys, 'text' => $this->querys]
]
];
}
# querys 处理
private function querys() {
global $_M,$_YW;
if(strlen($this->querys) == 0) return false;
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;
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;
private function condition()
{
global $_M, $_YW;
if (empty($this->condition)) return false;
// 进行处理
$condition = stringto_array($this->condition,'|||','$$$');
$condition = stringto_array($this->condition, '|||', '$$$');
foreach ($condition as $value) {
list($key,$val) = $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;
$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;
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;
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,' / ');
$text = arrayto_string($fiend, ' / ');
return $text;
}
//编号字段,根据此字段进行编号处理
private function charter() {
global $_M,$_YW;
private function charter()
{
global $_M, $_YW;
switch ($this->tname) {
case 'village':
$fiend = 'v_name';
$fiend = 'v_name';
break;
case 'customer':
$fiend = 'c_name';
$fiend = 'c_name';
break;
case 'workers':
$fiend = 'w_name';
$fiend = 'w_name';
break;
case 'contract':
$fiend = 'h_number';
$fiend = 'h_number';
break;
case 'launch':
$fiend = 'l_title';
$fiend = 'l_title';
break;
case 'weuser':
$fiend = 'nickname';
$fiend = 'nickname';
break;
case 'para':
$fiend = 'p_name';
$fiend = 'p_name';
break;
default:
break;
}
return $fiend;
}
// 查看场所名称列表
public function doselect() {
global $_M,$_YW;
public function doselect()
{
global $_M, $_YW;
//判断条件
self::querys();
//带入的判断条件
self::condition();
//编号的字段
$fiend = self::charter();
$fiend = self::charter();
//查询
$array = $this->tsql->table($this->tname)->where($this->where)->order('id DESC')->all('id');
// $sqltsr = $this->tsql->query();
$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']);
if ($this->tname == 'weuser') {
$val['nickname'] = urldecode($val['nickname']);
}
$letter = getstrcharter($val[$fiend]);
$selectlist[$letter][] = $val;
$letter = getstrcharter($val[ $fiend ]);
$selectlist[ $letter ][] = $val;
}
//是否显示全部
self::allnone();
//是否将搜索内容作为结果
self::children();
//处理结果
foreach ($selectlist as $key => $val){
foreach ($selectlist as $key => $val) {
$arr = [];
foreach ($val as $v) {
$valid = self::select_fiend($v);
$valid = self::select_fiend($v);
//判断是否只输出默认值
if(strlen($this->default) > 0){
if (strlen($this->default) > 0) {
$default = stringto_array($this->default, $this->division);
if(!in_array($valid, $default,true)) continue;
if (!in_array($valid, $default, true)) continue;
}
//组成选项
$arr[] = ['id' => $valid, 'text' => self::valuet($v)];
$arr[] = ['id' => $valid, 'text' => self::valuet($v)];
}
$this->data[] = ["text" => $key,"children" => $arr];
$this->data[] = ["text" => $key, "children" => $arr];
}
//当值不存在时
if(!count($this->data)){
if (!count($this->data)) {
//输出没有搜索到结果
$this->data = [["text" => $this->querys == ''?'检索不到相关信息':"检索不到 {$this->querys} 相关信息","children" => [] ]];
}else{
$this->data = [["text" => $this->querys == '' ? '检索不到相关信息' : "检索不到 {$this->querys} 相关信息", "children" => []]];
} else {
//对数组排序A-ZZ
$text = array_column($this->data, 'text');
array_multisort($text,SORT_ASC,$this->data);
$text = array_column($this->data, 'text');
array_multisort($text, SORT_ASC, $this->data);
}
echo jsoncallback(['results' => $this->data]);
}
}
?>

View File

@ -7,7 +7,8 @@ load::own_class('../traits/tlist');
load::own_class('../traits/tfield');
//表格
class table_ajax extends appadmin {
class table_ajax extends appadmin
{
//非备份,正常字段即可
private $bsign = false;
@ -18,47 +19,49 @@ class table_ajax extends appadmin {
private $sqlk;
//form数组
private $form = [];
//info_on 快速URL
private $own_name_info;
private $own_name_table;
public function __construct() {
global $_M,$_YW;
public function __construct()
{
global $_M, $_YW;
parent::__construct();
$this->form = $_M['form'];
if($this->form['tname']){
$this->tname = $this->form['tname'];
$this->sqlk = $_YW['k'][$this->tname];
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';
$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() {
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();
$field = self::td_field();
$sqlk = self::td_sqlk();
$where = self::td_where();
$order = self::td_order();
/*查询表*/
if($where){
if ($where) {
$conds .= " WHERE {$where} ";
}
if($order){
if ($order) {
$conds .= " ORDER BY {$order} ";
}
//整理查询条件
$query = "SELECT {$field} FROM {$sqlk} {$conds} ";
//获取数据
$data = $table->getdata($sqlk, $field, $where, $order,$query,$this->multi_table);
$data = $table->getdata($sqlk, $field, $where, $order, $query, $this->multi_table);
//数据整理
$array = self::sqlarr($data);
$array = self::sqlarr($data);
//返回数据
$table->rdata($array);
}
@ -69,28 +72,30 @@ class table_ajax extends appadmin {
* 【列出】
* 返回数据数组
*/
private function sqlarr($data = []) {
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;
// }
// 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(){
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=""');
$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);
}
@ -99,11 +104,12 @@ class table_ajax extends appadmin {
* 【新行】
* 生成文件新增行
*/
private function addlist($val) {
private function addlist($val)
{
global $_M;
$metinfo = '';
foreach ($this->list as $v){
$metinfo .= '<td class=" text-xs-center">'.$v.'</td>';
foreach ($this->list as $v) {
$metinfo .= '<td class=" text-xs-center">' . $v . '</td>';
}
echo "<tr>{$metinfo}</tr>";
}
@ -112,10 +118,11 @@ class table_ajax extends appadmin {
use tlist;
//公用的输出
protected function output($val,$checked = '') {
global $_M,$_YW;
$array = self::{$this->tname}($val,$checked);
$this->list = array();
protected function output($val, $checked = '')
{
global $_M, $_YW;
$array = self::{$this->tname}($val, $checked);
$this->list = array();
foreach ($array as $value) {
$this->list[] = $value;
}

View File

@ -4,11 +4,12 @@ defined('IN_MET') or exit ('No permission');
load::own_class('appadmin');
//表格
class table_off extends appadmin {
class table_off extends appadmin
{
//获取的ID
private $allid;
//表名
private $sqlk;
@ -17,39 +18,40 @@ class table_off extends appadmin {
//跳转URL
private $returl = '';
//参数
private $para = [];
public function __construct()
private $para = [];
public function __construct()
{
global $_M,$_YW;
global $_M, $_YW;
parent::__construct();
$this->tname = $_M['form']['tname'];
$this->sqlk = $_YW['k'][$this->tname];
$this->tname = $_M['form']['tname'];
$this->sqlk = $_YW['k'][ $this->tname ];
}
public function __destruct()
public function __destruct()
{
global $_M,$_YW;
if($this->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);
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']));
public function doindex()
{
global $_M, $_YW;
$this->allid = array_filter(explode(',', $_M['form']['all_id']));
switch ($_M['form']['submit_type']) {
case 'delet':
self::delet();
@ -71,97 +73,102 @@ class table_off extends appadmin {
default:
break;
}
if($_M['form']['method'] == 'ajax') {
if ($_M['form']['method'] == 'ajax') {
$this->destruct = false;
echo jsoncallback(['code' => $this->tsql->error()?1:0 ]);
echo jsoncallback(['code' => $this->tsql->error() ? 1 : 0]);
}
}
//保存
private function save() {
global $_M,$_YW;
private function save()
{
global $_M, $_YW;
foreach ($this->allid as $id) {
if($id){
$field = self::info($id);
if(is_number($id)){
if ($id) {
$field = self::info($id);
if (is_number($id)) {
$this->tsql->table($this->tname)
->field($field)
->where(" id = '{$id}' ")
->upd();
} else {
->field($field)
->where(" id = '{$id}' ")
->upd();
} else {
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
}
}
}
}
//删除
private function delet() {
global $_M,$_YW;
private function delet()
{
global $_M, $_YW;
foreach ($this->allid as $id) {
if($id){
if ($id) {
//删除关联表
$ret = self::todel($id);
if($ret == false) continue;
$ret = self::todel($id);
if ($ret == false) continue;
//删除本表
$where = " id = '{$id}' ";
$where = " id = '{$id}' ";
$this->tsql->table($this->tname)
->where($where)
->del();
->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';
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){
if ($id) {
$this->tsql->table('elevator')
->field(['e_enable' => $enable])
->where([$fid => $id])
->upd();
->field(['e_enable' => $enable])
->where([$fid => $id])
->upd();
}
}
}
//ajax单独调整
private function typeonoff() {
global $_M,$_YW;
$field = $_M['form']['field'];
$special = "ABS({$field}-1)";
private function typeonoff()
{
global $_M, $_YW;
$field = $_M['form']['field'];
$special = "ABS({$field}-1)";
$array = [$field => $special];
$field_id = 'id';
$array = [$field => $special];
$field_id = 'id';
foreach ($this->allid as $id) {
if($id){
if ($id) {
$this->tsql->table($this->tname)
->special($special)
->field($array)
->where([$field_id => $id])
->upd();
->special($special)
->field($array)
->where([$field_id => $id])
->upd();
}
}
}
//保存信息
private function info($id) {
global $_M,$_YW;
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]
$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:
@ -171,51 +178,52 @@ class table_off extends appadmin {
}
//删除其他的关联表
private function todel($id) {
global $_M,$_YW;
$ret = true;
private function todel($id)
{
global $_M, $_YW;
$ret = true;
switch ($this->tname) {
case 'contract':
//获取合同编号
$contract = $this->tsql->table('contract')
->where(['id' => $id])
->one();
$contract = $this->tsql->table('contract')
->where(['id' => $id])
->one();
//删除相关计划
$this->tsql->table('launch')
->where(['l_hnumber' => $contract['h_number'] ])
->del();
->where(['l_hnumber' => $contract['h_number']])
->del();
//删除相关排期
$this->tsql->table('schedule')
->where(['s_hnumber' => $contract['h_number'] ])
->del();
->where(['s_hnumber' => $contract['h_number']])
->del();
break;
case 'launch':
//删除相关排期
$this->tsql->table('schedule')
->where(['s_lid' => $id ])
->del();
->where(['s_lid' => $id])
->del();
break;
case 'para':
//删除相关的光广告位
if($_M['form']['p_num-'.$id] > 0) $ret = false;
if ($_M['form'][ 'p_num-' . $id ] > 0) $ret = false;
break;
case 'village':
//查询需要删除的广告位编号
$elevator = $this->tsql->table('elevator')
->where(['e_vid' => $id])
->all();
$elevator = $this->tsql->table('elevator')
->where(['e_vid' => $id])
->all();
$e_number = array_column($elevator, 'e_number');
$e_number = array_column($elevator, 'e_number');
self::del_elevator($e_number);
break;
case 'elevator':
$elevator = $this->tsql->table('elevator')
->where(['id' => $id])
->one();
$elevator = $this->tsql->table('elevator')
->where(['id' => $id])
->one();
//删除相关排期广告位编号
self::del_elevator($elevator['e_number']);
self::del_elevator($elevator['e_number']);
break;
default:
break;
}
@ -223,64 +231,66 @@ class table_off extends appadmin {
}
// 删除排期广告位编号
private function del_elevator($num) {
$dellist = [];
if(!is_array($num)) $num = [$num];
$num = array_unique($num);
if(count($num) == 0) return false;
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){
foreach ($num as $e_number) {
// 删除广告位
$this->tsql->table('elevator')
->where(['e_number' => $e_number ])
->del();
->where(['e_number' => $e_number])
->del();
//删除相关排期缓存
$this->tsql->table('schedule')
->where(['s_enumber' => $e_number ])
->del();
->where(['s_enumber' => $e_number])
->del();
// 整理数据
$launch = false;
// 选择的广告位
$launch = $this->tsql->table('launch')
->where(" find_in_set( '{$e_number}', l_selectenum ) ")
->all();
->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;
$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');
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');
->where(" find_in_set( '{$e_number}', l_enumber ) ")
->all();
if ($launch != false) $col($launch, 'l_enumber');
}
if(count($dellist) == 0) return false;
if (count($dellist) == 0) return false;
// 对值进行统计并修改
foreach ($dellist as $id => $la){
foreach ($dellist as $id => $la) {
// 处理的核心函数
$enum = function($field) use($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];
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();
->field(['l_selectenum' => $enum('l_selectenum'), 'l_enumber' => $enum('l_enumber')])
->where(['id' => $id])
->upd();
}
}
}
?>

View File

@ -3,133 +3,133 @@ defined('IN_MET') or exit ('No permission');
load::own_class('appadmin');
class table_on extends appadmin {
class table_on extends appadmin
{
// 表格标题
private $table_theme; // 等待完善
public function __construct()
public function __construct()
{
global $_M,$_YW;
global $_M, $_YW;
parent::__construct();
parent::appnav();
parent::point('table_off','doindex','table');
$this->table_theme = load::own_class('table_theme','new');
parent::point('table_off', 'doindex', 'table');
$this->table_theme = load::own_class('table_theme', 'new');
}
//输出模板内容
public function __destruct()
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);
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()
public function doelevator()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
//场所统计
public function dovillage()
public function dovillage()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
//广告合同关联表
public function doschedule()
public function doschedule()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all();
}
//合同统计
public function docontract()
public function docontract()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all();
}
//企业资料
public function docustomer()
public function docustomer()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
//企业联系人
public function doworkers()
public function doworkers()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
//投放计划单
public function dolaunch()
public function dolaunch()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
//参数配置
public function dopara()
public function dopara()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all();
}
// 场所统计
public function dovillages()
public function dovillages()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$vs_daytime = date('Y-m-d',time());
$vs_daytime = date('Y-m-d', time());
$this->input['top']['tips'] = '
<div class="alert dark alert-primary radius0 m-b-5">
<p><mark>闲置个数、排期中的个数、到期个数、预排的个数计算说明</mark></p>
<ol>
<li>若选择时间区段,若两者缺少其中一个则自动补全为当天时间(<span class="tag tag-danger">'.$vs_daytime.'</span></li>
<li><span class="tag tag-danger">闲置:</span>默认计算当天('.$vs_daytime.')的广告位闲置个数,选择时间区段后,计算的可以满足时间区段的广告位个数。(<span class="tag tag-danger">仅计算启用的广告位</span>)</li>
<li><span class="tag tag-danger">排期中:</span>默认计算当天('.$vs_daytime.')排期中的个数,选择时间区段后,计算的在时间区段内有排期的广告位个数。</li>
<li><span class="tag tag-danger">到期:</span>默认以当天('.$vs_daytime.')为准,计算<span class="tag tag-danger">7</span>天后到期的个数,选择时间区段后,计算的在时间区段内到期的广告位个数。</li>
<li><span class="tag tag-danger">预排:</span>默认计算当天('.$vs_daytime.')以后才开始的排期广告位个数,选择时间区段后,计算的是时间区段内排期状态为预排的广告位个数。</li>
<li>若选择时间区段,若两者缺少其中一个则自动补全为当天时间(<span class="tag tag-danger">' . $vs_daytime . '</span></li>
<li><span class="tag tag-danger">闲置:</span>默认计算当天(' . $vs_daytime . ')的广告位闲置个数,选择时间区段后,计算的可以满足时间区段的广告位个数。(<span class="tag tag-danger">仅计算启用的广告位</span>)</li>
<li><span class="tag tag-danger">排期中:</span>默认计算当天(' . $vs_daytime . ')排期中的个数,选择时间区段后,计算的在时间区段内有排期的广告位个数。</li>
<li><span class="tag tag-danger">到期:</span>默认以当天(' . $vs_daytime . ')为准,计算<span class="tag tag-danger">7</span>天后到期的个数,选择时间区段后,计算的在时间区段内到期的广告位个数。</li>
<li><span class="tag tag-danger">预排:</span>默认计算当天(' . $vs_daytime . ')以后才开始的排期广告位个数,选择时间区段后,计算的是时间区段内排期状态为预排的广告位个数。</li>
</ol>
</div>';
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
// 场所统计
public function doelevators()
public function doelevators()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all(1);
}
// 巡查密钥列表
public function dokeylist()
public function dokeylist()
{
global $_M,$_YW;
global $_M, $_YW;
parent::appurl(parent::tname());
$this->input['table'] = $this->table_theme->start($this->tname)->send_all();
}
}
?>

View File

@ -5,44 +5,44 @@ $met_title = $data['met_title'];
<include file='sys_admin/head_v2'/>
<div class="appmain">
<form method="POST" action="{$data.url.action}" target="_self" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>{$data.met_title}</h3>
<dl>
<dt><label class='form-control-label'>合同编号</label></dt>
<dd class="form-group">
<input type="text" name="h_number"
value="{$data.data.h_number}"
class="form-control"
placeholder='输入合同唯一编号'
required data-fv-notEmpty-message='不能为空'
data-fv-remote="true" data-fv-remote-url="{$data.remote_url}"
data-fv-remote-message="广告编号不能重复"
<input type="text" name="h_number"
value="{$data.data.h_number}"
class="form-control"
placeholder='输入合同唯一编号'
required data-fv-notEmpty-message='不能为空'
data-fv-remote="true" data-fv-remote-url="{$data.remote_url}"
data-fv-remote-message="广告编号不能重复"
{$data.data.h_number_readonly}
>
>
<span class="text-help m-l-10"><foot class="red-600">保存后不可二次修改</foot>,合同唯一编号,方便后期查询处理</span>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>签订日期</label></dt>
<dd>
<input type="text" name="h_signtime"
value="{$data.data.h_signtime}"
<input type="text" name="h_signtime"
value="{$data.data.h_signtime}"
class="form-control" data-plugin='datetimepicker' data-day-type="2">
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>签订企业</label></dt>
<dd class="form-group">
<select name='h_cid' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="customer"
data-fiend="id"
data-allnone="0"
data-source="add_contract"
data-default="{$data.data.h_cid}"
data-placeholder="输入企业全称"
<select name='h_cid' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="customer"
data-fiend="id"
data-allnone="0"
data-source="add_contract"
data-default="{$data.data.h_cid}"
data-placeholder="输入企业全称"
required data-fv-notEmpty-message='不能为空'>
<option value=""></option>
</select>
@ -51,15 +51,15 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>签订相关人员</label></dt>
<dd class="form-group">
<select name='h_wid[]' class="form-control" multiple data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="workers"
data-fiend="id"
data-allnone="0"
data-source="add_contract_workers"
data-default="{$data.data.h_wid}"
data-placeholder="输入联系人姓名/电话"
data-division=","
<select name='h_wid[]' class="form-control" multiple data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="workers"
data-fiend="id"
data-allnone="0"
data-source="add_contract_workers"
data-default="{$data.data.h_wid}"
data-placeholder="输入联系人姓名/电话"
data-division=","
required data-fv-notEmpty-message='不能为空'>
<option value=""></option>
</select>
@ -70,15 +70,15 @@ $met_title = $data['met_title'];
<dd class="form-group">
<div class="input-group">
<span class="input-group-addon">周期</span>
<input type="text" name="h_texta"
value="{$data.data.h_texta}"
class="form-control"
placeholder='投放周期' >
<input type="text" name="h_texta"
value="{$data.data.h_texta}"
class="form-control"
placeholder='投放周期'>
<span class="input-group-addon">--</span>
<input type="text" name="h_tower"
value="{$data.data.h_tower}"
class="form-control"
placeholder='投放台数' >
<input type="text" name="h_tower"
value="{$data.data.h_tower}"
class="form-control"
placeholder='投放台数'>
<span class="input-group-addon"></span>
</div>
<span class="text-help m-l-10"></span>
@ -89,21 +89,21 @@ $met_title = $data['met_title'];
<dd class="form-group">
<div class="input-group">
<span class="input-group-addon">开始时间</span>
<input type="text" name="h_starttime" value="{$data.data.h_starttime}"
class="form-control w-150"
id="date_timepicker_start"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
<input type="text" name="h_starttime" value="{$data.data.h_starttime}"
class="form-control w-150"
id="date_timepicker_start"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
<span class="input-group-addon">结束时间</span>
<input type="text" name="h_endtime" value="{$data.data.h_endtime}"
class="form-control w-150"
id="date_timepicker_end"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
<input type="text" name="h_endtime" value="{$data.data.h_endtime}"
class="form-control w-150"
id="date_timepicker_end"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
</div>
<span class="text-help m-l-10">影响后期的投放计划时间区间</span>
</dd>
@ -117,7 +117,8 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>合同到期通知</label></dt>
<dd>
<input type="text" name="h_noticeday" placeholder="输入天数,限于数字" value="{$data.data.h_noticeday}" data-plugin='tokenfield' data-delimiter=','/>
<input type="text" name="h_noticeday" placeholder="输入天数,限于数字" value="{$data.data.h_noticeday}"
data-plugin='tokenfield' data-delimiter=','/>
<span class="text-help m-l-10">可设置多个通知天数,输入完成一个回车后再输入下一个</span>
</dd>
</dl>
@ -125,11 +126,11 @@ $met_title = $data['met_title'];
<dt><label class='form-control-label'>合同总额</label></dt>
<dd class="form-group">
<div class="input-group">
<input type="text" name="h_tprice"
value="{$data.data.h_tprice}"
class="form-control"
placeholder='输入合同总额'
required data-fv-notEmpty-message='不能为空'>
<input type="text" name="h_tprice"
value="{$data.data.h_tprice}"
class="form-control"
placeholder='输入合同总额'
required data-fv-notEmpty-message='不能为空'>
<span class="input-group-addon"></span>
</div>
<span class="text-help m-l-10">合同总额方便后期统计</span>
@ -138,7 +139,8 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>合同备注</label></dt>
<dd class="form-group">
<textarea name="h_text" rows="5" placeholder='备注描述' class='form-control m-r-10'>{$data.data.h_text}</textarea>
<textarea name="h_text" rows="5" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.h_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>

View File

@ -7,16 +7,16 @@
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)
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: 0 1px 1px rgba(0, 0, 0, .05)
}
.panel-content>.row {
.panel-content > .row {
padding-left: 30px;
padding-right: 30px
}
.panel-content>.row>[class*=col-] {
.panel-content > .row > [class*=col-] {
padding-left: 30px;
padding-right: 30px
}
@ -29,11 +29,11 @@
border-top-left-radius: .214rem
}
.panel-heading+.alert {
.panel-heading + .alert {
border-radius: 0
}
.panel-heading>.nav-tabs {
.panel-heading > .nav-tabs {
border-bottom: none
}
@ -42,24 +42,24 @@
background-color: #62a8ea
}
.panel-heading-tab>.nav-tabs .nav-link {
.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 {
.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 {
.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 {
.panel-heading + .nav-tabs {
margin-top: -.715rem
}
.panel-heading>.dropdown .dropdown-toggle {
.panel-heading > .dropdown .dropdown-toggle {
color: inherit
}
@ -74,19 +74,19 @@
clear: both
}
.panel-heading+.panel-body {
.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 {
.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 {
.panel-body > :last-child {
margin-bottom: 0
}
.panel-body>.list-group-dividered:only-child>.list-group-item:last-child {
.panel-body > .list-group-dividered:only-child > .list-group-item:last-child {
border-bottom-color: transparent
}
@ -98,7 +98,7 @@
border-bottom-left-radius: .214rem
}
.table+.panel-footer {
.table + .panel-footer {
padding-top: 15px;
border-color: #e4eaec
}
@ -112,19 +112,19 @@
color: #37474f
}
.panel-title>.icon {
.panel-title > .icon {
margin-right: 10px
}
.panel-title>.tag {
.panel-title > .tag {
margin-left: 10px
}
.panel-title .small,.panel-title small {
.panel-title .small, .panel-title small {
color: #76838f
}
.panel-title>.small>a,.panel-title>a,.panel-title>small>a {
.panel-title > .small > a, .panel-title > a, .panel-title > small > a {
color: inherit
}
@ -140,17 +140,17 @@
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%);
-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
right: 20px
}
}
@ -158,12 +158,12 @@ ul .panel-actions {
list-style: none
}
ul .panel-actions>li {
ul .panel-actions > li {
display: inline-block;
margin-left: 8px
}
ul .panel-actions>li:first-child {
ul .panel-actions > li:first-child {
margin-left: 0
}
@ -209,12 +209,12 @@ ul.panel-actions {
list-style: none
}
ul.panel-actions>li {
ul.panel-actions > li {
display: inline-block;
margin-left: 8px
}
ul.panel-actions>li:first-child {
ul.panel-actions > li:first-child {
margin-left: 0
}
@ -240,7 +240,7 @@ ul.panel-actions>li:first-child {
text-align: center
}
.panel-toolbar .btn.active,.panel-toolbar .btn:active,.panel-toolbar .btn:hover {
.panel-toolbar .btn.active, .panel-toolbar .btn:active, .panel-toolbar .btn:hover {
color: #76838f
}
@ -260,19 +260,19 @@ ul.panel-actions>li:first-child {
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%)
-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) {
.panel > :not(.panel-loading):not(.collapsing) {
-webkit-transition: opacity .3s;
-o-transition: opacity .3s;
transition: opacity .3s
}
.panel.is-loading>:not(.panel-loading) {
.panel.is-loading > :not(.panel-loading) {
opacity: .3
}
@ -294,23 +294,23 @@ ul.panel-actions>li:first-child {
}
.panel-body.scrollable-vertical {
padding-left: 0!important;
padding-right: 0!important
padding-left: 0 !important;
padding-right: 0 !important
}
.panel-body.scrollable-vertical>.scrollable-container>.scrollable-content {
.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;
.panel-body.scrollable-vertical > .scrollable-container > .scrollable-content {
padding-left: 20px;
padding-right: 20px
}
}
.panel-body.scrollable-vertical>.scrollable-bar {
.panel-body.scrollable-vertical > .scrollable-bar {
margin-top: 0;
margin-bottom: 30px;
height: -webkit-calc(100% - 30px);
@ -321,28 +321,28 @@ ul.panel-actions>li:first-child {
transform: translateX(-26px)
}
.panel-bordered>.panel-body.scrollable-vertical>.scrollable-bar {
.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
padding-top: 0 !important;
padding-bottom: 0 !important
}
.panel-body.scrollable-horizontal>.scrollable-container>.scrollable-content {
.panel-body.scrollable-horizontal > .scrollable-container > .scrollable-content {
padding-top: 0;
padding-bottom: 30px
}
.panel-bordered>.panel-body.scrollable-horizontal>.scrollable-container>.scrollable-content {
.panel-bordered > .panel-body.scrollable-horizontal > .scrollable-container > .scrollable-content {
padding-top: 30px;
padding-bottom: 30px
}
.panel-body.scrollable-horizontal>.scrollable-bar {
.panel-body.scrollable-horizontal > .scrollable-bar {
margin-left: 0;
margin-right: 30px;
width: -webkit-calc(100% - 60px);
@ -354,38 +354,38 @@ ul.panel-actions>li:first-child {
}
@media (max-width: 479px) {
.panel-body.scrollable-horizontal>.scrollable-bar {
margin-right:20px;
.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 {
.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 {
.panel-bordered > .panel-heading {
border-bottom: 1px solid #e4eaec
}
.panel-bordered>.panel-heading>.panel-title {
.panel-bordered > .panel-heading > .panel-title {
padding-bottom: 20px
}
.panel-bordered>.panel-footer {
.panel-bordered > .panel-footer {
border-top: 1px solid #e4eaec;
padding-top: 15px
}
.panel-bordered>.panel-body {
.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 {
.panel-bordered > .table > tbody:first-child > tr:first-child td, .panel-bordered > .table > tbody:first-child > tr:first-child th {
border-top: 0
}
@ -397,20 +397,20 @@ ul.panel-actions>li:first-child {
cursor: move
}
.panel>.nav-tabs-vertical .nav-tabs {
.panel > .nav-tabs-vertical .nav-tabs {
margin-left: -1px
}
.panel>.nav-tabs-vertical .nav-tabs>li>a {
.panel > .nav-tabs-vertical .nav-tabs > li > a {
border-left: none;
border-radius: 0
}
.panel>.nav-tabs-vertical .nav-tabs.nav-tabs-reverse {
.panel > .nav-tabs-vertical .nav-tabs.nav-tabs-reverse {
margin-right: -1px
}
.panel>.nav-tabs-vertical .nav-tabs.nav-tabs-reverse>li>a {
.panel > .nav-tabs-vertical .nav-tabs.nav-tabs-reverse > li > a {
border-right: none;
border-radius: 0
}
@ -450,170 +450,171 @@ ul.panel-actions>li:first-child {
height: 0
}
.panel>.alert {
.panel > .alert {
padding-left: 30px;
padding-right: 30px
}
.panel>.alert-dismissible {
.panel > .alert-dismissible {
padding-right: 50px
}
@media (max-width: 479px) {
.panel>.alert {
padding-left:20px;
.panel > .alert {
padding-left: 20px;
padding-right: 20px
}
.panel>.alert-dismissible {
.panel > .alert-dismissible {
padding-right: 40px
}
}
.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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 {
.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: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 {
.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-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 {
.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 {
.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,.panel>.panel-body>.list-group .list-group-item{
.panel > .list-group .list-group-item, .panel > .panel-collapse > .list-group .list-group-item, .panel > .panel-body > .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 {
.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 {
.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 {
.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 {
.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;
.panel > .list-group .list-group-item {
padding-left: 20px;
padding-right: 20px
}
}
.panel-heading+.list-group .list-group-item:first-child {
.panel-heading + .list-group .list-group-item:first-child {
border-top-width: 0
}
.list-group+.panel-footer {
.list-group + .panel-footer {
border-top-width: 0
}
@ -624,7 +625,7 @@ ul.panel-actions>li:first-child {
box-shadow: none
}
.panel.panel-transparent>.panel-footer,.panel.panel-transparent>.panel-heading {
.panel.panel-transparent > .panel-footer, .panel.panel-transparent > .panel-heading {
border-color: transparent
}
@ -634,7 +635,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-default .panel-heading+.panel-collapse>.panel-body {
.panel-default .panel-heading + .panel-collapse > .panel-body {
border-top-color: #e4eaec
}
@ -651,7 +652,7 @@ ul.panel-actions>li:first-child {
color: #76838f
}
.panel-default .panel-footer+.panel-collapse>.panel-body {
.panel-default .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #e4eaec
}
@ -665,7 +666,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-primary .panel-heading+.panel-collapse>.panel-body {
.panel-primary .panel-heading + .panel-collapse > .panel-body {
border-top-color: #62a8ea
}
@ -682,7 +683,7 @@ ul.panel-actions>li:first-child {
color: #fff
}
.panel-primary .panel-footer+.panel-collapse>.panel-body {
.panel-primary .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #62a8ea
}
@ -692,7 +693,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-success .panel-heading+.panel-collapse>.panel-body {
.panel-success .panel-heading + .panel-collapse > .panel-body {
border-top-color: #3dae6a
}
@ -709,7 +710,7 @@ ul.panel-actions>li:first-child {
color: #fff
}
.panel-success .panel-footer+.panel-collapse>.panel-body {
.panel-success .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #3dae6a
}
@ -719,7 +720,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-info .panel-heading+.panel-collapse>.panel-body {
.panel-info .panel-heading + .panel-collapse > .panel-body {
border-top-color: #3bcdc4
}
@ -736,7 +737,7 @@ ul.panel-actions>li:first-child {
color: #fff
}
.panel-info .panel-footer+.panel-collapse>.panel-body {
.panel-info .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #3bcdc4
}
@ -746,7 +747,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-warning .panel-heading+.panel-collapse>.panel-body {
.panel-warning .panel-heading + .panel-collapse > .panel-body {
border-top-color: #f18246
}
@ -763,7 +764,7 @@ ul.panel-actions>li:first-child {
color: #fff
}
.panel-warning .panel-footer+.panel-collapse>.panel-body {
.panel-warning .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #f18246
}
@ -773,7 +774,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-danger .panel-heading+.panel-collapse>.panel-body {
.panel-danger .panel-heading + .panel-collapse > .panel-body {
border-top-color: #f85974
}
@ -790,7 +791,7 @@ ul.panel-actions>li:first-child {
color: #fff
}
.panel-danger .panel-footer+.panel-collapse>.panel-body {
.panel-danger .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #f85974
}
@ -800,7 +801,7 @@ ul.panel-actions>li:first-child {
border: none
}
.panel-dark .panel-heading+.panel-collapse>.panel-body {
.panel-dark .panel-heading + .panel-collapse > .panel-body {
border-top-color: #526069
}
@ -817,7 +818,7 @@ ul.panel-actions>li:first-child {
color: #fff
}
.panel-dark .panel-footer+.panel-collapse>.panel-body {
.panel-dark .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #526069
}
@ -935,7 +936,7 @@ ul.panel-actions>li:first-child {
@media (max-width: 767px) {
.panel-actions {
position:relative;
position: relative;
top: auto;
right: auto;
display: block;
@ -952,16 +953,16 @@ ul.panel-actions>li:first-child {
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%)
-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
padding-left: 20px
}
.panel-actions-keep {
@ -976,7 +977,7 @@ ul.panel-actions>li:first-child {
display: none
}
.panel-body,.panel-footer,.panel-title {
.panel-body, .panel-footer, .panel-title {
padding-left: 20px;
padding-right: 20px
}
@ -993,7 +994,7 @@ ul.panel-actions>li:first-child {
box-shadow: none
}
.panel-group .panel+.panel {
.panel-group .panel + .panel {
margin-top: 10px
}
@ -1003,7 +1004,7 @@ ul.panel-actions>li:first-child {
font-size: 1rem
}
.panel-group .panel-title:after,.panel-group .panel-title:before {
.panel-group .panel-title:after, .panel-group .panel-title:before {
position: absolute;
top: 15px;
right: 30px;
@ -1045,7 +1046,7 @@ ul.panel-actions>li:first-child {
opacity: 1
}
.panel-group .panel-title:focus,.panel-group .panel-title:hover {
.panel-group .panel-title:focus, .panel-group .panel-title:hover {
color: #76838f;
text-decoration: none
}
@ -1058,11 +1059,11 @@ ul.panel-actions>li:first-child {
border-bottom: 0
}
.panel-group .panel-heading+.panel-collapse {
.panel-group .panel-heading + .panel-collapse {
margin: 0
}
.panel-group .panel-heading+.panel-collapse>.list-group {
.panel-group .panel-heading + .panel-collapse > .list-group {
border-top: 1px solid #e4eaec
}
@ -1074,7 +1075,7 @@ ul.panel-actions>li:first-child {
border-top: 0
}
.panel-group .panel-footer+.panel-collapse .panel-body {
.panel-group .panel-footer + .panel-collapse .panel-body {
border-bottom: 1px solid #e4eaec
}
@ -1090,7 +1091,7 @@ ul.panel-actions>li:first-child {
border-radius: 0 0 .286rem .286rem
}
.panel-group-continuous .panel+.panel {
.panel-group-continuous .panel + .panel {
margin-top: 0;
border-top: 1px solid #e4eaec
}
@ -1104,7 +1105,7 @@ ul.panel-actions>li:first-child {
padding-bottom: 10px
}
.panel-group-simple .panel-title:after,.panel-group-simple .panel-title:before {
.panel-group-simple .panel-title:after, .panel-group-simple .panel-title:before {
right: 5px
}
@ -1114,21 +1115,30 @@ ul.panel-actions>li:first-child {
padding-top: 10px
}
.panel-group-simple .panel+.panel {
.panel-group-simple .panel + .panel {
margin-top: 0
}
/*自定义样式*/
html, body{height: 100%;}
.app-sub-nav .nav-tabs{border-bottom:none;}
.btn-cursor-pointer{cursor:pointer;}
html, body {
height: 100%;
}
.app-sub-nav .nav-tabs {
border-bottom: none;
}
.btn-cursor-pointer {
cursor: pointer;
}
/*把脑残替换的恢复过来*/
.form-inline .form-group {
margin-right: 20px;
}
@media (min-width: 480px){
@media (min-width: 480px) {
.form-inline .form-group, .form-inline .form-control {
display: inline-block;
margin-bottom: 0;
@ -1136,28 +1146,34 @@ html, body{height: 100%;}
vertical-align: middle;
}
}
/*在帮脑残修复一下*/
table .form-inline .form-group {
margin-right: 0px;
}
@media (min-width: 480px){
@media (min-width: 480px) {
table .form-inline .form-group, table .form-inline .form-control {
display: block;
width: 100%;
}
}
.modal-open .select2-container{
z-index:auto!important;
.modal-open .select2-container {
z-index: auto !important;
}
/*CSS*/
@media (min-width: 767px){
.metadmin-fmbx dl .city-css .form-control{
@media (min-width: 767px) {
.metadmin-fmbx dl .city-css .form-control {
width: auto;
}
.metadmin-fmbx dl .city-css .form-control{
.metadmin-fmbx dl .city-css .form-control {
width: auto;
}
.appmain #showmap{
.appmain #showmap {
width: 60%;
}
}
@ -1169,31 +1185,32 @@ table .form-inline .form-group {
height: 60px;
margin-left: -15px;
width: 100%;
margin-bottom:0;
margin-bottom: 0;
}
.line_through{
.line_through {
text-decoration: line-through;
}
.float-left {
float: left!important
float: left !important
}
.float-right {
float: right!important
float: right !important
}
.float-none {
float: none!important
float: none !important
}
/*统计总页面*/
.page-profile .card-shadow {
-webkit-box-shadow:none;
box-shadow:none;
-webkit-box-shadow: none;
box-shadow: none;
}
.page-profile .card-footer {
padding: 0px;
border-radius: .215rem;
@ -1201,7 +1218,7 @@ table .form-inline .form-group {
border-top: none;
}
.page-profile .card-footer>div>div{
.page-profile .card-footer > div > div {
padding: 10px 0px;
}
@ -1218,47 +1235,63 @@ table .form-inline .form-group {
}
/*表格头部排序样式*/
.orderby-arrow.desc:before{ content: '\2193'; font-weight: bold; margin-left: 5px;}
.orderby-arrow.asc:before{ content: '\2191'; font-weight: bold; margin-left: 5px;}
.orderby-arrow.desc:before {
content: '\2193';
font-weight: bold;
margin-left: 5px;
}
.metadmin-main table td .loader-ellipsis{
.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{
.h-700 {
height: 700px;
}
li.village-list-item > button.close{
position: static!important;
li.village-list-item > button.close {
position: static !important;
font-size: 1.2rem;
outline: none;
}
.filterList li.village-list-item > button.close{
.filterList li.village-list-item > button.close {
margin-top: 10px;
}
li.village-list-item > button.close:hover{
li.village-list-item > button.close:hover {
color: #f2353c;
}
li.village-list-item>h5{
font-weight: 600!important;
display: inline-block!important;
li.village-list-item > h5 {
font-weight: 600 !important;
display: inline-block !important;
margin-bottom: .5rem;
}
li.village-list-item>p{
margin-bottom: 0!important;
li.village-list-item > p {
margin-bottom: 0 !important;
}
.villageList li.village-list-item>h5{
cursor:pointer
.villageList li.village-list-item > h5 {
cursor: pointer
}
.btn-group-toggle-menu{
left: -49px!important;
.btn-group-toggle-menu {
left: -49px !important;
padding: 5px;
min-width: 120px;
}
.btn-group-toggle-menu a, .btn-group-toggle-menu button{
.btn-group-toggle-menu a, .btn-group-toggle-menu button {
display: inherit;
border-radius:0;
border-radius: 0;
}

View File

@ -5,21 +5,21 @@ $met_title = $data['met_title'];
<include file='sys_admin/head_v2'/>
<div class="appmain">
<form method="POST" action="{$data.url.action}" target="_self" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>{$data.met_title}</h3>
<dl>
<dt><label class='form-control-label'>企业全称</label></dt>
<dd class="form-group">
<select name='c_allname' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="{$data.tname}"
data-fiend="c_allname"
data-allnone="3"
data-source="add_customer"
data-default="{$data.data.c_allname}"
data-placeholder="输入企业全称"
<select name='c_allname' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="{$data.tname}"
data-fiend="c_allname"
data-allnone="3"
data-source="add_customer"
data-default="{$data.data.c_allname}"
data-placeholder="输入企业全称"
required data-fv-notEmpty-message='不能为空'>
<option value=""></option>
</select>
@ -28,10 +28,10 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>企业简称</label></dt>
<dd class="form-group">
<input type="text" name="c_name"
value="{$data.data.c_name}"
class="form-control"
placeholder='输入企业简称'>
<input type="text" name="c_name"
value="{$data.data.c_name}"
class="form-control"
placeholder='输入企业简称'>
<span class="text-help m-l-10">企业简短名称</span>
</dd>
</dl>
@ -39,15 +39,16 @@ $met_title = $data['met_title'];
<dt><label class='form-control-label'>企业地址</label></dt>
<dd>
<div data-plugin="select-linkage" data-select-url="{$data.url.city}" class="city-css form-group">
<select name="c_province" class="form-control m-r-5 prov" data-checked="{$data.data.c_province}"
<select name="c_province" class="form-control m-r-5 prov" data-checked="{$data.data.c_province}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="c_city" class="form-control m-r-5 city" data-checked="{$data.data.c_city}"
<select name="c_city" class="form-control m-r-5 city" data-checked="{$data.data.c_city}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="c_district" class="form-control m-r-5 dist" data-checked="{$data.data.c_district}"
<select name="c_district" class="form-control m-r-5 dist" data-checked="{$data.data.c_district}"
required data-fv-notEmpty-message="不能为空"></select>
</div>
<div class="form-group clearfix">
<input type="text" name="c_address" value="{$data.data.c_address}" placeholder="请输入详细地址" class="form-control"
<input type="text" name="c_address" value="{$data.data.c_address}" placeholder="请输入详细地址"
class="form-control"
required data-fv-notEmpty-message="不能为空">
</div>
</dd>
@ -55,23 +56,25 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>相关联系人</label></dt>
<dd class="form-group">
<input type="text" name="c_lxname"
value="{$data.data.c_lxname}"
class="form-control"
placeholder="请输入联系人姓名">
<input type="text" name="c_lxname"
value="{$data.data.c_lxname}"
class="form-control"
placeholder="请输入联系人姓名">
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>联系电话</label></dt>
<dd>
<input type="text" name="c_tel" value="{$data.data.c_tel}" data-plugin='tokenfield' data-delimiter=','/>
<input type="text" name="c_tel" value="{$data.data.c_tel}" data-plugin='tokenfield'
data-delimiter=','/>
<span class="text-help m-l-10">可备注多个联系电话,输入完成一个回车后再输入下一个</span>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>备注</label></dt>
<dd class="form-group">
<textarea name="c_text" rows="5" placeholder='备注描述' class='form-control m-r-10'>{$data.data.c_text}</textarea>
<textarea name="c_text" rows="5" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.c_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>

View File

@ -3,117 +3,124 @@ defined('IN_MET') or exit('No permission');
$met_title = $data['met_title'];
?>
<include file='sys_admin/head_v2'/>
<!--二级导航-->
{$data.nav_sub}
<div class="page-profile">
<div class="card card-shadow text-xs-center">
<div class="card-footer">
<div class="row no-space">
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.village}</strong>
<span>场所总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.elevator}</strong>
<span>广告位总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vfree}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="今天空闲的广告位总数,包含禁用的广告位">广告位空闲数 <i class="icon fa-question-circle" aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vlease}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="今天正在排期中的广告位">广告位排期中 <i class="icon fa-question-circle" aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vendday}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="7天内即将到期的广告位总数">7天内到期 <i class="icon fa-question-circle" aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vprerow}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="投放开始时间大于今天的广告位">广告位预排数 <i class="icon fa-question-circle" aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.contract}</strong>
<span>订单总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.summoney}</strong>
<span>合同总额</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.endcontract}</strong>
<span>到期订单数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.launch}</strong>
<span>投放总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.endlaunch}</strong>
<span>投放结束数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.customer}</strong>
<span>企业总数</span>
</div>
<!--<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.workers}</strong>
<span>联系人总数</span>
</div>-->
<!--二级导航-->
{$data.nav_sub}
<div class="page-profile">
<div class="card card-shadow text-xs-center">
<div class="card-footer">
<div class="row no-space">
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.village}</strong>
<span>场所总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.elevator}</strong>
<span>广告位总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vfree}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="今天空闲的广告位总数,包含禁用的广告位">广告位空闲数 <i class="icon fa-question-circle"
aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vlease}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="今天正在排期中的广告位">广告位排期中 <i class="icon fa-question-circle"
aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vendday}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="7天内即将到期的广告位总数">7天内到期 <i class="icon fa-question-circle"
aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.vprerow}</strong>
<span data-toggle="tooltip"
data-placement="bottom"
data-trigger="hover"
data-original-title="投放开始时间大于今天的广告位">广告位预排数 <i class="icon fa-question-circle"
aria-hidden="true"></i></span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.contract}</strong>
<span>订单总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.summoney}</strong>
<span>合同总额</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.endcontract}</strong>
<span>到期订单数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.launch}</strong>
<span>投放总数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.endlaunch}</strong>
<span>投放结束数</span>
</div>
<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.customer}</strong>
<span>企业总数</span>
</div>
<!--<div class="col-xs-1">
<strong class="profile-stat-count">{$data.num.workers}</strong>
<span>联系人总数</span>
</div>-->
</div>
</div>
</div>
<div class="row dzadsod_list">
<!--
<div class="col-md-4 col-lg-4 col-4">
<div class="panel panel-info ">
<div class="panel-heading">
<h3 class="panel-title">签定的最新合同</h3>
</div>
<div class="panel-body">
<ol class="list-group list-group-dividered list-group-full">
<li class="list-group-item active">XXXXXXX</li>
<li class="list-group-item">XXXXXXX</li>
<li class="list-group-item">XXXXXXX</li>
<li class="list-group-item disabled">XXXXXXX</li>
</ol>
</div>
<div class="row dzadsod_list">
<!--
<div class="col-md-4 col-lg-4 col-4">
<div class="panel panel-info ">
<div class="panel-heading">
<h3 class="panel-title">签定的最新合同</h3>
</div>
<div class="panel-body">
<ol class="list-group list-group-dividered list-group-full">
<li class="list-group-item active">XXXXXXX</li>
<li class="list-group-item">XXXXXXX</li>
<li class="list-group-item">XXXXXXX</li>
<li class="list-group-item disabled">XXXXXXX</li>
</ol>
</div>
</div>
</div>
</div>
-->
<div class="col-md-12 col-lg-12 col-12">
<div class="panel panel-info panel-line ">
-->
<div class="col-md-12 col-lg-12 col-12">
<div class="panel panel-info panel-line ">
<div class="panel-heading">
<h3 class="panel-title">订单到期提醒
<small>包含根据设置的到期提醒天数内的订单以及订单投放结束到期的订单符合条件的数据展示3天</small>
</h3>
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tableslist" data-table-ajaxurl="{$data.url.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody>
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
</td>
</tr>
</tbody>
<tfoot>{$data.table.tfoot}</tfoot>
</table>
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tableslist"
data-table-ajaxurl="{$data.url.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody>
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center">
<div class="loader vertical-align-middle loader-default"></div>
</div>
</td>
</tr>
</tbody>
<tfoot>{$data.table.tfoot}</tfoot>
</table>
</div>
</div>
</div>
<include file='sys_admin/foot_v2'/>

View File

@ -5,21 +5,21 @@ $met_title = $data['met_title'];
<include file='sys_admin/head_v2'/>
<div class="appmain">
<form method="POST" action="{$data.url.action}" target="_self" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>{$data.met_title}</h3>
<dl>
<dt><label class='form-control-label'>广告位编号</label></dt>
<dd class="form-group">
<input type="text" name="e_number"
value="{$data.data.e_number}"
class="form-control"
placeholder='输入广告位唯一编号'
required data-fv-notEmpty-message="不能为空"
data-fv-remote="true" data-fv-remote-url="{$data.remote_url}"
data-fv-remote-message="广告编号不能重复"
>
<input type="text" name="e_number"
value="{$data.data.e_number}"
class="form-control"
placeholder='输入广告位唯一编号'
required data-fv-notEmpty-message="不能为空"
data-fv-remote="true" data-fv-remote-url="{$data.remote_url}"
data-fv-remote-message="广告编号不能重复"
>
<input type="hidden" name="olde_number" value="{$data.data.e_number}">
<span class="text-help m-l-10">广告位唯一编号,方便后期查询处理。</span>
</dd>
@ -27,14 +27,14 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>选择场所</label></dt>
<dd class="form-group">
<select name='e_vid' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="village"
data-fiend="id"
data-allnone="0"
data-source="add_elevator"
data-default="{$data.data.e_vid}"
data-placeholder="输入场所名"
<select name='e_vid' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="village"
data-fiend="id"
data-allnone="0"
data-source="add_elevator"
data-default="{$data.data.e_vid}"
data-placeholder="输入场所名"
required data-fv-notEmpty-message='不能为空'>
<option value=""></option>
</select>
@ -53,15 +53,15 @@ $met_title = $data['met_title'];
{$data.para.e_aps_radio}
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>广告规格</label></dt>
<dd class="form-group">
<input type="text" name="e_size"
value="{$data.data.e_size}"
class="form-control"
placeholder='输入广告规格'
required data-fv-notEmpty-message='不能为空'>
<input type="text" name="e_size"
value="{$data.data.e_size}"
class="form-control"
placeholder='输入广告规格'
required data-fv-notEmpty-message='不能为空'>
<span class="text-help m-l-10">示例300*500</span>
</dd>
</dl>
@ -69,8 +69,9 @@ $met_title = $data['met_title'];
<dt><label class='form-control-label'>是否启用</label></dt>
<dd class="form-group">
<div class="radio-custom radio-primary radio-inline">
<input type="radio" id="e_enable0" name="e_enable" value='0' data-checked='{$data.data.e_enable}'
required data-fv-notEmpty-message='不能为空' />
<input type="radio" id="e_enable0" name="e_enable" value='0'
data-checked='{$data.data.e_enable}'
required data-fv-notEmpty-message='不能为空'/>
<label for="e_enable0">禁用</label>
</div>
<div class="radio-custom radio-primary radio-inline">
@ -82,14 +83,16 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>自主标签</label></dt>
<dd>
<input type="text" name="e_label" placeholder="输入标签" value="{$data.data.e_label}" data-plugin='tokenfield' data-delimiter=','/>
<input type="text" name="e_label" placeholder="输入标签" value="{$data.data.e_label}"
data-plugin='tokenfield' data-delimiter=','/>
<span class="text-help m-l-10">自定义广告位相关标签,可设置多个</span>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>备注</label></dt>
<dd class="form-group">
<textarea name="e_text" rows="5" placeholder='备注描述' class='form-control m-r-10'>{$data.data.e_text}</textarea>
<textarea name="e_text" rows="5" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.e_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>

View File

@ -5,7 +5,7 @@ $met_title = $data['app']['appname'];
?>
<include file='sys_admin/head_v2'/>
<link href="{$_M['url']['own_tem']}css/appcheck.min.css" rel='stylesheet' type='text/css'>
<div class="appcheck" data-ckitem="{$data.ckitem}" >
<div class="appcheck" data-ckitem="{$data.ckitem}">
<div class="row">
<div class="col-xs-12 col-md-4 offset-md-4">
@ -14,7 +14,8 @@ $met_title = $data['app']['appname'];
<div class="topimg">
<div class="topimg-image">
<div class="avatar">
<img class="img-circle img-bordered img-bordered-info" src="{$data.app.icon}" alt="image">
<img class="img-circle img-bordered img-bordered-info" src="{$data.app.icon}"
alt="image">
</div>
</div>
<div class="topimg-body p-10 p-l-5">
@ -29,11 +30,12 @@ $met_title = $data['app']['appname'];
应用进行逐项检测,状态:<i class="icon fa-times-circle"></i> 时会暂停检测,待处理问题后再继续执行检测。
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="appmodal" aria-hidden="true" data-keyboard="false" data-backdrop="false" role="dialog" tabindex="-1">
<div class="modal fade" id="appmodal" aria-hidden="true" data-keyboard="false" data-backdrop="false" role="dialog"
tabindex="-1">
<div class="modal-dialog modal-center">
<div class="modal-content">
<div class="modal-header">

View File

@ -1,18 +1,16 @@
//应用JS后期语法框架
(function($){
(function ($) {
//内部初始化入口
var appmap = function(){
var appmap = function () {
};
//扩展方法
appmap.prototype = {
};
appmap.prototype = {};
//外部入口
$.fn.maps = function () {
$.fn.maps = function () {
};
})(jQuery);

View File

@ -1,237 +1,237 @@
//应用JS后期语法框架
(function($){
(function ($) {
//内部初始化入口
var applan = function(){
var $self = this,
strArr = $self.aparr();
var applan = function () {
var $self = this,
strArr = $self.aparr();
//计算选中广告位个数
$self.addnum(strArr);
//提交处理
$(document).on('submit', '.add_ap_list form', function(event) {
$(document).on('submit', '.add_ap_list form', function (event) {
event.preventDefault(); //阻止默认提交
})
//修改form提交方式
$(document).on('click', '.add_ap_list form button[type="submit"]', function(event) {
$(document).on('click', '.add_ap_list form button[type="submit"]', function (event) {
event.preventDefault(); //阻止默认提交
var $form = $(this).parents('form');
var $form = $(this).parents('form');
//手动触发全部验证
// $form.data('formValidation').resetForm();
$form.data('formValidation').validate({debug:true});
$form.data('formValidation').validate({debug: true});
//查看验证结果,若为false 则阻止
var flag = $form.data("formValidation").isValid();
//验证时间是否合法
if(flag != false){
if (flag != false) {
//执行入库操作返回ID
$self.laaajx($form.attr('action'),$self.formdata($form));
$self.laaajx($form.attr('action'), $self.formdata($form));
}
//修改表格按钮禁止操作
// $(this).attr("disabled",true);
});
//解决被禁用前选中的,点击取消后则不能再勾选
$('table tbody').on('click', '.ap-one-disabled', function(event) {
$('table tbody').on('click', '.ap-one-disabled', function (event) {
$(this).removeClass('ap-one-disabled');
$(this).find('input').attr("disabled",true);
$(this).find('input').attr("disabled", true);
})
// $(document).on('change',"[data-table-search]",function(){
// return false;
// })
//全选
$(document).on('click','.ap-all input',function(){
var idArr = [];
$(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);
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);
this.checked === true ? $self.addap(idArr) : $self.apdelall(idArr);
});
//必须定位到 table tbody on方法才生效
$('table tbody').on('click','.ap-one input',function(){
$('table tbody').on('click', '.ap-one input', function () {
var idStr = $(this).val();
this.checked === true?$self.addap(idStr):$self.delap(idStr);
this.checked === true ? $self.addap(idStr) : $self.delap(idStr);
});
};
//扩展方法
applan.prototype = {
addnum:function(strArr){
var $self = this;
strArr = $.unique(strArr);
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){
apdelall : function (idArr) {
var $self = this;
$.each(idArr, function (i, idStr) {
$self.delap(idStr);
})
},
addap:function(idStrArr){
addap : function (idStrArr) {
//新增选中值
var $self = this,
strArr = $self.aparr();
var $self = this,
strArr = $self.aparr();
//新增选中的元素
strArr = strArr.concat(idStrArr);
strArr = strArr.concat(idStrArr);
//排序
strArr.sort();
//去重
strArr =$.unique(strArr);
$self.apinput(strArr.join(","),true);
strArr = $.unique(strArr);
$self.apinput(strArr.join(","), true);
//选中个数
$self.addnum(strArr);
},
delap:function(idStr){
delap : function (idStr) {
//删除选中值
var $self = this,
strArr = $self.aparr(),
strlen = $.inArray(idStr, strArr);
var $self = this,
strArr = $self.aparr(),
strlen = $.inArray(idStr, strArr);
//删除选中值
if(strlen != '-1') strArr.splice(strlen, 1);
if (strlen != '-1') strArr.splice(strlen, 1);
//排序
strArr.sort();
//重新写会
$self.apinput(strArr.join(","),true);
$self.apinput(strArr.join(","), true);
//选中个数
$self.addnum(strArr);
},
apinput:function(str,type){
apinput : function (str, type) {
//获取或者写入
//true 为写入 false为获取
var input = $('input[name="l_selectenum"]');
return APPFUN.isEmpty(type)?input.val():input.val(str);
var input = $('input[name="l_selectenum"]');
return APPFUN.isEmpty(type) ? input.val() : input.val(str);
},
aparr:function(){
aparr : function () {
//选中广告位编号
var $self = this,
str = $self.apinput();
return !APPFUN.isEmpty(str)?str.split(","):[];
var $self = this,
str = $self.apinput();
return !APPFUN.isEmpty(str) ? str.split(",") : [];
},
formdata:function(form){
var Array = form.serializeArray(),
dataOjb = {};
formdata : function (form) {
var Array = form.serializeArray(),
dataOjb = {};
//转成一对一
$.each(Array,function(key,val){
dataOjb[val.name] = val.value;
$.each(Array, function (key, val) {
dataOjb[val.name] = val.value;
});
return dataOjb;
},
laaajx:function(url,data){
var $self = this,
laaajx : function (url, data) {
var $self = this,
scrollable_this = $('[data-plugin="scrollable"]');
//点击保存后,先处理保存,再执行点位
$.post(url,data,function(json){
if(json.code){
$.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);
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');
}, 'json');
},
nextstep:function(){
var $self = this,
nextstep : function () {
var $self = this,
scrollable_this = $('[data-plugin="scrollable"]'),
//获取广告位数组
strArr = $self.aparr(),
strArr = $self.aparr(),
//提交的URL
url = M.url.own_name + 'c=ajax&a=doapplan&lang=' + M.lang,
url = M.url.own_name + 'c=ajax&a=doapplan&lang=' + M.lang,
//获取form数据
data = $self.formdata($('form')),
falsei = 0,
truei = 0;
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){
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){
$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{
} else {
falsei++;
inputid.removeClass('checkbox-success').addClass('checkbox-danger');
}
//输出最终结果
if(strArr.length == truei*1 + falsei*1){
if (strArr.length == truei * 1 + falsei * 1) {
//再执行将最终的结果保存到对应的投放ID内
var urls = M.url.own_name + 'c=ajax&a=dolenumber&lang=' + M.lang;
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;
$.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);
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');
$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');
}, 'json');
});
},
alerthtml:function(bool,text){
var color = bool?'alert-success':'alert-danger',
url = M.url.own_name + 'c=table_on&a=dolaunch',
alert = '<div class="launch_affix_save alert dark alert-icon alert-dismissible text-xs-center ' + color + '" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><span><i class="icon wb-bell p-r-10" aria-hidden="true"></i>'+text+'</span><button class="btn btn-sm btn-danger btn-inverse btn-outline launchlist" type="button">返回列表</button></div>';
alerthtml : function (bool, text) {
var color = bool ? 'alert-success' : 'alert-danger',
url = M.url.own_name + 'c=table_on&a=dolaunch',
alert = '<div class="launch_affix_save alert dark alert-icon alert-dismissible text-xs-center ' + color + '" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><span><i class="icon wb-bell p-r-10" aria-hidden="true"></i>' + text + '</span><button class="btn btn-sm btn-danger btn-inverse btn-outline launchlist" type="button">返回列表</button></div>';
$('.launch_affix_save').remove();
$('form').append(alert);
$(document).on('click','.launchlist',function(e){
$(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 = '<li class="' + color[code] + '"><i class="' + icon[code] + '" aria-hidden="true"></i>' + text + '</li>';
addappend : function (_this_, text, code) {
var color = ['blue-600', 'green-600', 'red-600'],
icon = ['wb-bell', 'wb-check', 'wb-close'],
litext = '<li class="' + color[code] + '"><i class="' + icon[code] + '" aria-hidden="true"></i>' + text + '</li>';
$('.launchshow').append(litext);
_this_.asScrollable('scrollTo','vertical','100%');
_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',
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']"
});
namespace : "scrollable",
contentSelector : "> [data-role='content']",
containerSelector: "> [data-role='container']"
});
});
},
scrollToEnd:function(){
scrollToEnd: function () {
//滚动到底部
var h = $(document).height()-$(window).height();
$(document).scrollTop(h);
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 ) {
$.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();
@ -239,5 +239,5 @@
};
//启动
$(".add_ap_list").aplist();
})(jQuery);

View File

@ -1,18 +0,0 @@
//用来阻止广告位重复添加的
(function($){
//内部初始化入口
var appmap = function(){
};
//扩展方法
appmap.prototype = {
};
//外部入口
$.fn.maps = function () {
};
})(jQuery);

View File

@ -36,7 +36,7 @@
*/
$(function () {
var myDate = new Date().getTime()
$.include(M.url.own_tem + 'js/appcheck.min.js?'+myDate);
$.include(M.url.own_tem + 'js/appcheck.min.js?' + myDate);
$.ajax({
type : "GET",
@ -61,12 +61,12 @@ $(function () {
})
// 表格数据加载状态
$('#tableslist').on('processing.dt', function (e, settings, processing) {
if(processing) {
if (processing) {
$self.tableProcessing(this)
}
})
$('#tables-list').on('processing.dt', function (e, settings, processing) {
if(processing) {
if (processing) {
$self.tableProcessing(this)
}
})
@ -120,7 +120,7 @@ $(function () {
};
appfun.prototype = {
isEmpty : function (val) {
isEmpty : function (val) {
switch (typeof val) {
case 'undefined':
return true;
@ -146,7 +146,7 @@ $(function () {
}
return false;
},
select2 : function (drawdt) {
select2 : function (drawdt) {
// drawdt true 执行默认操作 false 不执行
var $self = this,
select = [];
@ -211,7 +211,7 @@ $(function () {
});
});
},
datepicker: function () {
datepicker : function () {
var $self = this;
M['plugin']['datetimepicker'] = [
M['url']['epl'] + 'time/jquery.datetimepicker.css',
@ -250,7 +250,7 @@ $(function () {
});
})
},
alonetime : function () {
alonetime : function () {
var $self = this;
M['plugin']['datetimepicker'] = [
M['url']['epl'] + 'time/jquery.datetimepicker.css',
@ -268,7 +268,7 @@ $(function () {
});
});
},
tableaajx : function (timedom) {
tableaajx : function (timedom) {
if (typeof datatable != 'undefined') {
var $this_datatable = timedom.parents('.dataTable'),
datatable_index = $this_datatable.index('.dataTable');
@ -276,7 +276,7 @@ $(function () {
datatable[datatable_index].ajax.reload();
}
},
orders : function () {
orders : function () {
var $self = this;
$(document).on('click', 'a.orderby-link', function (event) {
var $this = $(this),
@ -303,7 +303,7 @@ $(function () {
dom.next().val(type);
$self.tableaajx(dom);
},
ownsubmit : function ($form, typestr) {
ownsubmit : function ($form, typestr) {
// 插入submit_type字段
if ($form.find('[name="submit_type"]').length) $form.append('<input type="hidden" name="submit_type" value=""/>');
$form.find('[name="submit_type"]').val(typestr);
@ -319,11 +319,11 @@ $(function () {
$form.find('[name="all_id"]').val(all_id);
}
},
tableProcessing:function (_this_){
tableProcessing: function (_this_) {
// 表格数据加载状态
var tbody = $(_this_).find('tbody')
var tbody = $(_this_).find('tbody')
var colspan = tbody.data('colspan')
var html= `<tr>
var html = `<tr>
<td colspan="${colspan}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
</td>

View File

@ -5,19 +5,19 @@ $met_title = $data['met_title'];
<include file='sys_admin/head_v2'/>
<div class="appmain">
<form method="POST" action="{$data.url.action}" target="_self" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>{$data.met_title}</h3>
<dl>
<dt><label class='form-control-label'>密码密钥</label></dt>
<dd class="form-group">
<div class="input-group">
<input type="text" name="k_passkey"
value="{$data.data.k_passkey}"
class="form-control"
placeholder='输入密码密钥'
required data-fv-notEmpty-message='不能为空'>
<input type="text" name="k_passkey"
value="{$data.data.k_passkey}"
class="form-control"
placeholder='输入密码密钥'
required data-fv-notEmpty-message='不能为空'>
</div>
<span class="text-help m-l-10">巡查人员密钥验证凭证</span>
</dd>
@ -25,15 +25,15 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>签订相关人员</label></dt>
<dd class="form-group">
<select name='k_wid' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="workers"
data-fiend="id"
data-allnone="0"
data-source="add_contract_workers"
data-default="{$data.data.k_wid}"
data-placeholder="输入联系人姓名/电话"
data-division=","
<select name='k_wid' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="workers"
data-fiend="id"
data-allnone="0"
data-source="add_contract_workers"
data-default="{$data.data.k_wid}"
data-placeholder="输入联系人姓名/电话"
data-division=","
required data-fv-notEmpty-message='不能为空'>
<option value=""></option>
</select>
@ -43,8 +43,8 @@ $met_title = $data['met_title'];
<dt><label class='form-control-label'>是否启用</label></dt>
<dd class="form-group">
<div class="radio-custom radio-primary radio-inline">
<input type="radio" id="k_state0" name="k_state" value='0' data-checked='{$data.data.k_state}'
required data-fv-notEmpty-message='不能为空' />
<input type="radio" id="k_state0" name="k_state" value='0' data-checked='{$data.data.k_state}'
required data-fv-notEmpty-message='不能为空'/>
<label for="k_state0">禁用</label>
</div>
<div class="radio-custom radio-primary radio-inline">
@ -56,7 +56,8 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>备注</label></dt>
<dd class="form-group">
<textarea name="k_text" rows="5" placeholder='备注描述' class='form-control m-r-10'>{$data.data.k_text}</textarea>
<textarea name="k_text" rows="5" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.k_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>

View File

@ -4,19 +4,20 @@ $met_title = $data['met_title'];
?>
<include file='sys_admin/head_v2'/>
<div class="add_ap_list">
<form method="POST" action="{$data.url.action}" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<form method="POST" action="{$data.url.action}" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>订单信息:<span class="text-help">{$data.data.h_cid}{$data.data.l_hnumber}</span></h3>
<h3 class='example-title'>订单信息:<span class="text-help">{$data.data.h_cid}{$data.data.l_hnumber}</span>
</h3>
<dl class="col-md-6 col-lg-6 col-6">
<dt><label class='form-control-label'>投放计划名称</label></dt>
<dd class="form-group">
<input type="text" name="l_title"
value="{$data.data.l_title}"
class="form-control"
required data-fv-notEmpty-message='不能为空'
placeholder='输入投放计划标题'>
<input type="text" name="l_title"
value="{$data.data.l_title}"
class="form-control"
required data-fv-notEmpty-message='不能为空'
placeholder='输入投放计划标题'>
<span class="text-help m-l-10">主要用来做标记区别</span>
</dd>
</dl>
@ -30,42 +31,43 @@ $met_title = $data['met_title'];
<input type="hidden" name="h_endtime" value="{$data.data.h_endtime}" data-table-search>
<div class="input-group">
<span class="input-group-addon">开始时间</span>
<input type="text" name="l_starttime" value="{$data.data.l_starttime}"
class="form-control w-150"
id="date_timepicker_start"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
<input type="text" name="l_starttime" value="{$data.data.l_starttime}"
class="form-control w-150"
id="date_timepicker_start"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
<span class="input-group-addon">结束时间</span>
<input type="text" name="l_endtime" value="{$data.data.l_endtime}"
class="form-control w-150"
id="date_timepicker_end"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
<input type="text" name="l_endtime" value="{$data.data.l_endtime}"
class="form-control w-150"
id="date_timepicker_end"
data-day-type="1"
data-table-search
data-plugin="datetosearch"
autocomplete="off">
</div>
<span class="text-help m-l-10">广告时间段不能超过订单时间段</span>
</dd>
</dl>
<dl class="col-md-4 col-lg-4 col-4">
<dt><label class='form-control-label'>广告进度状态</label></dt>
<dd class="form-group">
{$data.para.l_schedule_radio}
</dd>
<dt><label class='form-control-label'>广告进度状态</label></dt>
<dd class="form-group">
{$data.para.l_schedule_radio}
</dd>
</dl>
<dl class="col-md-4 col-lg-4 col-4">
<dt><label class='form-control-label'>广告类型</label></dt>
<dd class="form-group">
{$data.para.l_type_radio}
</dd>
<dt><label class='form-control-label'>广告类型</label></dt>
<dd class="form-group">
{$data.para.l_type_radio}
</dd>
</dl>
<dl class="col-md-4 col-lg-4 col-4">
<dt><label class='form-control-label'>投放计划备注</label></dt>
<dd class="form-group">
<textarea name="l_text" rows="3" placeholder='备注描述' class='form-control m-r-10'>{$data.data.l_text}</textarea>
<textarea name="l_text" rows="3" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.l_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>
@ -73,45 +75,48 @@ $met_title = $data['met_title'];
</div>
<!-- 广告位-->
<div class="row m-t-5">
<div class="col-md-9 col-lg-9 col-9">
<div class="m-t-10 clearfix">
<!--广告位选择是否入库-->
<input type="hidden" name="nextstep" value="{$_M.form.nextstep}" data-table-search>
<input type="hidden" name="slid" value="{$_M.form.slid}" data-table-search>
<!--合同编号-->
<input type="hidden" name="l_hnumber" value="{$data.data.l_hnumber}" data-table-search>
<!--选择的广告位-->
<input type="hidden" name="l_enumber" value="{$data.data.l_enumber}" data-table-search>
<input type="hidden" name="l_selectenum" value="{$data.data.l_selectenum}" data-table-search>
<!--头部搜索-->
{$data.table.search}
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tables-list" data-table-ajaxurl="{$data.table.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody data-colspan="{$data.table.tdcol}">
<div class="col-md-9 col-lg-9 col-9">
<div class="m-t-10 clearfix">
<!--广告位选择是否入库-->
<input type="hidden" name="nextstep" value="{$_M.form.nextstep}" data-table-search>
<input type="hidden" name="slid" value="{$_M.form.slid}" data-table-search>
<!--合同编号-->
<input type="hidden" name="l_hnumber" value="{$data.data.l_hnumber}" data-table-search>
<!--选择的广告位-->
<input type="hidden" name="l_enumber" value="{$data.data.l_enumber}" data-table-search>
<input type="hidden" name="l_selectenum" value="{$data.data.l_selectenum}" data-table-search>
<!--头部搜索-->
{$data.table.search}
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tables-list"
data-table-ajaxurl="{$data.table.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody data-colspan="{$data.table.tdcol}">
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
<div class="h-50 vertical-align text-xs-center">
<div class="loader vertical-align-middle loader-default"></div>
</div>
</td>
</tr>
</tbody>
<tfoot>{$data.table.tfoot}</tfoot>
</table>
</div>
<div class="col-md-3 col-lg-3 col-3">
<!--显示选中项-->
<div class="metadmin-fmbx m-t-15 p-b-10">
<h3 class='example-title'>广告投放结果</h3>
<div class="h-700" data-plugin="scrollable" data-skin="scrollable-shadow">
<div data-role="container">
<div data-role="content">
<ul class="list-icons p-y-10 launchshow"></ul>
</tbody>
<tfoot>{$data.table.tfoot}</tfoot>
</table>
</div>
<div class="col-md-3 col-lg-3 col-3">
<!--显示选中项-->
<div class="metadmin-fmbx m-t-15 p-b-10">
<h3 class='example-title'>广告投放结果</h3>
<div class="h-700" data-plugin="scrollable" data-skin="scrollable-shadow">
<div data-role="container">
<div data-role="content">
<ul class="list-icons p-y-10 launchshow"></ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</form>
</div>
<include file='sys_admin/foot_v2'/>

View File

@ -11,14 +11,17 @@ $met_title = $data['met_title'];
<!--头部搜索-->
{$data.table.search}
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tableslist" data-table-ajaxurl="{$data.url.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tableslist"
data-table-ajaxurl="{$data.url.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody data-colspan="{$data.table.tdcol}">
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
</td>
</tr>
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center">
<div class="loader vertical-align-middle loader-default"></div>
</div>
</td>
</tr>
</tbody>
<tfoot>{$data.table.tfoot}</tfoot>
</table>

View File

@ -5,11 +5,11 @@ $met_title = $data['met_title'];
<include file='sys_admin/head_v2'/>
<div class="appmain">
<form method="POST" action="{$data.url.action}" target="_self" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>{$data.met_title}</h3>
<dl>
<dt></dt>
<dd>

View File

@ -34,7 +34,8 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>场所地址</label></dt>
<dd>
<div data-plugin="select-linkage" data-select-url="{$data.url.city}" class="city-css city-js form-group">
<div data-plugin="select-linkage" data-select-url="{$data.url.city}"
class="city-css city-js form-group">
<select name="v_province" class="form-control m-r-5 prov" data-checked="{$data.data.v_province}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="v_city" class="form-control m-r-5 city" data-checked="{$data.data.v_city}"
@ -55,7 +56,7 @@ $met_title = $data['met_title'];
<dd>
<!--data-target="#appmaps" data-toggle="modal"-->
<div id="showmap" class="h-350"></div>
<button type="button" class="btn btn-primary btn-sm m-t-10" id="mapmodal">打开地图并标注地点的精确位置</button>
<button type="button" class="btn btn-primary btn-sm m-t-10" id="mapmodal">打开地图并标注地点的精确位置</button>
</dd>
</dl>
<dl>
@ -75,7 +76,8 @@ $met_title = $data['met_title'];
</dd>
</dl>
<!-- Modal 百度地图JS V3-->
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak={$data.mapkey}"></script>
<script type="text/javascript"
src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak={$data.mapkey}"></script>
<div class="modal fade" id="appmaps" aria-hidden="true" data-keyboard="false" role="dialog" tabindex="-1">
<div class="modal-dialog modal-center modal-lg">
<div class="modal-content">

View File

@ -5,8 +5,8 @@ $met_title = $data['met_title'];
<include file='sys_admin/head_v2'/>
<div class="appmain">
<form method="POST" action="{$data.url.action}" target="_self" enctype="multipart/form-data">
<!--二级导航-->
{$data.nav_sub}
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>{$data.met_title}</h3>
<dl>
@ -18,23 +18,25 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>姓名</label></dt>
<dd class="form-group">
<input type="text" name="w_name"
value="{$data.data.w_name}"
class="form-control"
required data-fv-notEmpty-message='不能为空'>
<input type="text" name="w_name"
value="{$data.data.w_name}"
class="form-control"
required data-fv-notEmpty-message='不能为空'>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>联系电话</label></dt>
<dd>
<input type="text" name="w_tel" value="{$data.data.w_tel}" data-plugin='tokenfield' data-delimiter=','/>
<input type="text" name="w_tel" value="{$data.data.w_tel}" data-plugin='tokenfield'
data-delimiter=','/>
<span class="text-help m-l-10">可备注多个联系电话,输入完成一个回车后再输入下一个</span>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>备注</label></dt>
<dd class="form-group">
<textarea name="w_text" rows="5" placeholder='备注描述' class='form-control m-r-10'>{$data.data.w_text}</textarea>
<textarea name="w_text" rows="5" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.w_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>

View File

@ -3,32 +3,35 @@ defined('IN_MET') or exit ('No permission');
load::sys_func('file');
class uninstall {
private $appno; //应用NO值
private $m_name; //应用文件夹
class uninstall
{
private $appno; //应用NO值
private $m_name; //应用文件夹
private $del_dirs = []; //需要删除的文件夹,以根目录为准
public function __construct() {
public function __construct()
{
global $_M;
$this->appno = $_M['form']['no']; //获取NO
$this->appno = $_M['form']['no']; //获取NO
//需要删除的文件名
$this->del_dirs[] = self::firstsql();
$this->del_dirs[] = $this->m_name?'app/app/'.$this->m_name:'';
$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","禁止卸载");
if (file_exists(PATH_ALL_APP . $this->m_name . "/config/uninstall.lock")) {
turnover("{$_M['url']['own_form']}a=doindex", "禁止卸载");
}
}
public function dodel() {
public function dodel()
{
global $_M;
//删除一些提前删除的内容
//删除自定义表
self::zdysql();
@ -36,49 +39,52 @@ class uninstall {
self::appsql();
//删除应用文件
// $this->delfile();
// $this->delfile();
}
//优先执行代码[推荐]
private function firstsql() {
private function firstsql()
{
global $_M;
//查询应用的文件夹
$mname = self::sqlone('applist');
$mname = self::sqlone('applist');
$this->m_name = $mname['m_name'];
//查询应用是否使用栏目
$file = self::sqlone('column'," module='{$this->appno}' ");
$file = self::sqlone('column', " module='{$this->appno}' ");
return $file['foldername'];
}
//删除自定义表
private function zdysql() {
private function zdysql()
{
global $_M;
//公用表
$cloud = ['cloud_config'];
$cloud = ['cloud_config'];
//自定义表
$table = file_get_contents(PATH_ALL_APP.$this->m_name.'/config/table');
$table = stringto_array($table,',');
$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;
$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);
if (in_array($val, $table)) $zdys[] = self::cloud($val);
}
//删除表
foreach ($zdys as $val){
foreach ($zdys as $val) {
self::deltablesql($val);
}
//删除配置文件
del_table(arrayto_string($zdys,'|'));
del_table(arrayto_string($zdys, '|'));
}
//删除固定的app表
private function appsql() {
private function appsql()
{
global $_M;
//删除栏目接口表
self::delsql('ifcolumn');
@ -91,78 +97,85 @@ class uninstall {
//删除应用插件表
self::delsql('app_plugin');
//删除网站后台栏目信息表
$where = "field='{$this->appno}'";
self::delsql('admin_column',$where);
$where = "field='{$this->appno}'";
self::delsql('admin_column', $where);
//删除网站栏目信息表
$where = "module='{$this->appno}'";
self::delsql('column',$where);
$where = "module='{$this->appno}'";
self::delsql('column', $where);
//删除语言表
$where = "app='{$this->appno}'";
self::delsql('language',$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 delfile()
{
foreach ($this->del_dirs as $dir) {
if (file_exists(PATH_WEB . $dir) && $dir != null) deldir(PATH_WEB . $dir);
}
}
//对公用配置表卸载处理
private function cloud($tname) {
private function cloud($tname)
{
global $_M;
$where = "m_name='{$this->m_name}'";
if(self::sqlcounter($tname,$where) > 0){
self::delsql($tname,$where);
$where = "m_name='{$this->m_name}'";
if (self::sqlcounter($tname, $where) > 0) {
self::delsql($tname, $where);
}
if(self::sqlcounter($tname) == 0){
if (self::sqlcounter($tname) == 0) {
return $tname;
}
}
//公共查询方法
private function sqlone($tname,$where = '') {
private function sqlone($tname, $where = '')
{
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->appno}'";
$table = $_M['table'][ $tname ];
if (!$where) {
$where = "no='{$this->appno}'";
}
return DB::get_one("select * from {$table} where {$where}");
}
//公共查询方法
private function sqlcounter($tname,$where = '') {
private function sqlcounter($tname, $where = '')
{
global $_M;
$table = $_M['table'][$tname];
if($where){
$where = 'WHERE '.$where;
$table = $_M['table'][ $tname ];
if ($where) {
$where = 'WHERE ' . $where;
}
return DB::counter("{$table} {$where}");
}
//公共删除数据
private function delsql($tname,$where = '') {
private function delsql($tname, $where = '')
{
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->appno}'";
$table = $_M['table'][ $tname ];
if (!$where) {
$where = "no='{$this->appno}'";
}
DB::query("DELETE FROM {$table} WHERE {$where}");
}
//公共删除表
private function deltablesql($tname) {
private function deltablesql($tname)
{
global $_M;
$table = $_M['table'][$tname];
$table = $_M['table'][ $tname ];
DB::query("DROP TABLE `{$table}`");
}
}
?>

View File

@ -7,8 +7,9 @@ load::own_func('appcmp');
load::own_class('../traits/appcmp');
//后台类
class appadmin extends admin{
class appadmin extends admin
{
# URL上c的值
public $u_urlc;
# URL上a的值
@ -17,252 +18,262 @@ class appadmin extends admin{
public $u_para;
# 管理员权限
public $adop = ['met'=>false,'add'=>false,'del'=>false];
public $adop = ['met' => false, 'add' => false, 'del' => false];
// 调用类
public $tsql;
public $cloud;
# 初始化
public function __construct() {
global $_M,$_YW;
public function __construct()
{
global $_M, $_YW;
parent::__construct();
//调试使用
ini_set("display_errors", "On");
error_reporting(E_ERROR);
$this->tsql = load::own_class('tsql','new');
$this->tsql = load::own_class('tsql', 'new');
self::cmp_load();
self::adminop();
$this->cloud = load::own_class('cloud','new');
$this->cloud = load::own_class('cloud', 'new');
}
use appcmp;
//调试使用
public function bug() {
public function bug()
{
$this->destruct = false;
}
# 后台导航
/*
* @$select string 最终菜单选项
* @$title string 当前页面标题
*/
public function appnav($select = '',$title = '') {
public function appnav($select = '', $title = '')
{
global $_M, $_YW;
if(is_array($select)) list($select,$title) = $select;
if (is_array($select)) list($select, $title) = $select;
//当前的CA组合
$select = empty($select)?$_M['form']['c'].'__'.$_M['form']['a']:$select;
$select = empty($select) ? $_M['form']['c'] . '__' . $_M['form']['a'] : $select;
//导航公用参数
$glpara = [
'navon'=> $_M['form']['navon'],
];
$glpara = [
'navon' => $_M['form']['navon'],
];
/*
* 导航规则
*/
//key 为c值和a值组成可实现自动选择
//val 第一位是导航名称,第二位为传递的参数(array) 若第三位跳转的外链
$nav = [
'dzadsod__dodzadsod' => [
$nav = [
'dzadsod__dodzadsod' => [
['统计中心'],
[
'dzadsod__dodzadsod' => ['总计界面'],
'table_on__dovillages' => ['场所统计'],
'table_on__doelevators' => ['广告位统计'],
'table_on__doschedule' => ['排期查询'],
'dzadsod__dodzadsod' => ['总计界面'],
'table_on__dovillages' => ['场所统计'],
'table_on__doelevators' => ['广告位统计'],
'table_on__doschedule' => ['排期查询'],
]
],
'table_on__docontract' => [
'table_on__docontract' => [
['运营中心'],
[
'table_on__docontract' => ['订单管理'],
'table_on__dolaunch' => ['投放计划'],
// 'info_on__douplaunch' => ['调整投放'],
'table_on__docustomer' => ['合作企业'],
'table_on__doworkers' => ['企业联系人'],
'table_on__dokeylist' => ['巡查人员'],
'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__doelevator' => ['广告位'],
'table_on__dovillage' => ['合作场所']
'table_on__doelevator' => ['广告位'],
'table_on__dovillage' => ['合作场所']
]
],
'table_on__dopara' => [
'table_on__dopara' => [
['配置参数'],
[
'config__doindex' => ['基础配置'],
'table_on__dopara' => ['参数列表']
'config__doindex' => ['基础配置'],
'table_on__dopara' => ['参数列表']
]
],
'index__doindex' => [
['更新检测',['check' => 1] ]
'index__doindex' => [
['更新检测', ['check' => 1]]
]
];
$i = 0;
$i = 0;
foreach ($nav as $key => $val) {
list($info,$sub) = $val;
list($info, $sub) = $val;
//判断是否执行当前二级目录
$li = '';
if(is_array($info) && ($select == $key || array_key_exists($select, $sub)) ){
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);
$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);
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;
if ($select == $skey) {
$select = $key;
$active = 'active';
$this->input['met_title'] = empty($title) ? $sname : $title;
}
//二级导航HTML
$li .= "<li class='nav-item'><a class='nav-link {$active}' href='{$surl}'>{$sname}</a></li>";
}
$this->input['nav_sub'] = empty($li)?'':'<div class="m-t-10 app-sub-nav"><ul class="p-b-10 nav nav-tabs nav-tabs-line">'.$li.'</ul></div>';
$this->input['nav_sub'] = empty($li) ? '' : '<div class="m-t-10 app-sub-nav"><ul class="p-b-10 nav nav-tabs nav-tabs-line">' . $li . '</ul></div>';
}
//执行一级目录的操作
if(!is_array($info)) $info = $val;
list($name,$url) = self::nav_para($key,$info,$glpara);
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;
$select_nav[ $key ] = $i;
//页面title
if($select == $key && empty($this->input['met_title'])) $this->input['met_title'] = empty($title)?$name:$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]);
if (array_key_exists($select, $nav)) nav::select_nav($select_nav[ $select ]);
}
//导航NAME和URL
private function nav_para($key,$info,$glpara){
global $_M,$_YW;
private function nav_para($key, $info, $glpara)
{
global $_M, $_YW;
//合并c和a
list($c,$a) = stringto_array($key,'__');
list($c, $a) = stringto_array($key, '__');
//合并默认参数值
$arr = array_merge(['c' => $c, 'a' => $a ],$glpara);
list($name,$para,$links) = $info;
$arr = array_merge(['c' => $c, 'a' => $a], $glpara);
list($name, $para, $links) = $info;
//判断是否有设置单独的参数,有则增加
if(is_array($para)) $arr = array_merge($arr,$para);
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 = 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;
public function point($c, $a, $appshow = '')
{
global $_M, $_YW;
$this->u_urlc = $c;
$this->u_urla = $a;
if(!empty($appshow)) $this->appshow = 'app/'.$appshow;
if (!empty($appshow)) $this->appshow = 'app/' . $appshow;
}
#URL处理
#$appshow 单独定义模板 某个方法内定义
public function appurl($tname = '',$query = [],$appshow = '') {
global $_M,$_YW;
public function appurl($tname = '', $query = [], $appshow = '')
{
global $_M, $_YW;
//数据库表简写
$this->tname = empty($tname)?self::tname():$tname;
$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);
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['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;
$_YW['url'] = $this->input['url'];
if (!empty($appshow)) $this->appshow = 'app/' . $appshow;
}
//权限
private function adminop() {
global $_M,$_YW;
private function adminop()
{
global $_M, $_YW;
$admin_op = background_privilege();
$adminop = array_filter(explode('-',$admin_op['admin_op']));
$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('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 (in_array('del', $adminop)) {
$this->adop['del'] = true;
}
if($this->adop['add'] && $this->adop['del']){
$this->adop['met'] = 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 .= '<span class="text-help m-l-10"><a target="_blank" href="'.$addparaurl.'">设置选项</a></span>';
public function setparahtml($ptype = 0, &$html)
{
global $_M, $_YW;
$addparaurl = $_M['url']['own_name'] . 'c=table_on&a=dopara&p_type=' . $ptype;
$html .= '<span class="text-help m-l-10"><a target="_blank" href="' . $addparaurl . '">设置选项</a></span>';
}
//参数单选组成
public function para_radio($para,$name,$checked,&$html,$exists = false) {
global $_M,$_YW;
$html = '';
$first = 'data-checked="'.$checked.'" required data-fv-notEmpty-message="不能为空"';
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{
if ($exists) {
list($p_name, $p_value, $p_text) = $val;
} else {
extract($val);
}
$html .= '<div class="radio-custom radio-primary radio-inline">
<input type="radio" id="'.$name.$key.'" name="'.$name.'" value="'.$p_value.'" '.$first.' />
<label for="'.$name.$key.'">'.$p_name.'</label>
<span class="text-help m-l-10">'.$p_text.'</span>
$html .= '<div class="radio-custom radio-primary radio-inline">
<input type="radio" id="' . $name . $key . '" name="' . $name . '" value="' . $p_value . '" ' . $first . ' />
<label for="' . $name . $key . '">' . $p_name . '</label>
<span class="text-help m-l-10">' . $p_text . '</span>
</div>';
$first = '';
$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="," 因为暂时无效
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{
if ($exists) {
list($p_name, $p_value, $p_text) = $val;
} else {
extract($val);
}
$html .= '<div class="checkbox-custom checkbox-primary checkbox-inline">
<input type="checkbox" id="'.$name.$key.'" name="'.$name.'" value="'.$p_value.'" '.$first.' />
<label for="'.$name.$key.'">'.$p_name.'</label>
<span class="text-help m-l-10">'.$p_text.'</span>
$html .= '<div class="checkbox-custom checkbox-primary checkbox-inline">
<input type="checkbox" id="' . $name . $key . '" name="' . $name . '" value="' . $p_value . '" ' . $first . ' />
<label for="' . $name . $key . '">' . $p_name . '</label>
<span class="text-help m-l-10">' . $p_text . '</span>
</div>';
$first = '';
}
@ -270,123 +281,136 @@ class appadmin extends admin{
}
//参数处理
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 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 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 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 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;
public function e_address($elevator)
{
global $_M, $_YW;
//门口方位
$e_bno = self::paralist(['p_type' => 3, 'p_value' => $elevator['e_bno'] ]);
$e_bno = self::paralist(['p_type' => 3, 'p_value' => $elevator['e_bno']]);
//广告位置
$e_aps = self::paralist(['p_type' => 0, 'p_value' => $elevator['e_aps'] ]);
$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_aps['p_name'];
$e_vid = self::villagelist($elevator['e_vid']);
return "{$elevator['e_number']}" . $e_vid . $e_bno['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 '<font class="'.$color[$state].'">'.$str[$state].'</font>';
public function state_color($state, $array = [])
{
global $_M, $_YW;
$color = ['red-600', 'green-600', 'purple-600'];
$str = count($array) > 0 ? $array : ['无效', '有效'];
return '<font class="' . $color[ $state ] . '">' . $str[ $state ] . '</font>';
}
//字体颜色
public function str_color($state,$str,$weight = 'unset') {
global $_M,$_YW;
$color = ['red-600','green-600','cyan-600','blue-600'];
return '<font class="'.$color[$state].' font-weight-'.$weight.'">'.$str.'</font>';
public function str_color($state, $str, $weight = 'unset')
{
global $_M, $_YW;
$color = ['red-600', 'green-600', 'cyan-600', 'blue-600'];
return '<font class="' . $color[ $state ] . ' font-weight-' . $weight . '">' . $str . '</font>';
}
//标签形式的分割显示
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;
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 .= '<span class="tag tag-sm '.$class[$type].'">'.$val.'</span> ';
$html .= '<span class="tag tag-sm ' . $class[ $type ] . '">' . $val . '</span> ';
$i++;
if($length > 0 && $length == $i) break;
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 '<span class="tag tag-sm '.$class[$type].'">'.$title.'</span> ';
public function e_state($title)
{
global $_M, $_YW;
$class = ['tag-danger', 'tag-primary'];
$title = $title > 0 ? '已租赁' : '空置';
$type = $title > 0 ? 1 : 0;
return '<span class="tag tag-sm ' . $class[ $type ] . '">' . $title . '</span> ';
}
//参数的对应值获取
public function paralist($p_type = 0) {
global $_M,$_YW;
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');
->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();
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}'";
public function strchange($strarr = [])
{
global $_M, $_YW;
foreach ($strarr as $val) {
if ($val != null) $idstr[] = "'{$val}'";
}
return arrayto_string($idstr,',');
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 '<span data-href="'.$url.'" class="btn-cursor-pointer tag tag-sm tag-outline '.$color[$value].'" >'.$array[$value].'</span>';
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 '<span data-href="' . $url . '" class="btn-cursor-pointer tag tag-sm tag-outline ' . $color[ $value ] . '" >' . $array[ $value ] . '</span>';
}
//处理多选的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);
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}) ";
$where .= " el.e_number IN({$idstr}) ";
break;
case 'villages':
$where .= " vi.id IN({$idstr}) ";
$where .= " vi.id IN({$idstr}) ";
break;
default:
break;
@ -395,51 +419,53 @@ class appadmin extends admin{
}
// 对现有广告位进行裂变,已经不再需要
public function fission() {
global $_M,$_YW;
public function fission()
{
global $_M, $_YW;
//获取所有广告位
$elevator = $this->tsql->table('elevator')->all();
$elevator = $this->tsql->table('elevator')->all();
//划定什么位置裂变成什么 1裂变出2
$e_aps = [
$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_aps' => $neweaps,
'e_size' => $val['e_size'],
'e_enable' => $val['e_enable'],
'e_label' => $val['e_label'],
'e_text' => $val['e_text']
$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_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();
->field($field)
->add();
}
}
//对字符串处理
public function e_number(&$num,$neweaps,$type = false) {
global $_M,$_YW;
if($type) $neweaps++;
public function e_number(&$num, $neweaps, $type = false)
{
global $_M, $_YW;
if ($type) $neweaps++;
//新的编号
$enum = $num.$neweaps;
$enum = $num . $neweaps;
//验证
$elevator = $this->tsql->table('elevator')->where(['e_number' => $enum ])->one();
if($elevator == false){
$elevator = $this->tsql->table('elevator')->where(['e_number' => $enum])->one();
if ($elevator == false) {
$num = $enum;
}else{
self::e_number($num,$neweaps,true);
} else {
self::e_number($num, $neweaps, true);
}
}

View File

@ -6,26 +6,28 @@ load::sys_class('web');
load::own_class('../traits/appcmp');
//前台类
class appweb extends web {
class appweb extends web
{
//开始时间
public $time;
public $datetime;
// 调用类
public $tsql;
public $cloud;
public $href;
public $sign = true;
//微信通知参数
public $webase;
public $postdata = [];
public $tem_id = '';
public function __construct() {
public $postdata = [];
public $tem_id = '';
public function __construct()
{
global $_M, $_YW;
parent::__construct();
self::cmp_load();
@ -33,9 +35,9 @@ class appweb extends web {
//开始时间
$this->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();
$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);
@ -44,260 +46,272 @@ class appweb extends web {
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();
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'].'" ';
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) {
public function postdata($type, $arr)
{
global $_M, $_YW;
//清理缓存
$this->postdata = [];
$this->tem_id = '';
$this->tem_id = '';
//微信模板
switch ($type) {
case 1:
//预约到期提醒
//模板ID
$this->tem_id = $_YW['c']['tem_ida'];
$this->tem_id = $_YW['c']['tem_ida'];
//内容
$this->postdata = [
$this->postdata = [
//开头 提醒的内容
'first' => ['value' => $arr['first']['value'], 'color' => $arr['first']['color'] ],
'first' => ['value' => $arr['first']['value'], 'color' => $arr['first']['color']],
// 合同开始日期
'keyword1' => ['value' => $arr['h_starttime'] ],
'keyword1' => ['value' => $arr['h_starttime']],
// 合同结束日期
'keyword2' => ['value' => $arr['h_endtime'] ],
'keyword2' => ['value' => $arr['h_endtime']],
//结尾
'remark' => ['value' =>
"合同编号:{$arr['h_number']}".PHP_EOL
."签定企业:{$arr['c_allname']}".PHP_EOL
."相关人员:{$arr['wnamestr']}".PHP_EOL
."提醒时间:{$this->datetime}"
],
'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->tem_id = $_YW['c']['tem_idb'];
//内容
$this->postdata = [
$this->postdata = [
//开头 提醒的内容
'first' => ['value' => $arr['first']['value'], 'color' => $arr['first']['color'] ],
'first' => ['value' => $arr['first']['value'], 'color' => $arr['first']['color']],
// 合同编号
'keyword1' => ['value' => $arr['h_number'] ],
'keyword1' => ['value' => $arr['h_number']],
// 合同开始日期
'keyword2' => ['value' => $arr['h_starttime'] ],
'keyword2' => ['value' => $arr['h_starttime']],
// 合同结束日期
'keyword3' => ['value' => $arr['h_endtime'] ],
'keyword3' => ['value' => $arr['h_endtime']],
//结尾
'remark' => ['value' =>
"签定企业:{$arr['c_allname']}".PHP_EOL
."相关人员:{$arr['wnamestr']}".PHP_EOL
."通知时间:{$this->datetime}"
],
'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->tem_id = $_YW['c']['tem_idc'];
//内容
$this->postdata = [
$this->postdata = [
//开头 提醒的内容
'first' => ['value' => '合同提醒汇总结果,请登录后台查看详情', 'color' => '#BDBDBD'],
'first' => ['value' => '合同提醒汇总结果,请登录后台查看详情', 'color' => '#BDBDBD'],
// 合同编号
'keyword1' => ['value' => '山东梯美广告有限公司' ],
'keyword1' => ['value' => '山东梯美广告有限公司'],
// 合同开始日期
'keyword2' => ['value' => $this->datetime ],
'keyword2' => ['value' => $this->datetime],
// 合同结束日期
'keyword3' => ['value' => array_sum($arr) ],
'keyword3' => ['value' => array_sum($arr)],
//结尾
'remark' => ['value' =>
"定时提醒:{$arr['daya']}".PHP_EOL
."三天到期:{$arr['dayb']}".PHP_EOL
."今天到期:{$arr['dayc']}".PHP_EOL
."今天投放开始总数:{$arr['dayd']}"
],
'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 = '')
public function openid($openid = '')
{
global $_M, $_YW;
$openid .= ','.$_YW['c']['openid'];
$openid = stringto_array($openid,',');
$openid .= ',' . $_YW['c']['openid'];
$openid = stringto_array($openid, ',');
foreach ($openid as $id) {
if($id) self::temmsg($id);
if ($id) self::temmsg($id);
}
return $this;
}
//微信合同到期提醒
private function temmsg($openid)
private function temmsg($openid)
{
global $_M, $_YW;
$return = ['errcode' => -1, 'errmsg' => "系统错误用户openid{$openid}消息模板Tem_id{$this->tem_id}"];
if($openid && $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;
$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
$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 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 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 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 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;
public function e_address($elevator)
{
global $_M, $_YW;
//门口方位
$e_bno = self::paralist(['p_type' => 3, 'p_value' => $elevator['e_bno'] ]);
$e_bno = self::paralist(['p_type' => 3, 'p_value' => $elevator['e_bno']]);
//广告位置
$e_aps = self::paralist(['p_type' => 0, 'p_value' => $elevator['e_aps'] ]);
$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_aps['p_name'];
$e_vid = self::villagelist($elevator['e_vid']);
return "{$elevator['e_number']}" . $e_vid . $e_bno['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 '<font class="'.$color[$state].'">'.$str[$state].'</font>';
public function state_color($state, $array = [])
{
global $_M, $_YW;
$color = ['red-600', 'green-600', 'purple-600'];
$str = count($array) > 0 ? $array : ['无效', '有效'];
return '<font class="' . $color[ $state ] . '">' . $str[ $state ] . '</font>';
}
//字体颜色
public function str_color($state,$str,$weight = 'unset') {
global $_M,$_YW;
$color = ['red-600','green-600','cyan-600','blue-600'];
return '<font class="'.$color[$state].' font-weight-'.$weight.'">'.$str.'</font>';
public function str_color($state, $str, $weight = 'unset')
{
global $_M, $_YW;
$color = ['red-600', 'green-600', 'cyan-600', 'blue-600'];
return '<font class="' . $color[ $state ] . ' font-weight-' . $weight . '">' . $str . '</font>';
}
//标签形式的分割显示
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;
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 .= '<span class="tag tag-sm '.$class[$type].'">'.$val.'</span> ';
$html .= '<span class="tag tag-sm ' . $class[ $type ] . '">' . $val . '</span> ';
$i++;
if($length > 0 && $length == $i) break;
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 '<span class="tag tag-sm '.$class[$type].'">'.$title.'</span> ';
public function e_state($title)
{
global $_M, $_YW;
$class = ['tag-danger', 'tag-primary'];
$title = $title > 0 ? '已租赁' : '空置';
$type = $title > 0 ? 1 : 0;
return '<span class="tag tag-sm ' . $class[ $type ] . '">' . $title . '</span> ';
}
//参数的对应值获取
public function paralist($p_type = 0) {
global $_M,$_YW;
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');
->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();
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}'";
public function strchange($strarr = [])
{
global $_M, $_YW;
foreach ($strarr as $val) {
if ($val != null) $idstr[] = "'{$val}'";
}
return arrayto_string($idstr,',');
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 '<span data-href="'.$url.'" class="btn-cursor-pointer tag tag-sm tag-outline '.$color[$value].'" >'.$array[$value].'</span>';
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 '<span data-href="' . $url . '" class="btn-cursor-pointer tag tag-sm tag-outline ' . $color[ $value ] . '" >' . $array[ $value ] . '</span>';
}
//处理多选的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);
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}) ";
$where .= " el.e_number IN({$idstr}) ";
break;
case 'villages':
$where .= " vi.id IN({$idstr}) ";
$where .= " vi.id IN({$idstr}) ";
break;
default:
break;
@ -306,51 +320,53 @@ class appweb extends web {
}
// 对现有广告位进行裂变,已经不再需要
public function fission() {
global $_M,$_YW;
public function fission()
{
global $_M, $_YW;
//获取所有广告位
$elevator = $this->tsql->table('elevator')->all();
$elevator = $this->tsql->table('elevator')->all();
//划定什么位置裂变成什么 1裂变出2
$e_aps = [
$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_aps' => $neweaps,
'e_size' => $val['e_size'],
'e_enable' => $val['e_enable'],
'e_label' => $val['e_label'],
'e_text' => $val['e_text']
$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_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();
->field($field)
->add();
}
}
//对字符串处理
public function e_number(&$num,$neweaps,$type = false) {
global $_M,$_YW;
if($type) $neweaps++;
public function e_number(&$num, $neweaps, $type = false)
{
global $_M, $_YW;
if ($type) $neweaps++;
//新的编号
$enum = $num.$neweaps;
$enum = $num . $neweaps;
//验证
$elevator = $this->tsql->table('elevator')->where(['e_number' => $enum ])->one();
if($elevator == false){
$elevator = $this->tsql->table('elevator')->where(['e_number' => $enum])->one();
if ($elevator == false) {
$num = $enum;
}else{
self::e_number($num,$neweaps,true);
} else {
self::e_number($num, $neweaps, true);
}
}

View File

@ -3,13 +3,15 @@
defined('IN_MET') or exit('No permission');
//所有公用方法
class cloud{
class cloud
{
public $tsql;
public function __construct() {
public function __construct()
{
global $_M, $_YW;
$this->tsql = load::own_class('tsql','new');
$this->tsql = load::own_class('tsql', 'new');
}
/*
@ -17,105 +19,108 @@ class cloud{
* @param array $back 输出字符串或数组
* @param string $callback ajax的回调函数的名称
*/
public function jsoncallback($back, $callback = 'callback') {
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;
$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 = [];
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{
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){
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;
if (array_level($aval['a']) == 2) array_unshift($aval['a'], ['s' => '请选择']);
$array[ $key ][ $pkey ][ $akey ] = $aval;
}
//跳过
continue;
}
$array[$key][$pkey] = $pval;
$array[ $key ][ $pkey ] = $pval;
}
}
}
$citydata = ['citylist'=>$array];
$citydata = ['citylist' => $array];
//生成缓存
$jsonstr = json_encode($citydata,JSON_UNESCAPED_UNICODE);
$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);
$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";
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();
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']),
'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']),
];
}
}
?>

View File

@ -834,7 +834,7 @@ class table_theme
if ($this->search_bool) {
$this->search['left'][] = self::th_toolmap('地图筛选');
$para = [['正常-按照广告位置排序', 0], ['推荐-将适合投放的提前排序', 1], ['选中-将选择中广告位提前排序', 2]];
$this->search['left'][] = self::para_select($para, ['eaps_order', '广告位排序',$_M['form']['eaps_order']], true, false);
$this->search['left'][] = self::para_select($para, ['eaps_order', '广告位排序', $_M['form']['eaps_order']], true, false);
$tsql = load::own_class('tsql', 'new');
$this->select2 = [
'_fiend' => ['e_vid', '选择场所', $_M['form']['e_vid']],
@ -1025,7 +1025,7 @@ class table_theme
'condition' => 'p_type|||6'
];
$this->search[] = self::input_select_search_multiple();
$this->search[] = self::th_toolmap('地图筛选');
}

View File

@ -7,29 +7,33 @@ defined('IN_MET') or exit('No permission');
/**
* 表格数据获取类
*
* @param array $rearray 表格数组返回数组
*/
class tabledata {
class tabledata
{
protected $rearray;
public $error;
public $error;
/**
* 获取表查询数据
* @param string $table 表名
* @param string $field 表字段
* @param string $where where条件
* @param string $order order by条件
* @param string $sql 自定义SQL语句
*
* @param string $table 表名
* @param string $field 表字段
* @param string $where where条件
* @param string $order order by条件
* @param string $sql 自定义SQL语句
* @return array 查询数据
*/
public function getdata($table, $field = '*', $where = '', $order = '', $sql = '',$multi_table = false) {
public function getdata($table, $field = '*', $where = '', $order = '', $sql = '', $multi_table = false)
{
global $_M;
//dump( $_M['form']);
/* 获取表格ajax传递的参数 */
$length = $_M['form']['length']; //每页显示数量
$start = $_M['form']['start']; //读取数据的起点
$draw = $_M['form']['draw']; //累计执行次数,无作用但必须回传
$start = $_M['form']['start']; //读取数据的起点
$draw = $_M['form']['draw']; //累计执行次数,无作用但必须回传
// if($_M['form']['tablepage_json']&&$start==0&&$draw!=1){
// $cook = explode("|",$_M['form']['tablepage_json']) ;
// $u = "{$_M['form']['n']},{$_M['form']['c']},{$_M['form']['a']}";
@ -39,7 +43,7 @@ class tabledata {
// }else{
// met_setcookie('tablepage_json', $_M['form']['start']/$_M['form']['length']."|{$_M['form']['n']},{$_M['form']['c']},{$_M['form']['a']}");
// }
if (!$sql) {
/* 查询表 */
if ($where) {
@ -49,9 +53,9 @@ class tabledata {
$conds .= " ORDER BY {$order} ";
}
//整理查询条件
$query = "SELECT {$field} FROM {$table} {$conds} LIMIT {$start},{$length}"; //mysql语句
$array = DB::get_all($query); //执行查询,获得数组
$array = DB::get_all($query); //执行查询,获得数组
$error = DB::error();
if ($error) {
$this->error = $query . "<br />" . $error;
@ -61,41 +65,43 @@ class tabledata {
$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 . "<br />" . $error:0;
$query = $sql . " LIMIT {$start},{$length}";
$array = DB::get_all($query);
$error = DB::error();
$this->error = $error ? $query . "<br />" . $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);
$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];
$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语句
// }
$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的数组
*
* @param array $rdata 需要转成json的数组
*/
public function rdata($rdata) {
public function rdata($rdata)
{
if ($rdata) {
$this->rarray['data'] = $rdata;
} else {
@ -103,7 +109,7 @@ class tabledata {
}
jsoncallback($this->rarray); //回传json格式
}
}
# This program is an open source system, commercial use, please consciously to purchase commercial license.

View File

@ -3,33 +3,37 @@
defined('IN_MET') or exit('No permission');
# 数据结构处理
class tsql {
private $sql = [];
private $m_name = M_NAME;
private $special = [];
private $ufield = [];
class tsql
{
private $sql = [];
private $m_name = M_NAME;
private $special = [];
private $ufield = [];
private $query;
private $multi_table = false; //采用分组才会采用子查询计算总数
public function __construct() {
public function __construct()
{
global $_M;
self::table_unset();
}
# 清空
public function table_unset() {
public function table_unset()
{
global $_M;
unset($this->sql, $this->special,$this->ufield);
unset($this->sql, $this->special, $this->ufield);
return $this;
}
# 数据库
# $sign false 不添加应用文件名前缀
public function table($tname,$sign = true) {
public function table($tname, $sign = true)
{
global $_M;
self::table_unset();
$this->sql['table'] = self::full_table_name($tname,$sign);
$this->sql['table'] = self::full_table_name($tname, $sign);
return $this;
}
@ -38,130 +42,144 @@ class tsql {
# $join 数据库连接方式
# $sign false 不添加应用文件名前缀
#
public function tables($tname = [],$join = '',$sign = true) {
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} ";
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) {
public function special($_special)
{
global $_M;
$this->special = is_array($_special)?$_special:[$_special];
$this->special = is_array($_special) ? $_special : [$_special];
return $this;
}
# 需要删除的字段,仅支持约束条件下
# 目前仅用于adup()时的 unique() 方法
public function ufield($_field = '') {
public function ufield($_field = '')
{
global $_M;
$this->ufield = is_array($_field)?$_field:[$_field];
$this->ufield = is_array($_field) ? $_field : [$_field];
return $this;
}
# 查询字段
# 查询或者多条插入信息
public function qfield($_field = '*') {
public function qfield($_field = '*')
{
global $_M;
if(is_array($_field)) $_field = arrayto_string($_field, ',');
if (is_array($_field)) $_field = arrayto_string($_field, ',');
$this->sql['field'] = $_field;
return $this;
}
# 插入更新字段
# $sign 单条插入或者更新设置其他值查询或者多条插入信息时使用qfield()
public function field($_field = '') {
public function field($_field = '')
{
global $_M;
if(is_array($_field)) $_field = self::field_arr($_field);
if (is_array($_field)) $_field = self::field_arr($_field);
$this->sql['field'] = $_field;
return $this;
}
# 分组查询 $_having 同where 一样
public function group($_group = '',$_having = '') {
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;
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') {
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;
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') {
public function order($_order = 'id DESC')
{
global $_M;
$this->sql['order'] = " ORDER BY " . $_order;
return $this;
}
# 单独值,用于 多条信息插入,或者约束插入更新
public function values($_values = '') {
public function values($_values = '')
{
global $_M;
if(is_array($_values)) $_values = self::values_arr($_values);
if (is_array($_values)) $_values = self::values_arr($_values);
$this->sql['values'] = $_values;
return $this;
}
# 约束条件下的UPDATE
public function unique($_unique = '') {
public function unique($_unique = '')
{
global $_M;
if(is_array($_unique)) {
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') {
public function limit($_limit = '30', $_start = '0')
{
global $_M;
$this->sql['limit'] = " LIMIT {$_start}," . $_limit;
return $this;
}
# 删除
public function del($_where) {
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);
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() {
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']} ";
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) {
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']} ";
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;
@ -171,67 +189,71 @@ class tsql {
# field 字段需要查询类型的 qfield()
# $data 一维二维都可以key = field
# $sign false 并且也没有单独调用unique()是多条信息插入, true 为是约束更新插入
public function adup($data = [],$sign = 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'])) {
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;
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']} ";
$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() {
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']} ";
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') {
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']} ";
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;
$res[ $val[ $key ] ] = $val;
}
return $res;
}
# 获取表结构
public function show() {
public function show()
{
global $_M;
if(empty($this->sql['table'])) return false;
$this->query = "SHOW FULL COLUMNS FROM .{$this->sql['table']}";
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 = [];
$rescolumns = DB::query($this->query);
while ($row = DB::fetch_array($rescolumns)) {
$res[] = $row;
}
return $res;
@ -240,85 +262,92 @@ class tsql {
# 条数统计
# field 采用查询方法 qfield
# $multi_table 若是采用分组了计算方式要调整为 子查询计算总条数
public function count($_field = '*') {
public function count($_field = '*')
{
global $_M;
if(empty($this->sql['table'])) return 0;
if(empty($this->sql['field'])) $this->sql['field'] = "COUNT({$_field})";
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);
$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() {
public function id()
{
global $_M;
return DB::insert_id();
}
# 错误信息(对查询是无效的)
public function error() {
public function error()
{
global $_M;
return DB::error();
}
# 返回完整数据库名
public function full_table_name($tname,$sign = true) {
public function full_table_name($tname, $sign = true)
{
global $_M;
return $sign == true?$_M['table'][$this->m_name.'_'.$tname]:$_M['table'][$tname];
return $sign == true ? $_M['table'][ $this->m_name . '_' . $tname ] : $_M['table'][ $tname ];
}
# 字段删除方法
public function field_del($array = []) {
public function field_del($array = [])
{
global $_M;
foreach ($this->ufield as $val) {
unset($array[$val]);
unset($array[ $val ]);
}
return $array;
}
# where条件的转换
# 仅是值等于的处理,例如某个字段判断为不等于或者其他的方法,切勿使用数组传递
public function where_arr($arr) {
global $_M;
$and = [];
public function where_arr($arr)
{
global $_M;
$and = [];
foreach ($arr as $key => $val) {
// 函数的使用 数字键名采用函数模式
if(is_numeric($key)) {
$and[] = $val;
if (is_numeric($key)) {
$and[] = $val;
continue;
}
// 仅是值等于的处理
if(is_array($val)){
$or = [];
if (is_array($val)) {
$or = [];
foreach ($val as $ky => $kv) {
$or[] = " {$key} = '{$kv}' ";
$or[] = " {$key} = '{$kv}' ";
// 函数的使用,非数字则采用函数模式
if(!is_numeric($ky)) {
$or[] = $val;
if (!is_numeric($ky)) {
$or[] = $val;
continue;
}
}
$orstr = arrayto_string($or, ' OR ');
$and[] = " ({$orstr}) ";
}else{
$and[] = " {$key} = '{$val}' ";
$orstr = arrayto_string($or, ' OR ');
$and[] = " ({$orstr}) ";
} else {
$and[] = " {$key} = '{$val}' ";
}
}
return arrayto_string($and, ' AND ');
}
# 入库字段转换
public function field_arr($arr) {
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)){
if (in_array($v, $this->special, true)) {
$str[] = " {$k} = {$v} ";
}else{
} else {
$str[] = " {$k} = '{$v}' ";
}
}
@ -326,33 +355,35 @@ class tsql {
}
# 单独值的字符串转换
public function values_arr($arr) {
public function values_arr($arr)
{
global $_M;
$str = [];
$str = [];
foreach ($arr as $val) {
if(is_array($val)){
if (is_array($val)) {
$str[] = self::values_arr($val);
}else{
if(in_array($val, $this->special,true)){
} else {
if (in_array($val, $this->special, true)) {
$str[] = " $val ";
}else{
} else {
$str[] = " '$val' ";
}
}
}
$arrtostr = arrayto_string($str, ',');
return array_level($arr) == 1?"({$arrtostr})":$arrtostr;
return array_level($arr) == 1 ? "({$arrtostr})" : $arrtostr;
}
# 约束条件新增的语句更新值的规则(最后一段)
# 数组key值为字段名非数字 说明是要单独处理的值
public function unique_arr($arr) {
public function unique_arr($arr)
{
global $_M;
$str = [];
foreach ($arr as $k => $v) {
if(is_numeric($k)){
if (is_numeric($k)) {
$str[] = " $v = VALUES($v) ";
}else{
} else {
$str[] = " $k = $v ";
}
}
@ -360,28 +391,30 @@ class tsql {
}
# 通过数据库整理出该数据库的字段一般是净化form提交的字段避免一个一个组装
public function tfield($form,$tablename = '') {
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);
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'];
$arr[ $v['Field'] ] = $v['Field'];
}
#根据数据库字段提炼
return array_intersect_key($form, $arr);
}
# 查看刚才执行过的sql语句方便核查sql语句
public function query() {
public function query()
{
global $_M;
return $this->query;
}
}
?>

View File

@ -2,17 +2,18 @@
//兼容函数array_column PHP5.5+
if (!function_exists('array_column')) {
function array_column($input, $columnKey, $indexKey = NULL) {
function array_column($input, $columnKey, $indexKey = NULL)
{
$columnKeyIsNumber = (is_numeric($columnKey)) ? TRUE : FALSE;
$indexKeyIsNull = (is_null($indexKey)) ? TRUE : FALSE;
$indexKeyIsNumber = (is_numeric($indexKey)) ? TRUE : FALSE;
$result = array();
foreach ((array) $input AS $key => $row) {
$indexKeyIsNull = (is_null($indexKey)) ? TRUE : FALSE;
$indexKeyIsNumber = (is_numeric($indexKey)) ? TRUE : FALSE;
$result = array();
foreach ((array)$input as $key => $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;
$tmp = isset($row[ $columnKey ]) ? $row[ $columnKey ] : NULL;
}
if (!$indexKeyIsNull) {
if ($indexKeyIsNumber) {
@ -20,10 +21,10 @@ if (!function_exists('array_column')) {
$key = (is_array($key) && !empty($key)) ? current($key) : NULL;
$key = is_null($key) ? 0 : $key;
} else {
$key = isset($row[$indexKey]) ? $row[$indexKey] : 0;
$key = isset($row[ $indexKey ]) ? $row[ $indexKey ] : 0;
}
}
$result[$key] = $tmp;
$result[ $key ] = $tmp;
}
return $result;
}
@ -32,55 +33,56 @@ if (!function_exists('array_column')) {
# 计算时间差
# $begin_time 起始日期
# $end_time 结束日期 一般指当前日期
function timediff($begin_time, $end_time,$type) {
$time = $end_time - $begin_time;
function timediff($begin_time, $end_time, $type)
{
$time = $end_time - $begin_time;
switch ($type) {
case 'year':
//总的年
$timestr = intval($time / 60 / 60 / 24 / 365);
$timestr = intval($time / 60 / 60 / 24 / 365);
break;
case 'month':
//总的月
$timestr = intval($time / 60 / 60 / 24 / 30);
$timestr = intval($time / 60 / 60 / 24 / 30);
break;
case 'week':
$timestr = intval($time / 60 / 60 / 24 / 7);
$timestr = intval($time / 60 / 60 / 24 / 7);
break;
case 'day':
$timestr = intval($time / 60 / 60 / 24);
$timestr = intval($time / 60 / 60 / 24);
break;
case 'hour':
$timestr = intval($time / 60 / 60);
$timestr = intval($time / 60 / 60);
break;
case 'min':
$timestr = intval($time / 60);
$timestr = intval($time / 60);
break;
case 'sec':
$timestr = $time;
$timestr = $time;
break;
default:
//总的年
$year = intval($time / 60 / 60 / 24 / 365);
$year = intval($time / 60 / 60 / 24 / 365);
//总的月
$month = intval($time / 60 / 60 / 24 / 30);
$month = intval($time / 60 / 60 / 24 / 30);
//总的周
$week = intval($time / 60 / 60 / 24 / 7);
$week = intval($time / 60 / 60 / 24 / 7);
//总的天数
$day = intval($time / 60 / 60 / 24);
$day = intval($time / 60 / 60 / 24);
//总的小时
$hour = intval($time / 60 / 60);
$hour = intval($time / 60 / 60);
//总的分钟数
$minute = intval($time / 60);
//总的秒数
$second = $time;
$second = $time;
$timestr = [
'year' =>$year, //总的年
'month'=>$month, //总的月
'week'=>$week, //总的周
'day'=>$day, //总的天数
'hour'=>$hour, //总的小时
'min'=>$minute, //总的分钟数
'sec'=>$second //总的秒数
'year' => $year, //总的年
'month' => $month, //总的月
'week' => $week, //总的周
'day' => $day, //总的天数
'hour' => $hour, //总的小时
'min' => $minute, //总的分钟数
'sec' => $second //总的秒数
];
break;
}
@ -88,14 +90,15 @@ function timediff($begin_time, $end_time,$type) {
}
//获取汉子的首字母
function getstrcharter($str) {
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;
$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';

View File

@ -4,8 +4,9 @@
* 表格数据显示,以及数据导出公用处理方案
*/
trait tdata {
trait tdata
{
//sql语句采用分组查询后调整为true 使用子查询计算总条数
public $multi_table = false;
//搜索的input字段用来处理表数据显示时的颜色加重问题
@ -22,33 +23,36 @@ trait tdata {
private $villages_where = '';
// 根据社区类型和地图选择判断小区的ID
private $village_whereid = '';
// 计算社区类型地图选择返回被选中的小区ID
private function fun_sqlk_vid(){
private function fun_sqlk_vid()
{
global $_M, $_YW;
$idArr = $vidArr = [];
$idArr = $vidArr = [];
if (is_array($this->form['vtype'])) {
$vtype = arrayto_string($this->form['vtype'],',');
$vid = $this->tsql->table('village')->qfield('id')->where("v_type IN({$vtype})")->all();
$idArr = array_column($vid,'id');
if(count($idArr) == 0) $idArr = [-1];
$vtype = arrayto_string($this->form['vtype'], ',');
$vid = $this->tsql->table('village')->qfield('id')->where("v_type IN({$vtype})")->all();
$idArr = array_column($vid, 'id');
if (count($idArr) == 0) $idArr = [-1];
}
if($this->form['v_id']){
$vidArr = stringto_array($this->form['v_id'],',');
if ($this->form['v_id']) {
$vidArr = stringto_array($this->form['v_id'], ',');
// 取社区类型和地图筛选的交集重叠ID社区类型没有操作则直接按照地图筛选结果
// $idArr = count($idArr) > 0?array_intersect($vidArr,$idArr):$vidArr;
if(count($idArr) > 0){
$idArr = array_intersect($vidArr,$idArr);
if (count($idArr) > 0) {
$idArr = array_intersect($vidArr, $idArr);
// 如果交集为空则确实通过此条件进行了筛选就要通知SQL没有任何值满足当前条件将ID设置为0肯定查找不到
if(count($idArr) == 0) $idArr = [-1];
}else{
$idArr = $vidArr;
if (count($idArr) == 0) $idArr = [-1];
} else {
$idArr = $vidArr;
}
}
return $idArr;
}
//表名
public function td_sqlk() {
public function td_sqlk()
{
global $_M, $_YW;
//当天日期时间
$curdate = date('Y-m-d', time());
@ -56,83 +60,83 @@ trait tdata {
case 'applan':
//判断是否可选的依据
if (!empty($this->form['slid'])) $where = " AND nla.id != '{$this->form['slid']}' ";
$ason = '';
// 计算是否区分广告位,不考虑导出
if (is_array($this->form['e_aps'])) {
$veaps = parent::strchange(array_filter($this->form['e_aps']));
$veaps = parent::strchange(array_filter($this->form['e_aps']));
$this->villages_where = " nel.e_aps IN({$veaps}) ";
$ason .= " {$this->villages_where} AND ";
$ason .= " {$this->villages_where} AND ";
}
// 根据小区单个ID
if($this->form['e_vid']){
if ($this->form['e_vid']) {
$ason .= " nel.e_vid = '{$this->form['e_vid']}' AND ";
}
// 社区类型 不考虑导出
$idArr = self::fun_sqlk_vid();
// 通过ID筛选掉不需要的
if(count($idArr) > 0){
$this->village_whereid = arrayto_string(array_unique($idArr),',');
$ason .= " nel.e_vid IN({$this->village_whereid}) AND ";
if (count($idArr) > 0) {
$this->village_whereid = arrayto_string(array_unique($idArr), ',');
$ason .= " nel.e_vid IN({$this->village_whereid}) AND ";
}
//表
$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 {$ason} 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 {$ason} 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 {$ason} 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 {$ason} 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 {$ason} 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 ";
. "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 {$ason} 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 {$ason} 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 {$ason} 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 {$ason} 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 {$ason} 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 ";
. "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 ";
. "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;
$bool = true;
$this->form['vs_starttime'] = $this->form['vs_starttime'] ?: $curdate;
$this->form['vs_endtime'] = $this->form['vs_endtime'] ?: $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'];
$vs_endtime = $this->form['vs_starttime'];
} else {
$vs_starttime = $this->form['vs_starttime'];
$vs_endtime = $this->form['vs_endtime'];
$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']));
$veaps = parent::strchange(array_filter($this->form['veaps']));
$this->villages_where = " el.e_aps IN({$veaps}) ";
$son .= " {$this->villages_where} AND ";
$son .= " {$this->villages_where} AND ";
}
// 社区类型
// 先查询出需要的ID
if (isset($this->form['jsadd_vtype'])) $this->form['vtype'] = stringto_array($this->form['jsadd_vtype'], ',');
$idArr = self::fun_sqlk_vid();
// 通过ID筛选掉不需要的
if(count($idArr) > 0){
$this->village_whereid = arrayto_string(array_unique($idArr),',');
$son .= " el.e_vid IN({$this->village_whereid}) AND ";
if (count($idArr) > 0) {
$this->village_whereid = arrayto_string(array_unique($idArr), ',');
$son .= " el.e_vid IN({$this->village_whereid}) AND ";
}
// 空置计算要排除当前排期中的广告位
if ($bool) {
//加上时间区块 那就是查看在区段内的情况
@ -140,11 +144,11 @@ trait tdata {
//空置
$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 ";
// $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}' ) ";
// $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}' ";
//预排
@ -160,13 +164,13 @@ trait tdata {
//预排,开始时间大于当天的
$pwhere = " {$son} el.l_starttime > '{$curdate}' ";
}
$sqlk = "{$_YW['k']['village']} AS vi LEFT JOIN {$_YW['k']['elevator']} AS el ON vi.id = el.e_vid "
. "LEFT JOIN (SELECT el.e_vid AS ae_vid,COUNT( DISTINCT el.e_number ) AS v_free,COUNT( DISTINCT el.e_vid, el.e_bno ) AS v_bno {$fwhere} GROUP BY ae_vid ) AS anum ON anum.ae_vid = vi.id "
. "LEFT JOIN (SELECT el.e_vid AS be_vid,COUNT( DISTINCT el.e_number ) AS v_lease {$lwhere} GROUP BY be_vid ) AS bnum ON bnum.be_vid = vi.id "
. "LEFT JOIN (SELECT el.e_vid AS ce_vid,COUNT( DISTINCT el.e_number ) AS v_endday {$dwhere} GROUP BY ce_vid ) AS cnum ON cnum.ce_vid = vi.id "
. "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 ";
. "LEFT JOIN (SELECT el.e_vid AS ae_vid,COUNT( DISTINCT el.e_number ) AS v_free,COUNT( DISTINCT el.e_vid, el.e_bno ) AS v_bno {$fwhere} GROUP BY ae_vid ) AS anum ON anum.ae_vid = vi.id "
. "LEFT JOIN (SELECT el.e_vid AS be_vid,COUNT( DISTINCT el.e_number ) AS v_lease {$lwhere} GROUP BY be_vid ) AS bnum ON bnum.be_vid = vi.id "
. "LEFT JOIN (SELECT el.e_vid AS ce_vid,COUNT( DISTINCT el.e_number ) AS v_endday {$dwhere} GROUP BY ce_vid ) AS cnum ON cnum.ce_vid = vi.id "
. "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 ";
@ -177,16 +181,17 @@ trait tdata {
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];
$sqlk = $_YW['k'][ $this->tname ];
break;
}
return $sqlk;
}
//字段
public function td_field() {
public function td_field()
{
global $_M, $_YW;
switch ($this->tname) {
case 'elevators':
@ -207,20 +212,21 @@ trait tdata {
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) {
public function td_search($link = true)
{
global $_M, $_YW;
//默认input字段为link搜索
if ($link)
@ -229,13 +235,13 @@ trait tdata {
$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]));
$search = trim(strtoupper($this->form[ $val ]));
if (strlen($search) > 0) {
$str = $join_field[$val];
$str = $join_field[ $val ];
if (in_array($val, $this->search_link)) {
$arrwhere[] = " {$str} LIKE '%{$search}%' ";
continue;
@ -243,7 +249,7 @@ trait tdata {
$arrwhere[] = " {$str} = '{$search}' ";
}
}
//返回内容
$where = '';
if (count($arrwhere) > 0) {
@ -252,18 +258,19 @@ trait tdata {
}
return $where;
}
//OR 内容搜索
public function td_search_or($orfield, $search_field = []) {
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]));
$search = trim(strtoupper($this->form[ $val ]));
if (strlen($search) > 0) {
$str = $join_field[$val];
$str = $join_field[ $val ];
if (in_array($val, $this->search_link)) {
$arrwhere[] = " {$str} LIKE '%{$search}%' ";
continue;
@ -271,7 +278,7 @@ trait tdata {
$arrwhere[] = " {$str} = '{$search}' ";
}
}
//返回内容
$where = '';
if (count($arrwhere) > 0) {
@ -279,9 +286,10 @@ trait tdata {
}
return strlen($where) > 0 ? " AND ({$where}) " : '';
}
//时间区间
public function td_time_search($field, $search_field = []) {
public function td_time_search($field, $search_field = [])
{
global $_M, $_YW;
list($start, $end) = $field;
//判断是否为链表查询
@ -289,9 +297,9 @@ trait tdata {
//相对独立的搜索
$arrwhere = [];
foreach ($field as $val) {
$search = trim(strtoupper($this->form[$val]));
$search = trim(strtoupper($this->form[ $val ]));
if (strlen($search) > 0) {
$str = $join_field[$val];
$str = $join_field[ $val ];
if ($val == $start) {
$arrwhere[] = " {$str} >= '{$search}' ";
} else {
@ -299,7 +307,7 @@ trait tdata {
}
}
}
//返回内容
$where = '';
if (count($arrwhere) > 0) {
@ -307,10 +315,11 @@ trait tdata {
}
return strlen($where) > 0 ? " AND ({$where}) " : '';
}
//获取重叠的时间区间
// $search_field 开始时间和结束时间的字段互相调换,结束的字段在前面
public function td_time_orsearch($field, $search_field = []) {
public function td_time_orsearch($field, $search_field = [])
{
global $_M, $_YW;
list($start, $end) = $field;
//判断是否为链表查询
@ -318,9 +327,9 @@ trait tdata {
//相对独立的搜索
$arrwhere = [];
foreach ($field as $val) {
$search = trim(strtoupper($this->form[$val]));
$search = trim(strtoupper($this->form[ $val ]));
if (strlen($search) > 0) {
$str = $join_field[$val];
$str = $join_field[ $val ];
if ($val == $start) {
$arrwhere[] = " {$str} < '{$search}' "; //结束字段,搜索为开始时间
} else {
@ -328,7 +337,7 @@ trait tdata {
}
}
}
//返回内容
$where = '';
if (count($arrwhere) > 0) {
@ -336,20 +345,21 @@ trait tdata {
}
return strlen($where) > 0 ? " AND NOT({$where}) " : '';
}
/*
* 【列出】
* SQL判断语句$where .= $this->search();
*/
public function td_where() {
public function td_where()
{
global $_M, $_YW;
$where = " 1=1 ";
switch ($this->tname) {
case 'applan':
$this->search_input = ['e_number'];
$this->search_other = ['e_bno', 'e_vid', 'e_enable'];
$where .= self::td_search();
$where .= self::td_search();
if (is_array($this->form['e_aps'])) {
// 不考虑导出的情况
$veaps = parent::strchange(array_filter($this->form['e_aps']));
@ -361,7 +371,7 @@ trait tdata {
$this->search_input = ['e_number'];
$this->search_other = ['e_aps', 'e_bno', 'e_vid', 'e_enable', 'endid', 'nowid', 'nextid'];
$this->search_field = ['el.e_number', 'el.e_aps', 'el.e_bno', 'el.e_vid', 'el.e_enable', 'cla.endid', 'ala.nowid', 'bla.nextid'];
$where .= self::td_search();
$where .= self::td_search();
//判断是否为备份
if ($this->bsign)
parent::where_id($where);
@ -371,73 +381,73 @@ trait tdata {
$this->search_input = ['e_number'];
$this->search_other = ['e_aps', 'e_bno', 'e_vid', 'e_enable', 'nowid', 'l_hnumber'];
$this->search_field = ['el.e_number', 'el.e_aps', 'el.e_bno', 'el.e_vid', 'el.e_enable', 'ala.nowid', 'la.l_hnumber'];
$where .= self::td_search();
$where .= 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_bno', 'e_vid', 'e_enable'];
$where .= self::td_search();
$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'];
$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_city'] = $this->form['v_address'];
$this->form['v_district'] = $this->form['v_address'];
$where .= self::td_search_or($this->search_link, ['vi.v_province', 'vi.v_city', 'vi.v_district', 'vi.v_address']);
self::td_groupby($where);
break;
case 'customer':
$this->search_input = ['c_text'];
$this->search_link = ['c_allname', 'c_name', 'c_province', 'c_city', 'c_district', 'c_address'];
$this->search_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']);
$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_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();
$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();
$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_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();
$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();
$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();
$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->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_city'] = $this->form['v_address'];
$this->form['v_district'] = $this->form['v_address'];
if (strlen($this->villages_where) > 0) $where .= " AND {$this->villages_where} ";
if (strlen($this->village_whereid) > 0) $where .= " AND vi.id IN({$this->village_whereid}) ";
$where .= self::td_search_or($this->search_link);
@ -448,28 +458,29 @@ trait tdata {
self::td_groupby($where);
break;
case 'schedule':
$where .= " AND la.id IS NOT NULL ";
$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();
$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
. '(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) {
public function td_groupby(&$where)
{
global $_M;
$this->multi_table = true;
switch ($this->tname) {
@ -495,13 +506,14 @@ trait tdata {
break;
}
}
/*
* 【列出】
* SQL排序方式语句
*/
public function td_order() {
public function td_order()
{
global $_M;
switch ($this->tname) {
case 'applan':
@ -546,7 +558,7 @@ trait tdata {
$order = " endetime {$this->form['order_endetime']} ";
if ($this->form['order_e_address']) {
$e_address = $this->form['order_e_address'];
$order = " el.e_vid {$e_address}, el.e_bno {$e_address}, el.e_aps {$e_address} ";
$order = " el.e_vid {$e_address}, el.e_bno {$e_address}, el.e_aps {$e_address} ";
}
break;
case 'patrol':
@ -597,7 +609,7 @@ trait tdata {
$order = " v_ebnonum {$this->form['order_v_ebnonum']} ";
if ($this->form['order_v_bno'])
$order = " v_bno {$this->form['order_v_bno']} ";
break;
case 'para':
$order = ' `id` DESC';
@ -616,8 +628,8 @@ trait tdata {
$order = ' `id` DESC';
break;
}
return $order;
}
}

View File

@ -4,8 +4,9 @@
* 表格列表的结果处理
*/
trait tlist {
trait tlist
{
//按钮组
protected $btn = [];
//禁用最后的按钮
@ -20,22 +21,23 @@ trait tlist {
protected static $workers = [];
//场所缓存
protected static $village = [];
//公用删除
//$query 主要用来替换删除按钮的值
protected function btn_group($val, $checked, $query = []) {
protected function btn_group($val, $checked, $query = [])
{
global $_M, $_YW;
if (empty($checked)) {
if ($query !== false) {
$para = [
'c' => 'table_off',
'a' => 'doindex',
$para = [
'c' => 'table_off',
'a' => 'doindex',
'submit_type' => 'delet',
'all_id' => $val['id'],
'tname' => $this->tname,
'all_id' => $val['id'],
'tname' => $this->tname,
];
$query = array_merge($para, $query);
$href = parent::http_build_query($_M['url']['own_name'], $query);
$query = array_merge($para, $query);
$href = parent::http_build_query($_M['url']['own_name'], $query);
$this->btn[] = '<a
class="btn btn-danger btn-sm"
table-delet
@ -54,28 +56,29 @@ trait tlist {
$btnstr = arrayto_string($this->btn, '');
unset($this->btn);
// 普通按钮组合
$btngroup = '<div class="btn-group" role="group" >'.$btnstr.'</div>';
$btngroup = '<div class="btn-group" role="group" >' . $btnstr . '</div>';
// 下拉方式的组合按钮组
$btngrouptoggle = '<div class="btn-group" role="group">
$btngrouptoggle = '<div class="btn-group" role="group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
'.$this->btn_group_toggle.'
' . $this->btn_group_toggle . '
</button>
<div class="dropdown-menu btn-group-toggle-menu">'.$btnstr.'</div>
<div class="dropdown-menu btn-group-toggle-menu">' . $btnstr . '</div>
</div>';
return $this->btn_group_toggle?$btngrouptoggle:$btngroup;
return $this->btn_group_toggle ? $btngrouptoggle : $btngroup;
}
}
//整合
private function assemble($key, $base, $val, $checked, $query = []) {
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]));
$search = trim(strtoupper($this->form[ $vs ]));
if ($search != null)
$val[$vs] = str_ireplace($search, '<font color="#FF0000">' . $search . '</font>', $val[$vs]);
$val[ $vs ] = str_ireplace($search, '<font color="#FF0000">' . $search . '</font>', $val[ $vs ]);
}
//按钮组处理
$operation = [];
@ -84,9 +87,10 @@ trait tlist {
//结果整合处理
return array_merge($base, $key, array_intersect_key($val, $key), $operation);
}
//广告位详细地址转换
protected function eaddress(&$val, $_address = 'e_address', $sign = false) {
protected function eaddress(&$val, $_address = 'e_address', $sign = false)
{
global $_M, $_YW;
//门口方位
if (empty(self::$para['e_bno']))
@ -95,32 +99,33 @@ trait tlist {
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 (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_aps'] = self::$para['e_aps'][$val['e_aps']];
$val['e_vid'] = self::$village[ $val['e_vid'] ];
$val['e_bno'] = self::$para['e_bno'][ $val['e_bno'] ];
$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_aps'][$val['e_aps']]
$villages = [
self::$village[ $val['e_vid'] ],
self::$para['e_bno'][ $val['e_bno'] ],
self::$para['e_aps'][ $val['e_aps'] ]
];
$val[$_address] = arrayto_string($villages, ' ');
$val[ $_address ] = arrayto_string($villages, ' ');
}
}
// +----------------------------------------------------------------------
// | 各表处理
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 各表处理
// +----------------------------------------------------------------------
//广告位统计
protected function elevator($val, $checked = '') {
protected function elevator($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_elevator();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '">
@ -134,36 +139,37 @@ trait tlist {
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 (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'] = '<a href="' . $scheduleurl . '"> ' . $val['e_number'] . '</a>';
$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_aps'] = self::$para['e_aps'][$val['e_aps']];
$val['e_vid'] = self::$village[ $val['e_vid'] ];
$val['e_bno'] = self::$para['e_bno'][ $val['e_bno'] ];
$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'];
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
//跳过标记突出处理
$this->skip_field = ['e_number'];
return self::assemble($key, $base, $val, $checked);
}
//场所统计
protected function village($val, $checked = '') {
protected function village($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_village();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '">
@ -173,57 +179,59 @@ trait tlist {
//场所分类
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'] = '<a href="' . $vnameurl . '"> ' . $val['v_name'] . '</a>';
$val['v_type'] = self::$para['v_type'][$val['v_type']];
$val['v_tel'] = parent::tab_tokenfield($val['v_tel'], 1);
$val['v_address'] = $val['v_province'] . $val['v_city'] . $val['v_district'] . $val['v_address'];
$val['v_name'] = '<a href="' . $vnameurl . '"> ' . $val['v_name'] . '</a>';
$val['v_type'] = self::$para['v_type'][ $val['v_type'] ];
$val['v_tel'] = parent::tab_tokenfield($val['v_tel'], 1);
$val['v_address'] = $val['v_province'] . $val['v_city'] . $val['v_district'] . $val['v_address'];
$val['v_forbidtype'] = parent::tab_tokenfield($val['v_forbidtype'], 2);
$val['v_totalstr'] = $val['noban'] > 0 ? parent::str_color(0, $totalstr, 600) : $totalstr;
$val['v_lnglat'] = $val['v_maplng'].$val['v_maplat'];
$val['v_lnglat'] = $val['v_maplng'] . $val['v_maplat'];
//执行操作按钮
if (empty($checked)) {
$this->btn_group_toggle = '操作按钮';
$this->btn[] = '<a href="' . $vnameurl . '" class="btn btn-primary btn-sm">查看广告位</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
$this->btn[] = '<a href="' . $vnameurl . '" class="btn btn-primary btn-sm">查看广告位</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
return self::assemble($key, $base, $val, $checked);
}
//广告合同关联表
protected function schedule($val, $checked = '', $base = []) {
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']);
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['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 = '') {
protected function contract($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_contract();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '">
@ -231,120 +239,123 @@ trait tlist {
</span>';
//对字段处理
//公司名称
if (empty(self::$customer[$val['h_cid']]))
self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']);
if (empty(self::$customer[ $val['h_cid'] ]))
self::$customer[ $val['h_cid'] ] = parent::customerlist($val['h_cid']);
//投放媒介
if (empty(self::$para['h_medium']))
self::$para['h_medium'] = parent::translate(4);
$h_mediumid = stringto_array($val['h_medium'], '#@met@#');
foreach ($h_mediumid as $hmid) {
$hmediumid[] = self::$para['h_medium'][$hmid];
$hmediumid[] = self::$para['h_medium'][ $hmid ];
}
//相关人员
$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];
if (empty(self::$workers[ $hwid ]))
self::$workers[ $hwid ] = parent::workerslist($hwid);
$workersstr[] = self::$workers[ $hwid ];
}
//内连接
$h_number = $val['h_number']; //避免后面采用
$h_number = $val['h_number']; //避免后面采用
$launchurl = $this->own_name_table . 'launch&l_hnumber=' . $h_number;
$curdate = date('Y-m-d', time());
$val['h_number'] = '<a href="' . $launchurl . '"> ' . $h_number . '</a>';
$val['h_cid'] = self::$customer[$val['h_cid']];
$val['h_wid'] = parent::tab_tokenfield(arrayto_string($workersstr), 1);
$curdate = date('Y-m-d', time());
$val['h_number'] = '<a href="' . $launchurl . '"> ' . $h_number . '</a>';
$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_medium'] = parent::tab_tokenfield(arrayto_string($hmediumid, ','));
$val['h_medium'] = parent::tab_tokenfield(arrayto_string($hmediumid, ','));
$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'];
$val['h_endtime'] = strtotime($val['h_endtime']) < strtotime($curdate) ? parent::str_color(0, $val['h_endtime'], 600) : $val['h_endtime'];
//执行操作按钮
if (empty($checked)) {
$this->btn_group_toggle = '操作按钮';
$addtourl = $this->own_name_info . 'launch&cid=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-primary btn-sm">新增投放</a>';
$this->btn[] = '<a href="' . $launchurl . '" class="btn btn-info btn-sm">查看投放</a>';
$addtourl = $_M['url']['own_name'] . 'c=backups&a=doindex&tname=schedule&l_hnumber=' . $h_number;
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-warning btn-sm">导出排期</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
$addtourl = $this->own_name_info . 'launch&cid=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-primary btn-sm">新增投放</a>';
$this->btn[] = '<a href="' . $launchurl . '" class="btn btn-info btn-sm">查看投放</a>';
$addtourl = $_M['url']['own_name'] . 'c=backups&a=doindex&tname=schedule&l_hnumber=' . $h_number;
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-warning btn-sm">导出排期</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
//跳过标记突出处理
$this->skip_field = ['h_number'];
return self::assemble($key, $base, $val, $checked);
}
//公司资料
protected function customer($val, $checked = '') {
protected function customer($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_customer();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '">
<label></label>
</span>';
//对字段处理
$hcidurl = $this->own_name_table . 'contract&h_cid=' . $val['id'];
$hcidurl = $this->own_name_table . 'contract&h_cid=' . $val['id'];
$val['c_allname'] = '<a href="' . $hcidurl . '"> ' . $val['c_allname'] . '</a>';
$val['c_tel'] = parent::tab_tokenfield($val['c_tel'], 1);
$val['c_tel'] = parent::tab_tokenfield($val['c_tel'], 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'];
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
return self::assemble($key, $base, $val, $checked);
}
//企业联系人
protected function workers($val, $checked = '') {
protected function workers($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_workers();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '">
<label></label>
</span>';
//拿到对应的ID
//职务
if (empty(self::$para))
self::$para = parent::translate(1);
//对字段处理
$val['w_jid'] = self::$para[$val['w_jid']];
$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'];
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
return self::assemble($key, $base, $val, $checked);
}
//参数统计
protected function para($val, $checked = '') {
protected function para($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_para();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '" ' . $checked . '>
<label></label>
</span>';
//对字段处理
//优先计算
switch ($val['p_type']) {
@ -366,19 +377,19 @@ trait tlist {
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 = '<input type="hidden" name="p_num-' . $val['id'] . '" value="' . $p_num . '">';
$val['p_num'] = $checked ? $inputp_num : $p_num . ' 条' . $inputp_num;
$val['p_type'] = '<div class="form-group">
$inputp_num = '<input type="hidden" name="p_num-' . $val['id'] . '" value="' . $p_num . '">';
$val['p_num'] = $checked ? $inputp_num : $p_num . ' 条' . $inputp_num;
$val['p_type'] = '<div class="form-group">
<select class="form-control" name="p_type-' . $val['id'] . '" data-checked="' . $val['p_type'] . '" required >
<option value="0">广告位置</option>
<option value="1">企业职位</option>
@ -392,24 +403,25 @@ trait tlist {
$val['p_order'] = '<div class="form-group">
<input type="text" name="p_order-' . $val['id'] . '" value="' . $val['p_order'] . '" placeholder="仅支持数字" data-fv-integer="true" data-fv-integer-message="请输入有效的整数数字" class="form-control">
</div>';
$val['p_name'] = '<div class="form-group">
$val['p_name'] = '<div class="form-group">
<input type="text" name="p_name-' . $val['id'] . '" value="' . $val['p_name'] . '" required class="form-control">
</div>';
$val['p_value'] = '<div class="form-group">
<input type="text" name="p_value-' . $val['id'] . '" value="' . $val['p_value'] . '" placeholder="仅支持数字" data-fv-integer="true" data-fv-integer-message="请输入有效的整数数字" class="form-control" ' . $readonly . '>
</div>';
$val['p_text'] = '<input type="text" name="p_text-' . $val['id'] . '" value="' . $val['p_text'] . '" class="form-control">';
$val['p_text'] = '<input type="text" name="p_text-' . $val['id'] . '" value="' . $val['p_text'] . '" class="form-control">';
//执行操作按钮
return self::assemble($key, $base, $val, $checked, $p_num > 0 ? false : []);
}
//投放计划
protected function launch($val, $checked = '') {
protected function launch($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_launch();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary ap-one">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '" ' . $checked . '>
@ -420,41 +432,42 @@ trait tlist {
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} ";
$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'];
$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'] = '<a href="' . $l_titleurl . '"> ' . $val['l_title'] . '</a>';
$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_title'] = '<a href="' . $l_titleurl . '"> ' . $val['l_title'] . '</a>';
$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'];
$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_group_toggle = '操作按钮';
$this->btn[] = '<a href="' . $l_titleurl . '" class="btn btn-info btn-sm">查看排期</a>';
$addtourl = $_M['url']['own_name'] . 'c=backups&a=doindex&tname=schedule&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-warning btn-sm">导出排期</a>';
$addtourl = $this->own_name_info.__FUNCTION__.'&fzid='.$val['id'].'&eaps_order=2';
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-primary btn-sm">复制</a>';
$addtourl = $this->own_name_info.__FUNCTION__.'&slid='.$val['id'].'&eaps_order=2';
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
$this->btn[] = '<a href="' . $l_titleurl . '" class="btn btn-info btn-sm">查看排期</a>';
$addtourl = $_M['url']['own_name'] . 'c=backups&a=doindex&tname=schedule&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-warning btn-sm">导出排期</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&fzid=' . $val['id'] . '&eaps_order=2';
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-primary btn-sm">复制</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&slid=' . $val['id'] . '&eaps_order=2';
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
return self::assemble($key, $base, $val, $checked);
}
//广告位统计
protected function applan($val, $checked = '') {
protected function applan($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_applan();
//列表前段
$e_number = $val['e_number'];
//判断之前是否已经选中
@ -464,16 +477,16 @@ trait tlist {
//$val['lanum'] 大于0 说明重复,不可投放
if ($ebool) {
$apchecked = ' checked ';
$slid = $this->form['slid'];
$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(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, '禁止投放');
@ -484,7 +497,7 @@ trait tlist {
}
} else {
$s_starttime = $_M['form']['l_starttime'];
$s_endtime = $_M['form']['l_endtime'];
$s_endtime = $_M['form']['l_endtime'];
if ($s_starttime && $s_endtime && strtotime($s_starttime) <= strtotime($s_endtime)) {
//判断是否可排期成功
if ($val['lanum'] > 0) {
@ -501,13 +514,13 @@ trait tlist {
$e_types = parent::str_color(3, '无法判断');
}
}
// checkbox-danger 没有在排期库的显示为红色 checkbox-primary 正常的显示蓝色 checkbox-success 绿色
$base[] = '<span class="checkbox-custom ' . $class . ' ap-one">
<input class="selectable-item" type="checkbox" name="id" value="' . $e_number . '" ' . $apchecked . $disabled . '>
<label></label>
</span>';
//对字段处理
$curtime = strtotime(date('Y-m-d', time()));
//上个排期
@ -516,9 +529,9 @@ trait tlist {
$val['endstime'] = '<span class="blue-grey-400">' . $val['endstime'] . '</span>';
$val['endetime'] = '<span class="blue-grey-400">' . $val['endetime'] . '</span>';
}
$val['endtime'] = strtotime($val['endtime']) < $curtime ? '<span class="line_through blue-grey-400">' . $val['endtime'] . '</span>' : $val['endtime'];
$val['e_types'] = $e_types;
$val['endtime'] = strtotime($val['endtime']) < $curtime ? '<span class="line_through blue-grey-400">' . $val['endtime'] . '</span>' : $val['endtime'];
$val['e_types'] = $e_types;
$val['e_enable'] = parent::state_color($val['e_enable'], ['禁用', '启用']);
self::eaddress($val, 'e_address');
//比较每个广告位的结束时间 和 现在设置的投放订单的开始时间 大小
@ -526,72 +539,74 @@ trait tlist {
$this->banbtn = true;
return self::assemble($key, $base, $val, $checked, false);
}
//广告位统计
protected function elevators($val, $checked = '') {
protected function elevators($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_elevators();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary ap-one">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['e_number'] . '" ' . $checked . '>
<label></label>
</span>';
//对字段处理
$curtime = strtotime(date('Y-m-d', time()));
$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'] = '<a href="' . $scheduleurl . '"> ' . $val['e_number'] . '</a>';
$val['etypes'] = parent::state_color($val['etypes'], [$val['e_enable'] ? '空位' : '已禁用', '排期中']);
$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'] ? '<a href="' . $scheduleurlid . $val['endid'] . '">' . $val['endtitle'] . '</a>' : '';
$val['nowtitle'] = $val['nowtitle'] ? '<a href="' . $scheduleurlid . $val['nowid'] . '">' . $val['nowtitle'] . '</a>' : '';
$scheduleurlid = $this->own_name_table . 'schedule&l_id=';
$val['endtitle'] = $val['endtitle'] ? '<a href="' . $scheduleurlid . $val['endid'] . '">' . $val['endtitle'] . '</a>' : '';
$val['nowtitle'] = $val['nowtitle'] ? '<a href="' . $scheduleurlid . $val['nowid'] . '">' . $val['nowtitle'] . '</a>' : '';
$val['nexttitle'] = $val['nexttitle'] ? '<a href="' . $scheduleurlid . $val['nextid'] . '">' . $val['nexttitle'] . '</a>' : '';
self::eaddress($val, 'e_address');
$val['endtime'] = strtotime($val['endtime']) < $curtime ? '<span class="line_through blue-grey-400">' . $val['endtime'] . '</span>' : $val['endtime'];
//上个排期
if (strtotime($val['endetime']) < $curtime) {
$val['endstime'] = '<span class="blue-grey-400">' . $val['endstime'] . '</span>';
$val['endetime'] = '<span class="blue-grey-400">' . $val['endetime'] . '</span>';
}
//执行操作按钮
if (empty($checked)) {
// $this->btn[] = '<a href="'.$uplaunchurl.'" class="btn btn-success btn-sm">调整排期</a>';
// $this->btn[] = '<a href="'.$uplaunchurl.'" class="btn btn-success btn-sm">调整排期</a>';
$this->btn[] = '<a href="' . $scheduleurl . '" class="btn btn-primary btn-sm">查看排期</a>';
}
//跳过标记突出处理
$this->skip_field = ['e_number'];
return self::assemble($key, $base, $val, $checked, false);
}
//场所统计展示
protected function villages($val, $checked = '') {
protected function villages($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_villages();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '">
<label></label>
</span>';
//场所分类
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'] = '<a href="' . $scheduleurl . '" title="查看排期"> ' . $val['v_name'] . '</a>';
$val['v_type'] = self::$para['v_type'][$val['v_type']];
$val['v_free'] = $val['v_free'] ? '<span class="tag tag-sm tag-pill tag-info">' . $val['v_free'] . '</span>' : $val['v_free'];
$val['v_lease'] = $val['v_lease'] ? '<span class="tag tag-sm tag-pill tag-warning">' . $val['v_lease'] . '</span>' : $val['v_lease'];
$val['v_name'] = '<a href="' . $scheduleurl . '" title="查看排期"> ' . $val['v_name'] . '</a>';
$val['v_type'] = self::$para['v_type'][ $val['v_type'] ];
$val['v_free'] = $val['v_free'] ? '<span class="tag tag-sm tag-pill tag-info">' . $val['v_free'] . '</span>' : $val['v_free'];
$val['v_lease'] = $val['v_lease'] ? '<span class="tag tag-sm tag-pill tag-warning">' . $val['v_lease'] . '</span>' : $val['v_lease'];
$val['v_endday'] = $val['v_endday'] ? '<span class="tag tag-sm tag-pill tag-success">' . $val['v_endday'] . '</span>' : $val['v_endday'];
$val['v_prerow'] = $val['v_prerow'] ? '<span class="tag tag-sm tag-pill tag-primary">' . $val['v_prerow'] . '</span>' : $val['v_prerow'];
if ($val['noban'] > 0) {
@ -605,43 +620,44 @@ trait tlist {
// $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'];
$addtourl = $this->own_name_table . 'elevators&e_vid=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-primary btn-sm">广告位统计</a>';
}
return self::assemble($key, $base, $val, $checked, false);
}
//场所统计展示
protected function noticeday($val, $checked = '', $base = []) {
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']);
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];
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()));
$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);
$str = parent::str_color(0, $val['noticeday'], 800);
$htypes = "{$str} 天后到期提醒";
} else {
//按照前后3天来设置
@ -654,69 +670,71 @@ trait tlist {
$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['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'];
$numberurl = $this->own_name_table . 'contract&h_number=' . $val['h_number'];
$val['h_number'] = '<a href="' . $numberurl . '" title="查看排期"> ' . $val['h_number'] . '</a>';
return self::assemble($key, $base, $val, $checked, false);
}
//前台巡查
protected function patrol($val, $checked = '') {
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;
$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 = '') {
protected function keylist($val, $checked = '')
{
global $_M, $_YW;
//获取字段
$key = self::tf_keylist();
//列表前段
$base[] = '<span class="checkbox-custom checkbox-primary">
<input class="selectable-item" type="checkbox" name="id" value="' . $val['id'] . '" ' . $checked . '>
<label></label>
</span>';
//对字段处理
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'];
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);
$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'];
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
//执行操作按钮
return self::assemble($key, $base, $val, $checked);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -528,14 +528,14 @@ namespace APPMAP {
//模态框
$('#selectMapId').on('shown.bs.modal', () => {
// 设置地图高度,达到满屏效果
if(!this.selectMapInitType) this.setHeight()
if (!this.selectMapInitType) this.setHeight()
// 延迟效果可以让模态框加载时看起来没有卡的感觉
setTimeout(() => {
// 解决因页面产品滚动条导致的点击地图获取的经纬度不准确问题
// 让滚动条回滚到顶部
document.body.scrollTop = document.documentElement.scrollTop = 0
// 初始化模态框
if(!this.selectMapInitType) this.selectInitMap()
if (!this.selectMapInitType) this.selectInitMap()
// ajax查找 当前地区点的标注并添加在地图上
this.ajaxlnglatList(this.selectMap, {
id: '',
@ -545,7 +545,7 @@ namespace APPMAP {
allinfo: 'all'
}, true)
// 初始化绘制工具
if(!this.selectMapInitType) this.drawingManagerInit()
if (!this.selectMapInitType) this.drawingManagerInit()
// 绘制结束后的回调
this.drawingManager.addEventListener("overlaycomplete", (e) => {
let overlay = e.overlay
@ -604,7 +604,7 @@ namespace APPMAP {
})
});
// 标记为已经初始化过
if(this.selectMapInitType === false) this.selectMapInitType = true
if (this.selectMapInitType === false) this.selectMapInitType = true
}, 100)
});
@ -873,14 +873,14 @@ namespace APPMAP {
} else {
let listNums = this.villageList ? Object.keys(this.villageList).length : 0
$('#selectMapId .listNum').html(listNums)
$('button[data-target="#selectMapId"] .listNum').html(listNums > 0?listNums:'')
$('button[data-target="#selectMapId"] .listNum').html(listNums > 0 ? listNums : '')
if (listNums === 0 && type === 'del') this.mapreset()
}
}
// 将指传递到input
input(keysStr?){
const inputVid = $('input[name="v_id"]')
input(keysStr?) {
const inputVid = $('input[name="v_id"]')
inputVid.val(keysStr)
inputVid.trigger('change')
}

View File

@ -1,18 +1,18 @@
declare let $:any
declare let jQuery:any
declare let APPFUN:{
isEmpty: (a:any)=>{}
declare let $: any
declare let jQuery: any
declare let APPFUN: {
isEmpty: (a: any) => {}
}
declare let BMapGL:any
declare let M:any
declare let alertify:any
declare let CL:any
declare let BMAP_ANCHOR_TOP_LEFT:any
declare let BMAP_ANCHOR_BOTTOM_LEFT:any
declare let BMAP_ANCHOR_TOP_RIGHT:any
declare let BMAP_DRAWING_MARKER:any
declare let BMAP_DRAWING_POLYLINE:any
declare let BMAP_DRAWING_RECTANGLE:any
declare let BMAP_DRAWING_POLYGON:any
declare let BMAP_DRAWING_CIRCLE:any
declare let BMapGLLib:any
declare let BMapGL: any
declare let M: any
declare let alertify: any
declare let CL: any
declare let BMAP_ANCHOR_TOP_LEFT: any
declare let BMAP_ANCHOR_BOTTOM_LEFT: any
declare let BMAP_ANCHOR_TOP_RIGHT: any
declare let BMAP_DRAWING_MARKER: any
declare let BMAP_DRAWING_POLYLINE: any
declare let BMAP_DRAWING_RECTANGLE: any
declare let BMAP_DRAWING_POLYGON: any
declare let BMAP_DRAWING_CIRCLE: any
declare let BMapGLLib: any

View File

@ -5,8 +5,9 @@
* 应用支持php5.4+
*/
trait appcmp {
trait appcmp
{
# 应用文件名
public $m_name = M_NAME;
# 应用数据库名简写
@ -21,94 +22,102 @@ trait appcmp {
protected function show($file, $data)
{
global $_M, $_YW;
$view =load::sys_class('engine','new');
$view = load::sys_class('engine', 'new');
require_once $view->dodisplay($file, $data);
}
protected function check_auth() {
protected function check_auth()
{
global $_M, $_YW;
self::cmp_a();
$exetime = time();
$bool = false;
$exetime = time();
$bool = false;
//解密后的数组
$cache = json_decode(authcode($_YW['c']['ac_cache'],'DECODE',md5($_M['config']['met_weburl'])),true);
$cache = json_decode(authcode($_YW['c']['ac_cache'], 'DECODE', md5($_M['config']['met_weburl'])), true);
//查看本地是否存在禁止更新锁
if(file_exists(PATH_APP_FILE."config/update.lock")) $cache['update'] = 1;
if (file_exists(PATH_APP_FILE . "config/update.lock")) $cache['update'] = 1;
//需要对比数据
if( $cache['time'] > $exetime || ($cache['time'] > $cache['exetime'] && $cache['time'] < $exetime) ){
$check = json_decode(authcode($cache['check'],'DECODE', md5(self::parse_url($_M['config']['met_weburl']).md5($this->m_name.$_YW['app']['addtime']))),true);
$state = $check['state'] && $check['app']['v_m_name'] == $this->m_name?true:false;
if($state){
if($check['vatime']['minute'] > 0){
if ($cache['time'] > $exetime || ($cache['time'] > $cache['exetime'] && $cache['time'] < $exetime)) {
$check = json_decode(authcode($cache['check'], 'DECODE', md5(self::parse_url($_M['config']['met_weburl']) . md5($this->m_name . $_YW['app']['addtime']))), true);
$state = $check['state'] && $check['app']['v_m_name'] == $this->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 <= $exetime ) $state = false;
$time = date('Y-m-d H:i:s', $check['vatime']['stime']);
$endtime = strtotime("{$time} +{$check['vatime']['minute']} minute");
if ($endtime <= $exetime) $state = false;
}
//最终结果判断
$bool = $state && !empty($cache['wechat']) && !empty($cache['update'])?true:false;
$bool = $state && !empty($cache['wechat']) && !empty($cache['update']) ? true : false;
}
}
if(!$bool) turnover($_M['url']['own_name'].'c=index&a=doindex&check=1','No prompt');
if (!$bool) turnover($_M['url']['own_name'] . 'c=index&a=doindex&check=1', 'No prompt');
}
# 加载方法
public function loadp($str = '') {
public function loadp($str = '')
{
global $_M, $_YW;
$arr = explode(",",$str);
$arr = explode(",", $str);
foreach ($arr as $val) {
self::$val();
}
}
# 批量加载
public function cmp_load() {
public function cmp_load()
{
global $_M, $_YW;
self::loadp('cmp_k,cmp_c,cmp_t');
}
# 获取完整数据库
public function cmp_k() {
public function cmp_k()
{
global $_M, $_YW;
//全局
$globaltablename = ['cloud_config'];
//应用独有表名
$tablename = file_get_contents(PATH_ALL_APP.$this->m_name.'/config/table');
$this->k_name = array_diff(stringto_array($tablename,','),$globaltablename);
$tablename = file_get_contents(PATH_ALL_APP . $this->m_name . '/config/table');
$this->k_name = array_diff(stringto_array($tablename, ','), $globaltablename);
foreach ($this->k_name as $val) {
$_YW['k'][$val] = $_M['table'][$this->m_name . '_' . $val];
$_YW['k'][ $val ] = $_M['table'][ $this->m_name . '_' . $val ];
}
foreach ($globaltablename as $val) {
$_YW['k'][$val] = $_M['table'][$val];
$_YW['k'][ $val ] = $_M['table'][ $val ];
}
}
# 配置信息
public function cmp_c($lang = '') {
public function cmp_c($lang = '')
{
global $_M, $_YW;
$_YW['n'] = $this->m_name;
$_YW['n'] = $this->m_name;
if (empty($lang)) $lang = $_M['lang'];
$result = DB::query("select name,value from {$_M['table']['cloud_config']} where m_name = '{$this->m_name}' AND (lang = '{$lang}' OR lang = 'cloud') ");
while ($val = DB::fetch_array($result)) {
$_YW['c'][$val['name']] = $val['value'];
$_YW['c'][ $val['name'] ] = $val['value'];
}
if(class_exists('admin') || class_exists('app')) self::check_auth();
if (class_exists('admin') || class_exists('app')) self::check_auth();
}
# 应用信息
public function cmp_a() {
public function cmp_a()
{
global $_M, $_YW;
$_YW['app'] = DB::get_one("SELECT * FROM {$_M['table']['applist']} WHERE m_name='{$this->m_name}' ");
}
# 栏目信息
public function cmp_ac() {
public function cmp_ac()
{
global $_M, $_YW;
$_YW['app']['column'] = DB::get_one("SELECT * FROM {$_M['table']['column']} WHERE module='{$_YW['app']['no']}' AND lang='{$_M['lang']}' ");
}
# 语言文字
public function cmp_t() {
public function cmp_t()
{
global $_M, $_YW;
$file = PATH_APP_FILE . 'lang/' . $_M['lang'] . '.php';
if (!file_exists($file)) {
@ -118,14 +127,16 @@ trait appcmp {
}
# 单条配置语句入库
public function addconsql($name, $val = '',$lang) {
public function addconsql($name, $val = '', $lang)
{
global $_M, $_YW;
if (empty($lang)) $lang = $_M['lang'];
DB::query("INSERT INTO {$_M['table']['cloud_config']} (name,lang,m_name,value) VALUES ('{$name}','{$lang}','{$this->m_name}','{$val}') ON DUPLICATE KEY UPDATE value='{$val}' ");
}
# 信息JQ弹出并刷新当前页面
public function scriptgo($info) {
public function scriptgo($info)
{
global $_M;
$this->destruct = false;
echo "<script>alert('{$info}');history.go(-1);</script>";
@ -133,21 +144,24 @@ trait appcmp {
}
//表简称
public function tname() {
public function tname()
{
global $_M, $_YW;
return substr($_M['form']['a'],2);
return substr($_M['form']['a'], 2);
}
//时间格式化
public function data_time($time) {
global $_M,$_YW;
return $time?date('Y-m-d H:i:s', $time):'';
public function data_time($time)
{
global $_M, $_YW;
return $time ? date('Y-m-d H:i:s', $time) : '';
}
//字符截取
public function sub_str($str) {
global $_M,$_YW;
return strlen($str) > 0?substr($str,0, 8).'...':'';
public function sub_str($str)
{
global $_M, $_YW;
return strlen($str) > 0 ? substr($str, 0, 8) . '...' : '';
}
/*
@ -155,41 +169,45 @@ trait appcmp {
* @param array $back 输出字符串或数组
* @param string $callback ajax的回调函数的名称
*/
public function jsoncallback($back, $callback = 'callback') {
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;
$callback = $_M['form'][ $callback ];
$json = json_encode($back, JSON_UNESCAPED_UNICODE);
echo $callback ? $callback . '(' . $json . ')' : $json;
}
# 分析网址
public function parse_url($url,$type = 'host') {
public function parse_url($url, $type = 'host')
{
global $_M;
$url = url_standard($url);
$array = parse_url($url);
return $type == 'arr'?$array:$array[$type];
$url = url_standard($url);
$array = parse_url($url);
return $type == 'arr' ? $array : $array[ $type ];
}
//URL参数处理防止URL拼接错误
public function http_build_query($url,$arr) {
public function http_build_query($url, $arr)
{
global $_M, $_YW;
if(!in_array(substr($url,-1), ['&','?'])) $url .= '&';
return $url.http_build_query($arr);
if (!in_array(substr($url, -1), ['&', '?'])) $url .= '&';
return $url . http_build_query($arr);
}
//前端CSS合并
public function merge_css($addcss = '') {
public function merge_css($addcss = '')
{
global $_M, $_YW;
$cssfile = PATH_APP_FILE.'public/css/webcss.css';
if(!file_exists($cssfile)) return false;
$css = file_get_contents($cssfile);
$cssfile = PATH_APP_FILE . 'public/css/webcss.css';
if (!file_exists($cssfile)) return false;
$css = file_get_contents($cssfile);
//自定义新增CSS文件
$diycss = PATH_APP_FILE.'public/css/diycss.css';
if(file_exists($diycss)) $css .= PHP_EOL.file_get_contents($diycss);
$diycss = PATH_APP_FILE . 'public/css/diycss.css';
if (file_exists($diycss)) $css .= PHP_EOL . file_get_contents($diycss);
//通过后台新增的CSS
if(empty($addcss)) $addcss = $_YW['c']['diycss'];
return file_put_contents(PATH_APP_FILE.'web/templates/met/css/metinfo.css', $css.PHP_EOL.$addcss);
if (empty($addcss)) $addcss = $_YW['c']['diycss'];
return file_put_contents(PATH_APP_FILE . 'web/templates/met/css/metinfo.css', $css . PHP_EOL . $addcss);
}

View File

@ -3,8 +3,10 @@ defined('IN_MET') or exit('No permission');
//更新文件的模板
load::sys_class('admin');
load::sys_func('file');
//不继承APP
class update extends admin{
class update extends admin
{
//应用信息
private $app;
@ -17,42 +19,45 @@ class update extends admin{
//当前版本号
private $oldver;
//安装锁信息,应用入口信息
private $appinfo = [];
private $appinfo = [];
//应用数据库
private $sqlk;
private $fixed_name;
# 初始化
public function __construct() {
public function __construct()
{
global $_M;
parent::__construct();
//安装锁信息,应用入口信息
$this->appinfo = [
'url' => '',
'c' => 'dzadsod',
'a' => 'dodzadsod',
'lang' => $_M['lang'],
'time' => date('Y-m-d H:i:s',time())
$this->appinfo = [
'url' => '',
'c' => 'dzadsod',
'a' => 'dodzadsod',
'lang' => $_M['lang'],
'time' => date('Y-m-d H:i:s', time())
];
$this->sqlk = $_M['table']['cloud_config'];
$this->sqlk = $_M['table']['cloud_config'];
}
//需要传递值
public function set($app) {
public function set($app)
{
global $_M;
$this->app = $app;
$this->appno = $app['no'];
$this->m_name = $app['m_name'];
$this->newver = $app['ver'];
$this->oldver = $app['oldver'];
$this->app = $app;
$this->appno = $app['no'];
$this->m_name = $app['m_name'];
$this->newver = $app['ver'];
$this->oldver = $app['oldver'];
return $this;
}
//修改数据库版本
public function start() {
public function start()
{
global $_M;
if(file_exists(INS_LOCK_FILE)){
if (file_exists(INS_LOCK_FILE)) {
switch ($this->newver) {
case 1.1:
//更新数据库
@ -60,13 +65,13 @@ class update extends admin{
//更新版本内容
self::update_1_1();
break;
default:
break;
}
//更新版本号
self::upver();
}else{
} else {
//创建数据表
self::inssql();
//默认系统表处理
@ -74,7 +79,7 @@ class update extends admin{
//默认数据
self::default_config();
//创建栏目 [前端页面时才需要API也不需要]
// self::column();
// self::column();
//安装锁
self::install_lock();
}
@ -91,13 +96,14 @@ class update extends admin{
+-------------------------------------------------------------------------------------------
*/
// 1.1 版本
public function update_1_1() {
global $_M;
// 对一个表新增字段
}
// 1.1 版本
public function update_1_1()
{
global $_M;
// 对一个表新增字段
}
/*
+ 应用新安装操作
+-------------------------------------------------------------------------------------------
@ -108,9 +114,10 @@ class update extends admin{
+ systable : 当前应用版本针对数据库表的信息
+-------------------------------------------------------------------------------------------
*/
//数据库创建
protected function table_field() {
protected function table_field()
{
global $_M;
// 场所资料库
$zdytable['village'] = " `id` int(11) NOT NULL AUTO_INCREMENT,
@ -212,7 +219,7 @@ class update extends admin{
`l_updatetime` datetime DEFAULT NULL COMMENT '修改时间',
`l_addtime` datetime DEFAULT NULL COMMENT '录入时间',
PRIMARY KEY (`id`)";
// 广告时间段排期表,广告位编号,合同编号,开始时间,结束时间,状态
// 排期的缓存表
$zdytable['schedule'] = " `id` char(36) NOT NULL COMMENT 'uuid',
@ -223,7 +230,7 @@ class update extends admin{
`s_endtime` varchar(255) DEFAULT NULL COMMENT '广告结束时间',
PRIMARY KEY (`id`),
UNIQUE KEY `slidse` (`s_lid`,`s_enumber`)";
// 参数配置
$zdytable['para'] = " `id` int(11) NOT NULL AUTO_INCREMENT,
`p_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '参数分类 0广告位置,1职位,2合同状态,3道闸方位',
@ -262,12 +269,12 @@ class update extends admin{
PRIMARY KEY (`id`)";
/**
* 1、增加新表
* name 配置名称
* id 添加信息自动增加,
* value 配置名称值
* lang 语言[后台]
**/
* 1、增加新表
* name 配置名称
* id 添加信息自动增加,
* value 配置名称值
* lang 语言[后台]
**/
$zdytable['cloud_config'] = " `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`m_name` varchar(50) NOT NULL,
@ -281,11 +288,12 @@ class update extends admin{
}
//mysql 触发器
protected function trigger() {
protected function trigger()
{
global $_M;
//新增schedule 表的更新触发器
$table_name = self::split_table_name('schedule',true);
$launch_name = self::split_table_name('launch',true);
$table_name = self::split_table_name('schedule', true);
$launch_name = self::split_table_name('launch', true);
//更新触发器并没有排除两个时间字段为空的排查
$array[] = " CREATE TRIGGER `add` BEFORE INSERT ON `{$table_name}` FOR EACH ROW
BEGIN
@ -336,12 +344,13 @@ class update extends admin{
}
//mysql 视图
protected function tview() {
protected function tview()
{
global $_M;
//查询到期合同以及根据设置的到期天数提醒
$sequence = self::split_table_name('sequence',true);
$contract = self::split_table_name('contract',true);
$noticeday = self::split_table_name('noticeday',true);
$sequence = self::split_table_name('sequence', true);
$contract = self::split_table_name('contract', true);
$noticeday = self::split_table_name('noticeday', true);
$array['noticeday'] = " CREATE VIEW {$noticeday} AS
SELECT
ct.*,
@ -351,17 +360,17 @@ class update extends admin{
FROM
{$sequence} AS sq INNER JOIN {$contract} AS ct
ON sq.seq <= ( ( 1 + length( ct.h_noticeday ) ) - length( REPLACE ( ct.h_noticeday, ',', '' ) ) ) ";
//查询微信关注用户,排除非关注的用户
$weuser = self::split_table_name('weuser',true);
$nwechat_user = self::split_table_name('nwechat_user',true);
$weuser = self::split_table_name('weuser', true);
$nwechat_user = self::split_table_name('nwechat_user', true);
$array['weuser'] = " CREATE VIEW {$weuser} AS
SELECT * FROM {$nwechat_user} WHERE subscribe = 1 ";
// 广告位排期统计,计算广告位的空闲,到期,投放中
$elevator = self::split_table_name('elevator',true);
$launch = self::split_table_name('launch',true);
$countela = self::split_table_name('countela',true);
$elevator = self::split_table_name('elevator', true);
$launch = self::split_table_name('launch', true);
$countela = self::split_table_name('countela', true);
$array['countela'] = " CREATE VIEW {$countela} AS
SELECT
e.id,
@ -383,27 +392,29 @@ class update extends admin{
LEFT JOIN {$launch} AS l ON find_in_set( e.e_number, l.l_enumber ) ";
return $array;
}
//默认配置
protected function default_config() {
protected function default_config()
{
global $_M;
//正常升级
$config = [
'tem_ida','tem_idb','tem_idc','openid'
'tem_ida', 'tem_idb', 'tem_idc', 'openid'
];
$lang = $_M['lang'];
foreach ($config as $key => $val){
foreach ($config as $key => $val) {
DB::query("INSERT INTO {$this->sqlk} (name,lang,m_name,value) VALUES ('{$key}','{$lang}','{$this->m_name}','{$val}') ON DUPLICATE KEY UPDATE value='{$val}' ");
}
}
//系统表
protected function systable() {
protected function systable()
{
global $_M;
//访问入口固定为app/index.php?n=XXX&c=XXX&a=XXX
//定时处理入口
// $field = "no='{$this->appno}',m_name='{$this->m_name}',filename='timing.php',m_module='web',m_class='timing',m_action='@\$_GET[a]'";
// self::addsql('ifcolumn_addfile',$field);
// $field = "no='{$this->appno}',m_name='{$this->m_name}',filename='timing.php',m_module='web',m_class='timing',m_action='@\$_GET[a]'";
// self::addsql('ifcolumn_addfile',$field);
}
/*
@ -418,7 +429,8 @@ class update extends admin{
*/
//应用数据表创建
protected function inssql() {
protected function inssql()
{
global $_M;
$tables = self::table_field();
$table = $tname = [];
@ -426,18 +438,18 @@ class update extends admin{
$tname[] = $key;
$table_name = self::split_table_name($key);
$table[] = $table_name;
if($val) DB::query("CREATE TABLE `{$_M['config']['tablepre']}{$table_name}` ( {$val} ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8");
if ($val) DB::query("CREATE TABLE `{$_M['config']['tablepre']}{$table_name}` ( {$val} ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8");
}
//建立触发器
$trigger = self::trigger();
foreach ($trigger as $val){
foreach ($trigger as $val) {
DB::query($val);
}
//执行SQL其他操作
$tview = self::tview();
foreach ($tview as $key => $val){
foreach ($tview as $key => $val) {
$tname[] = $key;
$table_name = self::split_table_name($key);
$table[] = $table_name;
@ -445,31 +457,33 @@ class update extends admin{
}
//记录表名
add_table(arrayto_string($table,'|'));
$filetable = PATH_ALL_APP.$this->m_name.'/config/table';
add_table(arrayto_string($table, '|'));
$filetable = PATH_ALL_APP . $this->m_name . '/config/table';
//先获取之前已经存在的简短表名
if(file_exists($filetable)) {
$tnamestr = file_get_contents($filetable);
$tname = array_merge($tname,stringto_array($tnamestr,','));
}else{
if (file_exists($filetable)) {
$tnamestr = file_get_contents($filetable);
$tname = array_merge($tname, stringto_array($tnamestr, ','));
} else {
//创建
makefile($filetable);
}
//写入
file_put_contents($filetable,arrayto_string(array_unique($tname),','));
file_put_contents($filetable, arrayto_string(array_unique($tname), ','));
}
//修改版本号
protected function upver() {
protected function upver()
{
global $_M;
DB::query("UPDATE {$_M['table']['applist']} SET ver='{$this->newver}' WHERE no='{$this->appno}' AND m_name='{$this->m_name}' ");
}
//创建安装锁
protected function install_lock() {
protected function install_lock()
{
global $_M;
if(!file_exists(INS_LOCK_FILE)) makefile(INS_LOCK_FILE);
file_put_contents(INS_LOCK_FILE, json_encode($this->appinfo,JSON_UNESCAPED_UNICODE) );
if (!file_exists(INS_LOCK_FILE)) makefile(INS_LOCK_FILE);
file_put_contents(INS_LOCK_FILE, json_encode($this->appinfo, JSON_UNESCAPED_UNICODE));
}
/*
@ -486,38 +500,42 @@ class update extends admin{
*/
//公共查询方法
private function sqlone($tname,$where = '') {
private function sqlone($tname, $where = '')
{
global $_M;
$table = $_M['table'][$tname];
if(!$where) $where = "no='{$this->appno}'";
$table = $_M['table'][ $tname ];
if (!$where) $where = "no='{$this->appno}'";
return DB::get_one("select * from {$table} where {$where}");
}
//公共查询方法
private function sqlall($tname,$where = '') {
private function sqlall($tname, $where = '')
{
global $_M;
$table = $_M['table'][$tname];
if(!$where) $where = "no='{$this->appno}'";
$table = $_M['table'][ $tname ];
if (!$where) $where = "no='{$this->appno}'";
return DB::get_all("select * from {$table} where {$where}");
}
//公共写入方法
private function addsql($tname,$field = '') {
private function addsql($tname, $field = '')
{
global $_M;
$table = $_M['table'][$tname];
$table = $_M['table'][ $tname ];
DB::query("INSERT INTO {$table} SET {$field}");
}
//拼接完整数据库名
private function split_table_name($name,$all = false) {
private function split_table_name($name, $all = false)
{
global $_M;
//公用表
$global_table = ['cloud_config','nwechat_user'];
$tablename = in_array($name, $global_table)?$name:$this->m_name.'_'.$name;
return $all?$_M['config']['tablepre'].$tablename:$tablename;
$global_table = ['cloud_config', 'nwechat_user'];
$tablename = in_array($name, $global_table) ? $name : $this->m_name . '_' . $name;
return $all ? $_M['config']['tablepre'] . $tablename : $tablename;
}
/*
+ 前端入口的创建。
+-------------------------------------------------------------------------------------------
@ -526,34 +544,36 @@ class update extends admin{
*/
//创建前台入口API形式
protected function column_api() {
protected function column_api()
{
global $_M;
$file = self::sqlall('ifcolumn_addfile');
$dir = PATH_WEB.$this->fixed_name;
if(makedir($dir)){
if(getdirpower($dir) == false) modifydirpower($dir,0777);
$file = self::sqlall('ifcolumn_addfile');
$dir = PATH_WEB . $this->fixed_name;
if (makedir($dir)) {
if (getdirpower($dir) == false) modifydirpower($dir, 0777);
}
foreach ($file as $val) {
$dirfile = $dir.'/'.$val['filename'];
$action = strstr($val['m_action'],'@$_')?$val['m_action']:"'{$val['m_action']}'";
$phpstr = "<?php".PHP_EOL
. "define('M_NAME', '{$val['m_name']}');".PHP_EOL
. "define('M_MODULE', '{$val['m_module']}');".PHP_EOL
. "define('M_CLASS', '{$val['m_class']}');".PHP_EOL
. "define('M_ACTION', {$action});".PHP_EOL
. "require_once '../app/app/entrance.php';".PHP_EOL
. "?>";
$dirfile = $dir . '/' . $val['filename'];
$action = strstr($val['m_action'], '@$_') ? $val['m_action'] : "'{$val['m_action']}'";
$phpstr = "<?php" . PHP_EOL
. "define('M_NAME', '{$val['m_name']}');" . PHP_EOL
. "define('M_MODULE', '{$val['m_module']}');" . PHP_EOL
. "define('M_CLASS', '{$val['m_class']}');" . PHP_EOL
. "define('M_ACTION', {$action});" . PHP_EOL
. "require_once '../app/app/entrance.php';" . PHP_EOL
. "?>";
file_put_contents($dirfile, $phpstr);
}
}
}
//创建栏目信息
protected function column() {
protected function column()
{
global $_M;
$name = array('cn'=>'加盟店','en'=>'Join store query','tc'=>'加盟店');
foreach (array('cn','en','tc') as $k => $v) {
$name = array('cn' => '加盟店', 'en' => 'Join store query', 'tc' => '加盟店');
foreach (array('cn', 'en', 'tc') as $k => $v) {
DB::query("INSERT INTO {$_M['table']['column']} SET name='{$name[$v]}',foldername='{$this->fixed_name}',module='{$this->appno}',no_order='100',if_in='1',classtype='1',out_url='{$_M['url']['site']}{$this->fixed_name}',isshow='1',lang='{$v}',nav='1'");
}
}
}

View File

@ -6,60 +6,61 @@ defined('IN_MET') or exit('No permission');
load::own_class('appweb');
class index extends appweb
class index extends appweb
{
# 过滤方法名
private $ado = ['doindex','dotable','dotableto','doajaxcl'];
private $ado = ['doindex', 'dotable', 'dotableto', 'doajaxcl'];
private $urls;
//初始化
public function __construct()
public function __construct()
{
global $_M, $_YW;
parent::__construct();
// 过滤
if (!in_array(M_ACTION, $this->ado,true)) {
if (!in_array(M_ACTION, $this->ado, true)) {
//报错
exit(0);
}
$this->urls = $_M['url']['site'].'app/index.php?n=dzadsod';
$this->input['page_title'] = '广告位巡查';
$this->urls = $_M['url']['site'] . 'app/index.php?n=dzadsod';
$this->input['page_title'] = '广告位巡查';
}
//广告位排期中的巡查,验证码校验
public function doindex()
public function doindex()
{
global $_M, $_YW;
//进入密码输入页面
$this->input['url'] = $this->urls.'&a=dotable';
$this->input['url'] = $this->urls . '&a=dotable';
$this->show('app/index', $this->input);
}
//数据列表
public function dotable()
public function dotable()
{
global $_M, $_YW;
//校验验证码
$mdck = $this->tsql->table('keylist')
->where(['k_passkey' => md5($_M['form']['check']), 'k_state' => 1 ])
->one();
if($mdck == false) parent::scriptgo('密钥错误!');
okinfo($this->urls.'&a=dotableto');
$mdck = $this->tsql->table('keylist')
->where(['k_passkey' => md5($_M['form']['check']), 'k_state' => 1])
->one();
if ($mdck == false) parent::scriptgo('密钥错误!');
okinfo($this->urls . '&a=dotableto');
}
//数据列表
public function dotableto()
public function dotableto()
{
global $_M, $_YW;
$this->input['url'] = $this->urls.'&c=table_ajax&a=doindex&tname=patrol';
$this->input['table'] = load::own_class('table_theme','new')->start('patrol')->send_all(1);
$this->input['url'] = $this->urls . '&c=table_ajax&a=doindex&tname=patrol';
$this->input['table'] = load::own_class('table_theme', 'new')->start('patrol')->send_all(1);
$this->show('app/table', $this->input);
}
//获取doajaxcl
public function doajaxcl() {
public function doajaxcl()
{
global $_M, $_YW;
parent::jsoncallback([]);
}

View File

@ -9,7 +9,9 @@ load::own_func('appcmp');
* 配置
* 包含其他功能初始化
*/
class select extends appweb {
class select extends appweb
{
/*
* @$querys string 搜索内容
@ -24,10 +26,10 @@ class select extends appweb {
* @$where string sql判断语句
*/
# 过滤方法名
private $ado = ['doselect'];
private $ado = ['doselect'];
//搜索内容
private $querys = '';
private $querys = '';
//指定字段为值
private $fiend;
//来源页面标记
@ -42,270 +44,279 @@ class select extends appweb {
private $division;
//sql判断条件
private $where = '';
private $where = '';
//返回的数组
private $data = [];
public function __construct() {
global $_M,$_YW;
private $data = [];
public function __construct()
{
global $_M, $_YW;
parent::__construct();
// 过滤
if (!in_array(M_ACTION, $this->ado,true)) {
if (!in_array(M_ACTION, $this->ado, true)) {
//报错
exit(0);
}
//指定表
$this->tname = $_M['form']['tname'];
$this->tname = $_M['form']['tname'];
//搜索内容
$this->querys = $_M['form']['querys'];
$this->querys = $_M['form']['querys'];
//以指定字段为值
$this->fiend = $_M['form']['fiend']?:'id';
$this->fiend = $_M['form']['fiend'] ?: 'id';
//来源
$this->source = $_M['form']['source'];
$this->source = $_M['form']['source'];
//是否显示全部
$this->allnone = $_M['form']['allnone'];
$this->allnone = $_M['form']['allnone'];
//判断条件
$this->condition = $_M['form']['condition'];
$this->condition = $_M['form']['condition'];
//默认值
$this->default = $_M['form']['default'];
$this->default = $_M['form']['default'];
//默认值分隔符
$this->division = $_M['form']['division'];
}
# select2 选项字段处理
private function select_fiend($val) {
global $_M,$_YW;
$strarr = stringto_array($this->fiend,'|');
private function select_fiend($val)
{
global $_M, $_YW;
$strarr = stringto_array($this->fiend, '|');
foreach ($strarr as $value) {
$arrstr[] = $val[$value];
$arrstr[] = $val[ $value ];
}
return arrayto_string($arrstr,'|');
return arrayto_string($arrstr, '|');
}
# allnone 默认选项全部处理
private function allnone() {
global $_M,$_YW;
private function allnone()
{
global $_M, $_YW;
// 若不需要显示‘全部’值,则直接返回空
// 0 为不显示‘全部’,同时也在未搜索到结果的情况下 不 设置为可选值
// 1 为显示 显示‘全部’,同时也在未搜索结果的情况下 设置可选值
// 2 只显示‘全部’
// 3 只将未搜索到结果的情况下设置为可选值
if(empty($this->allnone) || $this->allnone == '3') return false;
if (empty($this->allnone) || $this->allnone == '3') return false;
//然后可根据来源标记进行处理
switch ($this->source) {
// case 'githooks':
// $initial[] = ['id' => 'newver','text'=>'自动部署至最新版本'];
// break;
// case 'githooks':
// $initial[] = ['id' => 'newver','text'=>'自动部署至最新版本'];
// break;
default:
$initial[] = [ 'id' => '','text' => '全部' ];
$initial[] = ['id' => '', 'text' => '全部'];
break;
}
$this->data[] = ["text" => '',"children" => $initial ];
$this->data[] = ["text" => '', "children" => $initial];
}
# 当未搜索到值是否将搜索结果设置为可选值
private function children() {
global $_M,$_YW;
private function children()
{
global $_M, $_YW;
// 判断是否要将搜索内容设置为可选值
if(empty($this->allnone) || $this->allnone == '2' || strlen($this->querys) == 0) return false;
if (empty($this->allnone) || $this->allnone == '2' || strlen($this->querys) == 0) return false;
// 要注意id的是否为可写入数据库 误区,若有些字段为数字 则会导致无法录入成功
// 后期可增加一个判断方式来处理这个误区
$this->data[] = [
"text" => '',
"text" => '',
"children" => [
['id'=> $this->querys,'text' => $this->querys]
]
['id' => $this->querys, 'text' => $this->querys]
]
];
}
# querys 处理
private function querys() {
global $_M,$_YW;
$curdate = date('Y-m-d',time());
private function querys()
{
global $_M, $_YW;
$curdate = date('Y-m-d', time());
switch ($this->source) {
case 'weblaunchsearch':
$this->where = " l_starttime <= '{$curdate}' ";
// $this->where = " NOT ( l_endtime < '{$curdate}' OR l_starttime > '{$curdate}' ) ";
$this->where = " l_starttime <= '{$curdate}' ";
// $this->where = " NOT ( l_endtime < '{$curdate}' OR l_starttime > '{$curdate}' ) ";
break;
case 'webcontractsearch':
$this->where = " h.h_starttime <= '{$curdate}' ";
$this->where = " h.h_starttime <= '{$curdate}' ";
break;
default:
$this->where = false;
$this->where = false;
break;
}
if(strlen($this->querys) == 0) return false;
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 .= " AND ( h.h_number LIKE '%{$this->querys}%' OR c.c_allname LIKE '%{$this->querys}%' OR c.c_name LIKE '%{$this->querys}%' ) ";
break;
case 'launch':
$this->where .= " AND l_title LIKE '%{$this->querys}%' ";
break;
case 'weuser':
$nickname = urlencode($this->querys);
$this->where = " nickname LIKE '%{$nickname}%' ";
break;
default:
break;
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 .= " AND ( h.h_number LIKE '%{$this->querys}%' OR c.c_allname LIKE '%{$this->querys}%' OR c.c_name LIKE '%{$this->querys}%' ) ";
break;
case 'launch':
$this->where .= " AND l_title LIKE '%{$this->querys}%' ";
break;
case 'weuser':
$nickname = urlencode($this->querys);
$this->where = " nickname LIKE '%{$nickname}%' ";
break;
default:
break;
}
}
# condition 处理
private function condition() {
global $_M,$_YW;
if(empty($this->condition)) return false;
private function condition()
{
global $_M, $_YW;
if (empty($this->condition)) return false;
// 进行处理
$condition = stringto_array($this->condition,'|||','$$$');
$condition = stringto_array($this->condition, '|||', '$$$');
foreach ($condition as $value) {
list($key,$val) = $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;
$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;
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'],$val['c_allname']];
break;
case 'launch':
$fiend = [$val['l_title'],$val['l_hnumber']];
break;
case 'weuser':
$sex = ['未知','男','女'];
$fiend = [$val['nickname'],$sex[$val['sex']] ];
break;
default:
break;
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'], $val['c_allname']];
break;
case 'launch':
$fiend = [$val['l_title'], $val['l_hnumber']];
break;
case 'weuser':
$sex = ['未知', '男', '女'];
$fiend = [$val['nickname'], $sex[ $val['sex'] ]];
break;
default:
break;
}
$text = arrayto_string($fiend,' / ');
$text = arrayto_string($fiend, ' / ');
return $text;
}
//编号字段,根据此字段进行编号处理
private function charter() {
global $_M,$_YW;
private function charter()
{
global $_M, $_YW;
switch ($this->tname) {
case 'village':
$fiend = 'v_name';
$fiend = 'v_name';
break;
case 'customer':
$fiend = 'c_name';
$fiend = 'c_name';
break;
case 'workers':
$fiend = 'w_name';
$fiend = 'w_name';
break;
case 'contract':
$fiend = 'h_number';
$fiend = 'h_number';
break;
case 'launch':
$fiend = 'l_title';
$fiend = 'l_title';
break;
case 'weuser':
$fiend = 'nickname';
$fiend = 'nickname';
break;
default:
break;
}
return $fiend;
}
// 查看场所名称列表
public function doselect() {
global $_M,$_YW;
public function doselect()
{
global $_M, $_YW;
//判断条件
self::querys();
//带入的判断条件
self::condition();
//编号的字段
$fiend = self::charter();
$fiend = self::charter();
//查询
if($this->tname != 'contract'){
$array = $this->tsql->table($this->tname)->where($this->where)->order('id DESC')->all('id');
}else{
$array = $this->tsql->table_unset()
->tables([$this->tname,'h'], 'LEFT JOIN')
->tables(['customer','c'], 'ON h.h_cid = c.id')
->where($this->where)
->qfield(" h.*,c.c_allname ")
->order('h.id DESC')->all('id');
if ($this->tname != 'contract') {
$array = $this->tsql->table($this->tname)->where($this->where)->order('id DESC')->all('id');
} else {
$array = $this->tsql->table_unset()
->tables([$this->tname, 'h'], 'LEFT JOIN')
->tables(['customer', 'c'], 'ON h.h_cid = c.id')
->where($this->where)
->qfield(" h.*,c.c_allname ")
->order('h.id DESC')->all('id');
}
// dump($this->tsql->query());
// dump($this->tsql->query());
foreach ($array as $val) {
if($this->tname == 'weuser'){
$val['nickname'] = urldecode($val['nickname']);
if ($this->tname == 'weuser') {
$val['nickname'] = urldecode($val['nickname']);
}
$letter = getstrcharter($val[$fiend]);
$selectlist[$letter][] = $val;
$letter = getstrcharter($val[ $fiend ]);
$selectlist[ $letter ][] = $val;
}
//是否显示全部
self::allnone();
//是否将搜索内容作为结果
self::children();
//处理结果
foreach ($selectlist as $key => $val){
foreach ($selectlist as $key => $val) {
$arr = [];
foreach ($val as $v) {
$valid = self::select_fiend($v);
$valid = self::select_fiend($v);
//判断是否只输出默认值
if(strlen($this->default) > 0){
if (strlen($this->default) > 0) {
$default = stringto_array($this->default, $this->division);
if(!in_array($valid, $default,true)) continue;
if (!in_array($valid, $default, true)) continue;
}
//组成选项
$arr[] = ['id' => $valid, 'text' => self::valuet($v)];
$arr[] = ['id' => $valid, 'text' => self::valuet($v)];
}
$this->data[] = ["text" => $key,"children" => $arr];
$this->data[] = ["text" => $key, "children" => $arr];
}
//当值不存在时
if(!count($this->data)){
if (!count($this->data)) {
//输出没有搜索到结果
$this->data = [["text" => $this->querys == ''?'检索不到相关信息':"检索不到 {$this->querys} 相关信息","children" => [] ]];
}else{
$this->data = [["text" => $this->querys == '' ? '检索不到相关信息' : "检索不到 {$this->querys} 相关信息", "children" => []]];
} else {
//对数组排序A-ZZ
$text = array_column($this->data, 'text');
array_multisort($text,SORT_ASC,$this->data);
$text = array_column($this->data, 'text');
array_multisort($text, SORT_ASC, $this->data);
}
echo jsoncallback(['results' => $this->data]);
}
}
?>

View File

@ -7,10 +7,11 @@ load::own_class('../traits/tlist');
load::own_class('../traits/tfield');
//表格
class table_ajax extends appweb {
class table_ajax extends appweb
{
# 过滤方法名
private $ado = ['doindex'];
private $ado = ['doindex'];
//非备份,正常字段即可
private $bsign = false;
@ -21,53 +22,55 @@ class table_ajax extends appweb {
private $sqlk;
//form数组
private $form = [];
//info_on 快速URL
private $own_name_info;
private $own_name_table;
public function __construct() {
global $_M,$_YW;
public function __construct()
{
global $_M, $_YW;
parent::__construct();
// 过滤
if (!in_array(M_ACTION, $this->ado,true)) {
if (!in_array(M_ACTION, $this->ado, true)) {
//报错
exit(0);
}
$this->form = $_M['form'];
if($this->form['tname']){
$this->tname = $this->form['tname'];
$this->sqlk = $_YW['k'][$this->tname];
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';
// $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() {
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();
$field = self::td_field();
$sqlk = self::td_sqlk();
$where = self::td_where();
$order = self::td_order();
/*查询表*/
if($where){
if ($where) {
$conds .= " WHERE {$where} ";
}
if($order){
if ($order) {
$conds .= " ORDER BY {$order} ";
}
//整理查询条件
$query = "SELECT {$field} FROM {$sqlk} {$conds} ";
//获取数据
$data = $table->getdata($sqlk, $field, $where, $order,$query,$this->multi_table);
$data = $table->getdata($sqlk, $field, $where, $order, $query, $this->multi_table);
//数据整理
$array = self::sqlarr($data);
$array = self::sqlarr($data);
//返回数据
$table->rdata($array);
}
@ -78,28 +81,30 @@ class table_ajax extends appweb {
* 【列出】
* 返回数据数组
*/
private function sqlarr($data = []) {
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;
// }
// 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(){
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=""');
$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);
}
@ -108,11 +113,12 @@ class table_ajax extends appweb {
* 【新行】
* 生成文件新增行
*/
private function addlist($val) {
private function addlist($val)
{
global $_M;
$metinfo = '';
foreach ($this->list as $v){
$metinfo .= '<td class=" text-xs-center">'.$v.'</td>';
foreach ($this->list as $v) {
$metinfo .= '<td class=" text-xs-center">' . $v . '</td>';
}
echo "<tr>{$metinfo}</tr>";
}
@ -121,10 +127,11 @@ class table_ajax extends appweb {
use tlist;
//公用的输出
protected function output($val,$checked = '') {
global $_M,$_YW;
$array = self::{$this->tname}($val,$checked);
$this->list = array();
protected function output($val, $checked = '')
{
global $_M, $_YW;
$array = self::{$this->tname}($val, $checked);
$this->list = array();
foreach ($array as $value) {
$this->list[] = $value;
}

View File

@ -3,7 +3,8 @@
.form-inline .form-group {
margin-right: 20px;
}
@media (min-width: 480px){
@media (min-width: 480px) {
.form-inline .form-group, .form-inline .form-control {
display: inline-block;
margin-bottom: 0;
@ -11,27 +12,45 @@
vertical-align: middle;
}
}
/*在帮脑残修复一下*/
table .form-inline .form-group {
margin-right: 0px;
}
@media (min-width: 480px){
@media (min-width: 480px) {
table .form-inline .form-group, table .form-inline .form-control {
display: block;
width: 100%;
}
}
.cloudweb input[name="gotopage"]{
display: inline-block!important;
.cloudweb input[name="gotopage"] {
display: inline-block !important;
}
.cloudweb .gotopage{
.cloudweb .gotopage {
display: none;
}
@media (max-width: 767px){
.cloudweb div.m-y-80{margin-top: 0px!important;}
div.dataTables_paginate .paginate_button>a{padding: .429rem .780rem;}
.form-inline .form-group{margin-right: 0px;}
.cloudweb select[name="e_vid"]{max-width: auto;}
.cloudweb .input-group .select2-container--default{width: 100%!important;}
@media (max-width: 767px) {
.cloudweb div.m-y-80 {
margin-top: 0px !important;
}
div.dataTables_paginate .paginate_button > a {
padding: .429rem .780rem;
}
.form-inline .form-group {
margin-right: 0px;
}
.cloudweb select[name="e_vid"] {
max-width: auto;
}
.cloudweb .input-group .select2-container--default {
width: 100% !important;
}
}

View File

@ -3,41 +3,41 @@
# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved.
defined('IN_MET') or exit('No permission');
?>
<script>
var MET=[];
MET['url']=[];
MET['langtxt'] = {
"jsx15":"{$_M['word']['jsx15']}",
"js35":"{$_M['word']['js35']}",
"jsx17":"{$_M['word']['jsx17']}",
"formerror1":"{$_M['word']['formerror1']}",
"formerror2":"{$_M['word']['formerror2']}",
"formerror3":"{$_M['word']['formerror3']}",
"formerror4":"{$_M['word']['formerror4']}",
"formerror5":"{$_M['word']['formerror5']}",
"formerror6":"{$_M['word']['formerror6']}",
"formerror7":"{$_M['word']['formerror7']}",
"formerror8":"{$_M['word']['formerror8']}",
"js46":"{$_M['word']['js46']}",
"js23":"{$_M['word']['js23']}",
"checkupdatetips":"{$_M['word']['checkupdatetips']}",
"detection":"{$_M['word']['detection']}",
"try_again":"{$_M['word']['try_again']}",
"fileOK":"{$_M['word']['fileOK']}",
};
MET['met_editor']="{$_M['config']['met_editor']}";
MET['met_keywords']="{$_M['config']['met_keywords']}";
MET['url']['ui']="{$_M['url']['ui']}";
MET['url']['own']="{$_M['url']['own']}";
MET['url']['own_tem']="{$_M['url']['own_tem']}";
MET['url']['api']="{$_M['url']['api']}";
</script>
<met_foot />
<if value="!$c['shopv2_open']">
<?php $app_js_time = filemtime(PATH_WEB.'public/ui/v2/static/js/app.js'); ?>
<script src="{$_M['url']['site']}public/ui/v2/static/js/app.js?{$app_js_time}"></script>
</if>
<?php if(file_exists(PATH_OWN_FILE."templates/met/js/own.js") && !((M_NAME=='product' || M_NAME=='shop') && $_M['config']['shopv2_open'])){
$own_js_time = filemtime(PATH_OWN_FILE.'templates/met/js/own.js');
?>
<script src="{$_M['url']['own_tem']}js/own.js?{$own_js_time}"></script><?php } ?>
<script>
var MET = [];
MET['url'] = [];
MET['langtxt'] = {
"jsx15" : "{$_M['word']['jsx15']}",
"js35" : "{$_M['word']['js35']}",
"jsx17" : "{$_M['word']['jsx17']}",
"formerror1" : "{$_M['word']['formerror1']}",
"formerror2" : "{$_M['word']['formerror2']}",
"formerror3" : "{$_M['word']['formerror3']}",
"formerror4" : "{$_M['word']['formerror4']}",
"formerror5" : "{$_M['word']['formerror5']}",
"formerror6" : "{$_M['word']['formerror6']}",
"formerror7" : "{$_M['word']['formerror7']}",
"formerror8" : "{$_M['word']['formerror8']}",
"js46" : "{$_M['word']['js46']}",
"js23" : "{$_M['word']['js23']}",
"checkupdatetips": "{$_M['word']['checkupdatetips']}",
"detection" : "{$_M['word']['detection']}",
"try_again" : "{$_M['word']['try_again']}",
"fileOK" : "{$_M['word']['fileOK']}",
};
MET['met_editor'] = "{$_M['config']['met_editor']}";
MET['met_keywords'] = "{$_M['config']['met_keywords']}";
MET['url']['ui'] = "{$_M['url']['ui']}";
MET['url']['own'] = "{$_M['url']['own']}";
MET['url']['own_tem'] = "{$_M['url']['own_tem']}";
MET['url']['api'] = "{$_M['url']['api']}";
</script>
<met_foot/>
<if value="!$c['shopv2_open']">
<?php $app_js_time = filemtime(PATH_WEB . 'public/ui/v2/static/js/app.js'); ?>
<script src="{$_M['url']['site']}public/ui/v2/static/js/app.js?{$app_js_time}"></script>
</if>
<?php if (file_exists(PATH_OWN_FILE . "templates/met/js/own.js") && !((M_NAME == 'product' || M_NAME == 'shop') && $_M['config']['shopv2_open'])) {
$own_js_time = filemtime(PATH_OWN_FILE . 'templates/met/js/own.js');
?>
<script src="{$_M['url']['own_tem']}js/own.js?{$own_js_time}"></script><?php } ?>

View File

@ -3,12 +3,12 @@
# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved.
defined('IN_MET') or exit('No permission');
?>
<include file="metinfo.inc.php"/>
<?php $met_page=$template_type=='ui'?'index':''; ?>
<met_meta page="$met_page" />
<include file="metinfo.inc.php"/>
<?php $met_page = $template_type == 'ui' ? 'index' : ''; ?>
<met_meta page="$met_page"/>
<?php
if(file_exists(PATH_OWN_FILE."templates/met/css/metinfo.css")){
$own_metinfo_css_filemtime = filemtime(PATH_OWN_FILE.'templates/met/css/metinfo.css');
?>
<link href="{$_M['url']['own_tem']}css/metinfo.css?{$own_metinfo_css_filemtime}" rel='stylesheet' type='text/css'>
if (file_exists(PATH_OWN_FILE . "templates/met/css/metinfo.css")) {
$own_metinfo_css_filemtime = filemtime(PATH_OWN_FILE . 'templates/met/css/metinfo.css');
?>
<link href="{$_M['url']['own_tem']}css/metinfo.css?{$own_metinfo_css_filemtime}" rel='stylesheet' type='text/css'>
<?php } ?>

View File

@ -14,7 +14,8 @@ $data['page_title'] = $data['app']['column']['name'] . $data['page_title'];
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">密钥</span>
<input type="password" class="form-control" placeholder="输入身份密钥" name="check" autocomplete="off">
<input type="password" class="form-control" placeholder="输入身份密钥" name="check"
autocomplete="off">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">提交</button>
</span>

View File

@ -35,83 +35,84 @@
* M['url']['editor'] 当前编辑器应用文件夹路径
*/
$(function () {
var myDate=new Date().getTime();
var myDate = new Date().getTime();
var appfun = function () {
var $self = this;
if($self.isEmpty(M['n'])) M['n'] = $('div[data-m_name]').data('m_name');
$self.own_name = M['weburl'] + 'app/index.php?n=' + M['n'];
if ($self.isEmpty(M['n'])) M['n'] = $('div[data-m_name]').data('m_name');
$self.own_name = M['weburl'] + 'app/index.php?n=' + M['n'];
$self.config();
//select2
if($('[data-plugin="select2"]').length) $self.select2(true);
if ($('[data-plugin="select2"]').length) $self.select2(true);
};
appfun.prototype = {
config:function(){
config : function () {
var $self = this;
$.ajax({
type: "GET",
url: $self.own_name + '&c=index&a=doajaxcl&lang=' + M['lang'],
dataType: "jsonp",
async: false
}).done(function (data) {
type : "GET",
url : $self.own_name + '&c=index&a=doajaxcl&lang=' + M['lang'],
dataType: "jsonp",
async : false
}).done(function (data) {
CL = data;
});
},
select2:function(drawdt){
select2: function (drawdt) {
// drawdt true 执行默认操作 false 不执行
var $self = this,select = [];
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};
}
}
});
$.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){
if (!$self.isEmpty(defaults) && drawdt == true) {
$.getJSON(
select2url,
{
tname: _self.data('tname'), //指定简短表
fiend: _self.data('fiend'), //指定字段值
allnone: _self.data('allnone'), //是否只显示应用的值
source: _self.data('source'), //查看来源标记
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);
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');
})
});
@ -149,7 +150,7 @@ $(function () {
return false;
}
};
APPFUN = new appfun();
//缓存

View File

@ -6,24 +6,27 @@ $data['page_title'] = $data['app']['column']['name'] . $data['page_title'];
<div class="metadmin-main container-fluid cloudweb">
<div class="row">
<div class="col-xs-12 m-y-80">
<div class="form-group">
<h3 class="text-xs-center">广告位投放状态</h3>
</div>
<div class="clearfix">
{$data.top.tips}
<!--头部搜索-->
{$data.table.search}
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-5" id='test-table' data-table-ajaxurl="{$data.url}" data-table-pagelength='15'>
<thead>{$data.table.thead}</thead>
<tbody>
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
</td>
</tr>
</tbody>
</table>
<div class="form-group">
<h3 class="text-xs-center">广告位投放状态</h3>
</div>
<div class="clearfix">
{$data.top.tips}
<!--头部搜索-->
{$data.table.search}
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-5" id='test-table'
data-table-ajaxurl="{$data.url}" data-table-pagelength='15'>
<thead>{$data.table.thead}</thead>
<tbody>
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center">
<div class="loader vertical-align-middle loader-default"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@ -7,14 +7,14 @@ defined('IN_MET') or exit('No permission');
load::own_class('appweb');
class timing extends appweb
class timing extends appweb
{
# 过滤方法名
private $ado = ['doindex'];
private $ado = ['doindex'];
//初始化
public function __construct()
public function __construct()
{
global $_M, $_YW;
parent::__construct();
@ -27,10 +27,10 @@ class timing extends appweb
header('Access-Control-Allow-Methods:post');
ob_start();
//Windows服务器需要加上这行。
echo 'API响应时间'.date('Y-m-d H:i:s', $this->time).str_repeat(" ",4096);
echo 'API响应时间' . date('Y-m-d H:i:s', $this->time) . str_repeat(" ", 4096);
//----------------------------------加快信息响应------中段---------------------------
// 过滤
if (!in_array(M_ACTION, $this->ado,true)) {
if (!in_array(M_ACTION, $this->ado, true)) {
//报错
exit(0);
}
@ -46,75 +46,75 @@ class timing extends appweb
set_time_limit(0);
//----------------------------------加快信息响应------结束---------------------------
}
# 每天凌晨后或者早上6点之前进行广告位排期处理
# 主要计算排期是否过期,是否已经提到开始排期了
public function doindex()
public function doindex()
{
global $_M, $_YW;
$this->webase = load::own_class('../met_wechat/include/class/LW_BASE', 'new');
$this->webase = load::own_class('../met_wechat/include/class/LW_BASE', 'new');
//当天日期时间
$curdate = date('Y-m-d',$this->time);
$strdate = strtotime($curdate);
$num = ['daya' => 0,'dayb' => 0,'dayc' => 0];
$curdate = date('Y-m-d', $this->time);
$strdate = strtotime($curdate);
$num = ['daya' => 0, 'dayb' => 0, 'dayc' => 0];
//查询到期订单
//查询的是设置的提醒天数以及订单结束日期的前后3天数
$where = " endtime = CURDATE() OR (h_endtime BETWEEN CURDATE() AND DATE_ADD( CURDATE(), INTERVAL 3 DAY ) ) ";
$noticeday = $this->tsql->table('noticeday')->where($where)->all();
$where = " endtime = CURDATE() OR (h_endtime BETWEEN CURDATE() AND DATE_ADD( CURDATE(), INTERVAL 3 DAY ) ) ";
$noticeday = $this->tsql->table('noticeday')->where($where)->all();
foreach ($noticeday as $val) {
//延时2秒
sleep(3);
$h_endtime = strtotime($val['h_endtime']);
$h_endtime = strtotime($val['h_endtime']);
//首先判断当前这条信息是属于到期前台3天的 还是属于设置的提醒
//那就是判断订单结束时间和今天的相差天数
$day = abs(($h_endtime - $strdate) / 86400);
if($day > 3){
$day = abs(($h_endtime - $strdate) / 86400);
if ($day > 3) {
//按照设置的提醒来计算
$htypes = "合同 {$val['noticeday']} 天后到期提醒";
//蓝色
$color = "#57c7d4";
$type = 1;
$color = "#57c7d4";
$type = 1;
$num['daya']++;
}else{
} else {
//说明还没到期
if($h_endtime > $strdate){
if ($h_endtime > $strdate) {
$htypes = "合同 {$day} 天后到期";
//黄色
$color = "#f2a654";
$type = 1;
$color = "#f2a654";
$type = 1;
$num['dayb']++;
}else{
} else {
$htypes = "合同今天到期";
//红色
$color = "#F96868";
$type = 2;
$color = "#F96868";
$type = 2;
$num['dayc']++;
}
}
//公司名称
$customer = $this->tsql->table('customer')->where(['id' => $val['h_cid']])->one();
$customer = $this->tsql->table('customer')->where(['id' => $val['h_cid']])->one();
//签定人员
$w_name = [];
$workerswid = stringto_array($val['h_wid'],',');
$workerswid = stringto_array($val['h_wid'], ',');
foreach ($workerswid as $hwid) {
$workers = $this->tsql->table('workers')->where(['id' => $hwid])->one();
$w_name[] = $workers['w_name'];
$workers = $this->tsql->table('workers')->where(['id' => $hwid])->one();
$w_name[] = $workers['w_name'];
}
//整理内容
$val['first'] = ['value' => $htypes, 'color' => $color];
$val['c_allname'] = $customer['c_allname'];
$val['wnamestr'] = arrayto_string($w_name,'');
$val['first'] = ['value' => $htypes, 'color' => $color];
$val['c_allname'] = $customer['c_allname'];
$val['wnamestr'] = arrayto_string($w_name, '');
//发送通知
parent::postdata($type,$val)->openid();
parent::postdata($type, $val)->openid();
}
//以上为定时通知或者到期通知
//增加一个今天要上架的投放
$num['dayd'] = $this->tsql->table('launch')->where(" l_starttime = CURDATE() ")->count();
parent::postdata(3,$num)->openid();
$num['dayd'] = $this->tsql->table('launch')->where(" l_starttime = CURDATE() ")->count();
parent::postdata(3, $num)->openid();
die();
}