Authored by wuxiao

解决getreplaybarrage接口返回的不是json格式的问题

... ... @@ -70,6 +70,7 @@ class BaseController extends Controller
'md5' => md5(strval($data))
];
}
header('Content-type: application/json;charset=utf-8');
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
echo json_encode($retData);
Yii::$app->end();
... ...
... ... @@ -392,7 +392,7 @@ class LivingController extends BaseController
$dependency = new \yii\caching\DbDependency(['sql' => 'SELECT COUNT(*) FROM '.LiveComment::tableName($room_id)." WHERE room_id={$room_id} AND create_time>={$startTime} AND create_time<={$endTime}"]);
$this->cache->set($key, json_encode($ret), Yii::$app->params['defaultCacheExpire'], $dependency);
}
}
$this->renderJson(Yii::$app->params['success_code'],'',$ret);
}
... ...