getKey(); if(_empty_($ids)){ return $this->response()->warning('没有勾选'); } $codes = WxUserInviteTempCode::whereIn('id', $ids) ->get(['id', 'code']) ->map(function ($item) { return [ 'name' => 'id-'.$item->id, 'url' => $item->code ]; })->toArray(); if($codes){ $zip_file_path = DownUtils::down_invite_temp_code($codes); return $this->response()->download($zip_file_path); }else{ return $this->response()->error('下载程序出错'); } } /** * @return string|array|void */ public function confirm() { return ['确定下载选中的推广码?']; } /** * @param Model|Authenticatable|HasPermissions|null $user * * @return bool */ protected function authorize($user): bool { return true; } /** * @return array */ protected function parameters() { return []; } }