add
This commit is contained in:
21
app/admin/model/SysCaptcha.php
Normal file
21
app/admin/model/SysCaptcha.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
use think\captcha\facade\Captcha as thinkCaptcha;
|
||||
|
||||
class SysCaptcha extends Model
|
||||
{
|
||||
public static function getCode($uuid)
|
||||
{
|
||||
$code_data = thinkCaptcha::create('czg');
|
||||
// 保存至数据库
|
||||
self::create([
|
||||
'uuid' => $uuid,
|
||||
'code' => $code_data['code'],
|
||||
'expire_time' => date('Y-m-d H:i:s', time() + config('captcha.expire_time')),
|
||||
]);
|
||||
return ['img' => $code_data['img']];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user