This commit is contained in:
tokumeikoi
2021-05-07 01:17:55 +09:00
parent b3b0988730
commit dc6317db97
6 changed files with 15 additions and 7 deletions

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Services\PaymentService;
use App\Utils\Helper;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Payment;
@ -56,7 +57,8 @@ class PaymentController extends Controller
if (!Payment::create([
'name' => $request->input('name'),
'payment' => $request->input('payment'),
'config' => $request->input('config')
'config' => $request->input('config'),
'uuid' => Helper::guid()
])) {
abort(500, '保存失败');
}

View File

@ -11,10 +11,10 @@ use App\Http\Controllers\Controller;
class PaymentController extends Controller
{
public function notify($method, $id, Request $request)
public function notify($method, $uuid, Request $request)
{
try {
$paymentService = new PaymentService($method, $id);
$paymentService = new PaymentService($method, null, $uuid);
$verify = $paymentService->notify($request->input());
if (!$verify) abort(500, 'verify error');
if (!$this->handle($verify['trade_no'], $verify['callback_no'])) {

View File

@ -21,7 +21,7 @@ class GuestRoute
// Telegram
$router->post('/telegram/webhook', 'Guest\\TelegramController@webhook');
// Payment
$router->match(['get', 'post'], '/payment/notify/{method}/{id}', 'Guest\\PaymentController@notify');
$router->match(['get', 'post'], '/payment/notify/{method}/{uuid}', 'Guest\\PaymentController@notify');
// Comm
$router->get ('/comm/config', 'Guest\\CommController@config');
});