| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- declare (strict_types=1);
- namespace App\Model\Mongo;
- use Hyperf\Mongodb\Mongodb;
- use Hyperf\Utils\ApplicationContext;
- use MongoDB\Client;
- /**
- * Class CrashLogModel
- * @return Client|StatUserModel
- *
- * @package App\Model\Mongo
- */
- class StatUserModel extends Mongodb
- {
- // mongoDB 表名
- // protected $dbName = 'douyin_lite'; // mongoDB 库名
- protected $collectionName = 'stat_user'; // mongoDB 表名
- public function db()
- {
- $container = ApplicationContext::getContainer();
- /**
- * @var $mongodb Client
- */
- $mongodb = $container->get(self::class);
- return $mongodb->selectDatabase(env('MONGODB_DB'))
- ->selectCollection($this->collectionName);
- }
- }
|