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.
|
|
<?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'); 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']); }
/** * The data of the form. * * @return array */ public function default() { return [ 'activity' => '2', 'forward' => '', 'repay' => '', ]; }
}
|