Commit 0b69f017 by 杨苏杭

card mac 修改为5字节

parent 00730ff9
...@@ -64,6 +64,7 @@ class Events ...@@ -64,6 +64,7 @@ class Events
static::$redis->select('4'); static::$redis->select('4');
\Lib\log\Log::bootLog(); \Lib\log\Log::bootLog();
......
...@@ -108,27 +108,27 @@ class OverController extends Controller ...@@ -108,27 +108,27 @@ class OverController extends Controller
break; break;
case StateCode::FINISH_USER: //用户主动结束 case StateCode::FINISH_USER: //用户主动结束
$this->logRecord->setDesc('用户主动结束充电'); $this->logRecord->setDesc('用户主动结束充电->' . $state);
$orderState->toUserFinish(); $orderState->toUserFinish();
break; break;
case StateCode::FINISH_SHED_TIMEOUT: //端口脱落超时 case StateCode::FINISH_SHED_TIMEOUT: //端口脱落超时
$this->logRecord->setDesc('端口脱落超时结束'); $this->logRecord->setDesc('端口脱落超时结束->' . $state);
$orderState->toShedTimeoutState(); $orderState->toShedTimeoutState();
break; break;
case StateCode::FINISH_REFUND: //充电失败退款 case StateCode::FINISH_REFUND: //充电失败退款
$this->logRecord->setDesc('充电失败退款结束'); $this->logRecord->setDesc('充电失败退款结束->' . $state);
$orderState->toRefundFinish(); $orderState->toRefundFinish();
break; break;
case StateCode::FINISH_EXCEED: //功率超限 case StateCode::FINISH_EXCEED: //功率超限
$this->logRecord->setDesc('功率超限充电结束'); $this->logRecord->setDesc('功率超限充电结束->' . $state);
$orderState->toPowerExceedState(); $orderState->toPowerExceedState();
break; break;
case StateCode::FINISH_FULL: //充满自停 case StateCode::FINISH_FULL: //充满自停
$this->logRecord->setDesc('充满自停结束'); $this->logRecord->setDesc('充满自停结束->' . $state);
$orderState->toPowerFullState(); $orderState->toPowerFullState();
break; break;
case StateCode::FINISH_TIME_END: //充电时间结束 case StateCode::FINISH_TIME_END: //充电时间结束
$this->logRecord->setDesc('充电时间完结束'); $this->logRecord->setDesc('充电时间完结束->' . $state);
$orderState->toTimeoutState(); $orderState->toTimeoutState();
break; break;
...@@ -164,6 +164,8 @@ class OverController extends Controller ...@@ -164,6 +164,8 @@ class OverController extends Controller
} }
} else { } else {
Log::error('redis can not find');
$this->logRecord->setException(0); $this->logRecord->setException(0);
$this->logRecord->setDesc('redis副本订单状态异常,非可结束订单状态'); $this->logRecord->setDesc('redis副本订单状态异常,非可结束订单状态');
......
...@@ -176,7 +176,7 @@ class PowerController extends Controller ...@@ -176,7 +176,7 @@ class PowerController extends Controller
if ($i === ($count - 1)) { if ($i === ($count - 1)) {
$orderModel = new OrderModel(); $orderModel = new OrderModel();
$capacity = hexdec($capacitys[$i]); $capacity = hexdec($capacitys[$i]);
$orderModel->update(['start_capacity' => hexdec($capacitys[0])], 'id =' . $orderId . 'and start_capacity = -1'); $orderModel->update(['start_capacity' => hexdec($capacitys[0])], 'id =' . $orderId . ' and start_capacity = -1');
$orderModel->update([ $orderModel->update([
'end_capacity' => $capacity, 'end_capacity' => $capacity,
], 'id = ' . $orderId); ], 'id = ' . $orderId);
......
...@@ -12,6 +12,7 @@ namespace Application\controller\card; ...@@ -12,6 +12,7 @@ namespace Application\controller\card;
use Application\controller\Controller; use Application\controller\Controller;
use Application\model\CardModel; use Application\model\CardModel;
use Application\model\UserModel; use Application\model\UserModel;
use Lib\log\Log;
class BalanceController extends Controller class BalanceController extends Controller
{ {
...@@ -19,7 +20,7 @@ class BalanceController extends Controller ...@@ -19,7 +20,7 @@ class BalanceController extends Controller
'32' => [ '32' => [
'card_id' => 4 'card_id' => 5,
] ]
]; ];
...@@ -33,11 +34,16 @@ class BalanceController extends Controller ...@@ -33,11 +34,16 @@ class BalanceController extends Controller
$cardModel = new CardModel(); $cardModel = new CardModel();
$userId = $cardModel->getColumn('user_id', 'card_number = ' . $cardId); Log::debug($cardId);
$userId = $cardModel->getColumn('user_id', 'mac = ' . "'$cardId'");
Log::debug($userId);
if (isset($userId)) { if (isset($userId)) {
$userModel = new UserModel(); $userModel = new UserModel();
$balance = $userModel->getColumn('balance', 'id = ' . $userId); $balance = $userModel->getColumn('wallet_balance', 'id = ' . $userId);
} }
$balance = isset($balance) ? $balance : 0; $balance = isset($balance) ? $balance : 0;
......
...@@ -25,7 +25,7 @@ class RequestController extends Controller ...@@ -25,7 +25,7 @@ class RequestController extends Controller
'33' => [ '33' => [
'type' => 1, 'type' => 1,
'logic_id' => 1, 'logic_id' => 1,
'card_id' => 4, 'card_id' => 5,
'time' => 2, 'time' => 2,
'price' => 2, 'price' => 2,
], ],
...@@ -62,11 +62,13 @@ class RequestController extends Controller ...@@ -62,11 +62,13 @@ class RequestController extends Controller
$cardModel = new CardModel(); $cardModel = new CardModel();
$userId = $cardModel->getColumn('user_id', 'card_number = ' . $cardId); $userId = $cardModel->getColumn('user_id', 'mac = ' . "'$cardId'");
Log::debug($userId);
if (isset($userId)) { if (isset($userId)) {
$userModel = new UserModel(); $userModel = new UserModel();
$balance = $userModel->getColumn('balance', 'id = ' . $userId); $balance = $userModel->getColumn('wallet_balance', 'id = ' . $userId);
} }
$balance = isset($balance) ? $balance : 0; $balance = isset($balance) ? $balance : 0;
if ((int)$balance < (int)$price) { if ((int)$balance < (int)$price) {
......
...@@ -11,10 +11,10 @@ use \Exception; ...@@ -11,10 +11,10 @@ use \Exception;
* For full copyright and license information, please see the MIT-LICENSE.txt * For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @author walkor<walkor@workerman.net> * @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net> * @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/ * @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license http://www.opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
...@@ -35,7 +35,7 @@ class Gateway ...@@ -35,7 +35,7 @@ class Gateway
* *
* @var string * @var string
*/ */
public static $registerAddress = 'webapppush.default:1239'; public static $registerAddress = '100.124.0.5:1239';
//public static $registerAddress = '127.0.0.1:1236'; //public static $registerAddress = '127.0.0.1:1236';
...@@ -60,10 +60,10 @@ class Gateway ...@@ -60,10 +60,10 @@ class Gateway
/** /**
* 向所有客户端连接(或者 client_id_array 指定的客户端连接)广播消息 * 向所有客户端连接(或者 client_id_array 指定的客户端连接)广播消息
* *
* @param string $message 向客户端发送的消息 * @param string $message 向客户端发送的消息
* @param array $client_id_array 客户端 id 数组 * @param array $client_id_array 客户端 id 数组
* @param array $exclude_client_id 不给这些client_id发 * @param array $exclude_client_id 不给这些client_id发
* @param bool $raw 是否发送原始数据(即不调用gateway的协议的encode方法) * @param bool $raw 是否发送原始数据(即不调用gateway的协议的encode方法)
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
...@@ -144,7 +144,7 @@ class Gateway ...@@ -144,7 +144,7 @@ class Gateway
/** /**
* 向某个client_id对应的连接发消息 * 向某个client_id对应的连接发消息
* *
* @param int $client_id * @param int $client_id
* @param string $message * @param string $message
* @return void * @return void
*/ */
...@@ -796,7 +796,7 @@ class Gateway ...@@ -796,7 +796,7 @@ class Gateway
/** /**
* 踢掉某个客户端,并以$message通知被踢掉客户端 * 踢掉某个客户端,并以$message通知被踢掉客户端
* *
* @param int $client_id * @param int $client_id
* @param string $message * @param string $message
* @return void * @return void
*/ */
...@@ -870,7 +870,7 @@ class Gateway ...@@ -870,7 +870,7 @@ class Gateway
/** /**
* 将 client_id 与 uid 绑定 * 将 client_id 与 uid 绑定
* *
* @param int $client_id * @param int $client_id
* @param int|string $uid * @param int|string $uid
* @return void * @return void
*/ */
...@@ -882,7 +882,7 @@ class Gateway ...@@ -882,7 +882,7 @@ class Gateway
/** /**
* 将 client_id 与 uid 解除绑定 * 将 client_id 与 uid 解除绑定
* *
* @param int $client_id * @param int $client_id
* @param int|string $uid * @param int|string $uid
* @return void * @return void
*/ */
...@@ -894,7 +894,7 @@ class Gateway ...@@ -894,7 +894,7 @@ class Gateway
/** /**
* 将 client_id 加入组 * 将 client_id 加入组
* *
* @param int $client_id * @param int $client_id
* @param int|string $group * @param int|string $group
* @return void * @return void
*/ */
...@@ -907,7 +907,7 @@ class Gateway ...@@ -907,7 +907,7 @@ class Gateway
/** /**
* 将 client_id 离开组 * 将 client_id 离开组
* *
* @param int $client_id * @param int $client_id
* @param int|string $group * @param int|string $group
* *
* @return void * @return void
...@@ -940,7 +940,7 @@ class Gateway ...@@ -940,7 +940,7 @@ class Gateway
* 向所有 uid 发送 * 向所有 uid 发送
* *
* @param int|string|array $uid * @param int|string|array $uid
* @param string $message * @param string $message
* *
* @return void * @return void
*/ */
...@@ -962,10 +962,10 @@ class Gateway ...@@ -962,10 +962,10 @@ class Gateway
/** /**
* 向 group 发送 * 向 group 发送
* *
* @param int|string|array $group 组(不允许是 0 '0' false null array()等为空的值) * @param int|string|array $group 组(不允许是 0 '0' false null array()等为空的值)
* @param string $message 消息 * @param string $message 消息
* @param array $exclude_client_id 不给这些client_id发 * @param array $exclude_client_id 不给这些client_id发
* @param bool $raw 发送原始数据(即不调用gateway的协议的encode方法) * @param bool $raw 发送原始数据(即不调用gateway的协议的encode方法)
* *
* @return void * @return void
*/ */
...@@ -1026,7 +1026,7 @@ class Gateway ...@@ -1026,7 +1026,7 @@ class Gateway
/** /**
* 更新 session,框架自动调用,开发者不要调用 * 更新 session,框架自动调用,开发者不要调用
* *
* @param int $client_id * @param int $client_id
* @param string $session_str * @param string $session_str
* @return bool * @return bool
*/ */
...@@ -1038,7 +1038,7 @@ class Gateway ...@@ -1038,7 +1038,7 @@ class Gateway
/** /**
* 设置 session,原session值会被覆盖 * 设置 session,原session值会被覆盖
* *
* @param int $client_id * @param int $client_id
* @param array $session * @param array $session
* *
* @return void * @return void
...@@ -1055,7 +1055,7 @@ class Gateway ...@@ -1055,7 +1055,7 @@ class Gateway
/** /**
* 更新 session,实际上是与老的session合并 * 更新 session,实际上是与老的session合并
* *
* @param int $client_id * @param int $client_id
* @param array $session * @param array $session
* *
* @return void * @return void
...@@ -1096,8 +1096,8 @@ class Gateway ...@@ -1096,8 +1096,8 @@ class Gateway
/** /**
* 向某个用户网关发送命令和消息 * 向某个用户网关发送命令和消息
* *
* @param int $client_id * @param int $client_id
* @param int $cmd * @param int $cmd
* @param string $message * @param string $message
* @param string $ext_data * @param string $ext_data
* @return boolean * @return boolean
...@@ -1130,7 +1130,7 @@ class Gateway ...@@ -1130,7 +1130,7 @@ class Gateway
/** /**
* 发送数据并返回 * 发送数据并返回
* *
* @param int $address * @param int $address
* @param mixed $data * @param mixed $data
* @return bool * @return bool
* @throws Exception * @throws Exception
...@@ -1184,7 +1184,7 @@ class Gateway ...@@ -1184,7 +1184,7 @@ class Gateway
* 发送数据到网关 * 发送数据到网关
* *
* @param string $address * @param string $address
* @param array $gateway_data * @param array $gateway_data
* @return bool * @return bool
*/ */
protected static function sendToGateway($address, $gateway_data) protected static function sendToGateway($address, $gateway_data)
...@@ -1248,7 +1248,7 @@ class Gateway ...@@ -1248,7 +1248,7 @@ class Gateway
* 踢掉某个网关的 socket * 踢掉某个网关的 socket
* *
* @param string $address * @param string $address
* @param int $connection_id * @param int $connection_id
* @return bool * @return bool
*/ */
protected static function kickAddress($address, $connection_id, $message) protected static function kickAddress($address, $connection_id, $message)
...@@ -1264,7 +1264,7 @@ class Gateway ...@@ -1264,7 +1264,7 @@ class Gateway
* 销毁某个网关的 socket * 销毁某个网关的 socket
* *
* @param string $address * @param string $address
* @param int $connection_id * @param int $connection_id
* @return bool * @return bool
*/ */
protected static function destroyAddress($address, $connection_id) protected static function destroyAddress($address, $connection_id)
...@@ -1543,16 +1543,16 @@ class GatewayProtocol ...@@ -1543,16 +1543,16 @@ class GatewayProtocol
*/ */
const HEAD_LEN = 28; const HEAD_LEN = 28;
public static $empty = array( public static $empty = array(
'cmd' => 0, 'cmd' => 0,
'local_ip' => 0, 'local_ip' => 0,
'local_port' => 0, 'local_port' => 0,
'client_ip' => 0, 'client_ip' => 0,
'client_port' => 0, 'client_port' => 0,
'connection_id' => 0, 'connection_id' => 0,
'flag' => 0, 'flag' => 0,
'gateway_port' => 0, 'gateway_port' => 0,
'ext_data' => '', 'ext_data' => '',
'body' => '', 'body' => '',
); );
/** /**
......
...@@ -16,7 +16,7 @@ class StartMessage extends Message ...@@ -16,7 +16,7 @@ class StartMessage extends Message
/** /**
* @var string * @var string
*/ */
private $first = '充电已经开始,请注意接收消息'; private $first = '您的爱车已开始充电,预计在%s结束喔';
/** /**
* @var string * @var string
...@@ -38,6 +38,8 @@ class StartMessage extends Message ...@@ -38,6 +38,8 @@ class StartMessage extends Message
*/ */
private $remark = '感谢您的使用'; private $remark = '感谢您的使用';
private $purchaseTime = 0;
/** /**
* StartMessage constructor. * StartMessage constructor.
*/ */
...@@ -74,10 +76,10 @@ class StartMessage extends Message ...@@ -74,10 +76,10 @@ class StartMessage extends Message
'color' => '#333', 'color' => '#333',
], ],
'keyword3' => [ 'keyword3' => [
'value' => number_format($this->amount / 100, 2), 'value' => '¥' . number_format($this->amount / 100, 2),
'color' => '#333', 'color' => '#333',
], ],
'remark' => [ 'remark' => [
'value' => $this->remark . "($this->orderId)", 'value' => $this->remark . "($this->orderId)",
'color' => '#333', 'color' => '#333',
], ],
......
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