Initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user