From fa54726c1b8eb47209df063fda489dc80acab024 Mon Sep 17 00:00:00 2001 From: yuenblue <8060790+yuenzzy@user.noreply.gitee.com> Date: Sun, 7 Apr 2024 16:06:58 +0800 Subject: [PATCH] aaa --- demotp6/app/model/Article.php | 1 + demotp6/app/model/User.php | 3 +++ demotp6/tests/DemoTest.php | 13 +++++++++++++ demotp6/tests/ModelTest.php | 2 -- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/demotp6/app/model/Article.php b/demotp6/app/model/Article.php index d223ccf..b7d2d72 100644 --- a/demotp6/app/model/Article.php +++ b/demotp6/app/model/Article.php @@ -8,6 +8,7 @@ use think\Model; /** * @mixin \think\Model * @property string $title + * @property User user */ class Article extends Model { diff --git a/demotp6/app/model/User.php b/demotp6/app/model/User.php index da102ad..e9096cb 100644 --- a/demotp6/app/model/User.php +++ b/demotp6/app/model/User.php @@ -4,6 +4,8 @@ namespace app\model; use stdClass; use think\Model; +use think\model\Collection; + enum UserState:int{ case Inactive=0; case Activated=1; @@ -21,6 +23,7 @@ enum UserState:int{ * @property string password * @property string email * @property int status + * @property Collection articles */ final class User extends Model { diff --git a/demotp6/tests/DemoTest.php b/demotp6/tests/DemoTest.php index 52d717e..96d37c8 100644 --- a/demotp6/tests/DemoTest.php +++ b/demotp6/tests/DemoTest.php @@ -19,6 +19,19 @@ class DemoTest extends TestCase { assertTrue(true); } + public function testRandom() + { + foreach (range(1,100) as $aa) { + echo $aa,PHP_EOL; + $bytes = random_bytes(5); + print bin2hex($bytes); + print PHP_EOL; + echo rand(1,1000),PHP_EOL; + } + // $bytes = random_bytes(5); + // print bin2hex($bytes); + // print PHP_EOL; + } public function testLog(){ echo "aaaa"; echo "bbbb"; diff --git a/demotp6/tests/ModelTest.php b/demotp6/tests/ModelTest.php index 95c9c11..24fad01 100644 --- a/demotp6/tests/ModelTest.php +++ b/demotp6/tests/ModelTest.php @@ -46,8 +46,6 @@ class ModelTest extends TestCase $uu = User::with([User::Articles])->hasWhere(User::Articles,$wh)->select(); print $uu; - - } public function testArticleContent() { -- GitLab