| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Console\Commands;
- use App\Facade\TableName;
- use App\Http\helper\NumConfig;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\DB;
- class DecStock extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'dec_stock';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '减少crash库存';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $limitValue = 18000 * NumConfig::NUM_VALUE;
- $decValue = 3000 * NumConfig::NUM_VALUE;
- $list = DB::table(TableName::QPPlatformDB() . 'RoomStockStatic')
- ->where('GameID', 4020)
- ->where('Stock', '>=', $limitValue)
- ->get();
- if ($list->isNotEmpty()) {
- foreach ($list as $value) {
- DB::table(TableName::QPPlatformDB() . 'RoomStockStatic')
- ->where('ID', $value->ID)
- ->decrement('Stock', $decValue);
- }
- }
- }
- }
|