@@ -97,23 +97,27 @@ public function getInstallState()
9797
9898 /**
9999 * 下载模块文件
100- * @param string $token 官网会员token
101- * @param int $orderId 订单号
102- * @return string 下载文件路径
100+ * @return string 已下载文件路径
103101 * @throws Throwable
104102 */
105- public function download (string $ token , int $ orderId ): string
103+ public function download (): string
106104 {
105+ $ token = request ()->param ("token/s " );
106+ $ version = request ()->param ('version/s ' );
107+ $ orderId = request ()->param ("orderId/d " );
108+
107109 if (!$ orderId ) {
108110 throw new Exception ('Order not found ' );
109111 }
112+
110113 // 下载 - 系统版本号要求、已安装模块的互斥和依赖检测
111114 $ zipFile = Server::download ($ this ->uid , $ this ->installDir , [
112- 'sysVersion ' => Config::get ('buildadmin.version ' ),
115+ 'version ' => $ version ,
116+ 'orderId ' => $ orderId ,
113117 'nuxtVersion ' => Server::getNuxtVersion (),
114- 'ba-user-token ' => $ token ,
115- 'order_id ' => $ orderId ,
118+ 'sysVersion ' => Config::get ('buildadmin.version ' ),
116119 'installed ' => Server::getInstalledIds ($ this ->installDir ),
120+ 'ba-user-token ' => $ token ,
117121 ]);
118122
119123 // 删除旧版本代码
@@ -236,14 +240,14 @@ public function upload(string $token, string $file): array
236240 * 更新
237241 * @throws Throwable
238242 */
239- public function update (string $ token , int $ orderId ): void
243+ public function update (): void
240244 {
241245 $ state = $ this ->getInstallState ();
242246 if ($ state != self ::DISABLE ) {
243247 throw new Exception ('Please disable the module before updating ' );
244248 }
245249
246- $ this ->download ($ token , $ orderId );
250+ $ this ->download ();
247251
248252 // 标记需要执行更新脚本,并在安装请求执行(当前请求未自动加载到新文件不方便执行)
249253 $ info = $ this ->getInfo ();
@@ -253,20 +257,18 @@ public function update(string $token, int $orderId): void
253257
254258 /**
255259 * 安装模块
256- * @param string $token 用户token
257- * @param int $orderId 订单号
258260 * @return array 模块基本信息
259261 * @throws Throwable
260262 */
261- public function install (string $ token , int $ orderId ): array
263+ public function install (): array
262264 {
263265 $ state = $ this ->getInstallState ();
264266 if ($ state == self ::INSTALLED || $ state == self ::DIRECTORY_OCCUPIED || $ state == self ::DISABLE ) {
265267 throw new Exception ('Module already exists ' );
266268 }
267269
268270 if ($ state == self ::UNINSTALLED ) {
269- $ this ->download ($ token , $ orderId );
271+ $ this ->download ();
270272 }
271273
272274 // 导入sql
0 commit comments