feat : phone pool

This commit is contained in:
2025-04-10 13:41:39 +08:00
parent 7b26a6cf6b
commit 37331f114e
5 changed files with 102 additions and 1 deletions

View 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);
}
}