$id, 'title' => $input['title'], 'image' => $ossImageDir.'/'.$input['image'], 'relative_path' => $input['image'], ]; $data = json_encode($data); $res = Redis::hset(RedisKey::PROGRAM_SHARE_CARD ,$id, $data); if($res){ return $this->success('添加成功','/share_card_setting'); }else{ return $this->error('添加失败或被替换'); } } /** * Build a form here. */ public function form() { $this->display('setting' , ' ')->value('小程序分享卡片设置'); $this->text('title','标题')->required(); $this->image('image','图片')->required()->autoUpload()->width(3); } /** * The data of the form. * * @return array */ public function default() { return []; } }