正在显示
3 个修改的文件
包含
48 行增加
和
0 行删除
| @@ -271,6 +271,15 @@ public function getRandInquiryText(Request $request){ | @@ -271,6 +271,15 @@ public function getRandInquiryText(Request $request){ | ||
| 271 | } | 271 | } | 
| 272 | 272 | ||
| 273 | /** | 273 | /** | 
| 274 | + * 拉代码 | ||
| 275 | + * @param Request $request | ||
| 276 | + */ | ||
| 277 | + public function pullCode(Request $request){ | ||
| 278 | + $command = "cd /www/wwwroot/globalso-v6-c-customer && ./pull_custom_code.sh"; | ||
| 279 | + shell_exec($command); | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + /** | ||
| 274 | * @param $url | 283 | * @param $url | 
| 275 | * @return bool|string | 284 | * @return bool|string | 
| 276 | */ | 285 | */ | 
pull_custom_code.sh
0 → 100644
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +#输出当前时间 | ||
| 4 | +date --date='0 days ago' "+%Y-%m-%d %H:%M:%S" | ||
| 5 | + | ||
| 6 | +#web站点存放路径 | ||
| 7 | +webPath="/www/wwwroot/" | ||
| 8 | +projectName="globalso-v6-c-customer" | ||
| 9 | + | ||
| 10 | +#git项目 | ||
| 11 | +gitHttp="http://47.244.231.31:8099/zhl/globalso-v6-c-customer.git" | ||
| 12 | + | ||
| 13 | +#Git获取项目代码,执行composer更新 | ||
| 14 | +function getProjectCode() | ||
| 15 | +{ | ||
| 16 | + cd $webPath$projectName | ||
| 17 | + #判断是否存在git目录 | ||
| 18 | + if [ ! -d ".git" ]; then | ||
| 19 | + rm -rf .htaccess | ||
| 20 | + rm -rf .user.ini | ||
| 21 | + cd .. | ||
| 22 | + git clone -b dev $gitHttp $projectName | ||
| 23 | + cd $projectName | ||
| 24 | + composer install --ignore-platform-reqs | ||
| 25 | + # .env文件处理 | ||
| 26 | + cp .env.example ./.env | ||
| 27 | + else | ||
| 28 | + git checkout . | ||
| 29 | + git pull origin dev | ||
| 30 | + composer update --ignore-platform-reqs | ||
| 31 | + fi | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +# #Git获取项目代码,执行composer更新 | ||
| 35 | +getProjectCode | ||
| 36 | + | ||
| 37 | +exit | 
| @@ -32,5 +32,7 @@ | @@ -32,5 +32,7 @@ | ||
| 32 | Route::any('/website_html_handle',[NoticeController::class, 'websiteHtml']); | 32 | Route::any('/website_html_handle',[NoticeController::class, 'websiteHtml']); | 
| 33 | //询盘文案 | 33 | //询盘文案 | 
| 34 | Route::any('/Hjoh59552',[NoticeController::class,'getRandInquiryText']); | 34 | Route::any('/Hjoh59552',[NoticeController::class,'getRandInquiryText']); | 
| 35 | + //通知拉取代码 | ||
| 36 | + Route::any('/pullCode',[NoticeController::class,'pullCode']); | ||
| 35 | }); | 37 | }); | 
| 36 | 38 | 
- 
请 注册 或 登录 后发表评论