update new feature
This commit is contained in:
parent
3f22f89654
commit
6d87d47d68
|
@ -124,17 +124,30 @@ class ApiController extends Controller {
|
|||
$allFeatures = [];
|
||||
foreach ($listManagement as $key => $value) {
|
||||
$features = json_decode($value->image, true);
|
||||
$f = [];
|
||||
// $f = [];
|
||||
// foreach ($features as $k => $v) {
|
||||
// $f[] = $v['features'];
|
||||
// if (isset($v['features512']))
|
||||
// if (count($v['features512']))
|
||||
// $f[] = $v['features512'];
|
||||
// }
|
||||
// $allFeatures[] = [
|
||||
// "id" => $value->id,
|
||||
// "name" => $this->convert_vi_to_en($value->name),
|
||||
// "features" => $f
|
||||
// ];
|
||||
$feature1 = $feature2 = [];
|
||||
foreach ($features as $k => $v) {
|
||||
$f[] = $v['features'];
|
||||
$feature1[] = $v['features'];
|
||||
if (isset($v['features512']))
|
||||
if (count($v['features512']))
|
||||
$f[] = $v['features512'];
|
||||
$feature2[] = $v['features512'];
|
||||
}
|
||||
$allFeatures[] = [
|
||||
"id" => $value->id,
|
||||
"name" => $this->convert_vi_to_en($value->name),
|
||||
"features" => $f
|
||||
"feature1" => $feature1,
|
||||
"feature2" => $feature2
|
||||
];
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
|
|
|
@ -118,14 +118,24 @@ class ListManagement extends \yii\db\ActiveRecord {
|
|||
|
||||
public function getAllFeatures() {
|
||||
$features = json_decode($this->image, true);
|
||||
$f = [];
|
||||
// $f = [];
|
||||
// foreach ($features as $k => $v) {
|
||||
// $f[] = $v['features'];
|
||||
// if (isset($v['features512']))
|
||||
// if (count($v['features512']))
|
||||
// $f[] = $v['features512'];
|
||||
// }
|
||||
$feature1 = $feature2 = [];
|
||||
foreach ($features as $k => $v) {
|
||||
$f[] = $v['features'];
|
||||
$feature1[] = $v['features'];
|
||||
if (isset($v['features512']))
|
||||
if (count($v['features512']))
|
||||
$f[] = $v['features512'];
|
||||
$feature2[] = $v['features512'];
|
||||
}
|
||||
return $f;
|
||||
return [
|
||||
"feature1" => $feature1,
|
||||
"feature2" => $feature2
|
||||
];
|
||||
}
|
||||
|
||||
public static function statisticFeatures() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user