Commit c384929a by banice

修改定时任务订单充电时间从redis缓存中计算

parent 8641d689
No preview for this file type
......@@ -1455,7 +1455,7 @@ namespace Illuminate\Support\Facades {
}
/**
* Run an update statement against the database.
* Run an Update statement against the database.
*
* @param string $query
* @param array $bindings
......
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/10/9
* Time: 下午7:00
*/
namespace App\Console\Commands\sync;
use Illuminate\Console\Command;
use DB;
class SyncPortFromStaging extends Command
{
protected $signature = 'sync:port_staging';
protected $description = '从staging环境同步网管口子';
/**
*
*/
public function handle()
{
$devices = DB::connection('old_cdz')->table('devices')->where('gateway_id', 1)->get()->toArray();
dd($devices);
return;
foreach ($devices as $device) {
if (DB::table('devices')->where('device_mac', $device['device_mac'])->exists() === false) {
DB::table('devices')->insert([
'device_mac' => $device['device_mac'],
'name' => $device['name'],
'gateway_id' => 9,
'station_id' => 5,
'created_at' => date('Y-m-d H:i:s'),
'type' => 1,
]);
}
}
}
}
\ No newline at end of file
......@@ -10,9 +10,9 @@ namespace App\Console\Commands\timer;
use App\Model\LogGatewayModel;
use Carbon\Carbon;
use Illuminate\Console\Command;
use DB;
use Lib\cdz_order\Order;
use Lib\redis\RedisSingle;
use Log;
......@@ -26,14 +26,73 @@ class ScanOrderFinish extends Command
*/
protected $description = '定时器扫描订单是否已过时';
private function scanf()
{
$date = date('Y-m-d H:i:s');
$expireOrders = DB::table('wx_charger_orders')->where('state', -1)->get(['start_time', 'charger_time', 'id', 'port_id', 'station_id', 'gateway_id']);
$redis = RedisSingle::getRedis();
$time = time();
$redis->multi(2);
$redis = RedisSingle::getRedis();
$order = new Order();
foreach ($expireOrders as $expireOrder) {
echo $expireOrder->id . PHP_EOL;
$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)) {
Log::debug($expireOrder->id);
Log::debug($startTime);
$result = DB::table('wx_charger_orders')->where('id', $expireOrder->id)->update([
'end_time' => date('Y-m-d H:i:s', strtotime($expireOrder->start_time) + $expireOrder->charger_time * 60),
'updated_at' => $date,
'state' => 3,
'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);
}
}
$redis->exec();
}
public function handle()
{
$date = date('Y-m-d H:i:s');
$this->info($date);
$expireOrders = DB::table('wx_charger_orders')->where([
['is_charger', '12'],//开始充电
['end_time', null],//没有结束时间
......@@ -46,28 +105,38 @@ class ScanOrderFinish extends Command
$redis = RedisSingle::getRedis();
$redis->multi(2);
// $redis->multi(2);
$order = new Order();
foreach ($expireOrders as $expireOrder) {
echo $expireOrder->id . PHP_EOL;
$order->setId($expireOrder->id);
$cache = $order->getOrderCache($redis);
if ($cache === false) {
$startTime = strtotime($expireOrder->start_time);
} else {
$startTime = $cache['startTime'];
if ($time > strtotime($expireOrder->start_time) + $expireOrder->charger_time * 60 + 60 * 5) {
}
Log::debug('startTime' . $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', strtotime($expireOrder->start_time) + $expireOrder->charger_time * 60),
'end_time' => date('Y-m-d H:i:s', strtotime($expireOrder->start_time) + $expireOrder->charger_time * 60),
'updated_at' => $date,
'state' => 3,
'is_stop' => 46,
'state' => 4,
'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'
'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);
......@@ -81,10 +150,10 @@ class ScanOrderFinish extends Command
}
$redis->exec();
// $redis->exec();
Log::info('update expired orders');
Log::info('Update expired orders');
}
......
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/28
* Time: 下午1:58
*/
namespace App\Console\Commands\update;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class Sign extends Command
{
protected $signature = 'Update:sign';
protected $description = 'ota文件md5签名';
public function handle()
{
$updateFiles = DB::table('gateway_update')->get(['hardware_version', 'software_version', 'id']);
foreach ($updateFiles as $file) {
// $fileName = $file['hardware_version'] . $file['software_version'];
$fileName = $file->hardware_version . $file->software_version;
$sign = md5_file(base_path() . '/public/Update/' . $fileName . '.bin');
DB::table('gateway_update')->where('id', $file->id)->update([
'sign' => strtoupper($sign)
]);
}
}
}
\ No newline at end of file
......@@ -9,10 +9,12 @@ use App\Console\Commands\MenuSetting;
use App\Console\Commands\RedisCommand;
use App\Console\Commands\sync\Port;
use App\Console\Commands\sync\Station;
use App\Console\Commands\sync\SyncPortFromStaging;
use App\Console\Commands\sync\SyncWxUserOpenIdCommand;
use App\Console\Commands\SyncStationFrequency;
use App\Console\Commands\TestPortCommand;
use App\Console\Commands\timer\ScanOrderFinish;
use App\Console\Commands\update\Sign;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
......@@ -36,6 +38,8 @@ class Kernel extends ConsoleKernel
AddImg::class,
ScanOrderFinish::class,
Create::class,
Sign::class,
SyncPortFromStaging::class
];
/**
......
......@@ -58,10 +58,15 @@ class ChangePortController extends Controller
$newState = $port->getState(RedisSingle::getRedis(), $newPortId);
if ($newState != 11) {
abort(400, '更换口子非空闲状态');
}
$result = true;
if ($orderCollection->state === 3) {
Log::debug('以退款');
......@@ -69,8 +74,24 @@ class ChangePortController extends Controller
$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';
$this->resultMessage = '订单消费中,无法更换端口';
......@@ -79,174 +100,181 @@ class ChangePortController extends Controller
$this->resultCode = 'FAIL';
$result = false;
$this->resultMessage = '最多只能更换口子3次';
} else {
}
// 发送结束充电命令至端口,发送开始充电命令给新端口,修改订单表中的数据
if ($result === false) {
return $this->response->array($this->getResponseCode());
}
$stopChargerCommand = new StopChargerCommand();
$stopChargerCommand->setOrderId($orderId);
// 发送结束充电命令至端口,发送开始充电命令给新端口,修改订单表中的数据
$gateway = new Gateway();
$stopChargerCommand = new StopChargerCommand();
$gateway->setId($orderCollection->gateway_id);
$stopChargerCommand->setOrderId($orderId);
$gateway->idGetMac();
$gateway = new Gateway();
$oldGatewayMac = $gateway->getMacAddress();
$gateway->setId($orderCollection->gateway_id);
$gateway->idGetMac();
if (\Lib\Gateway::isUidOnline($gateway->getMacAddress())) {
Log::debug($gateway->getMacAddress() . 'online');
$oldGatewayMac = $gateway->getMacAddress();
} else {
abort(400, '网关掉线');
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) {
abort(400, '口子不在线');
}
$port->setPortId($request->get('new_port_id'));
$simpleChargerCommand = new SimpleChargerCommand();
$lastPortId = $orderCollection->port_id;
$send = new Send($simpleChargerCommand);
if ($port->getState(RedisSingle::getRedis(), $lastPortId) == 10) {
abort(400, '口子不在线');
}
$newPortId = $request->get('new_port_id');
$simpleChargerCommand = new SimpleChargerCommand();
try {
$send = new Send($simpleChargerCommand);
$logicNum = $port->getLogicNum();
$newPortId = $request->get('new_port_id');
Log::debug('开始充电的逻辑地址-->' . $logicNum);
try {
} catch (\Exception $exception) {
Log::error($exception->getMessage());
$logicNum = $port->getLogicNum();
}
Log::debug('开始充电的逻辑地址-->' . $logicNum);
} catch (\Exception $exception) {
Log::error($exception->getMessage());
$newLogicNum = $logicNum;
}
$simpleChargerCommand->setLogicNum($logicNum);
$port->setPortId($newPortId);
$newLogicNum = $logicNum;
$newGatewayId = $port->getGatewayId();
$simpleChargerCommand->setLogicNum($logicNum);
$gateway->setId($newGatewayId);
$port->setPortId($newPortId);
$gateway->idGetMac();
$newGatewayId = $port->getGatewayId();
$newGatewayMac = $gateway->getMacAddress();
$gateway->setId($newGatewayId);
$simpleChargerCommand->setChargerTime($orderCollection->charger_time);
$gateway->idGetMac();
$simpleChargerCommand->setGatewayMac($newGatewayMac);
$newGatewayMac = $gateway->getMacAddress();
$simpleChargerCommand->setOrderId($orderId);
$simpleChargerCommand->setChargerTime($orderCollection->charger_time);
$send->setCommand($simpleChargerCommand);
$simpleChargerCommand->setGatewayMac($newGatewayMac);
$send->send();//发送开始充电命令
$simpleChargerCommand->setOrderId($orderId);
$date = date('Y-m-d H:i:s');
$send->setCommand($simpleChargerCommand);
DB::table('gateway_log')->insert([
'request' => $send->getMessage(),
'command' => '04',
'station_id' => $orderCollection->station_id,
'gateway_id' => $orderCollection->gateway_id,
'order_id' => $orderId,
'port_id' => $newPortId,
'desc' => '更换充电口,下发打开口子',
'type' => 1,
'created_at' => $date,
]);
$send->send();//发送开始充电命令
$stopChargerCommand->setGatewayMac($oldGatewayMac);
$stopChargerCommand->setFinishType(sprintf('%02x', 47));
$date = date('Y-m-d H:i:s');
$stopChargerCommand->setLogicNum($orderCollection->logic_num);
DB::table('gateway_log')->insert([
'request' => $send->getMessage(),
'command' => '04',
'station_id' => $orderCollection->station_id,
'gateway_id' => $orderCollection->gateway_id,
'order_id' => $orderId,
'port_id' => $newPortId,
'desc' => '更换充电口,下发打开口子',
'type' => 1,
'created_at' => $date,
]);
unset($send);
$stopChargerCommand->setGatewayMac($oldGatewayMac);
$stopChargerCommand->setFinishType(sprintf('%02x', 47));
$send = new Send($stopChargerCommand);
$stopChargerCommand->setLogicNum($orderCollection->logic_num);
$send->send();//发送结束充电命令
unset($send);
DB::table('gateway_log')->insert([
'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,
'created_at' => $date
]);
$send = new Send($stopChargerCommand);
$send->send();//发送结束充电命令
try {
DB::table('gateway_log')->insert([
'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,
'created_at' => $date
]);
$orderTrace = new OrderTrace('98');
$orderTrace->setOrderId($orderId);
try {
$orderTrace->writeRawTrace('98', "更换口子($lastPortId -> $newPortId)");
$orderTrace = new OrderTrace('98');
$orderTrace->setOrderId($orderId);
} catch (\Exception $exception) {
Log::error($exception->getMessage());
$orderTrace->writeRawTrace('98', "更换口子($lastPortId -> $newPortId)");
}
$port->setPortId($request->get('new_port_id'));
$port->setState(-1);
} catch (\Exception $exception) {
Log::error($exception->getMessage());
// $port->setOrder(Auth::user()->id, $orderId);
}
$gateway = new Gateway();
$port->setPortId($request->get('new_port_id'));
$port->setState(-1);
$gateway->setId($orderCollection->gateway_id);
// $port->setOrder(Auth::user()->id, $orderId);
$gateway->idGetMac();
$gateway = new Gateway();
$order = new Order();
$gateway->setId($orderCollection->gateway_id);
$order->setId($orderId);
$gateway->idGetMac();
$waitingCharger = new WaitingCharger($order, RedisSingle::getRedis());
$order = new Order();
$order->setGatewayId($newGatewayId);
$order->setId($orderId);
$order->setGatewayMac($newGatewayMac);
$waitingCharger = new WaitingCharger($order, RedisSingle::getRedis());
$order->setGatewayId($newGatewayId);
$waitingCharger->toChangePort($newPortId, $request->get('new_port_name'), $lastPortId, $newLogicNum);
$order->setGatewayMac($newGatewayMac);
//记录修改端口异常表
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,
'change_times' => DB::raw('change_times + 1'),
$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,
'change_times' => DB::raw('change_times + 1'),
'start_time' => null,
'is_charger' => -1,
]);
}
return $this->response->array($this->getResponseCode());
......
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/29
* Time: 下午3:41
*/
namespace App\Http\Controllers\V1\Update;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Lib\send\command\UpdateCommand;
use Lib\send\Send;
use Validator;
use DB;
use Log;
class UpdateController extends Controller
{
public function noticeUpdate(Request $request)
{
$validator = Validator::make($request->all(), [
'gateway_mac' => 'required|exists|gateways,mac_address',
'download_url' => 'required',
'hardware' => 'required',
'software' => 'required',
'time' => 'required',
]);
if ($validator->fails() === true) {
abort(400, $validator->errors()->first());
}
$updateTime = $request->get('time');
$gatewayMac = $request->get('gateway_mac');
$downloadUrl = $request->get('download_url');
$hardwareVersion = $request->get('hardware');
$softwareVersion = $request->get('software');
$updateCommand = new UpdateCommand($gatewayMac);
$updateCommand->setSoftware($softwareVersion);
$updateCommand->setHardware($hardwareVersion);
$updateCommand->setDownloadUrl($downloadUrl);
$updateCommand->setUpdateTime($updateTime);
$send = new Send($updateCommand);
if ($send->send() === true) {
return $this->response->array($this->getResponseCode());
} else {
$this->resultCode = 'FAIL';
$this->resultMessage = '发送失败或设备不在线';
return $this->response->array($this->getResponseCode());
}
}
public function upload(Request $request)
{
Log::debug($request->all());
$validator = Validator::make($request->all(), [
'hardware' => 'required',
'software' => 'required',
'type' => 'required|exists:gateway_types,id',
]);
if ($validator->fails() === true) {
Log::debug('error');
return $this->response->array(['msg' => $validator->errors()->first(), 'code' => 'FAIL']);
}
if ($request->file('firmware')->isValid() === false) {
return $this->response->array(['msg' => 'miss file', 'code' => 'FAIL']);
}
$hardware = $request->get('hardware');
$software = $request->get('software');
$fileName = $hardware . $software . '.bin';
$gatewayType = $request->get('type');
$date = date('Y-m-d H:i:s');
$file = $request->file('firmware')->move(base_path() . '/public/update', $fileName);
Log::debug(base_path('/public/update/' . $fileName));
$sign = md5_file(base_path('/public/update/' . $fileName));
if (DB::table('gateway_update')->where(['gateway_type' => $gatewayType])->exists() === true) {
DB::table('gateway_update')->where(['gateway_type' => $gatewayType])->update([
'hardware_version' => strtoupper($hardware),
'software_version' => strtoupper($software),
'updated_at' => $date,
'sign' => strtoupper($sign),
]);
} else {
DB::table('gateway_update')->insert([
'hardware_version' => strtoupper($hardware),
'software_version' => strtoupper($software),
'updated_at' => $date,
'sign' => strtoupper($sign),
'created_at' => $date,
'gateway_type' => $gatewayType,
]);
}
return $this->response->array(['code' => 'SUCCESS']);
}
}
\ No newline at end of file
......@@ -63,12 +63,8 @@ class StatisticController extends Controller
$portsId = $userUsingOrder->getUserUsingPortId();//获取用户正在使用的口子id
Log::debug($portsId);
$orderIds = $userUsingOrder->getPortsOrderId($portsId);
Log::debug($orderIds);
if ($orderIds === false) {
$orderIds = [];
......@@ -86,8 +82,7 @@ class StatisticController extends Controller
$tmp = $adaptor->adaptor();
if($tmp !== false)
{
if ($tmp !== false) {
array_push($ordersState, $tmp);
}
......@@ -104,7 +99,7 @@ class StatisticController extends Controller
$createdAt = strtotime($value['created_at']);
return $createdAt + $chargerTime * 60 > time();
return $createdAt + $chargerTime * 60 + 1 * 60 > time();
});//剔除充电结束的订单
......
......@@ -78,6 +78,8 @@ class AccessController extends Controller
if (!$wxUserModel->addUser($wxUser)) {
Log::error('add user fail');
abort(500, 'database store error');
}
......@@ -103,7 +105,8 @@ class AccessController extends Controller
return $this->response->array($this->getResponseCode() + ['data' => [
'token' => $token,
]]);
]
]);
} catch (\Exception $exception) {
Log::error($exception->getMessage());
......
......@@ -1504,7 +1504,7 @@ class Connection
$this->indentCsv(array_values($this->col_values)) . ')';
}
// ------update-------
// ------Update-------
/**
* 更新哪个表
*
......@@ -1835,7 +1835,7 @@ class Connection
$statement = strtolower(trim($rawStatement[0]));
if ($statement === 'select' || $statement === 'show') {
return $this->sQuery->fetchAll($fetchmode);
} elseif ($statement === 'update' || $statement === 'delete') {
} elseif ($statement === 'Update' || $statement === 'delete') {
return $this->sQuery->rowCount();
} elseif ($statement === 'insert') {
if ($this->sQuery->rowCount() > 0) {
......
......@@ -1070,7 +1070,7 @@ class YourClient extends \Guzzle\Service\Client
"parameters":{
"id": {
"location": "uri",
"description":"Group to update by ID",
"description":Update,
"type": "integer",
"required": true
},
......
......@@ -412,7 +412,7 @@ class Connection implements ConnectionInterface
}
/**
* Run an update statement against the database.
* Run an Update statement against the database.
*
* @param string $query
* @param array $bindings
......@@ -473,7 +473,7 @@ class Connection implements ConnectionInterface
return 0;
}
// For update or delete statements, we want to get the number of rows affected
// For Update or delete statements, we want to get the number of rows affected
// by the statement and return that back to the developer. We'll first need
// to execute the statement and then we'll use PDO to fetch the affected.
$statement = $this->getPdo()->prepare($query);
......
......@@ -50,7 +50,7 @@ interface ConnectionInterface
public function insert($query, $bindings = []);
/**
* Run an update statement against the database.
* Run an Update statement against the database.
*
* @param string $query
* @param array $bindings
......
......@@ -384,7 +384,7 @@ class Builder
}
/**
* Create or update a record matching the attributes, and fill it with values.
* Create or Update a record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
......
......@@ -14,7 +14,7 @@ trait HasTimestamps
public $timestamps = true;
/**
* Update the model's update timestamp.
* Update the model's Update timestamp.
*
* @return bool
*/
......@@ -30,7 +30,7 @@ trait HasTimestamps
}
/**
* Update the creation and update timestamps.
* Update the creation and Update timestamps.
*
* @return void
*/
......
......@@ -539,9 +539,9 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
return false;
}
// If the model already exists in the database we can just update our record
// If the model already exists in the database we can just Update our record
// that is already in this database using the current IDs in this "where"
// clause to only update this model. Otherwise, we'll just insert them.
// clause to only Update this model. Otherwise, we'll just insert them.
if ($this->exists) {
$saved = $this->isDirty() ?
$this->performUpdate($query) : true;
......@@ -602,28 +602,28 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
}
/**
* Perform a model update operation.
* Perform a model Update operation.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return bool
*/
protected function performUpdate(Builder $query)
{
// If the updating event returns false, we will cancel the update operation so
// If the updating event returns false, we will cancel the Update operation so
// developers can hook Validation systems into their models and cancel this
// operation if the model does not pass validation. Otherwise, we update.
// operation if the model does not pass validation. Otherwise, we Update.
if ($this->fireModelEvent('updating') === false) {
return false;
}
// First we need to create a fresh query instance and touch the creation and
// update timestamp on the model which are maintained by us for developer
// Update timestamp on the model which are maintained by us for developer
// convenience. Then we will just continue saving the model instances.
if ($this->usesTimestamps()) {
$this->updateTimestamps();
}
// Once we have run the update operation, we will fire the "updated" event for
// Once we have run the Update operation, we will fire the "updated" event for
// this model instance. This will allow developers to hook into these after
// models are updated, giving them a chance to do any special processing.
$dirty = $this->getDirty();
......@@ -640,7 +640,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
}
/**
* Set the keys for a save update query.
* Set the keys for a save Update query.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
......@@ -676,7 +676,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
}
// First we'll need to create a fresh query instance and touch the creation and
// update timestamps on this model, which are maintained by us for developer
// Update timestamps on this model, which are maintained by us for developer
// convenience. After, we will just continue saving these model instances.
if ($this->usesTimestamps()) {
$this->updateTimestamps();
......@@ -703,8 +703,8 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
}
// We will go ahead and set the exists property to true, so that it is set when
// the created event is fired, just in case the developer tries to update it
// during the event. This will allow them to do so and run an update here.
// the created event is fired, just in case the developer tries to Update it
// during the event. This will allow them to do so and run an Update here.
$this->exists = true;
$this->wasRecentlyCreated = true;
......
......@@ -444,7 +444,7 @@ class BelongsToMany extends Relation
}
/**
* Create or update a related record matching the attributes, and fill it with values.
* Create or Update a related record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
......@@ -766,7 +766,7 @@ class BelongsToMany extends Relation
$this->related->getUpdatedAtColumn() => $this->related->freshTimestampString(),
];
// If we actually have IDs for the relation, we will run the query to update all
// If we actually have IDs for the relation, we will run the query to Update all
// the related model's timestamps, to make sure these all reflect the changes
// to the parent models. This will help us keep any caching synced up here.
if (count($ids = $this->allRelatedIds()) > 0) {
......@@ -922,7 +922,7 @@ class BelongsToMany extends Relation
}
/**
* Specify that the pivot table has creation and update timestamps.
* Specify that the pivot table has creation and Update timestamps.
*
* @param mixed $createdAt
* @param mixed $updatedAt
......
......@@ -154,15 +154,15 @@ trait InteractsWithPivotTable
foreach ($records as $id => $attributes) {
// If the ID is not in the list of existing pivot IDs, we will insert a new pivot
// record, otherwise, we will just update this existing record on this joining
// table, so that the developers will easily update these records pain free.
// record, otherwise, we will just Update this existing record on this joining
// table, so that the developers will easily Update these records pain free.
if (! in_array($id, $current)) {
$this->attach($id, $attributes, $touch);
$changes['attached'][] = $this->castKey($id);
}
// Now we'll try to update an existing pivot record with the attributes that were
// Now we'll try to Update an existing pivot record with the attributes that were
// given to the method. If the model is actually updated we will add it to the
// list of updated pivot records so we return them back out to the consumer.
elseif (count($attributes) > 0 &&
......@@ -293,7 +293,7 @@ trait InteractsWithPivotTable
$record[$this->foreignPivotKey] = $this->parent->{$this->parentKey};
// If the record needs to have creation and update timestamps, we will make
// If the record needs to have creation and Update timestamps, we will make
// them by calling the parent model's "freshTimestamp" method which will
// provide us with a fresh timestamp in this model's preferred format.
if ($timed) {
......@@ -308,7 +308,7 @@ trait InteractsWithPivotTable
}
/**
* Set the creation and update timestamps on an attach record.
* Set the creation and Update timestamps on an attach record.
*
* @param array $record
* @param bool $exists
......
......@@ -231,7 +231,7 @@ class HasManyThrough extends Relation
}
/**
* Create or update a related record matching the attributes, and fill it with values.
* Create or Update a related record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
......
......@@ -222,7 +222,7 @@ abstract class HasOneOrMany extends Relation
}
/**
* Create or update a related record matching the attributes, and fill it with values.
* Create or Update a related record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
......@@ -309,7 +309,7 @@ abstract class HasOneOrMany extends Relation
}
/**
* Perform an update on all the related models.
* Perform an Update on all the related models.
*
* @param array $attributes
* @return int
......
......@@ -26,7 +26,7 @@ class MorphPivot extends Pivot
protected $morphClass;
/**
* Set the keys for a save update query.
* Set the keys for a save Update query.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
......
......@@ -90,7 +90,7 @@ class Pivot extends Model
}
/**
* Set the keys for a save update query.
* Set the keys for a save Update query.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
......
......@@ -167,7 +167,7 @@ abstract class Relation
}
/**
* Run a raw update against the base query.
* Run a raw Update against the base query.
*
* @param array $attributes
* @return int
......
......@@ -97,7 +97,7 @@ class MigrationCreator
// We also have stubs for creating new tables and modifying existing tables
// to save the developer some typing when they are creating a new tables
// or modifying existing tables. We'll grab the appropriate stub here.
$stub = $create ? 'create.stub' : 'update.stub';
$stub = $create ? 'create.stub' : 'Update.stub';
return $this->files->get($this->stubPath()."/{$stub}");
}
......@@ -116,7 +116,7 @@ class MigrationCreator
// Here we will replace the table place-holders with the table specified by
// the developer, which is useful for quickly creating a tables creation
// or update migration from the console instead of typing it manually.
// or Update migration from the console instead of typing it manually.
if (! is_null($table)) {
$stub = str_replace('DummyTable', $table, $stub);
}
......
......@@ -2365,7 +2365,7 @@ class Builder
}
/**
* Insert or update a record matching the attributes, and fill it with values.
* Insert or Update a record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
......
......@@ -714,7 +714,7 @@ class Grammar extends BaseGrammar
}
/**
* Compile an update statement into SQL.
* Compile an Update statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
......@@ -724,7 +724,7 @@ class Grammar extends BaseGrammar
{
$table = $this->wrapTable($query->from);
// Each one of the columns in the update statements needs to be wrapped in the
// Each one of the columns in the Update statements needs to be wrapped in the
// keyword identifiers, also a place-holder needs to be created for each of
// the values in the list of bindings so we can make the sets statements.
$columns = collect($values)->map(function ($value, $key) {
......@@ -732,7 +732,7 @@ class Grammar extends BaseGrammar
})->implode(', ');
// If the query has any "join" clauses, we will setup the joins on the builder
// and compile them so we can attach them to this update, as update queries
// and compile them so we can attach them to this Update, as Update queries
// can get join statements to attach to other tables when they're needed.
$joins = '';
......@@ -740,16 +740,16 @@ class Grammar extends BaseGrammar
$joins = ' '.$this->compileJoins($query, $query->joins);
}
// Of course, update queries may also be constrained by where clauses so we'll
// Of course, Update queries may also be constrained by where clauses so we'll
// need to compile the where clauses and attach it to the query so only the
// intended records are updated by the SQL statements we generate to run.
$wheres = $this->compileWheres($query);
return trim("update {$table}{$joins} set $columns $wheres");
return trim("Update {$table}{$joins} set $columns $wheres");
}
/**
* Prepare the bindings for an update statement.
* Prepare the bindings for an Update statement.
*
* @param array $bindings
* @param array $values
......
......@@ -86,14 +86,14 @@ class MySqlGrammar extends Grammar
protected function compileLock(Builder $query, $value)
{
if (! is_string($value)) {
return $value ? 'for update' : 'lock in share mode';
return $value ? 'for Update' : 'lock in share mode';
}
return $value;
}
/**
* Compile an update statement into SQL.
* Compile an Update statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
......@@ -103,13 +103,13 @@ class MySqlGrammar extends Grammar
{
$table = $this->wrapTable($query->from);
// Each one of the columns in the update statements needs to be wrapped in the
// Each one of the columns in the Update statements needs to be wrapped in the
// keyword identifiers, also a place-holder needs to be created for each of
// the values in the list of bindings so we can make the sets statements.
$columns = $this->compileUpdateColumns($values);
// If the query has any "join" clauses, we will setup the joins on the builder
// and compile them so we can attach them to this update, as update queries
// and compile them so we can attach them to this Update, as Update queries
// can get join statements to attach to other tables when they're needed.
$joins = '';
......@@ -117,23 +117,23 @@ class MySqlGrammar extends Grammar
$joins = ' '.$this->compileJoins($query, $query->joins);
}
// Of course, update queries may also be constrained by where clauses so we'll
// Of course, Update queries may also be constrained by where clauses so we'll
// need to compile the where clauses and attach it to the query so only the
// intended records are updated by the SQL statements we generate to run.
$where = $this->compileWheres($query);
$sql = rtrim("update {$table}{$joins} set $columns $where");
$sql = rtrim("Update {$table}{$joins} set $columns $where");
// If the query has an order by clause we will compile it since MySQL supports
// order bys on update statements. We'll compile them using the typical way
// order bys on Update statements. We'll compile them using the typical way
// of compiling order bys. Then they will be appended to the SQL queries.
if (! empty($query->orders)) {
$sql .= ' '.$this->compileOrders($query, $query->orders);
}
// Updates on MySQL also supports "limits", which allow you to easily update a
// Updates on MySQL also supports "limits", which allow you to easily Update a
// single record very easily. This is not supported by all database engines
// so we have customized this update compiler here in order to add it in.
// so we have customized this Update compiler here in order to add it in.
if (isset($query->limit)) {
$sql .= ' '.$this->compileLimit($query, $query->limit);
}
......@@ -142,7 +142,7 @@ class MySqlGrammar extends Grammar
}
/**
* Compile all of the columns for an update statement.
* Compile all of the columns for an Update statement.
*
* @param array $values
* @return string
......@@ -177,7 +177,7 @@ class MySqlGrammar extends Grammar
}
/**
* Prepare the bindings for an update statement.
* Prepare the bindings for an Update statement.
*
* Booleans, integers, and doubles are inserted into JSON updates as raw values.
*
......
......@@ -74,7 +74,7 @@ class PostgresGrammar extends Grammar
protected function compileLock(Builder $query, $value)
{
if (! is_string($value)) {
return $value ? 'for update' : 'for share';
return $value ? 'for Update' : 'for share';
}
return $value;
......@@ -110,7 +110,7 @@ class PostgresGrammar extends Grammar
}
/**
* Compile an update statement into SQL.
* Compile an Update statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
......@@ -120,7 +120,7 @@ class PostgresGrammar extends Grammar
{
$table = $this->wrapTable($query->from);
// Each one of the columns in the update statements needs to be wrapped in the
// Each one of the columns in the Update statements needs to be wrapped in the
// keyword identifiers, also a place-holder needs to be created for each of
// the values in the list of bindings so we can make the sets statements.
$columns = $this->compileUpdateColumns($values);
......@@ -129,27 +129,27 @@ class PostgresGrammar extends Grammar
$where = $this->compileUpdateWheres($query);
return trim("update {$table} set {$columns}{$from} {$where}");
return trim("Update {$table} set {$columns}{$from} {$where}");
}
/**
* Compile the columns for the update statement.
* Compile the columns for the Update statement.
*
* @param array $values
* @return string
*/
protected function compileUpdateColumns($values)
{
// When gathering the columns for an update statement, we'll wrap each of the
// When gathering the columns for an Update statement, we'll wrap each of the
// columns and convert it to a parameter value. Then we will concatenate a
// list of the columns that can be added into this update query clauses.
// list of the columns that can be added into this Update query clauses.
return collect($values)->map(function ($value, $key) {
return $this->wrap($key).' = '.$this->parameter($value);
})->implode(', ');
}
/**
* Compile the "from" clause for an update with a join.
* Compile the "from" clause for an Update with a join.
*
* @param \Illuminate\Database\Query\Builder $query
* @return string|null
......@@ -199,7 +199,7 @@ class PostgresGrammar extends Grammar
}
/**
* Compile the "join" clause where clauses for an update.
* Compile the "join" clause where clauses for an Update.
*
* @param \Illuminate\Database\Query\Builder $query
* @return string
......@@ -223,7 +223,7 @@ class PostgresGrammar extends Grammar
}
/**
* Prepare the bindings for an update statement.
* Prepare the bindings for an Update statement.
*
* @param array $bindings
* @param array $values
......
......@@ -187,7 +187,7 @@ class SQLiteGrammar extends Grammar
}
/**
* Compile an update statement into SQL.
* Compile an Update statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
......@@ -204,14 +204,14 @@ class SQLiteGrammar extends Grammar
if (isset($query->joins) || isset($query->limit)) {
$selectSql = parent::compileSelect($query->select("{$query->from}.rowid"));
return "update {$table} set $columns where {$this->wrap('rowid')} in ({$selectSql})";
return "Update {$table} set $columns where {$this->wrap('rowid')} in ({$selectSql})";
}
return trim("update {$table} set {$columns} {$this->compileWheres($query)}");
return trim("Update {$table} set {$columns} {$this->compileWheres($query)}");
}
/**
* Prepare the bindings for an update statement.
* Prepare the bindings for an Update statement.
*
* @param array $bindings
* @param array $values
......
......@@ -287,7 +287,7 @@ class SqlServerGrammar extends Grammar
}
/**
* Compile an update statement into SQL.
* Compile an Update statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
......@@ -297,7 +297,7 @@ class SqlServerGrammar extends Grammar
{
list($table, $alias) = $this->parseUpdateTable($query->from);
// Each one of the columns in the update statements needs to be wrapped in the
// Each one of the columns in the Update statements needs to be wrapped in the
// keyword identifiers, also a place-holder needs to be created for each of
// the values in the list of bindings so we can make the sets statements.
$columns = collect($values)->map(function ($value, $key) {
......@@ -305,7 +305,7 @@ class SqlServerGrammar extends Grammar
})->implode(', ');
// If the query has any "join" clauses, we will setup the joins on the builder
// and compile them so we can attach them to this update, as update queries
// and compile them so we can attach them to this Update, as Update queries
// can get join statements to attach to other tables when they're needed.
$joins = '';
......@@ -313,16 +313,16 @@ class SqlServerGrammar extends Grammar
$joins = ' '.$this->compileJoins($query, $query->joins);
}
// Of course, update queries may also be constrained by where clauses so we'll
// Of course, Update queries may also be constrained by where clauses so we'll
// need to compile the where clauses and attach it to the query so only the
// intended records are updated by the SQL statements we generate to run.
$where = $this->compileWheres($query);
if (! empty($joins)) {
return trim("update {$alias} set {$columns} from {$table}{$joins} {$where}");
return trim("Update {$alias} set {$columns} from {$table}{$joins} {$where}");
}
return trim("update {$table}{$joins} set $columns $where");
return trim("Update {$table}{$joins} set $columns $where");
}
/**
......@@ -343,7 +343,7 @@ class SqlServerGrammar extends Grammar
}
/**
* Prepare the bindings for an update statement.
* Prepare the bindings for an Update statement.
*
* @param array $bindings
* @param array $values
......
......@@ -931,7 +931,7 @@ class Blueprint
}
/**
* Add nullable creation and update timestamps to the table.
* Add nullable creation and Update timestamps to the table.
*
* @param int $precision
* @return void
......@@ -944,7 +944,7 @@ class Blueprint
}
/**
* Add nullable creation and update timestamps to the table.
* Add nullable creation and Update timestamps to the table.
*
* Alias for self::timestamps().
*
......@@ -957,7 +957,7 @@ class Blueprint
}
/**
* Add creation and update timestampTz columns to the table.
* Add creation and Update timestampTz columns to the table.
*
* @param int $precision
* @return void
......
......@@ -81,14 +81,14 @@ abstract class Grammar extends BaseGrammar
);
// Once we have the basic foreign key creation statement constructed we can
// build out the syntax for what should happen on an update or delete of
// build out the syntax for what should happen on an Update or delete of
// the affected columns, which will get something like "cascade", etc.
if (! is_null($command->onDelete)) {
$sql .= " on delete {$command->onDelete}";
}
if (! is_null($command->onUpdate)) {
$sql .= " on update {$command->onUpdate}";
$sql .= " on Update {$command->onUpdate}";
}
return $sql;
......
......@@ -83,11 +83,11 @@ class SQLiteGrammar extends Grammar
$sql .= " on delete {$foreign->onDelete}";
}
// If this foreign key specifies the action to be taken on update we will add
// If this foreign key specifies the action to be taken on Update we will add
// that to the statement here. We'll append it to this SQL and then return
// the SQL so we can keep adding any other foreign constraints onto this.
if (! is_null($foreign->onUpdate)) {
$sql .= " on update {$foreign->onUpdate}";
$sql .= " on Update {$foreign->onUpdate}";
}
return $sql;
......
......@@ -11,7 +11,7 @@ namespace Illuminate\Support\Facades;
* @method static mixed selectOne(string $query, array $bindings = [])
* @method static array select(string $query, array $bindings = [])
* @method static bool insert(string $query, array $bindings = [])
* @method static int update(string $query, array $bindings = [])
* @method static int Update(string $query, array $bindings = [])
* @method static int delete(string $query, array $bindings = [])
* @method static bool statement(string $query, array $bindings = [])
* @method static int affectingStatement(string $query, array $bindings = [])
......
......@@ -112,7 +112,7 @@ class RotatingFileHandler extends StreamHandler
*/
protected function rotate()
{
// update filename
// Update filename
$this->url = $this->getTimedFilename();
$this->nextRotation = new \DateTime('tomorrow');
......
......@@ -28,7 +28,7 @@ class AmqpHandlerTest extends TestCase
}
if (!class_exists('AMQPChannel')) {
$this->markTestSkipped("Please update AMQP to version >= 1.0");
$this->markTestSkipped("Please Update AMQP to version >= 1.0");
}
$messages = array();
......
......@@ -14,13 +14,13 @@ env:
sudo: false
before_install:
- sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-fr
- sudo apt-get Update && sudo apt-get --reinstall install -qq language-pack-fr
- if [[ $coverage = 'false' ]]; then phpenv config-rm xdebug.ini; fi
install:
- if [[ $phpstan = 'true' ]]; then travis_retry composer require --dev phpstan/phpstan; fi
- if [[ $setup = 'basic' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- if [[ $setup = 'basic' ]]; then travis_retry composer Update --prefer-dist --no-interaction --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer Update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- |
if [[ $setup = 'lowest' ]]; then
composer require sebastian/comparator:"~1.2.4" --no-update --dev
......
......@@ -46,7 +46,7 @@ foreach ($tags as $tag) {
shell_exec("git branch -d $branch");
shell_exec("git checkout tags/$tag -b $branch");
shell_exec('composer config platform.php 5.3.9');
shell_exec('composer update --no-interaction --no-dev --optimize-autoloader');
shell_exec('composer Update --no-interaction --no-dev --optimize-autoloader');
$zip = new ZipArchive();
$zip->open($archive, ZipArchive::CREATE | ZipArchive::OVERWRITE);
......@@ -81,7 +81,7 @@ foreach ($tags as $tag) {
shell_exec("git checkout $currentBranch");
shell_exec("git branch -d $branch");
shell_exec('git stash pop');
shell_exec('composer update --no-interaction');
shell_exec('composer Update --no-interaction');
}
exit(0);
......@@ -98,7 +98,7 @@ interface RequestInterface extends MessageInterface
/**
* Returns an instance with the provided URI.
*
* This method MUST update the Host header of the returned request by
* This method MUST Update the Host header of the returned request by
* default if the URI contains a host component. If the URI does not
* contain a host component, any pre-existing Host header MUST be carried
* over to the returned request.
......@@ -108,12 +108,12 @@ interface RequestInterface extends MessageInterface
* `true`, this method interacts with the Host header in the following ways:
*
* - If the Host header is missing or empty, and the new URI contains
* a host component, this method MUST update the Host header in the returned
* a host component, this method MUST Update the Host header in the returned
* request.
* - If the Host header is missing or empty, and the new URI does not contain a
* host component, this method MUST NOT update the Host header in the returned
* host component, this method MUST NOT Update the Host header in the returned
* request.
* - If a Host header is present and non-empty, this method MUST NOT update
* - If a Host header is present and non-empty, this method MUST NOT Update
* the Host header in the returned request.
*
* This method MUST be implemented in such a way as to retain the
......
......@@ -72,7 +72,7 @@ interface ServerRequestInterface extends RequestInterface
* be compatible with the structure of $_COOKIE. Typically, this data will
* be injected at instantiation.
*
* This method MUST NOT update the related Cookie header of the request
* This method MUST NOT Update the related Cookie header of the request
* instance, nor related values in the server params.
*
* This method MUST be implemented in such a way as to retain the
......
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cdzpay",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/configmaps/cdzpay",
"uid": "56609fea-99f6-11e8-a154-02fba74a71a4",
"resourceVersion": "57326041",
"creationTimestamp": "2018-08-07T03:59:52Z"
},
"data": {
"API_CONDITIONAL_REQUEST": "false",
"API_DEBUG": "true",
"API_DOMAIN": "cdzpay.staging.senthink.com",
"API_NAME": "cdz",
"API_PREFIX": "api",
"API_STANDARDS_TREE": "x",
"API_STRICT": "false",
"API_SUBTYPE": "cdz",
"API_VERSION": "v1",
"APP_DEBUG": "true",
"APP_ENV": "local",
"APP_KEY": "base64:eT7rjn+lf0GHA73E06rxhri1iVDYCRN70RhWxXEo7IM=",
"APP_LOCALE": "zh-CN",
"APP_LOG": "daily",
"APP_TIMEZONE": "PRC",
"CACHE_DRIVER": "file",
"DB_CONNECTION": "mysql",
"DB_DATABASE": "cdzpay",
"DB_HOST": "db.staging.senthink.com",
"DB_PASSWORD": "RRryCfWBXq2Whdq",
"DB_PORT": "3306",
"DB_USERNAME": "senthink",
"GATEWAY_REGISTER": "cdzregister.default.svc.cluster.local:1239",
"JWT_SECRET": "hISaT0VHD8tPvkr9siK2SY21FYtlyH2a",
"LOG_CHANNEL": "daily",
"MANAGE_HOST": "https://cdzback2.staging.senthink.com",
"PRE_DB_DATABASE": "stagingrevealcdz",
"PRE_DB_HOST": "db.staging.senthink.com",
"PRE_DB_PASSWORD": "RRryCfWBXq2Whdq",
"PRE_DB_PORT": "3306",
"PRE_DB_USERNAME": "senthink",
"QUEUE_DRIVER": "sync",
"RABBIT_HOST": "rabbitmq.default.svc.cluster.local",
"RABBIT_LOGIN": "rabbitmq",
"RABBIT_PASSWORD": "senthink123!",
"RABBIT_PORT": "5672",
"RABBIT_VHOST": "cdz_gateway",
"REDIS_HOST": "redis.default.svc.cluster.local",
"REDIS_PORT": "6379",
"WX_APP_ID": "wx5a234043195ec484",
"WX_APP_KEY": "shengpeng2017shengpeng2017shengp",
"WX_APP_SECRET": "74af342df5f80ed48e32deffe893de56",
"WX_MCH_ID": "1426979702",
"WX_TOKEN": "hahaha"
}
}
\ No newline at end of file
......@@ -14,7 +14,6 @@ use Log;
class Order
{
/**
* @var int
*/
......@@ -145,7 +144,6 @@ class Order
}
return $this->orderCache;
}
......@@ -434,5 +432,4 @@ class Order
}
}
\ No newline at end of file
......@@ -45,6 +45,7 @@ class UsingOrderAdaptor
}
return [
'port_id' => $orderCache['portId'],
......@@ -52,7 +53,7 @@ class UsingOrderAdaptor
'state' => $orderCache['stateCode'],
'order_id' => $orderCache['id'],
'charger_time' => $orderCache['purchaseTime'],
'created_at' => date('Y-m-d H:i:s', $orderCache['createdTime']),
'created_at' => date('Y-m-d H:i:s', isset($orderCache['startTime']) ? $orderCache['startTime'] : $orderCache['createdTime']),
'port_name' => $orderCache['portName'],
'order_amount' => number_format($orderCache['payAmount'] / 100, 2),
'start_time' => isset($orderCache['startTime']) ? date('Y-m-d H:i:s', $orderCache['startTime']) : null,
......
......@@ -37,7 +37,6 @@ $queueKeyWorker = 'queue_worker_check_port_charger_state';
$exchange = $myRabbitMq->getExchange();
$exchange->setName($myRabbitMq->getExchangeKey());
$exchange->setType(AMQP_EX_TYPE_DIRECT);
......
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/10/16
* Time: 上午10:26
*/
namespace Lib\send\command;
use Lib\send\Command;
class UpdateCommand extends Command
{
protected $headerCtrl = 'd2';
private $software = '';
private $hardware = '';
private $updateTime = '';
private $downloadUrl = '';
public function __construct(string $gatewayMac)
{
$this->clientUid = $gatewayMac;
}
public function getMessageBody(): string
{
$updateTime = sprintf('%08x', $this->updateTime);
$urlHex = '';
for ($i = 0; $i < strlen($this->downloadUrl); $i++) {
$hex = sprintf('%02x', ord($this->downloadUrl[$i]));
$urlHex .= $hex;
}
return $updateTime . $this->hardware . $this->software . $urlHex;
}
public function getClientId(): string
{
// TODO: Implement getClientId() method.
}
public function getClientUid(): string
{
return $this->clientUid;
}
/**
* @return string
*/
public function getSoftware(): string
{
return $this->software;
}
/**
* @param string $software
*/
public function setSoftware(string $software): void
{
$this->software = $software;
}
/**
* @return string
*/
public function getHardware(): string
{
return $this->hardware;
}
/**
* @param string $hardware
*/
public function setHardware(string $hardware): void
{
$this->hardware = $hardware;
}
/**
* @return string
*/
public function getUpdateTime(): string
{
return $this->updateTime;
}
/**
* @param string $updateTime
*/
public function setUpdateTime(string $updateTime): void
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getDownloadUrl(): string
{
return $this->downloadUrl;
}
/**
* @param string $downloadUrl
*/
public function setDownloadUrl(string $downloadUrl): void
{
$this->downloadUrl = $downloadUrl;
}
}
\ No newline at end of file
......@@ -16,29 +16,29 @@
//});
$router->get('/', function () use ($router) {
echo str_random(32);
dd(phpinfo());
dd(\Lib\Gateway::getAllClientSessions());
return $router->app->version();
});
$router->group(['namespace' => '\Rap2hpoutre\LaravelLogViewer'],function () use ($router){
$router->group(['namespace' => '\Rap2hpoutre\LaravelLogViewer'], function () use ($router) {
$router->get('logs','LogViewerController@index');
$router->get('logs', 'LogViewerController@index');
});
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', ['namespace' => 'App\Http\Controllers\V1', 'prefix' => 'api/wx'], function ($api) {
$api->post('notice/update', 'Update\UpdateController@noticeUpdate');
$api->post('firmware', 'Update\UpdateController@upload');
$api->post('user', ['as' => 'wx.token', 'uses' => 'Wx\AccessController@getUserInfo']);
//微信网页授权getcode
......@@ -98,18 +98,17 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\V1', 'prefix' => 'api/
$api->get('user/order/using', ['uses' => 'User\StatisticController@getUserUsingOrder']);
//token解析
$api->post('token/parse',['uses' => 'Tool\TokenController@parse']);
$api->post('token/parse', ['uses' => 'Tool\TokenController@parse']);
//更换口子
$api->post('port/change', ['uses' => 'Charger\ChangePortController@change']);
$api->get('user/recharge/orders',['uses' =>'User\OrderController@getRechargeOrder']);
$api->get('user/recharge/orders', ['uses' => 'User\OrderController@getRechargeOrder']);
$api->post('user/withdraw',['uses' => 'User\WithDrawController@withDraw']);
$api->post('user/withdraw', ['uses' => 'User\WithDrawController@withDraw']);
$api->get('user/code/withdraw',['uses' => 'User\WithDrawController@getCode']);
$api->get('user/code/withdraw', ['uses' => 'User\WithDrawController@getCode']);
// 查找附近的站点
......@@ -126,8 +125,7 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\V1', 'prefix' => 'api/
$api->get('send', 'TestController@send');
$api->any('receiver','Wx\ReceiverController@index');
$api->any('receiver', 'Wx\ReceiverController@index');
});
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