|
@@ -72,12 +72,12 @@ class ShouhuanCommand
|
|
|
} else {
|
|
|
$msg_type = 0;
|
|
|
}
|
|
|
- if ('back' == $config['kind']) {
|
|
|
- $content = $config['content'];
|
|
|
- $content = implode(',', $content);
|
|
|
- $send_type = 0;
|
|
|
- $is_success = 1;
|
|
|
- }
|
|
|
+ // if ('back' == $config['kind']) {
|
|
|
+ // $content = $config['content'];
|
|
|
+ // $content = implode(',', $content);
|
|
|
+ // $send_type = 0;
|
|
|
+ // $is_success = 1;
|
|
|
+ // }
|
|
|
if ('send' == $config['kind']) {
|
|
|
$content = $config['content'];
|
|
|
$useconmmand = $content['command'];
|
|
@@ -100,45 +100,90 @@ class ShouhuanCommand
|
|
|
$is_success = 1;
|
|
|
}
|
|
|
|
|
|
+ $weight = $this->getsendweight($command);
|
|
|
+ $msgdata = [
|
|
|
+ 0 => $commandxy,
|
|
|
+ 'device_id_code' => $device_id_code,
|
|
|
+ 'len' => str_pad(strtoupper(dechex(mb_strlen($content))), 4, "0", STR_PAD_LEFT),
|
|
|
+ 'content' => $content,
|
|
|
+ ];
|
|
|
+ $msg = '[' . implode('*', $msgdata) . ']';
|
|
|
+ $sslInsertData = [
|
|
|
+ 'facility_id' => $facility_id,
|
|
|
+ 'device_id_code' => $device_id_code,
|
|
|
+ 'command' => $command,
|
|
|
+ 'send_msg' => $msg,
|
|
|
+ 'send_weight' => $weight,
|
|
|
+ 'send_time' => date('Y-m-d H:i:s'),
|
|
|
+ 'is_success' => $is_success,
|
|
|
+ 'send_type' => $send_type,
|
|
|
+ 'sys_user_id' => $sys_user_id,
|
|
|
+ ];
|
|
|
+ $sslid = $m_ssl->insertData($sslInsertData);
|
|
|
+ if (empty($sslid)) {
|
|
|
+ throw new \Exception("发送数据添加失败");
|
|
|
+ }
|
|
|
+ $data = [
|
|
|
+ 'msg' => $msg,
|
|
|
+ 'weight' => $weight,
|
|
|
+ 'createtime' => date('Y-m-d H:i:s'),
|
|
|
+ 'facility_id' => $facility_id,
|
|
|
+ 'device_id_code' => $device_id_code,
|
|
|
+ 'send_list_id' => $sslid,
|
|
|
+ 'msg_type' => $msg_type,
|
|
|
+ ];
|
|
|
+ $m_ssq = new ShsendqueueModel();
|
|
|
+ $id = $m_ssq->insertData($data);
|
|
|
+ if (empty($id)) {
|
|
|
+ throw new \Exception("发送队列数据添加失败");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
- $weight = $this->getsendweight($command);
|
|
|
- $msgdata = [
|
|
|
- 0 => $commandxy,
|
|
|
- 'device_id_code' => $device_id_code,
|
|
|
- 'len' => str_pad(strtoupper(dechex(mb_strlen($content))), 4, "0", STR_PAD_LEFT),
|
|
|
- 'content' => $content,
|
|
|
- ];
|
|
|
- $msg = '[' . implode('*', $msgdata) . ']';
|
|
|
- $sslInsertData = [
|
|
|
- 'facility_id' => $facility_id,
|
|
|
- 'device_id_code' => $device_id_code,
|
|
|
- 'command' => $command,
|
|
|
- 'send_msg' => $msg,
|
|
|
- 'send_weight' => $weight,
|
|
|
- 'send_time' => date('Y-m-d H:i:s'),
|
|
|
- 'is_success' => $is_success,
|
|
|
- 'send_type' => $send_type,
|
|
|
- 'sys_user_id' => $sys_user_id,
|
|
|
- ];
|
|
|
- $sslid = $m_ssl->insertData($sslInsertData);
|
|
|
- if (empty($sslid)) {
|
|
|
- throw new \Exception("发送数据添加失败");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function createsendmsg2($facility_id, $device_id_code, $data)
|
|
|
+ {
|
|
|
+ $command = $data['command'];
|
|
|
+ $infoarr = $this->getsendcommandinfo($command);
|
|
|
+ if (!$infoarr) {
|
|
|
+ // Log::write("无对应命令数据1:" . $command, 'shouhuan');
|
|
|
+ // Log::write($data, 'shouhuan');
|
|
|
+ return false;
|
|
|
}
|
|
|
- $data = [
|
|
|
- 'msg' => $msg,
|
|
|
- 'weight' => $weight,
|
|
|
- 'createtime' => date('Y-m-d H:i:s'),
|
|
|
- 'facility_id' => $facility_id,
|
|
|
- 'device_id_code' => $device_id_code,
|
|
|
- 'send_list_id' => $sslid,
|
|
|
- 'msg_type' => $msg_type,
|
|
|
- ];
|
|
|
- $m_ssq = new ShsendqueueModel();
|
|
|
- $id = $m_ssq->insertData($data);
|
|
|
- if (empty($id)) {
|
|
|
- throw new \Exception("发送队列数据添加失败");
|
|
|
+ $content_arr = $data['content_arr'];
|
|
|
+ $config = $infoarr;
|
|
|
+
|
|
|
+ $m_ssl = new ShsendlistModel();
|
|
|
+ $commandxy = "3G";
|
|
|
+ if ('back' == $config['kind']) {
|
|
|
+ $content = $infoarr['command'];
|
|
|
+ $weight = $this->getsendweight($command);
|
|
|
+ $msgdata = [
|
|
|
+ 0 => $commandxy,
|
|
|
+ 'device_id_code' => $device_id_code,
|
|
|
+ 'len' => str_pad(strtoupper(dechex(mb_strlen($content))), 4, "0", STR_PAD_LEFT),
|
|
|
+ 'content' => $content,
|
|
|
+ ];
|
|
|
+ $msg = '[' . implode('*', $msgdata) . ']';
|
|
|
+ $sslInsertData = [
|
|
|
+ 'facility_id' => $facility_id,
|
|
|
+ 'device_id_code' => $device_id_code,
|
|
|
+ 'command' => $command,
|
|
|
+ 'send_msg' => $msg,
|
|
|
+ 'send_weight' => $weight,
|
|
|
+ 'send_time' => date('Y-m-d H:i:s'),
|
|
|
+ 'is_success' => 1,
|
|
|
+ 'send_type' => 0,
|
|
|
+ 'sys_user_id' => 0,
|
|
|
+ ];
|
|
|
+ $sslid = $m_ssl->insertData($sslInsertData);
|
|
|
+ if (empty($sslid)) {
|
|
|
+ throw new \Exception("发送数据添加失败");
|
|
|
+ }
|
|
|
+ return $msg;
|
|
|
}
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
/**
|
|
|
* 获取回复权重
|
|
@@ -464,6 +509,18 @@ class ShouhuanCommand
|
|
|
],
|
|
|
'kind' => 'back',
|
|
|
],
|
|
|
+ 'TKQ' => [
|
|
|
+ 'content' => [
|
|
|
+ 'command' => 'TKQ',
|
|
|
+ ],
|
|
|
+ 'kind' => 'back',
|
|
|
+ ],
|
|
|
+ 'WG' => [
|
|
|
+ 'content' => [
|
|
|
+ 'command' => 'WG',
|
|
|
+ ],
|
|
|
+ 'kind' => 'back',
|
|
|
+ ],
|
|
|
];
|
|
|
if (!isset($data[$command])) {
|
|
|
return false;
|