SearchConfigController.php 960 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace frontend\modules\api\controllers;
  3. use common\models\SearchConfig;
  4. use frontend\modules\api\components\BaseAdminController;
  5. use Yii;
  6. use yii\web\Response;
  7. class SearchConfigController extends BaseAdminController
  8. {
  9. /**
  10. * 高级搜索显示配置
  11. * @return Response
  12. */
  13. public function actionInfo()
  14. {
  15. $id = 1;
  16. $SearchConfig = SearchConfig::findOne($id);
  17. //组合数据
  18. $data['data'] = json_decode($SearchConfig->content, true);
  19. return $this->asJson($data);
  20. }
  21. /**
  22. * 高级搜索显示配置修改
  23. * @return Response
  24. */
  25. public function actionUpdate()
  26. {
  27. $data = Yii::$app->request->post()["data"];
  28. $id = 1;
  29. $SearchConfig = SearchConfig::findOne($id);
  30. $SearchConfig->content = json_encode($data, true);
  31. $SearchConfig->update_time = time();
  32. $SearchConfig->save();
  33. return $this->asJson();
  34. }
  35. }