You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
746 B
36 lines
746 B
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\model;
|
|
|
|
use think\Model;
|
|
|
|
/**
|
|
* @mixin \think\Model
|
|
*/
|
|
class Pincode extends Model
|
|
{
|
|
/**
|
|
* 保存短信验证码
|
|
* @param $phone
|
|
* @param $code
|
|
* @return bool[]
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function sendSave($phone,$code)
|
|
{
|
|
$query = $this->where('mobile',$phone)->find();
|
|
|
|
if ($query) $this->where('mobile',$phone)->delete();
|
|
|
|
$this->save([
|
|
'mobile' => $phone,
|
|
'code' => $code,
|
|
'time' => time()
|
|
]);
|
|
|
|
return ['status' => true];
|
|
}
|
|
}
|
|
|