some progress in sms panel changes

This commit is contained in:
Hesabix 2024-04-10 19:20:32 +00:00
parent b72981b103
commit 3c1dfd7d0d
4 changed files with 56 additions and 47 deletions

View file

@ -14,6 +14,7 @@ use App\Entity\StoreroomTicket;
use App\Entity\User;
use App\Entity\WalletTransaction;
use App\Service\Jdate;
use App\Service\JsonResp;
use App\Service\Notification;
use App\Service\Provider;
use App\Service\registryMGR;
@ -199,6 +200,9 @@ class AdminController extends AbstractController
{
$resp = [];
$resp['username'] = $registryMGR->get('sms','username');
$resp['password'] = $registryMGR->get('sms','password');
$resp['token'] = $registryMGR->get('sms','token');
$resp['walletpay'] = $registryMGR->get('sms','walletPay');
$resp['changePassword'] = $registryMGR->get('sms','changePassword');
$resp['f2a'] = $registryMGR->get('sms','f2a');
@ -210,6 +214,41 @@ class AdminController extends AbstractController
return $this->json($resp);
}
#[Route('/api/admin/sms/plan/info/save', name: 'admin_sms_plan_info_save')]
public function admin_sms_plan_info_save(registryMGR $registryMGR,Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
{
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
if(array_key_exists('username',$params))
$registryMGR->update('sms','username',$params['username']);
if(array_key_exists('password',$params))
$registryMGR->update('sms','password',$params['password']);
if(array_key_exists('token',$params))
$registryMGR->update('sms','token',$params['token']);
if(array_key_exists('walletpay',$params))
$registryMGR->update('sms','walletpay',$params['walletpay']);
if(array_key_exists('changePassword',$params))
$registryMGR->update('sms','changePassword',$params['changePassword']);
if(array_key_exists('f2a',$params))
$registryMGR->update('sms','f2a',$params['f2a']);
if(array_key_exists('ticketReplay',$params))
$registryMGR->update('sms','ticketReplay',$params['ticketReplay']);
if(array_key_exists('ticketRec',$params))
$registryMGR->update('sms','ticketRec',$params['ticketRec']);
if(array_key_exists('fromNum',$params))
$registryMGR->update('sms','fromNum',$params['fromNum']);
if(array_key_exists('sharefaktor',$params))
$registryMGR->update('sms','sharefaktor',$params['sharefaktor']);
if(array_key_exists('plan',$params))
$registryMGR->update('sms','plan',$params['plan']);
return $this->json(JsonResp::success());
}
#[Route('/api/admin/settings/system/info', name: 'admin_settings_system_info')]
public function admin_settings_system_info(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
{
@ -370,7 +409,7 @@ class AdminController extends AbstractController
}
#[Route('/api/admin/wallets/transactions/insert', name: 'app_admin_wallets_transactions_insert')]
public function app_admin_wallets_transactions_insert(SMS $SMS,Jdate $jdate,Notification $notification,Request $request,EntityManagerInterface $entityManager): JsonResponse
public function app_admin_wallets_transactions_insert(registryMGR $registryMGR, SMS $SMS,Jdate $jdate,Notification $notification,Request $request,EntityManagerInterface $entityManager): JsonResponse
{
$params = [];
if ($content = $request->getContent()) {
@ -394,7 +433,11 @@ class AdminController extends AbstractController
$entityManager->persist($item);
$entityManager->flush();
$notification->insert('تسویه کیف پول انجام شد.','/acc/wallet/view',$bid,$bid->getOwner());
$SMS->send([$bid->getName()],174225,$bid->getOwner()->getMobile());
$SMS->send(
[$bid->getName()],
$registryMGR->get('sms','walletpay'),
$bid->getOwner()->getMobile()
);
return $this->json(['result' => 1]);
}

View file

@ -20,6 +20,7 @@ use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
use App\Entity\User;
use App\Security\EmailVerifier;
use App\Service\registryMGR;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Form\FormError;
@ -206,7 +207,7 @@ class UserController extends AbstractController
}
#[Route('/api/user/register', name: 'api_user_register')]
public function api_user_register(SMS $SMS,MailerInterface $mailer,Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response
public function api_user_register(registryMGR $registryMGR,SMS $SMS,MailerInterface $mailer,Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response
{
$params = [];
if ($content = $request->getContent()) {
@ -243,6 +244,11 @@ class UserController extends AbstractController
$entityManager->persist($user);
$entityManager->flush();
$SMS->send([$user->getVerifyCode()],'162246',$user->getMobile());
$SMS->send(
[$user->getVerifyCode()],
$registryMGR->get('sms','f2a'),
$user->getMobile()
);
try {
$email = (new Email())
->to($user->getEmail())

View file

@ -14,11 +14,6 @@ class Settings
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $payamakUsername = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $payamakPassword = null;
#[ORM\Column(nullable: true)]
private ?bool $activeSendSms = null;
@ -32,9 +27,6 @@ class Settings
#[ORM\Column(length: 255, nullable: true)]
private ?string $storagePrice = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $melipayamakToken = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $siteKeywords = null;
@ -58,30 +50,6 @@ class Settings
return $this->id;
}
public function getPayamakUsername(): ?string
{
return $this->payamakUsername;
}
public function setPayamakUsername(?string $payamakUsername): static
{
$this->payamakUsername = $payamakUsername;
return $this;
}
public function getPayamakPassword(): ?string
{
return $this->payamakPassword;
}
public function setPayamakPassword(?string $payamakPassword): static
{
$this->payamakPassword = $payamakPassword;
return $this;
}
public function isActiveSendSms(): ?bool
{
return $this->activeSendSms;
@ -130,18 +98,6 @@ class Settings
return $this;
}
public function getMelipayamakToken(): ?string
{
return $this->melipayamakToken;
}
public function setMelipayamakToken(?string $melipayamakToken): static
{
$this->melipayamakToken = $melipayamakToken;
return $this;
}
public function getSiteKeywords(): ?string
{
return $this->siteKeywords;

View file

@ -27,4 +27,8 @@ class JsonResp
'tempStatus' => $hesabdariDoc->getTempStatus(),
];
}
public static function success(){
return ['error'=>0];
}
}