update đồng bộ dữ liệu giữa các thiết bị
This commit is contained in:
@@ -96,4 +96,36 @@ class ApiController extends Controller {
|
||||
return $allFeatures;
|
||||
}
|
||||
|
||||
public function actionData() {
|
||||
Yii::$app->response->format = "json";
|
||||
return ListManagement::find()->orderBy(['id' => SORT_DESC])->all();
|
||||
}
|
||||
|
||||
public function actionFullData() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$lists = ListManagement::find()->andWhere(["IN", "id", Yii::$app->request->post()])->orderBy(['id' => SORT_DESC])->all();
|
||||
$res = [];
|
||||
foreach ($lists as $key => $value) {
|
||||
$f = [];
|
||||
$features = json_decode($value->image, true);
|
||||
foreach ($features as $k => $v) {
|
||||
$f[] = ["url" => base64_encode(file_get_contents(Yii::getAlias('@webroot') . "/data/uploads/face/" . $v['url'])), "features" => $v['features']];
|
||||
}
|
||||
$res[] = [
|
||||
"id" => $value->id,
|
||||
"type" => $value->type,
|
||||
"name" => $value->name,
|
||||
"gender" => $value->gender,
|
||||
"birthday" => $value->birthday,
|
||||
"telephone" => $value->telephone,
|
||||
"address" => $value->address,
|
||||
"time" => $value->time,
|
||||
"image" => $f
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user