Commit 817c9b82 by banice

提测版

parent a656beef
......@@ -2251,7 +2251,7 @@ namespace Illuminate\Support\Facades {
}
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL timer.
*
* @param string $key The key of the item to store.
* @param mixed $value The value of the item to store, must be serializable.
......@@ -2458,7 +2458,7 @@ namespace Illuminate\Support\Facades {
}
/**
* Get the default cache time.
* Get the default cache timer.
*
* @return float|int
* @static
......@@ -2469,7 +2469,7 @@ namespace Illuminate\Support\Facades {
}
/**
* Set the default cache time in minutes.
* Set the default cache timer in minutes.
*
* @param float|int $minutes
* @return $this
......@@ -2528,7 +2528,7 @@ namespace Illuminate\Support\Facades {
}
/**
* Store an item in the cache for the default time.
* Store an item in the cache for the default timer.
*
* @param string $key
* @param mixed $value
......
......@@ -19,7 +19,7 @@ use Log;
class ScanOrderFinish extends Command
{
protected $signature = 'time:scan_order_finish';
protected $signature = 'timer:scan_order_finish';
/**
......@@ -127,7 +127,7 @@ class ScanOrderFinish extends Command
$result = DB::table('wx_charger_orders')->where('id', $expireOrder->id)->update([
'end_time' => date('Y-m-d H:i:s'),
'updated_at' => $date,
'state' => 4,
'state' => 1,
'is_stop' => 46,
]);
......
......@@ -10,6 +10,7 @@ namespace App\Http\Controllers\V1\Charger;
use App\Http\Controllers\Controller;
use App\Model\GatewayModel;
use App\Model\PortModel;
use Illuminate\Http\Request;
use Lib\balance\BalanceOrder;
......@@ -49,7 +50,7 @@ class BalanceController extends Controller
$validator = Validator::make($request->all(), [
'pay_amount' => 'required|numeric',
'time' => 'required|integer',
'timer' => 'required|integer',
'port_id' => 'required|exists:devices,id|',
'station_id' => 'required|exists:stations,id',
'charger_type' => 'required|integer',
......@@ -70,6 +71,8 @@ class BalanceController extends Controller
if ($portModel->status_id === 8) {
Log::debug('ban port');
abort(400, '口子被禁用');
}
......@@ -85,13 +88,13 @@ class BalanceController extends Controller
abort(400, '账户余额小于' . $amount . '元');
}
$time = (int)$request->get('time');
$time = (int)$request->get('timer');
$hasRule = false;
foreach ($payTemplate as $item) {
if ((int)$item['price'] === (int)($amount) && (int)$item['time'] === (int)$time) {
if ((int)$item['price'] === (int)($amount) && (int)$item['timer'] === (int)$time) {
$hasRule = true;
......@@ -150,7 +153,6 @@ class BalanceController extends Controller
$balanceOrder->setOutTradeNo($outTradeNo);
$handleClient = new HandleClient($balanceOrder);
$orderId = $balanceOrder->getOrderId();
......@@ -203,6 +205,10 @@ class BalanceController extends Controller
$cdzOrder->setOutTradeNo($outTradeNo);
$cdzOrder->setCreatedTime(time());
$cdzOrder->setGatewayType($balanceOrder->getGatewayType());
if ($balanceOrder->getGatewayType() === 5) {
$cdzOrder->setGatewayDeviceId($balanceOrder->getGatewayDeviceId());
}
try {
......
......@@ -7,6 +7,7 @@
namespace App\Http\Controllers\V1\Charger;
use App\Http\Controllers\Controller;
use App\Model\GatewayModel;
use App\Model\WxChargerOrderModel;
use Illuminate\Http\Request;
use Lib\cdz_order\Order;
......@@ -34,8 +35,8 @@ class ChangePortController extends Controller
$validator = Validator::make($request->all(), [
'order_id' => 'required|exists:wx_charger_orders,id',
'new_port_id' => 'required|integer',
'order_id' => 'required|exists:wx_charger_orders,id',
'new_port_id' => 'required|integer',
'new_port_name' => 'required',
]);
......@@ -58,89 +59,62 @@ class ChangePortController extends Controller
$newState = $port->getState(RedisSingle::getRedis(), $newPortId);
if ($newState != 11) {
abort(400, '更换口子非空闲状态');
}
$result = true;
if ($orderCollection->state === 3) {
Log::debug('以退款');
$this->resultCode = 'FAIL';
$this->resultMessage = '订单已退款';
$result = false;
} else if ($orderCollection->is_charger !== -1) {
$order = new Order();
$order->setId($orderId);
if ($order->getOrderCache(RedisSingle::getRedis()) != false) {
if ($order->getStateCode() != -1) {
$result = false;
} else {
DB::table('wx_charger_orders')->where('id', $orderId)->update([
'start_time' => null,
'is_charger' => -1,
]);
}
}
$this->resultCode = 'FAIL';
// $order = new Order();
// $order->setId($orderId);
// if ($order->getOrderCache(RedisSingle::getRedis()) != false) {
// if ($order->getStateCode() != -1) {
// $result = false;
// } else {
// DB::table('wx_charger_orders')->where('id', $orderId)->update([
// 'start_time' => null,
// 'is_charger' => -1,
// ]);
// }
// }
// $this->resultCode = 'FAIL';
$this->resultMessage = '订单消费中,无法更换端口';
} else if ($orderCollection->change_times === 3) {
$this->resultCode = 'FAIL';
$result = false;
$this->resultMessage = '最多只能更换口子3次';
}
if ($result === false) {
return $this->response->array($this->getResponseCode());
}
// 发送结束充电命令至端口,发送开始充电命令给新端口,修改订单表中的数据
$stopChargerCommand = new StopChargerCommand();
$stopChargerCommand->setOrderId($orderId);
$gateway = new Gateway();
$gateway->setId($orderCollection->gateway_id);
$gateway->idGetMac();
$oldGatewayMac = $gateway->getMacAddress();
if (\Lib\Gateway::isUidOnline($gateway->getMacAddress())) {
Log::debug($gateway->getMacAddress() . 'online');
} else {
abort(400, '网关掉线');
$oldGatewayDeviceId = $gateway->getNbDeviceId();
// 非iot设备通过tcp连接检测
if (blank($oldGatewayDeviceId)) {
if (\Lib\Gateway::isUidOnline($gateway->getMacAddress())) {
Log::debug($gateway->getMacAddress() . 'online');
} else {
abort(400, '网关掉线');
}
}
$port->setPortId($request->get('new_port_id'));
$lastPortId = $orderCollection->port_id;
if ($port->getState(RedisSingle::getRedis(), $lastPortId) == 10) {
if ($port->getState(RedisSingle::getRedis(), $newPortId) == 10) {
abort(400, '口子不在线');
}
......@@ -175,6 +149,7 @@ class ChangePortController extends Controller
$gateway->idGetMac();
$newGatewayMac = $gateway->getMacAddress();
$newNbDeviceID = $gateway->getNbDeviceId();
$simpleChargerCommand->setChargerTime($orderCollection->charger_time);
......@@ -189,14 +164,14 @@ class ChangePortController extends Controller
$date = date('Y-m-d H:i:s');
DB::table('gateway_log')->insert([
'request' => $send->getMessage(),
'command' => '04',
'request' => $send->getMessage(),
'command' => '04',
'station_id' => $orderCollection->station_id,
'gateway_id' => $orderCollection->gateway_id,
'order_id' => $orderId,
'port_id' => $newPortId,
'desc' => '更换充电口,下发打开口子',
'type' => 1,
'order_id' => $orderId,
'port_id' => $newPortId,
'desc' => '更换充电口,下发打开口子',
'type' => 1,
'created_at' => $date,
]);
......@@ -212,14 +187,14 @@ class ChangePortController extends Controller
$send->send();//发送结束充电命令
DB::table('gateway_log')->insert([
'request' => $send->getMessage(),
'command' => '05',
'request' => $send->getMessage(),
'command' => '05',
'station_id' => $orderCollection->station_id,
'gateway_id' => $orderCollection->gateway_id,
'order_id' => $orderId,
'port_id' => $orderCollection->port_id,
'desc' => '更换充电口,下发关闭口子',
'type' => 1,
'order_id' => $orderId,
'port_id' => $orderCollection->port_id,
'desc' => '更换充电口,下发关闭口子',
'type' => 1,
'created_at' => $date
]);
......@@ -252,26 +227,21 @@ class ChangePortController extends Controller
$order = new Order();
$order->setId($orderId);
$waitingCharger = new WaitingCharger($order, RedisSingle::getRedis());
$order->setGatewayId($newGatewayId);
$order->setGatewayDeviceId($newNbDeviceID);
$order->setGatewayMac($newGatewayMac);
$waitingCharger->toChangePort($newPortId, $request->get('new_port_name'), $lastPortId, $newLogicNum);
//记录修改端口异常表
DB::table('wx_charger_orders')->where('id', $orderId)->update([
'port_id' => $request->get('new_port_id'),
'logic_num' => $newLogicNum,
'port_name' => $request->get('new_port_name'),
'gateway_id' => $newGatewayId,
'port_id' => $request->get('new_port_id'),
'logic_num' => $newLogicNum,
'port_name' => $request->get('new_port_name'),
'gateway_id' => $newGatewayId,
'change_times' => DB::raw('change_times + 1'),
'start_time' => null,
'is_charger' => -1,
'start_time' => null,
'is_charger' => -1,
]);
......
......@@ -10,14 +10,16 @@ namespace App\Http\Controllers\V1\Charger;
use App\Http\Controllers\Controller;
use App\Model\WxChargerOrderModel;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use Lib\cdz_order\Order;
use Lib\Crc;
use Lib\gateway\Gateway;
use Lib\gateway\port\Port;
use Lib\redis\RedisSingle;
use Lib\send\command\StopChargerCommand;
use Lib\send\Send;
use Lib\tool\StringTool;
use Validator;
use Log;
use DB;
......@@ -57,6 +59,8 @@ class StopController extends Controller
}
$gatewayType = $order->getGatewayType();
$gatewayId = $order->getGatewayId();
$portId = $order->getPortId();
......@@ -86,32 +90,79 @@ class StopController extends Controller
$stopCommand->setOrderId($id);
$send = new Send($stopCommand);
$sendResult = true;
$client = new Client();
iF ($gatewayType === 5) {
$content = $stopCommand->getMessageBody();
$length = 8;
$length += strlen($content) / 2;
$length = StringTool::padded($length, 4);
$nonce = StringTool::padded(rand(0, 255), 2);
$message = 'ffaa0405' . $length . $nonce . $content;
$crc = sprintf('%08x', Crc::crc($message));
$mic = substr($crc, 0, 2);
$message .= $mic;
if ($send->send() === false) {
$response = $client->request('POST', config('iot.iot_http_url') . '/message/sender', [
'form_params' => [
'device_id' => $order->getGatewayDeviceId(),
'content' => $message,
'key' => '6DEWXswackIHb8OnftJgCz5AolrMFKp3u9iUdZ7R24SLmBT10xyNGqvPjehQYV',
]
]);
Log::debug($response->getStatusCode());
$sendResult = $response->getStatusCode() === 200;
} else {
// $stopCommand->setClientUid($gatewayMac);
$send = new Send($stopCommand);
$sendResult = $send->send();
$message = $send->getMessage();
}
if ($sendResult === false) {
$this->returnCode = '50001';
$this->resultCode = 'FAIL';
$this->resultMessage = '网关离线';
$this->resultMessage = '网关离线/消息发送失败';
} else {
DB::table('gateway_log')->insert([
'request' => $send->getMessage(),
'command' => '04',
'request' => $message,
'command' => '05',
'station_id' => $port->getStationId(),
'gateway_id' => $gatewayId,
'order_id' => $id,
'port_id' => $portId,
'desc' => '主动结束充电,下发结束充电',
'type' => 1,
'order_id' => $id,
'port_id' => $portId,
'desc' => '主动结束充电,下发结束充电',
'type' => 1,
'created_at' => date('Y-m-d H:i:s'),
]);
}
Log::debug($this->getResponseCode());
return $this->response->array($this->getResponseCode());
......
......@@ -25,7 +25,7 @@ class TestController extends Controller
$logic = $request->get('logic');
$time = $request->get('time');
$time = $request->get('timer');
$time =sprintf('%04x',$time);
......
......@@ -27,14 +27,21 @@ class UpdateController extends Controller
'download_url' => 'required',
'hardware' => 'required',
'software' => 'required',
'time' => 'required',
'timer' => 'required',
'sign' => 'required',
]);
Log::debug($request->all());
if ($validator->fails() === true) {
abort(400, $validator->errors()->first());
}
$updateTime = $request->get('time');
$updateTime = $request->get('timer');
if (strlen($updateTime) > 10) {
$updateTime = substr($updateTime, 0, 10);
}
$gatewayMac = $request->get('gateway_mac');
$downloadUrl = $request->get('download_url');
$hardwareVersion = $request->get('hardware');
......@@ -45,8 +52,12 @@ class UpdateController extends Controller
$updateCommand->setHardware($hardwareVersion);
$updateCommand->setDownloadUrl($downloadUrl);
$updateCommand->setUpdateTime($updateTime);
$updateCommand->setSign($request->get('sign'));
$send = new Send($updateCommand);
if ($send->send() === true) {
Log::debug('发送成功');
return $this->response->array($this->getResponseCode());
} else {
$this->resultCode = 'FAIL';
......
......@@ -56,7 +56,7 @@ class PayController extends Controller
'station_id' => 'required|exists:stations,id',
'port_id' => 'required',
'amount' => 'required|numeric',
// 'time' => 'required|integer',
// 'timer' => 'required|integer',
'charger_type' => 'required|integer',
]);
......@@ -107,14 +107,14 @@ class PayController extends Controller
$amount = $request->get('amount');
$time = $request->get('time');
$time = $request->get('timer');
$payRule = json_decode($station->getPayTemplate(), true);
$result = false;
foreach ($payRule as $rule) {
if ((int)$rule['price'] === (int)($amount) && $rule['time'] === (int)$time) {
if ((int)$rule['price'] === (int)($amount) && $rule['timer'] === (int)$time) {
$result = true;
break;
......
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/11/14
* Time: 上午10:44
*/
namespace App\Http\Controllers\V1\timer;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
use Lib\redis\RedisSingle;
use DB;
use Lib\cdz_order\Order;
use Lib\gateway\port\Port;
class OrderScanController extends Controller
{
public function scan(Request $request)
{
if ($request->get('key') !== 'sE5jICwtbYrhnuSAUF3JTv0xXpQMG1Bfoy4aWgLP67zqKNVmd9O2HDei8lcZRk') {
return;
}
$date = date('Y-m-d H:i:s');
$expireOrders = DB::table('wx_charger_orders')->where([
['is_charger', '12'],//开始充电
['end_time', null],//没有结束时间
['state', '<>', 3],//没有退款
['state', '<>', 4],
['state', '<>', 1],//订单未结束
])->whereDate('created_at', '=', date('Y-m-d'))->get(['start_time', 'charger_time', 'id', 'port_id', 'station_id', 'gateway_id']);
$time = time();
$redis = RedisSingle::getRedis();
$port = new Port();
foreach ($expireOrders as $expireOrder) {
Log::debug($expireOrder->id);
$order = new Order();
$order->setId($expireOrder->id);
$cache = $order->getOrderCache($redis);
if ($cache === false) {
$startTime = strtotime($expireOrder->start_time);
} else {
$startTime = $cache['startTime'];
}
if (($time - $startTime) > ($expireOrder->charger_time * 60 + 60 * 5)) {
$result = DB::table('wx_charger_orders')->where('id', $expireOrder->id)->update([
'end_time' => date('Y-m-d H:i:s'),
'updated_at' => $date,
'state' => 1,
'is_stop' => 46,
]);
DB::table('gateway_log')->insert([
'gateway_id' => $expireOrder->gateway_id,
'station_id' => $expireOrder->station_id,
'port_id' => $expireOrder->port_id,
'order_id' => $expireOrder->id,
'type' => 1,
'desc' => '系统自动结束订单',
'command' => 'ff'
]);
$redis->hDel('cdz:port:using:order_id:hash', $expireOrder->port_id);
$redis->zRem('cdz:port:using:user_id:zset', $expireOrder->port_id);
$redis->del('cdz:order:state:' . $expireOrder->id);
$port->setPortId($expireOrder->port_id);
$state = $port->getState($redis, $expireOrder->port_id);
if ($state === 12) {
$port->setState(11);
}
}
}
}
}
\ No newline at end of file
......@@ -23,4 +23,10 @@ class GatewayModel extends Model
protected $dates = ['deleted_at'];
public function getnbDeviceIdAttribute($value)
{
return filled($value) ? $value : '';
}
}
\ No newline at end of file
......@@ -76,9 +76,9 @@ return [
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| The expire timer is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
| they have less timer to be guessed. You may change this as needed.
|
*/
......
......@@ -8,8 +8,9 @@
return [
'cert_path' => storage_path('cert/key.pem'),
'password' => 'IoM@1234',
'host' => 'https://180.101.147.89:8743/',
'app_key' => 'tWVEY6ruJIYnQ1XdadMZHU9IR0sa',
'cert_path' => storage_path('cert/key.pem'),
'password' => 'IoM@1234',
'host' => 'https://180.101.147.89:8743/',
'app_key' => 'tWVEY6ruJIYnQ1XdadMZHU9IR0sa',
'iot_http_url' => 'http://cdz-nb.test.senthink.com',
];
DB_DATABASE=cdzpay
DB_HOST=db.test.senthink.com
DB_PASSWORD=senthink123
DB_PORT=3306
DB_USERNAME=cdz
NB_HOST=http://cdz-nb.test.senthink.com
\ No newline at end of file
<?php
namespace Lib;
class Crc
{
const CRC_TABLE = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
];
/**
* @param $data
* @return int
*/
public static function crc($data)
{
$crc = 0xffffffff;
$size = strlen($data);
for ($i = 0; $i < $size; $i += 2) {
$numHex = substr($data, $i, 2);
$number = hexdec($numHex);
$tmp = ($crc ^ $number) & 0xff;
$crcRightMove = (hexdec(sprintf("%08x", $crc >> 8)));
$crc = ($crcRightMove) ^ (self::CRC_TABLE[$tmp]);
}
return $crc ^ 0xffffffff;
}
}
\ No newline at end of file
......@@ -14,6 +14,10 @@ use Lib\cdz_order\state\State;
class Order
{
private $gatewayDeviceId = '';
private $gatewayType = 1;
/**
* @var int
*/
......@@ -114,7 +118,7 @@ class Order
*/
public function getOrderCache(\Redis $redis)
{
if(isset($this->orderCache) === false){
if (isset($this->orderCache) === false) {
$keyName = State::ORDER_HASH_PREFIX . $this->id;
......@@ -387,10 +391,37 @@ class Order
$this->outTradeNo = $outTradeNo;
}
/**
* @return string
*/
public function getGatewayDeviceId(): string
{
return $this->gatewayDeviceId;
}
/**
* @param string $gatewayDeviceId
*/
public function setGatewayDeviceId(string $gatewayDeviceId): void
{
$this->gatewayDeviceId = $gatewayDeviceId;
}
/**
* @return int
*/
public function getGatewayType(): int
{
return $this->gatewayType;
}
/**
* @param int $gatewayType
*/
public function setGatewayType(int $gatewayType): void
{
$this->gatewayType = $gatewayType;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/28
* Time: 上午10:47
*/
namespace Lib\iot;
use Lib\redis\RedisSingle;
use Psr\Http\Message\ResponseInterface;
class AccessToken implements Request
{
const ACCESS_CACHE_KEY = 'cdz:iot:access_token';
const REFRESH_ACCESS_CACHE_KEY = 'cdz:iot:refresh_token';
protected $url = 'iocm/app/sec/v1.1.0/login';
protected $method = 'POST';
protected $formData = [];
private $appId = '';
private $appSecret = '';
private $accessToken = '';
private $refreshToken = '';
public function __construct()
{
$this->appId = env('IOT_APP_ID');
$this->appSecret = env('IOT_APP_SECRET');
}
public function getReturnCode(): int
{
return 200;
}
public function isJson(): bool
{
return false;
}
public function parseResponse(ResponseInterface $response)
{
$body = json_decode($response->getBody(), true);
$this->accessToken = $body['accessToken'];
$expiresLn = $body['expiresIn'];
$this->refreshToken = $body['refreshToken'];
$redis = app('Redis');
if ($redis instanceof \Redis) {
$redis->set(self::ACCESS_CACHE_KEY, $this->accessToken, $expiresLn);
$redis->set(self::REFRESH_ACCESS_CACHE_KEY, $this->refreshToken, 25 * 24 * 60);
}
}
public static function getAccessTokenCache()
{
$redis = RedisSingle::getRedis();
// $redis->del(self::ACCESS_CACHE_KEY);
// $redis->del(self::REFRESH_ACCESS_CACHE_KEY);
if ($redis->exists(self::ACCESS_CACHE_KEY) == true) {
return $redis->get(self::ACCESS_CACHE_KEY);
} else if ($redis->exists(self::REFRESH_ACCESS_CACHE_KEY) === true) {
//todo refresh 换取token 并缓存新的token和新的refresh
$refreshToken = new RefreshToken();
$refreshToken->setRefreshToken($redis->get(self::REFRESH_ACCESS_CACHE_KEY));
$iotClient = new IotClient($refreshToken);
if ($iotClient->request() === true) {
$response = $iotClient->getResponse();
$accessToken = $refreshToken->parseResponse($response);
return $accessToken->getAccessToken();
}
} else {
//todo 请求token
$accessToken = new AccessToken();
$iotClient = new IotClient($accessToken);
if ($iotClient->request() === true) {
$accessToken->parseResponse($iotClient->getResponse());
return $accessToken->getAccessToken();
}
}
}
/**
* @return mixed|string
*/
public function getAppId()
{
return $this->appId;
}
/**
* @param mixed|string $appId
*/
public function setAppId($appId): void
{
$this->appId = $appId;
}
/**
* @return mixed|string
*/
public function getAppSecret()
{
return $this->appSecret;
}
/**
* @param mixed|string $appSecret
*/
public function setAppSecret($appSecret): void
{
$this->appSecret = $appSecret;
}
/**
* @return string
*/
public function getAccessToken(): string
{
return $this->accessToken;
}
/**
* @param string $accessToken
*/
public function setAccessToken(string $accessToken): void
{
$this->accessToken = $accessToken;
}
/**
* @return string
*/
public function getRefreshToken(): string
{
return $this->refreshToken;
}
/**
* @param string $refreshToken
*/
public function setRefreshToken(string $refreshToken): void
{
$this->refreshToken = $refreshToken;
}
/**
* @return string
*/
public function getUrl(): string
{
return $this->url;
}
/**
* @param string $url
*/
public function setUrl(string $url): void
{
$this->url = $url;
}
/**
* @return string
*/
public function getMethod(): string
{
return $this->method;
}
/**
* @param string $method
*/
public function setMethod(string $method): void
{
$this->method = $method;
}
/**
* @return array
*/
public function getFormData(): array
{
$this->formData = [
'appId' => $this->appId,
'secret' => $this->appSecret,
];
return $this->formData;
}
/**
* @param array $formData
*/
public function setFormData(array $formData): void
{
$this->formData = $formData;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/28
* Time: 上午10:51
*/
namespace Lib\iot;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
use Psr\Http\Message\ResponseInterface;
class IotClient
{
/**
* @var Request
*/
private $request;
private $headers = [];
/**
* @var ResponseInterface
*/
private $response;
public function __construct(Request $request)
{
$this->request = $request;
}
public function setDefaultHeader()
{
$this->headers = [
'app_key' => env('IOT_APP_ID'),
'Authorization' => 'Bearer ' . AccessToken::getAccessTokenCache(),
];
if ($this->request->isJson() === true) {
$this->headers['Content-Type'] = 'application/json';
}
}
/**
* @param int $returnCode
* @return bool
*/
public function request($returnCode = 200): bool
{
$client = new Client();
$request = [
'verify' => false,
'cert' => [
config('iot.cert_path'),
'IoM@1234',
]
];
if (filled($this->headers) === true) {
$request['headers'] = $this->headers;
}
if ($this->request->isJson() === false) {
$request['form_params'] = $this->request->getFormData();
$this->response = $client->request($this->request->getMethod(), config('iot.host') . $this->request->getUrl(), $request);
} else {
$request['json'] = $this->request->getFormData();
$this->response = $client->request($this->request->getMethod(), config('iot.host') . $this->request->getUrl(), $request);
}
return $this->response->getStatusCode() === $returnCode;
}
/**
* @return ResponseInterface
*/
public function getResponse(): ResponseInterface
{
return $this->response;
}
/**
* @return Request
*/
public function getRequest(): Request
{
return $this->request;
}
/**
* @param Request $request
*/
public function setRequest(Request $request): void
{
$this->request = $request;
}
/**
* @return array
*/
public function getHeaders(): array
{
return $this->headers;
}
/**
* @param array $headers
*/
public function setHeaders(array $headers): void
{
$this->headers = $headers;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/29
* Time: 上午10:54
*/
namespace Lib\iot;
use Psr\Http\Message\ResponseInterface;
class RefreshToken implements Request
{
private $refreshToken = '';
/**
* @param ResponseInterface $response
* @return AccessToken
*/
public function parseResponse(ResponseInterface $response)
{
$accessToken = new AccessToken();
$accessToken->parseResponse($response);
return $accessToken;
}
public function getReturnCode(): int
{
return 200;
}
public function isJson(): bool
{
return true;
}
public function getUrl(): string
{
return 'iocm/app/sec/v1.1.0/refreshToken';
}
public function getMethod(): string
{
return 'POST';
}
public function getFormData(): array
{
return [
'appId' => env('IOT_APP_ID'),
'secret' => env('IOT_APP_SECRET'),
'refreshToken' => $this->refreshToken
];
}
/**
* @return string
*/
public function getRefreshToken(): string
{
return $this->refreshToken;
}
/**
* @param string $refreshToken
*/
public function setRefreshToken(string $refreshToken): void
{
$this->refreshToken = $refreshToken;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/28
* Time: 上午10:49
*/
namespace Lib\iot;
use Psr\Http\Message\ResponseInterface;
interface Request
{
public function getReturnCode(): int;
public function getUrl(): string;
public function getMethod(): string;
public function getFormData(): array;
public function parseResponse(ResponseInterface $response);
public function isJson(): bool;
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/29
* Time: 上午11:45
*/
namespace Lib\iot\command;
use Lib\iot\Request;
use Lib\ToHex;
class ChargerCommand extends Command
{
protected $command = '04';
private $type = 1;
private $portLogic = 0;
private $orderId = 0;
private $time = 0;
public function organizeMessage()
{
$this->message = ToHex::toHex($this->type, 1) . ToHex::toHex($this->portLogic, 1) . ToHex::toHex($this->orderId, 6) . ToHex::toHex($this->time, 2);
}
/**
* @return int
*/
public function getType(): int
{
return $this->type;
}
/**
* @param int $type
*/
public function setType(int $type): void
{
$this->type = $type;
}
/**
* @return int
*/
public function getPortLogic(): int
{
return $this->portLogic;
}
/**
* @param int $portLogic
*/
public function setPortLogic(int $portLogic): void
{
$this->portLogic = $portLogic;
}
/**
* @return int
*/
public function getOrderId(): int
{
return $this->orderId;
}
/**
* @param int $orderId
*/
public function setOrderId(int $orderId): void
{
$this->orderId = $orderId;
}
/**
* @return int
*/
public function getTime(): int
{
return $this->time;
}
/**
* @param int $time
*/
public function setTime(int $time): void
{
$this->time = $time;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/29
* Time: 上午11:38
*/
namespace Lib\iot\command;
use Lib\iot\Request;
use Psr\Http\Message\ResponseInterface;
abstract class Command
{
protected $crc = '';
protected $command = '';
protected $encrypt = '04';
protected $length = 0;
protected $serviceId = '';
protected $method = '';
protected $paras = [];
protected $message = '';
abstract public function organizeMessage();
/**
* @return string
*/
public function getCrc(): string
{
return $this->crc;
}
/**
* @param string $crc
*/
public function setCrc(string $crc): void
{
$this->crc = $crc;
}
/**
* @return string
*/
public function getCommand(): string
{
return $this->command;
}
/**
* @param string $command
*/
public function setCommand(string $command): void
{
$this->command = $command;
}
/**
* @return string
*/
public function getEncrypt(): string
{
return $this->encrypt;
}
/**
* @param string $encrypt
*/
public function setEncrypt(string $encrypt): void
{
$this->encrypt = $encrypt;
}
/**
* @return int
*/
public function getLength(): int
{
return $this->length;
}
/**
* @param int $length
*/
public function setLength(int $length): void
{
$this->length = $length;
}
/**
* @return string
*/
public function getServiceId(): string
{
return $this->serviceId;
}
/**
* @param string $serviceId
*/
public function setServiceId(string $serviceId): void
{
$this->serviceId = $serviceId;
}
/**
* @return string
*/
public function getMethod(): string
{
return $this->method;
}
/**
* @param string $method
*/
public function setMethod(string $method): void
{
$this->method = $method;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
/**
* @param string $message
*/
public function setMessage(string $message): void
{
$this->message = $message;
}
public function getParas()
{
return json_encode($this->message);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/29
* Time: 上午11:34
*/
namespace Lib\iot\command;
use Illuminate\Support\Facades\Log;
use Lib\iot\AccessToken;
use Lib\iot\IotClient;
use Lib\iot\Request;
use Lib\ToHex;
use Psr\Http\Message\ResponseInterface;
/**
* 发送命令至iot设备
* Class Send
* @package Lib\iot\command
*/
class Send implements Request
{
protected $accessToken = '';
protected $appKey = '';
protected $contentType = 'application/json';
protected $appId = '';
protected $deviceId = '';
protected $command = '';
protected $commandInstance;
protected $callBackUrl = '';
protected $expireTime = 0;
protected $maxRetransmit = 2;
private $response;
/**
* Send constructor.
* @param Command $command
* @throws \Exception
*/
public function __construct(Command $command)
{
$this->appId = env('IOT_APP_ID');
$this->appKey = env('IOT_APP_ID');
$this->commandInstance = $command;
$body = $this->commandInstance->getMessage();
$nonce = ToHex::toHex(rand(1, 255), 1);
$length = 7 + strlen($body) / 2;
$message = 'ffaa' . $this->commandInstance->getEncrypt() . ToHex::toHex($length, 2) . $nonce . $body;
Log::debug($message);
if ($this->commandInstance->getEncrypt() === '04') {
$this->command = [
'serviceId' => $this->commandInstance->getServiceId(),
'method' => $this->commandInstance->getMethod(),
'paras' => ['downData' => $message],
];
} else {
throw new \Exception('no encrypt function');
}
}
public function getReturnCode(): int
{
return 201;
}
public function send(): bool
{
$iotClient = new IotClient($this);
$iotClient->setHeaders([
'app_key' => $this->appKey,
'Authorization' => 'Bearer ' . AccessToken::getAccessTokenCache(),
'Content-Type' => 'application/json'
]);
if ($iotClient->request($this->getReturnCode()) === true) {
$this->response = $iotClient->getResponse();
return true;
}
return false;
}
public function getUrl(): string
{
return 'iocm/app/cmd/v1.4.0/deviceCommands';
}
public function isJson(): bool
{
return true;
}
public function getMethod(): string
{
return 'POST';
// TODO: Implement getMethod() method.
}
public function getFormData(): array
{
return [
'deviceId' => $this->deviceId,
'command' => $this->command,
// 'callbackUrl' => $this->callBackUrl,
'expireTime' => $this->expireTime,
'maxRetransmit' => $this->maxRetransmit,
];
}
public function parseResponse(ResponseInterface $response)
{
$this->response = $response;
}
/**
* @return string
*/
public function getAccessToken(): string
{
return $this->accessToken;
}
/**
* @param string $accessToken
*/
public function setAccessToken(string $accessToken): void
{
$this->accessToken = $accessToken;
}
/**
* @return string
*/
public function getAppKey(): string
{
return $this->appKey;
}
/**
* @param string $appKey
*/
public function setAppKey(string $appKey): void
{
$this->appKey = $appKey;
}
/**
* @return string
*/
public
function getContentType(): string
{
return $this->contentType;
}
/**
* @param string $contentType
*/
public function setContentType(string $contentType): void
{
$this->contentType = $contentType;
}
/**
* @return string
*/
public function getAppId(): string
{
return $this->appId;
}
/**
* @param string $appId
*/
public function setAppId(string $appId): void
{
$this->appId = $appId;
}
/**
* @return string
*/
public function getDeviceId(): string
{
return $this->deviceId;
}
/**
* @param string $deviceId
*/
public function setDeviceId(string $deviceId): void
{
$this->deviceId = $deviceId;
}
/**
* @return array|string
*/
public function getCommand()
{
return $this->command;
}
/**
* @param array|string $command
*/
public function setCommand($command): void
{
$this->command = $command;
}
/**
* @return Command
*/
public function getCommandInstance(): Command
{
return $this->commandInstance;
}
/**
* @param Command $commandInstance
*/
public function setCommandInstance(Command $commandInstance): void
{
$this->commandInstance = $commandInstance;
}
/**
* @return string
*/
public function getCallBackUrl(): string
{
return $this->callBackUrl;
}
/**
* @param string $callBackUrl
*/
public function setCallBackUrl(string $callBackUrl): void
{
$this->callBackUrl = $callBackUrl;
}
/**
* @return int
*/
public function getExpireTime(): int
{
return $this->expireTime;
}
/**
* @param int $expireTime
*/
public function setExpireTime(int $expireTime): void
{
$this->expireTime = $expireTime;
}
/**
* @return int
*/
public function getMaxRetransmit(): int
{
return $this->maxRetransmit;
}
/**
* @param int $maxRetransmit
*/
public function setMaxRetransmit(int $maxRetransmit): void
{
$this->maxRetransmit = $maxRetransmit;
}
/**
* @return ResponseInterface
*/
public function getResponse(): ResponseInterface
{
return $this->response;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/10/10
* Time: 上午10:44
*/
namespace Lib\iot\subscribe;
use Illuminate\Support\Facades\Log;
use Lib\iot\Request;
use Psr\Http\Message\ResponseInterface;
class Business implements Request
{
private $notifyType = 'deviceDataChanged';
private $callBackUrl = '';
public function __construct()
{
$this->callBackUrl = route('deviceMessageReceiver', [], true);
$this->callBackUrl = str_replace('com', 'com:443', $this->callBackUrl);
}
public function getReturnCode(): int
{
return 201;
}
public function getUrl(): string
{
return 'iocm/app/sub/v1.2.0/subscriptions';
// TODO: Implement getUrl() method.
}
public function getMethod(): string
{
return 'POST';
}
public function getFormData(): array
{
return [
'callbackUrl' => $this->callBackUrl,
'notifyType' => $this->notifyType,
];
}
public function parseResponse(ResponseInterface $response)
{
Log::debug($response->getBody());
}
public function isJson(): bool
{
return true;
// TODO: Implement isJson() method.
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/10/10
* Time: 上午11:13
*/
namespace Lib\iot\subscribe;
use Illuminate\Support\Facades\Log;
use Lib\iot\Request;
use Psr\Http\Message\ResponseInterface;
class QueryMass implements Request
{
public function getReturnCode(): int
{
return 200;
}
public function getUrl(): string
{
return 'iocm/app/sub/v1.2.0/subscriptions';
}
public function getMethod(): string
{
return 'GET';
}
public function getFormData(): array
{
return [];
}
public function parseResponse(ResponseInterface $response)
{
Log::debug($response->getBody());
}
public function isJson(): bool
{
return false;
}
}
\ No newline at end of file
......@@ -31,7 +31,7 @@ class UserUsingPort
$redis->hSet($key,$orderId,json_encode([
'time' => $chargerTime,
'timer' => $chargerTime,
]));
......
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/11/5
* Time: 上午9:55
*/
namespace Lib\send;
use GuzzleHttp\Client;
use Lib\Crc;
use Lib\iot\AccessToken;
use Lib\Log;
use Lib\tool\StringTool;
class IotSend
{
private $command;
protected $expireTime = 0;
protected $maxRetransmit = 2;
private $message = '';
public function __construct(Command $command)
{
$this->command = $command;
}
public function send()
{
$headers = [
'app_key' => env('IOT_APP_ID'),
'Authorization' => 'Bearer ' . AccessToken::getAccessTokenCache(),
'Content-Type' => 'application/json'
];
$request = [
'verify' => false,
'cert' => [
'./key.pem',
'IoM@1234',
]
];
$request['headers'] = $headers;
$client = new Client();
$serviceId = time() . rand(100000, 999999);
$content = $this->command->getMessageBody();
$length = 8;
$length += strlen($content) / 2;
$length = StringTool::padded($length, 4);
$nonce = StringTool::padded(rand(0, 255), 2);
$message = 'ffaa0405' . $length . $nonce . $content;
$crc = sprintf('%08x', Crc::crc($message));
$mic = substr($crc, 0, 2);
$this->message = $message .= $mic;
// $request['json'] = [
// 'deviceId' => $this->command->getClientUid(),
// 'command' => [
//
// 'serviceId' => $serviceId,
// 'method' => 'Cmd_Res',
// 'paras' => ['downData' => $message],
// ],
// 'expireTime' => $this->expireTime,
// 'maxRetransmit' => $this->maxRetransmit,
//
// ];
//
//
// Log::debug($message);
//
//
// $url = 'iocm/app/cmd/v1.4.0/deviceCommands';
//
// $response = $client->request('POST', config('iot.host') . $url, $request);
//
// Log::debug($response->getStatusCode());
//
// var_dump($response->getStatusCode());
$client = new Client();
$response = $client->request('POST', getenv('NB_HOST') . '/message/sender', [
'form_params' => [
'device_id' => $this->command->getClientUid(),
'content' => $message,
'key' => '6DEWXswackIHb8OnftJgCz5AolrMFKp3u9iUdZ7R24SLmBT10xyNGqvPjehQYV',
]
]);
return $response->getStatusCode() === 200;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
/**
* @param string $message
*/
public function setMessage(string $message): void
{
$this->message = $message;
}
}
\ No newline at end of file
......@@ -9,7 +9,9 @@
namespace Lib\send;
use GuzzleHttp\Client;
use Lib\Gateway;
use Lib\send\command\StopChargerCommand;
use Lib\tool\Crc;
use Lib\tool\StringTool;
......@@ -92,6 +94,20 @@ class Send
$this->message = $message = $this->makeMessage();
if ($this->command instanceof StopChargerCommand) {
if ($this->command->getGatewayType() === 5) {
$client = new Client();
$response = $client->request('POST', getenv('NB_HOST') . '/message/sender', [
'form_params' => [
'device_id' => $this->command->getGatewayDeviceId(),
'content' => $message,
'key' => '6DEWXswackIHb8OnftJgCz5AolrMFKp3u9iUdZ7R24SLmBT10xyNGqvPjehQYV',
]
]);
return $response->getStatusCode() === 200;
}
}
if (Gateway::isUidOnline($clientUid) === 1) {
......
......@@ -8,13 +8,15 @@
namespace Lib\send\command;
use Lib\tool\Crc;
use Lib\send\Command;
class StopChargerCommand extends Command
{
private $gatewayType = 1;
private $gatewayDeviceId = '';
/**
* @var int
*/
......@@ -172,7 +174,37 @@ class StopChargerCommand extends Command
$this->clientUid = $clientUid;
}
/**
* @return int
*/
public function getGatewayType(): int
{
return $this->gatewayType;
}
/**
* @param int $gatewayType
*/
public function setGatewayType(int $gatewayType): void
{
$this->gatewayType = $gatewayType;
}
/**
* @return string
*/
public function getGatewayDeviceId(): string
{
return $this->gatewayDeviceId;
}
/**
* @param string $gatewayDeviceId
*/
public function setGatewayDeviceId(string $gatewayDeviceId): void
{
$this->gatewayDeviceId = $gatewayDeviceId;
}
}
\ No newline at end of file
Bag Attributes
localKeyID: E2 22 EC 85 05 50 93 61 45 50 EA 4C 0D 72 95 38 AC CC C8 73
subject=/C=CN/ST=GD/L=SZ/O=Huawei/OU=CN/CN=www.smarthome-demo.com
issuer=/C=CN/ST=GD/L=SZ/O=Huawei/OU=CN/CN=IOT
-----BEGIN CERTIFICATE-----
MIIDVjCCAj6gAwIBAgIJAJCrWqXqdcxuMA0GCSqGSIb3DQEBCwUAMFMxCzAJBgNV
BAYTAkNOMQswCQYDVQQIEwJHRDELMAkGA1UEBxMCU1oxDzANBgNVBAoTBkh1YXdl
aTELMAkGA1UECxMCQ04xDDAKBgNVBAMTA0lPVDAeFw0xNjA1MDQxMjM1NTRaFw0y
NjA1MDIxMjM1NTRaMGYxCzAJBgNVBAYTAkNOMQswCQYDVQQIEwJHRDELMAkGA1UE
BxMCU1oxDzANBgNVBAoTBkh1YXdlaTELMAkGA1UECxMCQ04xHzAdBgNVBAMTFnd3
dy5zbWFydGhvbWUtZGVtby5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQDXabyOJ/boRw8kqMOGzlVqoq6eSeeeeYPni7QL3IlTYCIP4AdZ3W4S4Tki
tSE7YwwVDlIipEhqDVHthR2YPU7sYELhqrDqxHtjXGnMEmmWCvauV6kstrMSQMKT
DFD3ATlJwVGqBRw81GtpRSeo2lCibXMk8Y4mZJy1d7U70VgRaq/Vhjv6oTPcFLsW
IVevMuMwZj3/+C4oLIr6WARo84stMhEFMR0IIbaVbmy8sbt28bq33fz6+n5V2R+g
r97DbQ9wEtb+q2aPPyGYJke3F4j8F/Kw0QTlYcnpO6+Ghs37Iv10r6cN7meigD5/
gYr8O1VAFmeIqldKjIPQkoFFfOXBAgMBAAGjGjAYMAkGA1UdEwQCMAAwCwYDVR0P
BAQDAgXgMA0GCSqGSIb3DQEBCwUAA4IBAQCQebgg89ZZMW9R3yQ7tSeOVCt2M/tO
gZRaLrKMxWRJZngQeg+SVeJvkXcxlRTgwqElcVG/i7zguZjO/ff39Y8MPcWAaNIy
yTmt7kuP7YAS6Jf7unUA2y76mXsPiFJAOMLVm/CO+/BP2a0HJGm+6B+1TZzBZeQl
zeOxesFrEAJxopBkHpmgQNJM/E/5AAgrI1gNB5DrG2Zn3/M0FF+FLDv9QGWZJ5ay
R1Wn5WCMpPqFm6PP7qG2n+a4wzqxjaeVBBmv6X2cvHNVVUZ/zDdIMOtzQs6KMqWo
wZIpeAax6+fhzGh3X482oJRpSS8ZNSFBycN9tYlk69NuPB9bD6Kxhnrv
-----END CERTIFICATE-----
Bag Attributes
localKeyID: E2 22 EC 85 05 50 93 61 45 50 EA 4C 0D 72 95 38 AC CC C8 73
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDXabyOJ/boRw8k
qMOGzlVqoq6eSeeeeYPni7QL3IlTYCIP4AdZ3W4S4TkitSE7YwwVDlIipEhqDVHt
hR2YPU7sYELhqrDqxHtjXGnMEmmWCvauV6kstrMSQMKTDFD3ATlJwVGqBRw81Gtp
RSeo2lCibXMk8Y4mZJy1d7U70VgRaq/Vhjv6oTPcFLsWIVevMuMwZj3/+C4oLIr6
WARo84stMhEFMR0IIbaVbmy8sbt28bq33fz6+n5V2R+gr97DbQ9wEtb+q2aPPyGY
Jke3F4j8F/Kw0QTlYcnpO6+Ghs37Iv10r6cN7meigD5/gYr8O1VAFmeIqldKjIPQ
koFFfOXBAgMBAAECggEAbfdcenWMZidgY6aDql3K3RUPb17rDsuZuqpmz2dV82ov
+Uq0dfvEJX80W7N7s4VstZMJ+wVCsmD6YfaClSU3FRRPEETC7BZBpweWOsdrf105
cObvRhQ+diL5MXgoHPBS/oPh3JmfQK5v5t2W0Wwhncmh7koh9xeFqF3j9xV3j+um
cTEq0IAxvlaWaR4fYq7xy/U6I8TuDsrHTnPgp8CdHSMMQ0oj+SxMCJMorYjRkHrx
VghrR/ZEcLCdQD43uNDT5YqsfX9GjkvbqAaTf/ZqgN9DRexEKi0uRzqyPxyHSL6Y
dmEExGI6AKGou8hqj0qOd+5ifHVECcZgsEODdFsQAQKBgQD6tgCwkwUarYPRkEC/
l2JtI9/1LZrdY4dcGAZtAh5uSptBC/+oXT1l8yyYs2WBxOz2EzH8cRnhXTzbj5tB
r+xqn6NvtxYjm6Hs4/+pMXTX0lwuHspLwSplr5B71eAOOnuokusYtI/UIu87gDUe
HjuVQk8VOnR9bjBlO3xSnWk6cQKBgQDb9RpTr8JHeLHPM+/0hWbFLWeCDMU+f2et
SHY0Y8MUFmAjDfUK3PajueRnrlI7Nz+kjywNorf+foJy811l7dnrh5m/nHWFcwtw
TBGYeRJj2rEVs5NRRaEbGeQPIYprPGKEWLJZ6G+bMIKdpS6BAlJI2TI+wZod8FvL
ZuYJ/WvoUQKBgQClFccqfgS0ZmEQUx5vii1jlGXaOedptCnjeGZyzRxgn3vPvyjf
IlZVlWReQHKsmpE2D7mwcoEKJqz2Hn+rJz5Tjz69Rx+q3sYnCJLGRCyeGIReUiP+
8fkK8CoBgPmCJPxcKjHoGK1EkKRa17ciV+IADKOqZM1j8nSnlB3vAHvT4QKBgAN7
2FTm/b7ADKDpg61tx3jsBS2sIhuhTPUTpruhsN9Kk286s1zerxFcyl9SBX9mmp1y
nxIAN8XSHyLO8/W/VKpEVY0RX1MjxVSb/9NYZ5ApUJC1bWnmHm0ddd0/fL/CDxVl
ij2eTtY4aHkyuo/Uh5Uby43u5w/+VJXeJVqXJvRhAoGAAuPkfKD6+OdB2HNREpK7
jJ4b0dFygj8EJf7sxxM/QARAxAUVMTIO+oE3sQCfAdT19YR/3bPY1VFZB6Z18mc6
tD0UfdzUFTs0XAtT5P/zHSsoRSWmFMIEPXTjjE+42MaXnHi2Ul7bqCHr8rr1hIkB
DY5UCch6GiVKxDjWpHb+J4s=
-----END PRIVATE KEY-----
\ No newline at end of file
......@@ -12,6 +12,7 @@
"illuminate/database": "^5.6",
"guzzlehttp/guzzle": "^6.3",
"monolog/monolog": "^1.23",
"illuminate/events": "^5.6"
"illuminate/events": "^5.6",
"vlucas/phpdotenv": "^2.5"
}
}
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "47c9d4401aacfaf3641ef449fa2ecf37",
"content-hash": "df33cd535229d574ade8ae63540d8efe",
"packages": [
{
"name": "doctrine/inflector",
......@@ -949,6 +949,56 @@
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2018-05-21T10:09:47+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "http://www.vancelucas.com"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
],
"time": "2018-07-29T20:33:41+00:00"
}
],
"packages-dev": [],
......
......@@ -18,6 +18,9 @@ use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$dotenv = new \Dotenv\Dotenv(__DIR__);
$dotenv->load();
try {
$rabbitMq = new MyRabbitMq();
......@@ -62,14 +65,14 @@ try {
$capule->addConnection([
'driver' => 'mysql',
'host' => 'db.staging.senthink.com',
'database' => 'cdzpay',
'username' => 'senthink',
'password' => 'RRryCfWBXq2Whdq',
'charset' => 'utf8',
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_DATABASE'),
'username' => getenv('DB_USERNAME'),
'password' => getenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix' => '',
]);
$capule->setEventDispatcher(new Dispatcher(new Container()));
......@@ -80,15 +83,25 @@ try {
$message = json_decode($envelope->getBody(), true);
Log::debug('receiver', ['message' => json_decode($envelope->getBody(), true), 'time' => date('H:i:s')]);
Log::debug('receiver', ['message' => json_decode($envelope->getBody(), true), 'timer' => date('H:i:s')]);
$orderId = $message['order_id'];
$orderInfo = Capsule::table('wx_charger_orders')->where('id', $orderId)->first(['is_charger', 'port_id', 'state', 'wx_user_id', 'is_charger', 'station_id', 'gateway_id', 'order_amount', 'out_trade_no', 'logic_num', 'pay_type', 'station_name', 'port_name']);
$orderInfo = Capsule::table('wx_charger_orders')->where('id', $orderId)->first(['is_charger', 'port_id', 'state', 'wx_user_id', 'is_charger', 'station_id', 'gateway_id', 'order_amount', 'out_trade_no', 'logic_num', 'pay_type', 'station_name', 'port_name', 'id']);
$orderInfo = (Array)$orderInfo;
if (count($orderInfo) === 0) {
Log::error('can not find order_id ' . $orderId);
$queue->ack($envelope->getDeliveryTag());
return;
}
$stationName = $orderInfo['station_name'];
$portName = $orderInfo['port_name'];
$outTradeNo = $orderInfo['out_trade_no'];
......@@ -107,6 +120,8 @@ try {
$stationId = $orderInfo['station_id'];
$gatewayType = isset($message['gateway_type']) ? $message['gateway_type'] : 1;
$gatewayMac = Capsule::table('gateways')->where('id', $gatewayId)->first(['mac_address']);
$payType = $orderInfo['pay_type'];
......@@ -122,6 +137,7 @@ try {
return;
}
// 订单的端口id是否和消息中的相同,如果不同则发生过端口改变,无视该条消息
switch ($isCharger) {
......@@ -163,11 +179,11 @@ try {
$orderTrace->setData([
'out_refund_no' => $outRefundNo,
'refund_amount' => $totalFee,
'gateway_id' => $gatewayId,
'port_id' => $portId,
'station_id' => $stationId,
'out_trade_no' => $outTradeNo,
'total_fee' => $totalFee,
'gateway_id' => $gatewayId,
'port_id' => $portId,
'station_id' => $stationId,
'out_trade_no' => $outTradeNo,
'total_fee' => $totalFee,
]);
......@@ -207,22 +223,22 @@ try {
Capsule::table('wx_refund_orders')->insert([
'out_refund_no' => $outRefundNo,
'refund_amount' => $totalFee,
'gateway_id' => $gatewayId,
'port_id' => $portId,
'station_id' => $stationId,
'out_trade_no' => $outTradeNo,
'total_fee' => $totalFee,
'created_at' => $date,
'updated_at' => $date,
'desc' => $refundDesc,
'wx_user_id' => $userId,
'gateway_id' => $gatewayId,
'port_id' => $portId,
'station_id' => $stationId,
'out_trade_no' => $outTradeNo,
'total_fee' => $totalFee,
'created_at' => $date,
'updated_at' => $date,
'desc' => $refundDesc,
'wx_user_id' => $userId,
]);
Capsule::table('wx_charger_orders')->where('id', $orderId)->update([
'state' => 3,
'state' => 3,
'refund_amount' => $totalFee,
'refund_type' => 1,
'refund_type' => 1,
]);
Capsule::commit();
......@@ -244,35 +260,36 @@ try {
try {
Capsule::beginTransaction();
Capsule::table('wx_refund_orders')->insert([
'out_refund_no' => $outRefundNo,
'refund_amount' => $totalFee,
'gateway_id' => $gatewayId,
'port_id' => $portId,
'station_id' => $stationId,
'out_trade_no' => $outTradeNo,
'total_fee' => $totalFee,
'created_at' => $date,
'updated_at' => $date,
'desc' => $refundDesc,
'wx_user_id' => $userId,
'gateway_id' => $gatewayId,
'port_id' => $portId,
'station_id' => $stationId,
'out_trade_no' => $outTradeNo,
'total_fee' => $totalFee,
'created_at' => $date,
'updated_at' => $date,
'desc' => $refundDesc,
'wx_user_id' => $userId,
]);
Capsule::table('wx_users')->where('id', $userId)->update([
'wallet_balance' => Capsule::raw('wallet_balance +' . $totalFee),
'total_cost' => Capsule::raw('total_cost - ' . $totalFee),
'current_cost' => Capsule::raw('current_cost - ' . $totalFee),
'updated_at' => $date,
'total_cost' => Capsule::raw('total_cost - ' . $totalFee),
'current_cost' => Capsule::raw('current_cost - ' . $totalFee),
'updated_at' => $date,
]);
Capsule::table('wx_charger_orders')->where('id', $orderId)->update([
'state' => 3,
'state' => 3,
'refund_amount' => $totalFee,
'refund_type' => 1,
'updated_at' => $date,
'refund_type' => 1,
'updated_at' => $date,
]);
Capsule::commit();
......@@ -315,23 +332,29 @@ try {
$stopCommand->setLogicNum($logicNum);
if ($isCharger == 13) {
$stopCommand->setStopType(44);
} else {
$stopCommand->setStopType(43);
}
$send = new Send($stopCommand);
if ($gatewayType === 1 || $gatewayType === 4) {
$send = new Send($stopCommand);
} else {
$stopCommand->setStopType(43);
$iotDeviceId = $message['iot_device_id'];
$stopCommand->setClientUid($iotDeviceId);
$stopCommand->setGatewayMac($iotDeviceId);
$send = new Send($stopCommand);
}
$send = new \Lib\send\IotSend($stopCommand);
}
$redis = \Lib\redis\RedisSingle::getRedis();
$key = 'cdz:order:state:' . $orderId;
$redis->hSet($key, 'isRefund', 1);
$redis->expire($key, 60 * 60 * 24);
$redis->hDel('cdz:port:using:order_id:hash', $portId);
......@@ -344,16 +367,18 @@ try {
} else {
Log::debug('send' . $send->getMessage());
Capsule::table('gateway_log')->insert([
'port_id' => $portId,
'port_id' => $portId,
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'order_id' => $orderId,
'order_id' => $orderId,
'created_at' => date('Y-m-d H:i:s'),
'type' => 1,
'command' => '05',
'request' => $send->getMessage(),
'desc' => '退款,结束充电',
'type' => 1,
'command' => '05',
'request' => $send->getMessage(),
'desc' => '退款,结束充电',
]);
Log::debug('发送结束充电命令' . $orderId);
......
......@@ -18,6 +18,10 @@ use Lib\cdz_order\Order;
use Lib\redis\RedisSingle;
use Lib\rabbit_mq\PublishPortShed;
$dotenv = new \Dotenv\Dotenv(__DIR__);
$dotenv->load();
try {
$rabbitMq = new MyRabbitMq();
} catch (AMQPConnectionException $e) {
......@@ -60,14 +64,14 @@ try {
$capule->addConnection([
'driver' => 'mysql',
'host' => 'db.staging.senthink.com',
'database' => 'cdzpay',
'username' => 'senthink',
'password' => 'RRryCfWBXq2Whdq',
'charset' => 'utf8',
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_DATABASE'),
'username' => getenv('DB_USERNAME'),
'password' => getenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix' => '',
]);
$capule->setEventDispatcher(new Dispatcher(new Container()));
......@@ -106,6 +110,10 @@ try {
$stopCommand = new StopChargerCommand();
if ($order->getGatewayType() === 5) {
$stopCommand->setGatewayType($order->getGatewayType());
$stopCommand->setGatewayDeviceId($order->getGatewayDeviceId());
}
$stopCommand->setOrderId($orderId);
$stopCommand->setGatewayMac($gatewayMac);
......@@ -126,13 +134,13 @@ try {
Capsule::table('gateway_log')->insert([
'gateway_id' => $order->getGatewayId(),
'station_id' => $data['station_id'],
'port_id' => $order->getPortId(),
'command' => '05',
'port_id' => $order->getPortId(),
'command' => '05',
'created_at' => date('Y-m-d H:i:s'),
'desc' => '插口脱落超时,下发充电命令失败,网关不在线, 重新检测已达到3次,结束',
'request' => $send->getMessage(),
'type' => 1,
'order_id' => $orderId,
'desc' => '插口脱落超时,下发充电命令失败,网关不在线, 重新检测已达到3次,结束',
'request' => $send->getMessage(),
'type' => 1,
'order_id' => $orderId,
]);
return $queue->ack($envelope->getDeliveryTag());
......@@ -140,13 +148,13 @@ try {
Capsule::table('gateway_log')->insert([
'gateway_id' => $order->getGatewayId(),
'station_id' => $data['station_id'],
'port_id' => $order->getPortId(),
'command' => '05',
'port_id' => $order->getPortId(),
'command' => '05',
'created_at' => date('Y-m-d H:i:s'),
'desc' => '插口脱落超时,下发充电命令失败,网关不在线, 重新发布任务,十分钟后再次检测',
'request' => $send->getMessage(),
'type' => 1,
'order_id' => $orderId,
'desc' => '插口脱落超时,下发充电命令失败,网关不在线, 重新发布任务,十分钟后再次检测',
'request' => $send->getMessage(),
'type' => 1,
'order_id' => $orderId,
]);
$publishShedJob = new PublishPortShed();
......@@ -159,13 +167,13 @@ try {
Capsule::table('gateway_log')->insert([
'gateway_id' => $order->getGatewayId(),
'station_id' => $data['station_id'],
'port_id' => $order->getPortId(),
'command' => '05',
'port_id' => $order->getPortId(),
'command' => '05',
'created_at' => date('Y-m-d H:i:s'),
'desc' => '插口脱落超时,下发充电命令成功',
'request' => $send->getMessage(),
'type' => 1,
'order_id' => $orderId,
'desc' => '插口脱落超时,下发充电命令成功',
'request' => $send->getMessage(),
'type' => 1,
'order_id' => $orderId,
]);
}
......
......@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
......
......@@ -22,6 +22,7 @@ return array(
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'),
'' => array($vendorDir . '/nesbot/carbon/src'),
);
......@@ -51,6 +51,7 @@ class ComposerStaticInit8c119b004aa624b54e5609ed67b0bb28
),
'D' =>
array (
'Dotenv\\' => 7,
'Doctrine\\Common\\Inflector\\' => 26,
),
);
......@@ -120,6 +121,10 @@ class ComposerStaticInit8c119b004aa624b54e5609ed67b0bb28
array (
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
),
'Dotenv\\' =>
array (
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
),
'Doctrine\\Common\\Inflector\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector',
......
......@@ -976,5 +976,57 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com"
},
{
"name": "vlucas/phpdotenv",
"version": "v2.5.1",
"version_normalized": "2.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.0"
},
"time": "2018-07-29T20:33:41+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "http://www.vancelucas.com"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
]
}
]
......@@ -302,7 +302,7 @@ class Client implements ClientInterface
if (isset($options['form_params'])) {
if (isset($options['multipart'])) {
throw new \InvalidArgumentException('You cannot use '
. 'form_params and multipart at the same time. Use the '
. 'form_params and multipart at the same timer. Use the '
. 'form_params option if you want to send application/'
. 'x-www-form-urlencoded requests, and the multipart '
. 'option to send multipart/form-data requests.');
......
......@@ -88,7 +88,7 @@ final class RequestOptions
const DECODE_CONTENT = 'decode_content';
/**
* delay: (int) The amount of time to delay before sending in milliseconds.
* delay: (int) The amount of timer to delay before sending in milliseconds.
*/
const DELAY = 'delay';
......@@ -163,7 +163,7 @@ final class RequestOptions
* associated with your client. ``on_stats`` is a callable that is invoked
* when a handler has finished sending a request. The callback is invoked
* with transfer statistics about the request, the response received, or
* the error encountered. Included in the data is the total amount of time
* the error encountered. Included in the data is the total amount of timer
* taken to send the request.
*/
const ON_STATS = 'on_stats';
......
......@@ -20,7 +20,7 @@ final class TransferStats
/**
* @param RequestInterface $request Request that was sent.
* @param ResponseInterface $response Response received (if any)
* @param null $transferTime Total handler transfer time.
* @param null $transferTime Total handler transfer timer.
* @param mixed $handlerErrorData Handler error data.
* @param array $handlerStats Handler specific stats.
*/
......@@ -91,7 +91,7 @@ final class TransferStats
}
/**
* Get the estimated time the request was being transferred by the handler.
* Get the estimated timer the request was being transferred by the handler.
*
* @return float Time in seconds.
*/
......
......@@ -11,7 +11,7 @@ interface TaskQueueInterface
public function isEmpty();
/**
* Adds a task to the queue that will be executed the next time run is
* Adds a task to the queue that will be executed the next timer run is
* called.
*
* @param callable $task
......
......@@ -356,7 +356,7 @@ function each(
/**
* Like each, but only allows a certain number of outstanding promises at any
* given time.
* given timer.
*
* $concurrency may be an integer or a function that accepts the number of
* pending promises and returns a numeric concurrency limit value to allow for
......
......@@ -630,7 +630,7 @@ class Container implements ArrayAccess, ContainerContract
// If an instance of the type is currently being managed as a singleton we'll
// just return an existing instance instead of instantiating new instances
// so the developer can keep using the same objects instance every time.
// so the developer can keep using the same objects instance every timer.
if (isset($this->instances[$abstract]) && ! $needsContextualBuild) {
return $this->instances[$abstract];
}
......
......@@ -116,7 +116,7 @@ interface Filesystem
public function size($path);
/**
* Get the file's last modification time.
* Get the file's last modification timer.
*
* @param string $path
* @return int
......
......@@ -360,7 +360,7 @@ class Connection implements ConnectionInterface
// Next, we'll execute the query against the database and return the statement
// so we can return the cursor. The cursor will use a PHP generator to give
// back one row at a time without using a bunch of memory to render them.
// back one row at a timer without using a bunch of memory to render them.
$statement->execute();
return $statement;
......@@ -628,9 +628,9 @@ class Connection implements ConnectionInterface
);
}
// Once we have run the query we will calculate the time that it took to run and
// then log the query, bindings, and execution time so we will report them on
// the event that the developer needs them. We'll log time in milliseconds.
// Once we have run the query we will calculate the timer that it took to run and
// then log the query, bindings, and execution timer so we will report them on
// the event that the developer needs them. We'll log timer in milliseconds.
$this->logQuery(
$query, $bindings, $this->getElapsedTime($start)
);
......@@ -651,8 +651,8 @@ class Connection implements ConnectionInterface
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
// run the SQL against the PDO connection. Then we can calculate the timer it
// took to execute and log the query SQL, bindings and timer in our memory.
try {
$result = $callback($query, $bindings);
}
......@@ -687,7 +687,7 @@ class Connection implements ConnectionInterface
}
/**
* Get the elapsed time since a given starting point.
* Get the elapsed timer since a given starting point.
*
* @param int $start
* @return float
......
......@@ -76,7 +76,7 @@ class PostgresConnector extends Connector implements ConnectorInterface
if (isset($config['timezone'])) {
$timezone = $config['timezone'];
$connection->prepare("set time zone '{$timezone}'")->execute();
$connection->prepare("set timer zone '{$timezone}'")->execute();
}
}
......
......@@ -79,7 +79,7 @@ class MigrateCommand extends BaseCommand
// Finally, if the "seed" option has been given, we will re-run the database
// seed task to re-populate the database, which is convenient when adding
// a migration and a seed at the same time, as it is only this command.
// a migration and a seed at the same timer, as it is only this command.
if ($this->option('seed')) {
$this->call('db:seed', ['--force' => true]);
}
......
......@@ -519,7 +519,7 @@ trait HasAttributes
}
/**
* Determine if the cast type is a custom date time cast.
* Determine if the cast type is a custom date timer cast.
*
* @param string $cast
* @return bool
......@@ -683,7 +683,7 @@ trait HasAttributes
}
/**
* Return a timestamp as DateTime object with time set to 00:00:00.
* Return a timestamp as DateTime object with timer set to 00:00:00.
*
* @param mixed $value
* @return \Illuminate\Support\Carbon
......@@ -709,7 +709,7 @@ trait HasAttributes
}
// If the value is already a DateTime instance, we will just skip the rest of
// these checks since they will be a waste of time, and hinder performance
// these checks since they will be a waste of timer, and hinder performance
// when checking the field. We will just return the DateTime right away.
if ($value instanceof DateTimeInterface) {
return new Carbon(
......
......@@ -128,7 +128,7 @@ trait HasRelationships
{
// If no relation name was given, we will use this debug backtrace to extract
// the calling method's name and use that as the relationship name as most
// of the time this will be what we desire to use for the relationships.
// of the timer this will be what we desire to use for the relationships.
if (is_null($relation)) {
$relation = $this->guessBelongsToRelation();
}
......
......@@ -141,7 +141,7 @@ class Migrator
// Once we have the array of migrations, we will spin through them and run the
// migrations "up" so the changes are made to the databases. We'll then log
// that the migration was run so we don't repeat it next time we execute.
// that the migration was run so we don't repeat it next timer we execute.
foreach ($migrations as $file) {
$this->runUp($file, $batch, $pretend);
......@@ -177,7 +177,7 @@ class Migrator
$this->runMigration($migration, 'up');
// Once we have run a migrations class, we will log that it was run in this
// repository so that we don't try to run it next time we do a migration
// repository so that we don't try to run it next timer we do a migration
// in the application. A migration repository keeps the migrate order.
$this->repository->log($name, $batch);
......
......@@ -1091,7 +1091,7 @@ class Builder
}
/**
* Add a "where time" statement to the query.
* Add a "where timer" statement to the query.
*
* @param string $column
* @param string $operator
......@@ -1109,7 +1109,7 @@ class Builder
}
/**
* Add an "or where time" statement to the query.
* Add an "or where timer" statement to the query.
*
* @param string $column
* @param string $operator
......@@ -1231,7 +1231,7 @@ class Builder
}
/**
* Add a date based (year, month, day, time) statement to the query.
* Add a date based (year, month, day, timer) statement to the query.
*
* @param string $type
* @param string $column
......
......@@ -346,7 +346,7 @@ class Grammar extends BaseGrammar
}
/**
* Compile a "where time" clause.
* Compile a "where timer" clause.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $where
......@@ -354,7 +354,7 @@ class Grammar extends BaseGrammar
*/
protected function whereTime(Builder $query, $where)
{
return $this->dateBasedWhere('time', $query, $where);
return $this->dateBasedWhere('timer', $query, $where);
}
/**
......
......@@ -36,7 +36,7 @@ class PostgresGrammar extends Grammar
}
/**
* Compile a "where time" clause.
* Compile a "where timer" clause.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $where
......@@ -46,7 +46,7 @@ class PostgresGrammar extends Grammar
{
$value = $this->parameter($where['value']);
return $this->wrap($where['column']).'::time '.$where['operator'].' '.$value;
return $this->wrap($where['column']).'::timer '.$where['operator'].' '.$value;
}
/**
......
......@@ -117,7 +117,7 @@ class SQLiteGrammar extends Grammar
}
/**
* Compile a "where time" clause.
* Compile a "where timer" clause.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $where
......
......@@ -859,7 +859,7 @@ class Blueprint
}
/**
* Create a new date-time column on the table.
* Create a new date-timer column on the table.
*
* @param string $column
* @param int $precision
......@@ -871,7 +871,7 @@ class Blueprint
}
/**
* Create a new date-time column (with time zone) on the table.
* Create a new date-timer column (with timer zone) on the table.
*
* @param string $column
* @param int $precision
......@@ -883,7 +883,7 @@ class Blueprint
}
/**
* Create a new time column on the table.
* Create a new timer column on the table.
*
* @param string $column
* @param int $precision
......@@ -891,11 +891,11 @@ class Blueprint
*/
public function time($column, $precision = 0)
{
return $this->addColumn('time', $column, compact('precision'));
return $this->addColumn('timer', $column, compact('precision'));
}
/**
* Create a new time column (with time zone) on the table.
* Create a new timer column (with timer zone) on the table.
*
* @param string $column
* @param int $precision
......@@ -919,7 +919,7 @@ class Blueprint
}
/**
* Create a new timestamp (with time zone) column on the table.
* Create a new timestamp (with timer zone) column on the table.
*
* @param string $column
* @param int $precision
......
......@@ -602,7 +602,7 @@ class MySqlGrammar extends Grammar
}
/**
* Create the column definition for a date-time type.
* Create the column definition for a date-timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -613,7 +613,7 @@ class MySqlGrammar extends Grammar
}
/**
* Create the column definition for a date-time (with time zone) type.
* Create the column definition for a date-timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -624,18 +624,18 @@ class MySqlGrammar extends Grammar
}
/**
* Create the column definition for a time type.
* Create the column definition for a timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeTime(Fluent $column)
{
return $column->precision ? "time($column->precision)" : 'time';
return $column->precision ? "timer($column->precision)" : 'timer';
}
/**
* Create the column definition for a time (with time zone) type.
* Create the column definition for a timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -659,7 +659,7 @@ class MySqlGrammar extends Grammar
}
/**
* Create the column definition for a timestamp (with time zone) type.
* Create the column definition for a timestamp (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......
......@@ -575,47 +575,47 @@ class PostgresGrammar extends Grammar
}
/**
* Create the column definition for a date-time type.
* Create the column definition for a date-timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeDateTime(Fluent $column)
{
return "timestamp($column->precision) without time zone";
return "timestamp($column->precision) without timer zone";
}
/**
* Create the column definition for a date-time (with time zone) type.
* Create the column definition for a date-timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeDateTimeTz(Fluent $column)
{
return "timestamp($column->precision) with time zone";
return "timestamp($column->precision) with timer zone";
}
/**
* Create the column definition for a time type.
* Create the column definition for a timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeTime(Fluent $column)
{
return "time($column->precision) without time zone";
return "timer($column->precision) without timer zone";
}
/**
* Create the column definition for a time (with time zone) type.
* Create the column definition for a timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeTimeTz(Fluent $column)
{
return "time($column->precision) with time zone";
return "timer($column->precision) with timer zone";
}
/**
......@@ -626,20 +626,20 @@ class PostgresGrammar extends Grammar
*/
protected function typeTimestamp(Fluent $column)
{
$columnType = "timestamp($column->precision) without time zone";
$columnType = "timestamp($column->precision) without timer zone";
return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType;
}
/**
* Create the column definition for a timestamp (with time zone) type.
* Create the column definition for a timestamp (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeTimestampTz(Fluent $column)
{
$columnType = "timestamp($column->precision) with time zone";
$columnType = "timestamp($column->precision) with timer zone";
return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType;
}
......
......@@ -584,7 +584,7 @@ class SQLiteGrammar extends Grammar
}
/**
* Create the column definition for a date-time type.
* Create the column definition for a date-timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -595,7 +595,7 @@ class SQLiteGrammar extends Grammar
}
/**
* Create the column definition for a date-time (with time zone) type.
* Create the column definition for a date-timer (with timer zone) type.
*
* Note: "SQLite does not have a storage class set aside for storing dates and/or times."
* @link https://www.sqlite.org/datatype3.html
......@@ -609,18 +609,18 @@ class SQLiteGrammar extends Grammar
}
/**
* Create the column definition for a time type.
* Create the column definition for a timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeTime(Fluent $column)
{
return 'time';
return 'timer';
}
/**
* Create the column definition for a time (with time zone) type.
* Create the column definition for a timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -642,7 +642,7 @@ class SQLiteGrammar extends Grammar
}
/**
* Create the column definition for a timestamp (with time zone) type.
* Create the column definition for a timestamp (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......
......@@ -515,7 +515,7 @@ class SqlServerGrammar extends Grammar
}
/**
* Create the column definition for a date-time type.
* Create the column definition for a date-timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -526,7 +526,7 @@ class SqlServerGrammar extends Grammar
}
/**
* Create the column definition for a date-time (with time zone) type.
* Create the column definition for a date-timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -537,18 +537,18 @@ class SqlServerGrammar extends Grammar
}
/**
* Create the column definition for a time type.
* Create the column definition for a timer type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeTime(Fluent $column)
{
return $column->precision ? "time($column->precision)" : 'time';
return $column->precision ? "timer($column->precision)" : 'timer';
}
/**
* Create the column definition for a time (with time zone) type.
* Create the column definition for a timer (with timer zone) type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
......@@ -572,7 +572,7 @@ class SqlServerGrammar extends Grammar
}
/**
* Create the column definition for a timestamp (with time zone) type.
* Create the column definition for a timestamp (with timer zone) type.
*
* @link https://msdn.microsoft.com/en-us/library/bb630289(v=sql.120).aspx
*
......
......@@ -53,7 +53,7 @@ trait InteractsWithTime
}
/**
* Get the current system time as a UNIX timestamp.
* Get the current system timer as a UNIX timestamp.
*
* @return int
*/
......
......@@ -63,7 +63,7 @@ abstract class Manager
}
// If the given driver has not been created before, we will create the instances
// here and cache it so we can return it next time very quickly. If there is
// here and cache it so we can return it next timer very quickly. If there is
// already a driver created by this name, we'll just return that instance.
if (! isset($this->drivers[$driver])) {
$this->drivers[$driver] = $this->createDriver($driver);
......
......@@ -532,7 +532,7 @@ class Str
}
/**
* Generate a time-ordered UUID (version 4).
* Generate a timer-ordered UUID (version 4).
*
* @return \Ramsey\Uuid\UuidInterface
*/
......
......@@ -39,7 +39,7 @@ class PDOHandler extends AbstractProcessingHandler
'channel' => $record['channel'],
'level' => $record['level'],
'message' => $record['formatted'],
'time' => $record['datetime']->format('U'),
'timer' => $record['datetime']->format('U'),
));
}
......@@ -47,10 +47,10 @@ class PDOHandler extends AbstractProcessingHandler
{
$this->pdo->exec(
'CREATE TABLE IF NOT EXISTS monolog '
.'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)'
.'timer'
);
$this->statement = $this->pdo->prepare(
'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)'
'timer'
);
$this->initialized = true;
......
......@@ -58,7 +58,7 @@ class ErrorHandler
*/
public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
{
//Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929
//Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-timer on PHP5.3. See https://github.com/Seldaek/monolog/pull/929
class_exists('\\Psr\\Log\\LogLevel', true);
$handler = new static($logger);
......
......@@ -105,7 +105,7 @@ class CubeHandler extends AbstractProcessingHandler
{
$date = $record['datetime'];
$data = array('time' => $date->format('Y-m-d\TH:i:s.uO'));
$data = array('timer' => $date->format('Y-m-d\TH:i:s.uO'));
unset($record['datetime']);
if (isset($record['context']['type'])) {
......
......@@ -23,7 +23,7 @@ use Monolog\Logger;
* to the file specified by $deduplicationStore. When further logs come in at the end of the
* request (or when flush() is called), all those above $deduplicationLevel are checked
* against the existing stored logs. If they match and the timestamps in the stored log is
* not older than $time seconds, the new log record is discarded. If no log record is new, the
* not older than $timer seconds, the new log record is discarded. If no log record is new, the
* whole data set is discarded.
*
* This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers
......
......@@ -32,7 +32,7 @@ use PhpConsole\Helper;
* $logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler()));
* \Monolog\ErrorHandler::register($logger);
* echo $undefinedVar;
* $logger->addDebug('SELECT * FROM users', array('db', 'time' => 0.012));
* $logger->addDebug('SELECT * FROM users', array('db', 'timer' => 0.012));
* PC::debug($_SERVER); // PHP Console debugger for any type of vars
*
* @author Sergey Barbushin https://www.linkedin.com/in/barbushin
......
......@@ -135,7 +135,7 @@ class RotatingFileHandler extends StreamHandler
foreach (array_slice($logFiles, $this->maxFiles) as $file) {
if (is_writable($file)) {
// suppress errors here as unlink() might fail if two processes
// are cleaning up/rotating at the same time
// are cleaning up/rotating at the same timer
set_error_handler(function ($errno, $errstr, $errfile, $errline) {});
unlink($file);
restore_error_handler();
......
......@@ -263,7 +263,7 @@ class CarbonPeriod implements Iterator, Countable
}
/**
* Return whether given interval contains non zero value of any time unit.
* Return whether given interval contains non zero value of any timer unit.
*
* @param \DateInterval $interval
*
......
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minuut|:count minute',
'second' => ':count sekond|:count sekondes',
's' => ':count sekond|:count sekondes',
'ago' => ':time terug',
'from_now' => ':time van nou af',
'after' => ':time na',
'before' => ':time voor',
'ago' => ':timer terug',
'from_now' => ':timer van nou af',
'after' => ':timer na',
'before' => ':timer voor',
);
......@@ -24,8 +24,8 @@ return array(
'min' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة',
'second' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية',
's' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية',
'ago' => 'منذ :time',
'from_now' => ':time من الآن',
'after' => 'بعد :time',
'before' => 'قبل :time',
'ago' => 'منذ :timer',
'from_now' => ':timer من الآن',
'after' => 'بعد :timer',
'before' => 'قبل :timer',
);
......@@ -24,8 +24,8 @@ return array(
'min' => '[0,1] دَقِيقَة|{2} دَقِيقَتَيْن|[3,10]:count دَقَائِق|[11,Inf]:count دَقِيقَة',
'second' => '[0,1] ثَانِيَة|{2} ثَانِيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانِيَة',
's' => '[0,1] ثَانِيَة|{2} ثَانِيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانِيَة',
'ago' => 'مُنْذُ :time',
'from_now' => 'مِنَ الْآن :time',
'after' => 'بَعْدَ :time',
'before' => 'قَبْلَ :time',
'ago' => 'مُنْذُ :timer',
'from_now' => 'مِنَ الْآن :timer',
'after' => 'بَعْدَ :timer',
'before' => 'قَبْلَ :timer',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count dəqiqə',
'second' => ':count saniyə',
's' => ':count saniyə',
'ago' => ':time əvvəl',
'from_now' => ':time sonra',
'after' => ':time sonra',
'before' => ':time əvvəl',
'ago' => ':timer əvvəl',
'from_now' => ':timer sonra',
'after' => ':timer sonra',
'before' => ':timer əvvəl',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count минута|:count минути',
'second' => ':count секунда|:count секунди',
's' => ':count секунда|:count секунди',
'ago' => 'преди :time',
'from_now' => ':time от сега',
'after' => 'след :time',
'before' => 'преди :time',
'ago' => 'преди :timer',
'from_now' => ':timer от сега',
'after' => 'след :timer',
'before' => 'преди :timer',
);
......@@ -24,8 +24,8 @@ return array(
'min' => '১ মিনিট|:count মিনিট',
'second' => '১ সেকেন্ড|:count সেকেন্ড',
's' => '১ সেকেন্ড|:count সেকেন্ড',
'ago' => ':time পূর্বে',
'from_now' => 'এখন থেকে :time',
'after' => ':time পরে',
'before' => ':time আগে',
'ago' => ':timer পূর্বে',
'from_now' => 'এখন থেকে :timer',
'after' => ':timer পরে',
'before' => ':timer আগে',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minut|:count minuta|:count minuta',
'second' => ':count sekund|:count sekunda|:count sekundi',
's' => ':count sekund|:count sekunda|:count sekundi',
'ago' => 'prije :time',
'from_now' => 'za :time',
'after' => 'nakon :time',
'before' => ':time ranije',
'ago' => 'prije :timer',
'from_now' => 'za :timer',
'after' => 'nakon :timer',
'before' => ':timer ranije',
);
......@@ -24,10 +24,10 @@ return array(
'min' => ':count minut|:count minuts',
'second' => ':count segon|:count segons',
's' => ':count segon|:count segons',
'ago' => 'fa :time',
'from_now' => 'dins de :time',
'after' => ':time després',
'before' => ':time abans',
'ago' => 'fa :timer',
'from_now' => 'dins de :timer',
'after' => ':timer després',
'before' => ':timer abans',
'diff_now' => 'ara mateix',
'diff_yesterday' => 'ahir',
'diff_tomorrow' => 'demà',
......
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minutu|:count minuty|:count minut',
'second' => ':count sekundu|:count sekundy|:count sekund',
's' => ':count sekundu|:count sekundy|:count sekund',
'ago' => ':time nazpět',
'from_now' => 'za :time',
'after' => ':time později',
'before' => ':time předtím',
'ago' => ':timer nazpět',
'from_now' => 'za :timer',
'after' => ':timer později',
'before' => ':timer předtím',
);
......@@ -22,8 +22,8 @@ return array(
'min' => ':countm',
'second' => ':count eiliad',
's' => ':counts',
'ago' => ':time yn ôl',
'from_now' => ':time o hyn ymlaen',
'after' => ':time ar ôl',
'before' => ':time o\'r blaen',
'ago' => ':timer yn ôl',
'from_now' => ':timer o hyn ymlaen',
'after' => ':timer ar ôl',
'before' => ':timer o\'r blaen',
);
......@@ -18,14 +18,14 @@ return array(
'w' => ':count uge|:count uger',
'day' => ':count dag|:count dage',
'd' => ':count dag|:count dage',
'hour' => ':count time|:count timer',
'h' => ':count time|:count timer',
'hour' => ':count timer|:count timer',
'h' => ':count timer|:count timer',
'minute' => ':count minut|:count minutter',
'min' => ':count minut|:count minutter',
'second' => ':count sekund|:count sekunder',
's' => ':count sekund|:count sekunder',
'ago' => ':time siden',
'from_now' => 'om :time',
'after' => ':time efter',
'before' => ':time før',
'ago' => ':timer siden',
'from_now' => 'om :timer',
'after' => ':timer efter',
'before' => ':timer før',
);
......@@ -24,10 +24,10 @@ return array(
'min' => ':countMin|:countMin',
'second' => ':count Sekunde|:count Sekunden',
's' => ':countSek|:countSek',
'ago' => 'vor :time',
'from_now' => 'in :time',
'after' => ':time später',
'before' => ':time zuvor',
'ago' => 'vor :timer',
'from_now' => 'in :timer',
'after' => ':timer später',
'before' => ':timer zuvor',
'year_from_now' => ':count Jahr|:count Jahren',
'month_from_now' => ':count Monat|:count Monaten',
......
......@@ -24,8 +24,8 @@ return array(
'min' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް',
'second' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު',
's' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު',
'ago' => ':time ކުރިން',
'from_now' => ':time ފަހުން',
'after' => ':time ފަހުން',
'before' => ':time ކުރި',
'ago' => ':timer ކުރިން',
'from_now' => ':timer ފަހުން',
'after' => ':timer ފަހުން',
'before' => ':timer ކުރި',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count λεπτό|:count λεπτά',
'second' => ':count δευτερόλεπτο|:count δευτερόλεπτα',
's' => ':count δευτερόλεπτο|:count δευτερόλεπτα',
'ago' => 'πριν από :time',
'from_now' => 'σε :time από τώρα',
'after' => ':time μετά',
'before' => ':time πριν',
'ago' => 'πριν από :timer',
'from_now' => 'σε :timer από τώρα',
'after' => ':timer μετά',
'before' => ':timer πριν',
);
......@@ -24,10 +24,10 @@ return array(
'min' => ':countm|:countm',
'second' => ':count second|:count seconds',
's' => ':counts|:counts',
'ago' => ':time ago',
'from_now' => ':time from now',
'after' => ':time after',
'before' => ':time before',
'ago' => ':timer ago',
'from_now' => ':timer from now',
'after' => ':timer after',
'before' => ':timer before',
'diff_now' => 'just now',
'diff_yesterday' => 'yesterday',
'diff_tomorrow' => 'tomorrow',
......
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minuto|:count minutoj',
'second' => ':count sekundo|:count sekundoj',
's' => ':count sekundo|:count sekundoj',
'ago' => 'antaŭ :time',
'from_now' => 'je :time',
'after' => ':time poste',
'before' => ':time antaŭe',
'ago' => 'antaŭ :timer',
'from_now' => 'je :timer',
'after' => ':timer poste',
'before' => ':timer antaŭe',
);
......@@ -24,10 +24,10 @@ return array(
'min' => ':count minuto|:count minutos',
'second' => ':count segundo|:count segundos',
's' => ':count segundo|:count segundos',
'ago' => 'hace :time',
'from_now' => 'dentro de :time',
'after' => ':time después',
'before' => ':time antes',
'ago' => 'hace :timer',
'from_now' => 'dentro de :timer',
'after' => ':timer después',
'before' => ':timer antes',
'diff_now' => 'ahora mismo',
'diff_yesterday' => 'ayer',
'diff_tomorrow' => 'mañana',
......
......@@ -24,10 +24,10 @@ return array(
'min' => ':count minut|:count minutit',
'second' => ':count sekund|:count sekundit',
's' => ':count sekund|:count sekundit',
'ago' => ':time tagasi',
'from_now' => ':time pärast',
'after' => ':time pärast',
'before' => ':time enne',
'ago' => ':timer tagasi',
'from_now' => ':timer pärast',
'after' => ':timer pärast',
'before' => ':timer enne',
'year_from_now' => ':count aasta',
'month_from_now' => ':count kuu',
'week_from_now' => ':count nädala',
......
......@@ -24,8 +24,8 @@ return array(
'min' => 'Minutu 1|:count minutu',
'second' => 'Segundu 1|:count segundu',
's' => 'Segundu 1|:count segundu',
'ago' => 'Orain dela :time',
'from_now' => ':time barru',
'after' => ':time geroago',
'before' => ':time lehenago',
'ago' => 'Orain dela :timer',
'from_now' => ':timer barru',
'after' => ':timer geroago',
'before' => ':timer lehenago',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count دقیقه',
'second' => ':count ثانیه',
's' => ':count ثانیه',
'ago' => ':time پیش',
'from_now' => ':time بعد',
'after' => ':time پس از',
'before' => ':time پیش از',
'ago' => ':timer پیش',
'from_now' => ':timer بعد',
'after' => ':timer پس از',
'before' => ':timer پیش از',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minuutti|:count minuuttia',
'second' => ':count sekunti|:count sekuntia',
's' => ':count sekunti|:count sekuntia',
'ago' => ':time sitten',
'from_now' => ':time tästä hetkestä',
'after' => ':time sen jälkeen',
'before' => ':time ennen',
'ago' => ':timer sitten',
'from_now' => ':timer tästä hetkestä',
'after' => ':timer sen jälkeen',
'before' => ':timer ennen',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minutt|:count minuttir',
'second' => ':count sekund|:count sekundir',
's' => ':count sekund|:count sekundir',
'ago' => ':time síðan',
'from_now' => 'um :time',
'after' => ':time aftaná',
'before' => ':time áðrenn',
'ago' => ':timer síðan',
'from_now' => 'um :timer',
'after' => ':timer aftaná',
'before' => ':timer áðrenn',
);
......@@ -24,10 +24,10 @@ return array(
'min' => ':count min.',
'second' => ':count seconde|:count secondes',
's' => ':count sec.',
'ago' => 'il y a :time',
'from_now' => 'dans :time',
'after' => ':time après',
'before' => ':time avant',
'ago' => 'il y a :timer',
'from_now' => 'dans :timer',
'after' => ':timer après',
'before' => ':timer avant',
'diff_now' => "à l'instant",
'diff_yesterday' => 'hier',
'diff_tomorrow' => 'demain',
......
......@@ -17,8 +17,8 @@ return array(
'hour' => ':count hora|:count horas',
'minute' => ':count minuto|:count minutos',
'second' => ':count segundo|:count segundos',
'ago' => 'fai :time',
'from_now' => 'dentro de :time',
'after' => ':time despois',
'before' => ':time antes',
'ago' => 'fai :timer',
'from_now' => 'dentro de :timer',
'after' => ':timer despois',
'before' => ':timer antes',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':countમિ.|:countમિ.',
'second' => ':count સેકેન્ડ|:count સેકેન્ડ',
's' => ':countસે.|:countસે.',
'ago' => ':time પહેલા',
'from_now' => ':time અત્યારથી',
'after' => ':time પછી',
'before' => ':time પહેલા',
'ago' => ':timer પહેલા',
'from_now' => ':timer અત્યારથી',
'after' => ':timer પછી',
'before' => ':timer પહેલા',
);
......@@ -24,8 +24,8 @@ return array(
'min' => 'דקה|{2}דקותיים|:count דקות',
'second' => 'שניה|:count שניות',
's' => 'שניה|:count שניות',
'ago' => 'לפני :time',
'from_now' => 'בעוד :time',
'after' => 'אחרי :time',
'before' => 'לפני :time',
'ago' => 'לפני :timer',
'from_now' => 'בעוד :timer',
'after' => 'אחרי :timer',
'before' => 'לפני :timer',
);
......@@ -24,8 +24,8 @@ return array(
'min' => '1 मिनट|:count मिनटों',
'second' => '1 सेकंड|:count सेकंड',
's' => '1 सेकंड|:count सेकंड',
'ago' => ':time पूर्व',
'from_now' => ':time से',
'after' => ':time के बाद',
'before' => ':time के पहले',
'ago' => ':timer पूर्व',
'from_now' => ':timer से',
'after' => ':timer के बाद',
'before' => ':timer के पहले',
);
......@@ -24,8 +24,8 @@ return array(
'min' => ':count minutu|:count minute |:count minuta',
'second' => ':count sekundu|:count sekunde|:count sekundi',
's' => ':count sekundu|:count sekunde|:count sekundi',
'ago' => 'prije :time',
'from_now' => 'za :time',
'after' => 'za :time',
'before' => 'prije :time',
'ago' => 'prije :timer',
'from_now' => 'za :timer',
'after' => 'za :timer',
'before' => 'prije :timer',
);
......@@ -24,10 +24,10 @@ return array(
'min' => ':count perc',
'second' => ':count másodperc',
's' => ':count másodperc',
'ago' => ':time',
'from_now' => ':time múlva',
'after' => ':time később',
'before' => ':time korábban',
'ago' => ':timer',
'from_now' => ':timer múlva',
'after' => ':timer később',
'before' => ':timer korábban',
'year_ago' => ':count éve',
'month_ago' => ':count hónapja',
'week_ago' => ':count hete',
......
......@@ -24,8 +24,8 @@ return array(
'min' => ':countր',
'second' => ':count վարկյան',
's' => ':countվրկ',
'ago' => ':time առաջ',
'from_now' => ':time ներկա պահից',
'after' => ':time հետո',
'before' => ':time առաջ',
'ago' => ':timer առաջ',
'from_now' => ':timer ներկա պահից',
'after' => ':timer հետո',
'before' => ':timer առաջ',
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment