Files
EasySoft-ZenTaoPMS/test/model/user/getbyquery.php
2022-03-17 13:40:02 +08:00

24 lines
901 B
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=测试 userModel::getById();
cid=1
pid=1
对比获取到的内部用户的数量 >> 303
按ID倒序查询内部用户获取最后一个用户的account >> admin
获取第一个外部用户的真实姓名 >> 用户1
*/
$user = new userTest();
$insideQAUsers = $user->getByQueryTest('inside', "`role` = 'qa'", 'id desc');
$outsideUsers = $user->getByQueryTest('outside');
r(count($insideQAUsers)) && p() && e('303'); //对比获取到的内部用户的数量
r($insideQAUsers) && p('302:account') && e('admin'); //按ID倒序查询内部用户获取最后一个用户的account
r($outsideUsers) && p('0:realname') && e('用户1'); //获取第一个外部用户的真实姓名