composer require yiisoft/yii2 --update-with-all-dependencies
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
// web_check.go | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"net/http" | |
"os" | |
"time" | |
) |
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
// тек.время по дефолт.таймзоне с временем блокировки | |
$current_time = (new \DateTime()) | |
->setTimezone(new \DateTimeZone(Timezone::DEFAULT_TIMEZONE)) | |
->getTimestamp(); | |
// Время через час | |
$current_time_hour = $current_time + 60*60; | |
$dataProvider = new SqlDataProvider([ | |
'sql' => 'SELECT "queue".*, COUNT(DISTINCT "order1".id) as count, COUNT(DISTINCT "order2".id) as count_hour |
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
Например, необходимо из таблицы заказов вытащить кол-во доступных текущих заказов, и кол-во заказов, доступных через час. | |
SELECT "queue".*, COUNT(DISTINCT "order1".id) as count, COUNT(DISTINCT "order2".id) as count_hour | |
FROM "queue" | |
LEFT JOIN "order" as "order1" ON "queue".id="order1".queue_id | |
LEFT JOIN "order" as "order2" ON "queue".id="order2".queue_id | |
WHERE ( | |
("order1"."updated_at"<=:current_time AND "order1"."updated_at" IS NOT NULL) | |
OR "order1"."updated_at" IS NULL) | |
AND ( |
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
$this->id = 1; | |
$id = str_pad($this->id, 6, '0', STR_PAD_LEFT); | |
echo $id; // 000001 |
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
// first | |
$dataProvider = new ArrayDataProvider(['query' => $query]); | |
$dataProvider->setSort([ | |
'attributes' => [ | |
'time', | |
'total', | |
'average-price', | |
], | |
'defaultOrder' => ['time' => SORT_ASC] | |
]); |