...
|
...
|
@@ -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{
|
...
|
...
|
|