Merge branch dev/bug-63624 of zentao/zentaopms (#9936)
This commit is contained in:
+44
-48
@@ -1577,28 +1577,14 @@ class actionModel extends model
|
||||
{
|
||||
$period = strtolower($period);
|
||||
|
||||
/* 1. 确切的日期。 */
|
||||
/* 1. The exact date. */
|
||||
if($date)
|
||||
{
|
||||
if($direction == 'pre') return array('begin' => $date, 'end' => FUTURE_DATE);
|
||||
if($direction == 'next') return array('begin' => EPOCH_DATE, 'end' => $date);
|
||||
return array('begin' => $date, 'end' => $date);
|
||||
}
|
||||
$beginDate = '';
|
||||
$year = date('Y');
|
||||
|
||||
/* 2. 所有时间。 */
|
||||
/* 2. All time. */
|
||||
if($period == 'all')
|
||||
{
|
||||
$beginDate = '';
|
||||
$year = date('Y');
|
||||
|
||||
/* 查询所有动态时最多查询最后两年的数据。 */
|
||||
/* When query all dynamic then query the data of the last two years at most. */
|
||||
if($this->app->getMethodName() == 'dynamic') $year = $year - 1;
|
||||
$beginDate = $year . '-01-01';
|
||||
return array('begin' => $beginDate, 'end' => FUTURE_DATE);
|
||||
}
|
||||
/* 查询所有动态时最多查询最后两年的数据。 */
|
||||
/* When query all dynamic then query the data of the last two years at most. */
|
||||
if($this->app->getMethodName() == 'dynamic') $year = $year - 1;
|
||||
$beginDate = $year . '-01-01';
|
||||
$beginAndEnd = array('begin' => $beginDate, 'end' => FUTURE_DATE);
|
||||
|
||||
$this->app->loadClass('date');
|
||||
|
||||
@@ -1607,10 +1593,10 @@ class actionModel extends model
|
||||
$yesterday = date::yesterday();
|
||||
$twoDaysAgo = date::twoDaysAgo();
|
||||
|
||||
if($period == 'today') return array('begin' => $today, 'end' => $tomorrow);
|
||||
if($period == 'yesterday') return array('begin' => $yesterday, 'end' => $today);
|
||||
if($period == 'twodaysago') return array('begin' => $twoDaysAgo, 'end' => $yesterday);
|
||||
if($period == 'latest3days') return array('begin' => $twoDaysAgo, 'end' => $tomorrow);
|
||||
if($period == 'today') $beginAndEnd = array('begin' => $today, 'end' => $tomorrow);
|
||||
if($period == 'yesterday') $beginAndEnd = array('begin' => $yesterday, 'end' => $today);
|
||||
if($period == 'twodaysago') $beginAndEnd = array('begin' => $twoDaysAgo, 'end' => $yesterday);
|
||||
if($period == 'latest3days') $beginAndEnd = array('begin' => $twoDaysAgo, 'end' => $tomorrow);
|
||||
|
||||
/* 如果时间段为周,则给结束日期增加结束时间。 */
|
||||
/* If the period is by week, add the end time to the end date. */
|
||||
@@ -1618,13 +1604,21 @@ class actionModel extends model
|
||||
{
|
||||
$func = "get$period";
|
||||
extract(date::$func());
|
||||
return array('begin' => $begin, 'end' => $end);
|
||||
$beginAndEnd = array('begin' => $begin, 'end' => $end);
|
||||
}
|
||||
|
||||
if($period == 'thismonth') return date::getThisMonth();
|
||||
if($period == 'lastmonth') return date::getLastMonth();
|
||||
if($period == 'thismonth') $beginAndEnd = date::getThisMonth();
|
||||
if($period == 'lastmonth') $beginAndEnd = date::getLastMonth();
|
||||
|
||||
return array('begin' => EPOCH_DATE, 'end' => FUTURE_DATE);
|
||||
/* 确切的日期。 */
|
||||
/* The exact date. */
|
||||
if($date)
|
||||
{
|
||||
if($direction == 'pre') $beginAndEnd['begin'] = $date;
|
||||
if($direction == 'next') $beginAndEnd['end'] = $date;
|
||||
}
|
||||
|
||||
return $beginAndEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1891,27 +1885,23 @@ class actionModel extends model
|
||||
public function buildDateGroup(array $actions, string $direction = 'next', string $orderBy = 'date_desc'): array
|
||||
{
|
||||
$dateGroup = array();
|
||||
$firstTime = 0;
|
||||
$timeStamp = 0;
|
||||
foreach($actions as $action)
|
||||
{
|
||||
$timeStamp = strtotime(isset($action->originalDate) ? $action->originalDate : $action->date);
|
||||
$date = date(DT_DATE3, $timeStamp);
|
||||
$action->time = date(DT_TIME2, $timeStamp);
|
||||
$dateGroup[$date][] = $action;
|
||||
if(empty($firstTime)) $firstTime = $timeStamp;
|
||||
}
|
||||
|
||||
/* 将日期的顺序修改正确。 */
|
||||
/* Modify date to the corrret order. */
|
||||
if($this->app->rawModule != 'company' && $direction != 'next')
|
||||
if($dateGroup && $firstTime < $timeStamp)
|
||||
{
|
||||
$dateGroup = array_reverse($dateGroup);
|
||||
}
|
||||
elseif($this->app->rawModule == 'company')
|
||||
{
|
||||
if($direction == 'pre') $dateGroup = array_reverse($dateGroup);
|
||||
if(($direction == 'next' && $orderBy == 'date_asc') || ($direction == 'pre' && $orderBy == 'date_desc'))
|
||||
{
|
||||
foreach($dateGroup as $key => $dateItem) $dateGroup[$key] = array_reverse($dateItem);
|
||||
}
|
||||
foreach($dateGroup as $key => $dateItem) $dateGroup[$key] = array_reverse($dateItem);
|
||||
}
|
||||
return $dateGroup;
|
||||
}
|
||||
@@ -1922,22 +1912,26 @@ class actionModel extends model
|
||||
*
|
||||
* @param string $date
|
||||
* @param string $direction
|
||||
* @param string $period
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPreOrNext(string $date, string $direction = 'next'): bool
|
||||
public function hasPreOrNext(string $date, string $direction = 'next', string $period = 'all'): bool
|
||||
{
|
||||
if(empty($date)) return false;
|
||||
|
||||
$condition = $this->session->actionQueryCondition;
|
||||
if(empty($condition)) return false;
|
||||
|
||||
$beginAndEnd = $this->computeBeginAndEnd($period, '', $direction);
|
||||
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
|
||||
$condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition);
|
||||
$actions = $this->dao->select('action.id')->from(TABLE_ACTION)->alias('action')
|
||||
->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi()
|
||||
->where($condition)
|
||||
->andWhere('date' . ($direction == 'next' ? '<' : '>') . "'{$date}'")
|
||||
->andWhere('`date`' . ($direction == 'next' ? '<' : '>') . "'{$date}'")
|
||||
->beginIF($direction == 'next' && $beginAndEnd['begin'] != EPOCH_DATE)->andWhere('date')->ge($beginAndEnd['begin'])->fi()
|
||||
->beginIF($direction != 'next' && $beginAndEnd['end'] != FUTURE_DATE)->andWhere('date')->le($beginAndEnd['end'])->fi()
|
||||
->limit(1)
|
||||
->fetchAll();
|
||||
|
||||
@@ -2606,12 +2600,16 @@ class actionModel extends model
|
||||
$condition = $this->session->actionQueryCondition;
|
||||
if(empty($condition)) return 0;
|
||||
|
||||
$table = $this->actionTao->getActionTable($period);
|
||||
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
|
||||
$table = $this->actionTao->getActionTable($period);
|
||||
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
|
||||
$beginAndEnd = $this->computeBeginAndEnd($period, '', 'next');
|
||||
$condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition);
|
||||
|
||||
$actions = $this->dao->select('action.id')->from($table)->alias('action')
|
||||
->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi()
|
||||
->where($condition)
|
||||
->beginIF($beginAndEnd['begin'] != EPOCH_DATE)->andWhere('date')->ge($beginAndEnd['begin'])->fi()
|
||||
->beginIF($beginAndEnd['end'] != FUTURE_DATE)->andWhere('date')->le($beginAndEnd['end'])->fi()
|
||||
->limit(self::MAXCOUNT)
|
||||
->fetchAll('id');
|
||||
return count($actions);
|
||||
@@ -2665,14 +2663,13 @@ class actionModel extends model
|
||||
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
|
||||
$lastDate = substr($lastAction->originalDate, 0, 10);
|
||||
$condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition);
|
||||
$direction = stripos($this->session->actionOrderBy, ' asc') !== false ? ' > ' : ' < ';
|
||||
$actions = $this->dao->select('action.id')->from(TABLE_ACTION)->alias('action')
|
||||
->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi()
|
||||
->where($condition)
|
||||
->andWhere("`date`")->ge($lastDate)
|
||||
->andWhere("`date`")->lt($lastDate . ' 23:59:59')
|
||||
->andWhere("`date` {$direction} '{$lastAction->originalDate}'")
|
||||
->orderBy($this->session->actionOrderBy)
|
||||
->andWhere("`date` < '{$lastAction->originalDate}'")
|
||||
->orderBy('date_desc')
|
||||
->limit(1)
|
||||
->fetchAll();
|
||||
return count($actions) > 0;
|
||||
@@ -2695,14 +2692,13 @@ class actionModel extends model
|
||||
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
|
||||
$lastAction = $this->dao->select('*')->from(TABLE_ACTION)->where('id')->eq($lastActionID)->fetch();
|
||||
$lastDate = substr($lastAction->date, 0, 10);
|
||||
$direction = stripos($this->session->actionOrderBy, ' asc') !== false ? ' > ' : ' < ';
|
||||
$actions = $this->dao->select('action.*')->from(TABLE_ACTION)->alias('action')
|
||||
->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi()
|
||||
->where($condition)
|
||||
->andWhere("`date`")->ge($lastDate)
|
||||
->andWhere("`date`")->lt($lastDate . ' 23:59:59')
|
||||
->andWhere("`date` {$direction} '{$lastAction->date}'")
|
||||
->orderBy($this->session->actionOrderBy)
|
||||
->andWhere("`date` < '{$lastAction->date}'")
|
||||
->orderBy('date_desc')
|
||||
->limit($limit)
|
||||
->fetchAll('id', false);
|
||||
|
||||
|
||||
@@ -520,24 +520,24 @@ class actionTest
|
||||
public function computeBeginAndEndTest($period, $date = '', $direction = 'next')
|
||||
{
|
||||
$this->objectModel->app->methodName = 'dynamic';
|
||||
$date = $this->objectModel->computeBeginAndEnd($period, $date, $direction);
|
||||
$result = $this->objectModel->computeBeginAndEnd($period, $date, $direction);
|
||||
|
||||
$today = date('Y-m-d');
|
||||
$tomorrow = date('Y-m-d', strtotime('+1 days'));
|
||||
$yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||
$twoDaysAgo = date('Y-m-d', strtotime('-2 days'));
|
||||
|
||||
if(!empty($date) && empty($direction)) return $result['begin'] == '2025-04-23' && $result['end'] == '2025-04-23';
|
||||
if(!empty($date) && empty($direction)) return $result['begin'] == (date('Y') - 1) . '-01-01' and $result['end'] == '2030-01-01';
|
||||
|
||||
if($direction == 'pre') return $result['begin'] == '2025-04-23' && $result['end'] == '2030-01-01';
|
||||
if($direction == 'next') return $result['begin'] == '1970-01-01' && $result['end'] == '2025-04-23';
|
||||
if($period == 'all') return $date['begin'] == (date('Y') - 1) . '-01-01' and $date['end'] == '2030-01-01';
|
||||
if($period == 'today') return $date['begin'] == $today and $date['end'] == $tomorrow;
|
||||
if($period == 'yesterday') return $date['begin'] == $yesterday and $date['end'] == $today;
|
||||
if($period == 'twodaysago') return $date['begin'] == $twoDaysAgo and $date['end'] == $yesterday;
|
||||
if($period == 'latest3days') return $date['begin'] == $twoDaysAgo and $date['end'] == $tomorrow;
|
||||
if($period == 'thismonth') return $date == date::getThisMonth();
|
||||
if($period == 'lastmonth') return $date == date::getLastMonth();
|
||||
if($direction == 'next') return $result['begin'] == (date('Y') - 1) . '-01-01' && $result['end'] == '2025-04-23';
|
||||
if($period == 'all') return $result['begin'] == (date('Y') - 1) . '-01-01' and $result['end'] == '2030-01-01';
|
||||
if($period == 'today') return $result['begin'] == $today and $result['end'] == $tomorrow;
|
||||
if($period == 'yesterday') return $result['begin'] == $yesterday and $result['end'] == $today;
|
||||
if($period == 'twodaysago') return $result['begin'] == $twoDaysAgo and $result['end'] == $yesterday;
|
||||
if($period == 'latest3days') return $result['begin'] == $twoDaysAgo and $result['end'] == $tomorrow;
|
||||
if($period == 'thismonth') return $result == date::getThisMonth();
|
||||
if($period == 'lastmonth') return $result == date::getLastMonth();
|
||||
$func = "get$period";
|
||||
extract(date::$func());
|
||||
if($period == 'thisweek') return $result['begin'] == $begin && $result['end'] == $end;
|
||||
|
||||
@@ -19,49 +19,49 @@ cid=1
|
||||
|
||||
- 测试创建下一个动作日期组 今天 日期倒序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 昨天 日期倒序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 今天 日期倒序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 昨天 日期倒序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 今天 日期正序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 昨天 日期正序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 今天 日期正序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建下一个动作日期组 昨天 日期正序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 今天 日期倒序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 昨天 日期倒序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 今天 日期倒序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 昨天 日期倒序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 今天 日期正序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 昨天 日期正序 前一模块 my
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 今天 日期正序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @2
|
||||
- 属性dateActions @1
|
||||
- 测试创建上一个动作日期组 昨天 日期正序 前一模块 company
|
||||
- 属性dateCount @1
|
||||
- 属性dateActions @1
|
||||
@@ -75,19 +75,19 @@ $rawMethodList = array('my', 'company');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[0], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,2'); // 测试创建下一个动作日期组 今天 日期倒序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[0], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 今天 日期倒序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1], $orderByList[0], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 昨天 日期倒序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[0], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,2'); // 测试创建下一个动作日期组 今天 日期倒序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[0], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 今天 日期倒序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1], $orderByList[0], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 昨天 日期倒序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[1], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,2'); // 测试创建下一个动作日期组 今天 日期正序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[1], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 今天 日期正序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1], $orderByList[1], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 昨天 日期正序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[1], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,2'); // 测试创建下一个动作日期组 今天 日期正序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderByList[1], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 今天 日期正序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1], $orderByList[1], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建下一个动作日期组 昨天 日期正序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[0], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,2'); // 测试创建上一个动作日期组 今天 日期倒序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[0], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 今天 日期倒序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[1], $orderByList[0], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 昨天 日期倒序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[0], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,2'); // 测试创建上一个动作日期组 今天 日期倒序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[0], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 今天 日期倒序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[1], $orderByList[0], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 昨天 日期倒序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[1], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,2'); // 测试创建上一个动作日期组 今天 日期正序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[1], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 今天 日期正序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[1], $orderByList[1], $rawMethodList[0])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 昨天 日期正序 前一模块 my
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[1], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,2'); // 测试创建上一个动作日期组 今天 日期正序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0], $orderByList[1], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 今天 日期正序 前一模块 company
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[1], $orderByList[1], $rawMethodList[1])) && p('dateCount,dateActions') && e('1,1'); // 测试创建上一个动作日期组 昨天 日期正序 前一模块 company
|
||||
@@ -20,7 +20,7 @@ cid=1
|
||||
- 检查SQL。 @1
|
||||
- 测试传入条件 actor='admin' AND t2.product='1'。 @0
|
||||
- 检查SQL。 @1
|
||||
- 测试传入条件 1=1。 @5
|
||||
- 测试传入条件 1=1。 @0
|
||||
- 检查SQL。 @1
|
||||
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ $sql = $actionModel->dao->get();
|
||||
r(strpos($sql, "LEFT JOIN `zt_actionproduct` AS t2 ON action.id=t2.action") !== false) && p() && e('1'); // 检查SQL。
|
||||
|
||||
$_SESSION['actionQueryCondition'] = "1=1";
|
||||
r($actionModel->getDynamicCount('today')) && p() && e('5'); // 测试传入条件 1=1。
|
||||
r($actionModel->getDynamicCount('today')) && p() && e('0'); // 测试传入条件 1=1。
|
||||
|
||||
$sql = $actionModel->dao->get();
|
||||
r(strpos($sql, "SELECT action.id FROM `zt_actionrecent` AS action") !== false) && p() && e('1'); // 检查SQL。
|
||||
@@ -143,11 +143,10 @@ class company extends control
|
||||
* @param string|int $productID
|
||||
* @param string|int $projectID
|
||||
* @param string|int $executionID
|
||||
* @param string $orderBy date_deac|date_asc
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function dynamic(string $browseType = 'today', string $param = '', int $recTotal = 0, string $date = '', string $direction = 'next', int $userID = 0, string|int $productID = 0, string|int $projectID = 0, string|int $executionID = 0, string $orderBy = 'date_desc')
|
||||
public function dynamic(string $browseType = 'today', string $param = '', int $recTotal = 0, string $date = '', string $direction = 'next', int $userID = 0, string|int $productID = 0, string|int $projectID = 0, string|int $executionID = 0)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
|
||||
|
||||
@@ -10,10 +10,9 @@ function changeItem()
|
||||
var productID = $('[name="product"]').length ? $('[name="product"]').val() : 0;
|
||||
var projectID = $('[name="project"]').val();
|
||||
var executionID = $('[name="execution"]').val();
|
||||
var orderBy = $('[name="orderBy"]').val();
|
||||
|
||||
var type = browseType == 'bysearch' ? 'all' : browseType;
|
||||
link = $.createLink('company', 'dynamic', 'browseType=' + type + '¶m=&recTotal=0&date=&direction=no&userID=' + userID + '&productID=' + productID + '&projectID=' + projectID + '&executionID=' + executionID + '&orderBy=' + orderBy);
|
||||
link = $.createLink('company', 'dynamic', 'browseType=' + type + '¶m=&recTotal=0&date=&direction=no&userID=' + userID + '&productID=' + productID + '&projectID=' + projectID + '&executionID=' + executionID);
|
||||
loadPage(link);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,20 +73,6 @@ featureBar
|
||||
on::change('changeItem')
|
||||
)
|
||||
),
|
||||
li
|
||||
(
|
||||
setClass('w-28 ml-4'),
|
||||
picker
|
||||
(
|
||||
setID('orderBy'),
|
||||
set::name('orderBy'),
|
||||
set::placeholder($lang->execution->common),
|
||||
set::items($lang->company->order),
|
||||
set::value($orderBy),
|
||||
set::required(true),
|
||||
on::change('changeItem')
|
||||
)
|
||||
),
|
||||
li(setClass('ml-4'), searchToggle(set::module('action'), set::open($browseType == 'bysearch')))
|
||||
);
|
||||
|
||||
@@ -180,10 +166,10 @@ if(!empty($firstAction))
|
||||
{
|
||||
$firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
|
||||
$lastDate = substr($lastAction->originalDate, 0, 10);
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre');
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next');
|
||||
$preLink = $hasPre ? inlink('dynamic', "browseType={$browseType}¶m={$param}&recTotal=0&date=" . strtotime($firstDate) . "&direction=pre&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}&orderBy={$orderBy}") : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "browseType={$browseType}¶m={$param}&recTotal=0&date=" . strtotime($lastDate) . "&direction=next&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}&orderBy={$orderBy}") : 'javascript:;';
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $browseType);
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next', $browseType);
|
||||
$preLink = $hasPre ? inlink('dynamic', "browseType={$browseType}¶m={$param}&recTotal=0&date=" . strtotime($firstDate) . "&direction=pre&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}") : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "browseType={$browseType}¶m={$param}&recTotal=0&date=" . strtotime($lastDate) . "&direction=next&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}") : 'javascript:;';
|
||||
|
||||
if($hasPre || $hasNext)
|
||||
{
|
||||
|
||||
@@ -119,8 +119,8 @@ if(!empty($firstAction))
|
||||
{
|
||||
$firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
|
||||
$lastDate = substr($lastAction->originalDate, 0, 10);
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre');
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next');
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $type);
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next', $type);
|
||||
$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
|
||||
|
||||
|
||||
@@ -105,8 +105,8 @@ if(!empty($firstAction))
|
||||
{
|
||||
$firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
|
||||
$lastDate = substr($lastAction->originalDate, 0, 10);
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre');
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next');
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $type);
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next', $type);
|
||||
$preLink = $hasPre ? inlink('dynamic', "type=$type&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "type=$type&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ if(empty($firstAction)) return;
|
||||
|
||||
$firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
|
||||
$lastDate = substr($lastAction->originalDate, 0, 10);
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre');
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next');
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $type);
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next', $type);
|
||||
$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ if(!empty($firstAction))
|
||||
{
|
||||
$firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
|
||||
$lastDate = substr($lastAction->originalDate, 0, 10);
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre');
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next');
|
||||
$hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $type);
|
||||
$hasNext = $this->action->hasPreOrNext($lastDate, 'next', $type);
|
||||
$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user