NASER add sendsmslist api
This commit is contained in:
@@ -11,6 +11,8 @@ use App\Mail\YourMailableClass;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use App\Http\Controllers\pay\PaymanController;
|
||||
use App\Models\Message;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
Route::get('/refPricer', function () {
|
||||
// $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
||||
@@ -65,6 +67,33 @@ Route::get('/1', function () {
|
||||
]);
|
||||
});
|
||||
|
||||
Route::get('/getSmsList', function (Request $request) {
|
||||
if($request->Header('sicrtToken') !== 'dlrA0mAsfpixA5wgCOPK2khVtFE32vBLGqUHvSvLVkMaHNdHE5'){
|
||||
return response()->json(['auth_needed'],401);
|
||||
}
|
||||
|
||||
function SmsPrice($sms)
|
||||
{
|
||||
$charCount = mb_strlen($sms, "UTF-8");
|
||||
$isPersian = preg_match('/[آ-ی]/u', $sms);
|
||||
$isEnglish = preg_match('/[a-zA-Z]/u', $sms);
|
||||
$limit = ($isPersian && !$isEnglish) ? [70, 64, 67] : [160, 146, 153];
|
||||
$smsCount = ceil($charCount / $limit[0]);
|
||||
if ($isEnglish) {
|
||||
$smsCount *= 2;
|
||||
}
|
||||
return $smsCount;
|
||||
}
|
||||
|
||||
$startDate = Carbon::parse($request->startDate)->startOfDay();
|
||||
$endDate = Carbon::parse($request->endDate)->endOfDay();
|
||||
$messages = Message::with([])->whereBetween('created_at', [$request->startDate, $request->endDate])->get();
|
||||
foreach ($messages as $message) {
|
||||
|
||||
|
||||
}
|
||||
return $messages;
|
||||
});
|
||||
|
||||
//Route::get('/getdatabase', function () {
|
||||
// // دریافت لیست جداول
|
||||
|
||||
Reference in New Issue
Block a user