BaseServices.php 399 B

123456789101112131415161718192021
  1. <?php
  2. namespace app\api\services;
  3. use think\facade\Db;
  4. use utils\JwtAuth;
  5. abstract class BaseServices
  6. {
  7. protected $model = null;
  8. public function getModel($name){
  9. return Db::name($name);
  10. }
  11. public function createToken(int $uid, $user = null, string $type = 'API'){
  12. $jwt = app()->make(JwtAuth::class);
  13. return $jwt->createToken($uid, $user, $type);
  14. }
  15. }