<?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 QVWer; BFZ9M: foreach ($Y9WQp as $rpy90) { MemberUtil::update($rpy90['userId'], array('messageCount' => $rpy90['count'])); } goto E5fNH; QVWer: Schema::table('member_user', function (Blueprint $hTN3M) { $hTN3M->integer('messageCount')->nullable()->comment('未读消息数量'); }); goto uykfX; uykfX: $Y9WQp = ModelUtil::model('member_message')->where(array('status' => MemberMessageStatus::UNREAD))->groupBy('userId')->get(array('userId', \DB::raw('count(*) as count')))->toArray(); goto BFZ9M; E5fNH: } public function down() { } }