校验平安券核销

This commit is contained in:
2022-01-19 14:49:27 +08:00
parent 89e24812c8
commit 16e8a25b05
5 changed files with 168 additions and 2 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Admin\Controllers;
use App\Jobs\CheckCouponByLog;
use App\Jobs\CheckCouponLog;
use App\Models\Coupon;
use App\Models\Log;
use Carbon\Carbon;
@@ -9,6 +11,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use XuanChen\Coupon\Action\pingan\Verification;
class TestController
@@ -152,4 +155,44 @@ class TestController
dd(1);
}
/**
* Notes: 设置数据
*
* @Author: 玄尘
* @Date: 2022/1/19 13:29
*/
public function checkCouponLog(Request $request)
{
$type = $request->type ?? '';
if (! $type) {
dd('type 错误');
}
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
foreach ($tables as $table) {
if (Str::contains($table, 'api_log_')) {
echo " 开始处理 ".$table." <br>";
if (! Schema::hasColumn($table, 'coupon_no')) {
Schema::table($table, function (Blueprint $table) {
$table->string('coupon_no')->after('out_source')->nullable();
});
}
if ($type == 'log') {
CheckCouponLog::dispatch($table);
}
if ($type == 'coupon') {
CheckCouponByLog::dispatch($table);
}
}
}
}
}