Merge branch 'zentaopms_289' of https://gitlab.zcorp.cc/easycorp/zentaopms into zentaopms_289

This commit is contained in:
tianshujie
2023-02-24 14:50:42 +08:00
5 changed files with 87 additions and 0 deletions
+2
View File
@@ -130,6 +130,8 @@ $(function()
$(".form-item-content").on("click", 'input', function(e)
{
handleClickItem(e.target.id);
}).on("click", '.label', function(){
handleClickItem($(this).data('id'));
}).on("blur", 'input', function(e)
{
removeActive(e.target.id);
+2
View File
@@ -382,6 +382,8 @@ class devModel extends model
}
elseif($type == 'tag')
{
if(!isset($defaultLang->$module->featureBar)) return $originalLangs;
$langKey = 'featureBar-' . $method . '_';
$featureBars = zget($defaultLang->$module->featureBar, $method, array());
if(strpos($method, '_') !== false)
+31
View File
@@ -33,6 +33,22 @@ class devTest
return $result;
}
/**
* Test set field method.
*
* @param array $type
* @access public
* @return array
*/
public function setFieldTest($type)
{
$this->objectModel->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
$sql = "DESC zt_product";
$rawFields = $this->objectModel->dbh->query($sql)->fetchAll();
return $this->objectModel->setField((array)$rawFields[1], (object)$rawFields[1], $type, 1);
}
/**
* Test get APIs of a module.
*
@@ -59,6 +75,21 @@ class devTest
return $result;
}
/**
* Test get original lang method.
*
* @param string $type
* @param string $module
* @param string $method
* @access public
* @return int|array
*/
public function getOriginalLangTest($type = 'common', $module = '', $method = '')
{
$result = $this->objectModel->getOriginalLang($type, $module, $method);
return empty($result) ? 0 : $result;
}
/**
* Get nav lang.
*
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dev.class.php';
/**
title=测试 devModel::getOriginalLang();
cid=1
pid=1
错误的类型返回数据 >> 地盘
正确的类型返回数据 >> 项目
正确的类型,错误的模块返回数据 >> 0
正确的类型,正确的模块返回数据 >> 项目
正确的类型,正确的模块,错误的方法返回数据 >> 0
正确的类型,正确的模块,正确的方法返回数据 >> 全部
*/
$failModule = 'module';
$realModule = 'program';
$failMethod = 'method';
$realMethod = 'browse';
$devTester = new devTest();
r($devTester->getOriginalLangTest('test')) && p('my') && e("地盘"); // 错误的类型返回数据
r($devTester->getOriginalLangTest('common')) && p('projectCommon') && e("项目"); // 正确的类型返回数据
r($devTester->getOriginalLangTest('second', $failModule)) && p() && e("0"); // 正确的类型,错误的模块返回数据
r($devTester->getOriginalLangTest('second', $realModule)) && p('menu_project') && e("项目"); // 正确的类型,正确的模块返回数据
r($devTester->getOriginalLangTest('tag', $realModule, $failMethod)) && p() && e("0"); // 正确的类型,正确的模块,错误的方法返回数据
r($devTester->getOriginalLangTest('tag', $realModule, $realMethod)) && p('featureBar-browse_all') && e("全部"); // 正确的类型,正确的模块,正确的方法返回数据
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dev.class.php';
/**
title=测试 devModel::setField();
cid=1
pid=1
设置字段类型为varchar >> varchar
*/
$devTester = new devTest();
r($devTester->setFieldTest('varchar')) && p('type') && e("varchar"); // 设置字段类型为varchar