Merge branch 'zhouziqunzzq-master'

This commit is contained in:
LI JIAHAO
2017-06-18 00:09:29 +08:00
5 changed files with 50 additions and 3 deletions
@@ -65,6 +65,8 @@ class MessageController extends Controller
MessageContact::where('user_id', $user_id)
->where('contact_id', $contact_id)
->update(['unread_count' => 0]);
User::where('id', $user_id)
->update(['last_get_new_message_time' => time()]);
return json_encode($messages);
}
+2
View File
@@ -9,6 +9,8 @@ class User extends Model
{
protected $table = 'users';
protected $fillable = ['last_get_new_message_time', 'last_send_email_time'];
public function user_infos()
{
return $this->hasMany('App\UserInfo');
@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterUsersTableAddLocker extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasTable('users') && !Schema::hasColumn('users', 'last_get_new_message_time')
&& !Schema::hasColumn('users', 'last_send_email_time')) {
Schema::table('users', function (Blueprint $table) {
$table->integer('last_get_new_message_time')->nullable()->default(0);
$table->integer('last_send_email_time')->nullable()->default(0);
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasTable('users') && Schema::hasColumn('users', 'last_get_new_message_time')
&& Schema::hasColumn('users', 'last_send_email_time')) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['last_get_new_message_time', 'last_send_email_time']);
});
}
}
}
+6 -2
View File
@@ -157,8 +157,12 @@ Vue.component('message-dialog', {
mounted: function () {
this.$nextTick(function () {
this.$on('loadDialogHandler', function (id) {
this.clearMessage(id);
this.getHistoryMessage(id);
var vm = this;
if (vm.contact_id != id)
{
this.clearMessage(id);
this.getHistoryMessage(id);
}
});
this.$on('refreshMessageEvent', function () {
this.getNewMessage();
+1 -1
View File
@@ -70,7 +70,7 @@
<p v-if="contact_id == 0" class="message-content" v-html="message.content"></p>
<p v-else class="message-content">@{{ message.content }}</p>
<br/><br/>
<i class="time-tag">@{{ message.updated_at }}</i>
<i class="time-tag">@{{ message.created_at }}</i>
</span>
<span v-else>
<i class="history-text">以上是历史消息</i>