校验平安券核销
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user