#!/bin/bash
cd /www/wwwroot/xxx.xxxxx.com
git fetch --all
git reset --hard origin/master
git pull https://username:[email protected]/xxx/xxx.git master
namespace app\index\controller;
use think\facade\Request;
class Hooks
{
public function hook(){
$request = Request::instance();
$params = $request->param();
$pwd = $params['password'];
if($pwd == '111112323123'){
$command = '/www/wwwroot/xxx.xxxxx.com/update.sh';
chown($command,'www');
chmod($command,0755);
exec($command,$output);
return json(['code'=>200,'msg'=>'远程更新成功','data'=>$output]);
}else{
return json(['code'=>300,'msg'=>'更新失败','data'=>[]]);
}
}
}