This commit is contained in:
LI JIAHAO
2017-06-17 23:55:56 +08:00
committed by Harry Zhou
parent 94929b2d5d
commit b3b0606d95
6 changed files with 52 additions and 4 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class ContentController extends Controller
$data['populargoods'] = GoodInfo::where('baned', false)->where('count', '>', 0)->where('fav_num', '>', 0)->orderby('fav_num', 'desc')->limit(8)->get();
$data['cats'] = GoodCat::orderby('cat_index', 'asc')->get();
foreach($data['cats'] as $cat){
$data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->inRandomOrder()->limit(4)->get();
$data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->where('count', '>', 0)->inRandomOrder()->limit(4)->get();
}
$data['announces'] = Announcement::orderby('id', 'dsc')->limit(3)->get();
return View::make('welcome')->with($data);
@@ -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']);
});
}
}
}
+2 -1
View File
@@ -40,7 +40,7 @@ function setprice(){
location.href=hr;
}
function setc(ha){
var hr="/good/?";
var hr="/good?";
if($("#priceSet1").val()!=""){
hr=hr+"&start_price="+$("#priceSet1").val();
}
@@ -61,6 +61,7 @@ function setc(ha){
}
if(getUrlParam('cat_id'))
hr = hr + '&cat_id=' + getUrlParam('cat_id');
//alert(hr);
location.href=hr;
}
+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();