diff --git a/demotp6/app/model/Article.php b/demotp6/app/model/Article.php index d223ccfed0cfaddd675c9e4bcbc869b6aea20e33..b7d2d72269dbde68969150ebda8e1f527eb29c90 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 da102adf160214520affc4d4e3839b9827bec374..e9096cb24586709309eb3d75ddecbbe4934a38cb 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 52d717ec3255a0767d5a3dc0fdf779df8c0d46af..96d37c875f1f992c558d36f228b5e3556b3a3484 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 95c9c11c047e66f2ba58ea5e50a1582fbd26adcd..24fad014300307aa1ae6b687970b164b342e2688 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() {