作者 李小龙

通知拉取代码接口

... ... @@ -271,6 +271,15 @@ public function getRandInquiryText(Request $request){
}
/**
* 拉代码
* @param Request $request
*/
public function pullCode(Request $request){
$command = "cd /www/wwwroot/globalso-v6-c-customer && ./pull_custom_code.sh";
shell_exec($command);
}
/**
* @param $url
* @return bool|string
*/
... ...
#!/bin/bash
#输出当前时间
date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"
#web站点存放路径
webPath="/www/wwwroot/"
projectName="globalso-v6-c-customer"
#git项目
gitHttp="http://47.244.231.31:8099/zhl/globalso-v6-c-customer.git"
#Git获取项目代码,执行composer更新
function getProjectCode()
{
cd $webPath$projectName
#判断是否存在git目录
if [ ! -d ".git" ]; then
rm -rf .htaccess
rm -rf .user.ini
cd ..
git clone -b dev $gitHttp $projectName
cd $projectName
composer install --ignore-platform-reqs
# .env文件处理
cp .env.example ./.env
else
git checkout .
git pull origin dev
composer update --ignore-platform-reqs
fi
}
# #Git获取项目代码,执行composer更新
getProjectCode
exit
\ No newline at end of file
... ...
... ... @@ -32,5 +32,7 @@
Route::any('/website_html_handle',[NoticeController::class, 'websiteHtml']);
//询盘文案
Route::any('/Hjoh59552',[NoticeController::class,'getRandInquiryText']);
//通知拉取代码
Route::any('/pullCode',[NoticeController::class,'pullCode']);
});
... ...