public function actionReply()
 {
     $data = Yii::$app->request->post();
     $user = new User();
     $fromphone = $user->find()->select('id')->where(['phone' => $data['fphone']])->one();
     $model = new Reply();
     if ($data['tphone'] == '') {
         $model->toid = 0;
     } else {
         $tophone = $user->find()->select('id')->where(['phone' => $data['tphone']])->one();
         $model->toid = $tophone['id'];
     }
     $to = Message::findOne(['id' => $data['msgid']]);
     if ($fromphone['id'] != $to['id']) {
         $model3 = new Notify();
         $model3->from = $fromphone['id'];
         $model3->to = $to['userid'];
         $model3->message = '评论';
         $model3->created_at = time();
         if (!$model3->save()) {
             echo json_encode(array('flag' => 0, 'msg' => 'Reply failed!'));
             return;
         }
     }
     $model->fromid = $fromphone['id'];
     $model->msgid = $data['msgid'];
     $model->content = $data['content'];
     $model->isread = 0;
     $model->created_at = time();
     if ($model->save()) {
         echo json_encode(array('flag' => 1, 'msg' => 'Reply success!'));
     } else {
         echo json_encode(array('flag' => 0, 'msg' => 'Reply failed!'));
     }
 }