if (!defined('jquery')) {
define('jquery', false);
}
const request = require('request');
const client_id = "client_id "
const api_key = "api_key "
const headers = {
"client-id": client_id,
"api-key": api_key
};
let body = {
"filter": {
"visibility": "ALL"
},
"last_id": "",
"limit": 100
};
const options = {
url: 'https://api-seller.ozon.ru/v3/product/info/stocks',
method: 'POST',
headers: headers,
json: body
};
request(options, function (error, response, body) {
if (error) {
console.log('Error:', error);
} else {
console.log('Body:', body);
}
});
const contentString = contentRef.current.innerHTML;
const sendPost = async () => {
try {
const contentString = contentRef.current.innerHTML;
setTextContent(contentString);
const { data } = await axios.post('http://localhost:8000/api/post/create', {
post: textContent
});
} catch (err) {
console.log(err);
}
};
/* Скрыть форму на десктопе */
@media only screen and (min-width: 768px) {
.form {
display: none;
}
}
/* Показать форму на планшете */
@media only screen and (max-width: 767px) {
.form {
display: block;
}
}
<?php
// Массив страниц и соответствующих ссылок в меню
$menuItems = array(
"/page1" => "Ссылка 1",
"/page2" => "Ссылка 2",
"/page3" => "Ссылка 3",
"/page4" => "Ссылка 4",
);
// Получаем относительный путь
$url = $_SERVER['REQUEST_URI'];
$url = explode('?', $url);
$url = $url[0];
// Выводим ссылки в меню
foreach ($menuItems as $pageUrl => $menuItem) {
if ($pageUrl != $url) {
echo '<a href="' . $pageUrl . '">' . $menuItem . '</a>';
}
}
?>
function images() {
return src(path.src.img)
.pipe(webp({ quality: 70 }))
.pipe(dest(path.build.img))
.pipe(src(path.src.img))
.pipe(imagemin({
progressive: true,
svgoPlugins: [{ removeViewBox: false }],
interlaced: true,
optimizationLevel: 5
}))
.pipe(dest(path.build.img))
.pipe(browsersync.stream());
}
const path = {
build: {
html: project_folder + '/',
css: project_folder + '/css/',
js: project_folder + '/js/',
img: project_folder + '/img/',
fonts: project_folder + '/fonts/',
},
src: {
html: [source_folder + '/*.html', '!' + source_folder + '/_**/_*.html'],
css: source_folder + '/scss/style.scss',
js: source_folder + '/js/script.js',
img: source_folder + '/img/**/*.{jpg,png,svg,gif,ico,webp}',
fonts: source_folder + '/fonts/*.{ttf,ttf2,woff,woff2}',
},
watch: {
html: source_folder + '/**/*.html',
css: source_folder + '/scss/**/*.scss',
js: source_folder + '/js/**/*.js',
img: source_folder + '/img/**/*.{jpg,png,svg,gif,ico,webp}',
},
clean: './' + project_folder + '/',
};
SELECT
SUM(amount) as total_sum,
DATE_FORMAT(FROM_UNIXTIME(time), '%d.%m.%Y') as date,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY)) THEN amount ELSE 0 END) as day_1,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)) AND time <= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY)) THEN amount ELSE 0 END) as day_2,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 3 DAY)) AND time <= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)) THEN amount ELSE 0 END) as day_3,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 4 DAY)) AND time <= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 3 DAY)) THEN amount ELSE 0 END) as day_4,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 5 DAY)) AND time <= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 4 DAY)) THEN amount ELSE 0 END) as day_5,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 6 DAY)) AND time <= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 5 DAY)) THEN amount ELSE 0 END) as day_6,
SUM(CASE WHEN time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY)) AND time <= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 6 DAY)) THEN amount ELSE 0 END) as day_7,
SUM(amount) as total_amount
FROM payments
WHERE status = 3 AND shop_id = :shop_id AND time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
<div class="spoiler" data-spoiler-id="spoiler1">
<div class="spoiler-header">Имя спойлера</div>
<div class="spoiler-content">
<a href="#">Имя ссылки1</a>
<a href="#">Имя ссылки2</a>
<a href="#">Имя ссылки3</a>
</div>
</div>
// Получить все спойлеры на странице
const spoilers = document.querySelectorAll('.spoiler');
// Пройти по каждому спойлеру и добавить обработчик клика
spoilers.forEach(spoiler => {
const spoilerId = spoiler.getAttribute('data-spoiler-id');
const isSpoilerOpen = localStorage.getItem(spoilerId) === 'true';
// Установить начальное состояние спойлера (открыт/закрыт)
if (isSpoilerOpen) {
spoiler.classList.add('open');
} else {
spoiler.classList.remove('open');
}
// Добавить обработчик клика для сохранения состояния спойлера в localStorage
spoiler.addEventListener('click', () => {
const isOpen = spoiler.classList.contains('open');
localStorage.setItem(spoilerId, !isOpen);
});
});
.spoiler.open .spoiler-content {
display: block;
}
<!-- Подключение библиотеки Яндекс Карт -->
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
<!-- Определение функции init и ее вызов после загрузки библиотеки -->
<script type="text/javascript">
ymaps.ready(init);
function init() {
// ваш код инициализации карты
}
</script>
def echo_forward_handler(update, context):
text = 'Expect an answer'
context.bot.send_message(chat_id=update.effective_chat.id,
text=text)
forwarded = update.message.forward(chat_id=TELEGRAM_SUPPORT_CHAT_ID)
if not forwarded.forward_from:
context.bot.send_message(
chat_id=TELEGRAM_SUPPORT_CHAT_ID,
reply_to_message_id=forwarded.message_id,
text=f'{update.message.from_user.id}\n{REPLY_TO_THIS_MESSAGE}'
)
def setup_dispatcher(dp):
dp.add_handler(MessageHandler(Filters.text & (~Filters.command) & Filters.chat_type.private, echo_forward_handler))
return dp
import telebot
import constants
from telebot import types
bot = telebot.TeleBot(constants.token)
@bot.message_handler(commands=['start'])
def start(message):
sent = bot.send_message(message.chat.id, 'Please describe your problem.')
bot.register_next_step_handler(sent, hello)
def hello(message):
open('problem.txt', 'w').write(message.chat.id + ' | ' + message.text + '||')
bot.send_message(message.chat.id, 'Thank you!')
bot.send_message(ADMIN_ID, message.chat.id + ' | ' + message.text)
bot.polling()