修改bug

This commit is contained in:
2020-10-13 09:26:52 +08:00
parent 3ddfaa9502
commit a54e71a7ce
2 changed files with 85 additions and 82 deletions

View File

@@ -54,25 +54,27 @@ class RuleController extends AdminController
$form->switch('status', '状态')->default(1); $form->switch('status', '状态')->default(1);
$form->saving(function (Form $form) { $form->saving(function (Form $form) {
$code = $form->code; if ($form->code) {
$code = $form->code;
$ticket = explode('-', $code); $ticket = explode('-', $code);
if (!is_array($ticket) || count($ticket) != 3) { if (!is_array($ticket) || count($ticket) != 3) {
$error = new MessageBag([ $error = new MessageBag([
'title' => '错误', 'title' => '错误',
'message' => '规则编号格式错误', 'message' => '规则编号格式错误',
]); ]);
return back()->withInput()->with(compact('error')); return back()->withInput()->with(compact('error'));
}
$full = $ticket[1]; //full100
$price = $ticket[2];
preg_match('/\d+/', $full, $match);
$form->full = $match[0];
$form->take = $price;
} }
$full = $ticket[1]; //full100
$price = $ticket[2];
preg_match('/\d+/', $full, $match);
$form->full = $match[0];
$form->take = $price;
}); });
return $form; return $form;

View File

@@ -6,6 +6,7 @@ use App\Events\ConponCallback;
use App\Models\ActivityCouponLog; use App\Models\ActivityCouponLog;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use RuntimeException;
class ConponCallbackListener implements ShouldQueue class ConponCallbackListener implements ShouldQueue
{ {