56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Forms;
|
|
|
|
use App\Exceptions\JingCaiException;
|
|
use App\Jobs\RefreshOrderPlwResult;
|
|
use App\Jobs\RefreshOrderQxcResult;
|
|
use App\Model\Plw;
|
|
use App\Model\Qxc;
|
|
use Dcat\Admin\Contracts\LazyRenderable;
|
|
use Dcat\Admin\Traits\LazyWidget;
|
|
use Dcat\Admin\Widgets\Form;
|
|
use Arr;
|
|
use Log;
|
|
|
|
class SendPrizeQxcForm extends Form implements LazyRenderable
|
|
{
|
|
use LazyWidget;
|
|
|
|
public function handle(array $input)
|
|
{
|
|
if (empty($input)){
|
|
return $this->response()->alert()->error("设置失败1");
|
|
}else{
|
|
|
|
|
|
$shop = Qxc::where('id',$input['id'])->first();
|
|
if (empty($shop)){
|
|
return $this->response()->alert()->error("设置失败2");
|
|
}
|
|
|
|
try {
|
|
RefreshOrderQxcResult::dispatch($shop->id);
|
|
} catch (JingCaiException $exception) {
|
|
return $this->response()->alert()->error($exception->getMessage());
|
|
}
|
|
return $this->response()->success("设置成功")->refresh();
|
|
}
|
|
}
|
|
|
|
public function form()
|
|
{
|
|
$shop_id = $this->payload['id'];
|
|
$shops = Qxc::where('id',$shop_id)->first();
|
|
if (empty($shops)){
|
|
return $this->response()->alert()->error('无该数据');
|
|
}
|
|
|
|
$this->display('issue_num','期号')->value($shops->issue_num);
|
|
$this->display('result','结果')->value(implode(',',$shops->result ?: []));
|
|
$this->display('prize_time','开奖时间')->value($shops->prize_time);
|
|
$this->hidden('id')->value($shop_id);
|
|
}
|
|
|
|
}
|