This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chela.spring.core; | |
import javax.crypto.Cipher; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.util.Base64; | |
final public class ChCrypto { | |
final static Base64.Encoder encorder = Base64.getEncoder(); | |
final static Base64.Decoder decorder = Base64.getDecoder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
usort($ral_arr_formula, fn($a, $b) => $a['ral_delta'] <=> $b['ral_delta']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE v8users RENAME TO v8users_old; | |
UPDATE Params SET FileName = 'users.usr_old' WHERE FileName = 'users.usr'; | |
// Открываем конфигуратор | |
DROP TABLE v8users; | |
ALTER TABLE v8users_old RENAME TO v8users; | |
UPDATE Params SET FileName = 'users.usr' WHERE FileName = 'users.usr_old'; | |
// Правим нужного пользователя |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function parseFile($inputFileName) { | |
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName); | |
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); | |
$spreadsheet = $reader->load($inputFileName); | |
$data = $spreadsheet->getActiveSheet()->toArray(); | |
// Remove header | |
unset($data[0]); | |
return $data; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!Storage::disk('local')->exists("import")) { | |
Storage::disk('local')->makeDirectory("import"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_merge_recursive_save_keys() { | |
$arrays = func_get_args(); | |
$base = array_shift($arrays); | |
foreach ($arrays as $array) { | |
reset($base); | |
foreach($array as $key => $value) { | |
if (is_array($value) && @is_array($base[$key])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// TODO: Разбить на методы | |
public function uploadFile(Request $request) | |
{ | |
// Загружаем фото на хранилище присваивая начальную папку равную домену | |
$uuid = Str::uuid()->toString(); | |
$domain = $request->getHttpHost(); | |
$patient_id = $request->get('patient_id'); | |
$directory = $request->get('patient_id') . '/' . date("Y-m-d", time()) . '/' . $uuid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Jobs; | |
use App\Http\Controllers\LogController; | |
use App\Http\Controllers\TelegramBotController; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldBeUnique; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Foundation\Bus\Dispatchable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function sendMessage($user_id, $message) { | |
$user_data = User::findOrFail($user_id); | |
$telegram_chat_id = $user_data->telegram_chat_id; | |
$telegram_notify = $user_data->notify_telegram; | |
if (((int)$telegram_notify === 1) && (isset($telegram_chat_id)) && ($telegram_chat_id > 0)) { | |
Telegram::bot('bot_name')->sendMessage(['text' => $message, 'chat_id' => $telegram_chat_id, 'parse_mode' => 'html']); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function sync() { | |
$user_id = auth()->user()->id; | |
$user = User::findOrFail($user_id); | |
$searched_username = $user->telegram_username; | |
if (!isset($searched_username) || ($searched_username === '')) { | |
return ['success' => 'not', 'error' => 'Empty username']; | |
} | |
$response = Telegram::bot('bot_name')->getUpdates(); | |
$chat_id = 0; |
NewerOlder