<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use ModStart\Core\Dao\ModelUtil; use Module\Member\Type\MemberMessageStatus; use Module\Member\Util\MemberUtil; class ModifyMemberUserMessageCount extends Migration { public function up() { goto JgsmH; K77Zh: foreach ($XsrNI as $HKoLA) { MemberUtil::update($HKoLA['userId'], array('messageCount' => $HKoLA['count'])); } goto VH_BC; JgsmH: Schema::table('member_user', function (Blueprint $tM63P) { $tM63P->integer('messageCount')->nullable()->comment('未读消息数量'); }); goto te7oy; te7oy: $XsrNI = ModelUtil::model('member_message')->where(array('status' => MemberMessageStatus::UNREAD))->groupBy('userId')->get(array('userId', \DB::raw('count(*) as count')))->toArray(); goto K77Zh; VH_BC: } public function down() { } }