Merge branch 'master' of ssh://47.101.48.251:/data/git/wx.sstbc.com

master
lion 4 weeks ago
commit 6331adff9a

@ -43,9 +43,16 @@ class UpdateLetter extends Command
public function handle()
{
// 更新用户首字母
$users = User::whereNull('letter')->whereNotNull('name')->limit(100)->get();
$users = User::whereNull('letter')
->where(function ($query) {
$query->whereNotNull('name')->orWhereNotNull('username');
})->limit(100)->get();
foreach ($users as $user) {
$user->letter = strtoupper(Pinyin::abbr(mb_substr($user->name, 0, 1))[0]);
$name = $user->username;
if ($user->name) {
$name = $user->name;
}
$user->letter = strtoupper(Pinyin::abbr(mb_substr($name, 0, 1))[0]);
$user->save();
}
return self::SUCCESS;

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supply_demands', function (Blueprint $table) {
$table->string('fund_company')->nullable()->comment('融资公司');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('supply_demands', function (Blueprint $table) {
//
});
}
};
Loading…
Cancel
Save