feat : phone pool
This commit is contained in:
34
app/Service/ServiceTrait/Api/PhonePoolTrait.php
Normal file
34
app/Service/ServiceTrait/Api/PhonePoolTrait.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\ServiceTrait\Api;
|
||||
|
||||
use App\Lib\Log;
|
||||
use App\Model\PhonePool;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
trait PhonePoolTrait
|
||||
{
|
||||
/**
|
||||
* @var Log
|
||||
*/
|
||||
#[Inject]
|
||||
protected Log $log;
|
||||
|
||||
/**
|
||||
* @param string $mobile
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addMobilePhone(string $mobile): void
|
||||
{
|
||||
if (empty($mobile)) return;
|
||||
|
||||
$insertModel = new PhonePool();
|
||||
|
||||
$insertModel->phone = $mobile;
|
||||
if (!$insertModel->save()) $this->log->error('添加手机号到池子失败,mobile:'.$mobile);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user