链街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.
 
 
 
 

67 lines
1.4 KiB

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