check duplicate khi đồng bộ

This commit is contained in:
2020-12-09 11:04:33 +07:00
parent 4cb2f77598
commit ed4b8a0144
4 changed files with 25 additions and 4 deletions

View File

@@ -236,12 +236,18 @@ class ListManagementController extends Controller {
public function actionFormSync() {
if (Yii::$app->request->post()) {
$data = Yii::$app->request->post();
$results = file_get_contents("http://" . $data['ip'] . "/api/data");
$results = json_decode(file_get_contents("http://" . $data['ip'] . "/api/data", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST",
'content' => json_encode(ListManagement::nameArray())
]
])), true);
Yii::$app->response->format = "json";
return [
"title" => $data['ip'],
"form" => $this->renderPartial("list", [
"results" => json_decode($results, true),
"results" => $results,
"typeArray" => ListManagement::$typeArray,
"ip" => $data['ip']
])