Authored by wuxiao

Merge branch 'test' into develop

... ... @@ -67,21 +67,31 @@ class ForbiddenController extends BaseController
{
$model = new Forbidden();
if ($posts = Yii::$app->request->post()) {
$model->room_id = $posts['room_id'];
$model->uid = $posts['uid'];
$model->name = $posts['name'];
$model->status = 1;
$model->create_time = time();
if (!$model->save()) {
do {
$model->room_id = $posts['room_id'];
$model->uid = $posts['uid'];
$model->name = $posts['name'];
if (!$model->uid || !$model->name) {
$code = 400;
$msg = '用户id、昵称必填!';
break;
}
$model->status = 1;
$model->create_time = time();
if (!$model->save()) {
// var_dump($model->errors);
$code = 400;
$code_str = 'error';
$msg = '添加失败。'.current($model->getFirstErrors());
} else {
$code = 200;
$code_str = 'success';
$msg = '添加成功。';
$code = 400;
$code_str = 'error';
$msg = '添加失败。'.current($model->getFirstErrors());
} else {
$code = 200;
$code_str = 'success';
$msg = '添加成功。';
}
}
while(false);
if(Yii::$app->request->isAjax){
$this->renderJson($code,$msg);
}else{
... ...
... ... @@ -25,7 +25,7 @@ class LivingController extends BaseController
$key = __CLASS__.__FUNCTION__.'app'.$this->app;
if (!$ret = $this->cache->get($key)){
$ret = Room::find()->with(['master'])->where(['and',['!=','best','0'],['app'=>$this->app]])->limit(2)->orderBy(['best'=>SORT_ASC])->all();
$ret = Room::find()->with(['master'])->where(['and',['!=','best','0'],['app'=>$this->app]])->limit(2)->orderBy(['best'=>SORT_DESC])->all();
foreach ($ret as $k=>$model){
$row = [
... ...