链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
1.5 KiB

<?php
namespace App\Admin\Forms;
use Dcat\Admin\Widgets\Form;
use Symfony\Component\HttpFoundation\Response;
use App\Libs\SsdbClient;
class CouponTieForm extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return Response
*/
public function handle(array $input)
{
$data = [
'activity' => $input['activity'],
'forward' => $input['forward'],
'repay' => $input['repay'],
];
$coupon = SsdbClient::client()->multi_hset('coupon_rebate_activity',$data);
if($coupon === false){
return $this->error('修改失败');
}
return $this->success('修改成功', '/couponTie');
}
/**
* Build a form here.
*/
public function form()
{
$coupon = SsdbClient::client()->hgetall('coupon_rebate_activity');
if(empty($coupon)){
$coupon = [
'activity'=> 0,
'forward'=> '',
'repay' => ''
];
}
$this->text('activity')->required()->value($coupon['activity']);
$this->text('forward')->required()->value($coupon['forward']);
$this->text('repay')->required()->value($coupon['repay']);
$this->disableResetButton();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [
'activity' => '2',
'forward' => '',
'repay' => '',
];
}
}