123456789101112131415161718192021222324252627282930 |
- <?php
- namespace app\common\service;
- use app\common\model\soft\Codes as SoftCodes;
- use think\Cache;
- use think\Exception;
- use app\common\traits\ServiceTrait;
- class SoftCodeService
- {
- use ServiceTrait;
- /** @var SoftCodes */
- public static $Model = SoftCodes::class;
- /**
- * 获取可用激活码
- * @throws \Exception
- */
- public static function getAvailableCode()
- {
- $res = self::getOne(['status' => CommonService::NO]);
- if (!$res) {
- exception('激活码不足,请手动生成');
- }
- return $res->activate_code;
- }
- }
|