* Refactor myModel::getReviewingFeedbacks.
This commit is contained in:
+5
-4
@@ -1156,14 +1156,15 @@ class myModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评审中的反馈。
|
||||
* Get reviewing feedbacks.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param bool $checkExists
|
||||
* @param string $orderBy
|
||||
* @param bool $checkExists
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getReviewingFeedbacks($orderBy = 'id_desc', $checkExists = false)
|
||||
public function getReviewingFeedbacks(string $orderBy = 'id_desc', bool $checkExists = false): array|bool
|
||||
{
|
||||
if(!common::hasPriv('feedback', 'review')) return array();
|
||||
if($this->config->edition == 'open') return array();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/my.class.php';
|
||||
|
||||
zdTable('user')->gen('2');
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 myModel->getReviewingFeedbacks();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$my = new myTest();
|
||||
|
||||
$orderBy = array('id_desc', 'id_asc');
|
||||
$checkExist = array(false, true);
|
||||
|
||||
r($my->getReviewingFeedbacksTest($orderBy[0], $checkExist[0])) && p() && e('empty'); // 测试获取排序 id_desc 的审批id。
|
||||
r($my->getReviewingFeedbacksTest($orderBy[0], $checkExist[1])) && p() && e('empty'); // 测试获取排序 id_desc 的审批是否存在。
|
||||
r($my->getReviewingFeedbacksTest($orderBy[1], $checkExist[0])) && p() && e('empty'); // 测试获取排序 id_asc 的审批id。
|
||||
r($my->getReviewingFeedbacksTest($orderBy[1], $checkExist[1])) && p() && e('empty'); // 测试获取排序 id_asc 的审批是否存在。
|
||||
@@ -466,7 +466,7 @@ class myTest
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试获取审批中的审批。
|
||||
* 测试获取审批中的工作流。
|
||||
* Test get reviewing flows.
|
||||
*
|
||||
* @param string $orderBy
|
||||
@@ -483,4 +483,23 @@ class myTest
|
||||
if($return === true) return 'exist';
|
||||
return !empty($return) ? implode(',', array_column($return, 'id')) : 'empty';
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试获取审批中的反馈。
|
||||
* Test get reviewing feedbacks.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param bool $checkExist
|
||||
* @access public
|
||||
* @return int|string|array
|
||||
*/
|
||||
public function getReviewingFeedbacksTest(string $orderBy, bool $checkExist): int|string|array
|
||||
{
|
||||
$return = $this->objectModel->getReviewingFeedbacks($orderBy, $checkExist);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($return === true) return 'exist';
|
||||
return !empty($return) ? implode(',', array_column($return, 'id')) : 'empty';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user