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

  1. <?php
  2. namespace App\Admin\Forms\v3;
  3. use Dcat\Admin\Widgets\Form;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Illuminate\Support\Facades\Redis;
  6. use App\Libs\Redis\RedisKey;
  7. class ProgramShareCardForm extends Form
  8. {
  9. /**
  10. * Handle the form request.
  11. *
  12. * @param array $input
  13. *
  14. * @return Response
  15. */
  16. public function handle(array $input)
  17. {
  18. // 获取外部传递参数
  19. $flashSale = $input['flash_sale'];
  20. $groupBuy= $input['group_buy'];
  21. $newProduct= $input['new_product'];
  22. $data = [
  23. 'flash_sale' => $flashSale,
  24. 'group_buy' => $groupBuy,
  25. 'new_product' => $newProduct,
  26. ];
  27. $res = Redis::hmset(RedisKey::PROGRAM_SHARE_CARD , $data);
  28. if($res){
  29. return $this->success('修改成功','/goods_activity');
  30. }else{
  31. return $this->error('修改失败');
  32. }
  33. }
  34. /**
  35. * Build a form here.
  36. */
  37. public function form()
  38. {
  39. $data = Redis::hgetall(RedisKey::PROGRAM_SHARE_CARD);
  40. $flashSale = isset($data['flash_sale'])?$data['flash_sale']:0;
  41. $this->display('setting' , '设置')->value('小程序分享卡片设置');
  42. }
  43. /**
  44. * The data of the form.
  45. *
  46. * @return array
  47. */
  48. public function default()
  49. {
  50. return [];
  51. }
  52. }