30 lines
599 B
PHP
30 lines
599 B
PHP
<?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;
|
|
}
|
|
}
|