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

64 lines
1.4 KiB

<?php
namespace App\Admin\Forms\v3;
use Dcat\Admin\Widgets\Form;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Redis;
use App\Libs\Redis\RedisKey;
class ProgramShareCardForm extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return Response
*/
public function handle(array $input)
{
// 获取外部传递参数
$flashSale = $input['flash_sale'];
$groupBuy= $input['group_buy'];
$newProduct= $input['new_product'];
$data = [
'flash_sale' => $flashSale,
'group_buy' => $groupBuy,
'new_product' => $newProduct,
];
$res = Redis::hmset(RedisKey::PROGRAM_SHARE_CARD , $data);
if($res){
return $this->success('修改成功','/goods_activity');
}else{
return $this->error('修改失败');
}
}
/**
* Build a form here.
*/
public function form()
{
$data = Redis::hgetall(RedisKey::PROGRAM_SHARE_CARD);
$flashSale = isset($data['flash_sale'])?$data['flash_sale']:0;
$this->display('setting' , '设置')->value('小程序分享卡片设置');
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [];
}
}