fix bug ErrorCode -1
This commit is contained in:
parent
b5619f7a5f
commit
9719e836f8
|
@ -2,5 +2,6 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
"hideInfomation" => false,
|
"hideInfomation" => false,
|
||||||
"TCTECH" => true
|
"TCTECH" => true,
|
||||||
|
"CardService" => "192.168.1.245:2001"
|
||||||
];
|
];
|
||||||
|
|
|
@ -184,7 +184,7 @@ class common extends \yii\db\ActiveRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function requestToCardService($path, $data) {
|
public static function requestToCardService($path, $data) {
|
||||||
return file_get_contents("http://192.168.2.119:2001" . $path, false, stream_context_create([
|
return file_get_contents("http://" . Yii::$app->params["CardService"] . $path, false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
'header' => "Content-Type: application/json",
|
'header' => "Content-Type: application/json",
|
||||||
'method' => "POST",
|
'method' => "POST",
|
||||||
|
|
|
@ -327,8 +327,14 @@ function syncSchedule(schedule, ip) {
|
||||||
console.log("sync schedule: ", data.res);
|
console.log("sync schedule: ", data.res);
|
||||||
var html = "";
|
var html = "";
|
||||||
html = "<span class='text-green'><i class='fa fa-check'></i> Đồng bộ lịch trình tới thiết bị <b>" + data.IP + "</b>.</span><br>";
|
html = "<span class='text-green'><i class='fa fa-check'></i> Đồng bộ lịch trình tới thiết bị <b>" + data.IP + "</b>.</span><br>";
|
||||||
$("#logs-response").append(html);
|
|
||||||
progress++;
|
progress++;
|
||||||
|
if (data.res.ErrorCode == "-1") {
|
||||||
|
html = "<span class='text-red'><i class='fa fa-remove'></i> Đồng bộ tới thiết bị <b>" + data.IP + "</b> thất bại.</span><br>";
|
||||||
|
progress++;
|
||||||
|
} else {
|
||||||
|
syncStaffs(ip);
|
||||||
|
}
|
||||||
|
$("#logs-response").append(html);
|
||||||
var percent = parseInt(progress / totals * 100);
|
var percent = parseInt(progress / totals * 100);
|
||||||
$("#progress").attr("aria-valuenow", percent);
|
$("#progress").attr("aria-valuenow", percent);
|
||||||
$("#progress").attr("style", "width: " + percent + "%");
|
$("#progress").attr("style", "width: " + percent + "%");
|
||||||
|
@ -337,7 +343,6 @@ function syncSchedule(schedule, ip) {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
$("#close-modal").attr("disabled", false);
|
$("#close-modal").attr("disabled", false);
|
||||||
}
|
}
|
||||||
syncStaffs(ip);
|
|
||||||
},
|
},
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
common.ajaxError();
|
common.ajaxError();
|
||||||
|
@ -356,6 +361,9 @@ function syncStaffs(ip) {
|
||||||
console.log("sync user: ", data.resUser);
|
console.log("sync user: ", data.resUser);
|
||||||
var html = "";
|
var html = "";
|
||||||
html = "<span class='text-green'><i class='fa fa-check'></i> Đồng bộ nhân viên tới thiết bị <b>" + data.IP + "</b>.</span><br>";
|
html = "<span class='text-green'><i class='fa fa-check'></i> Đồng bộ nhân viên tới thiết bị <b>" + data.IP + "</b>.</span><br>";
|
||||||
|
if (data.res.ErrorCode == "-1") {
|
||||||
|
html = "<span class='text-red'><i class='fa fa-remove'></i> Đồng bộ nhân viên tới thiết bị <b>" + data.IP + "</b> thất bại.</span><br>";
|
||||||
|
}
|
||||||
$("#logs-response").append(html);
|
$("#logs-response").append(html);
|
||||||
progress++;
|
progress++;
|
||||||
var percent = parseInt(progress / totals * 100);
|
var percent = parseInt(progress / totals * 100);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user