* Adjust api create mr.

This commit is contained in:
liyuchun
2021-12-22 09:51:13 +08:00
parent b7ce8814fb
commit 5dd72fd196
2 changed files with 12 additions and 7 deletions
+6 -1
View File
@@ -431,7 +431,12 @@ class extension extends control
$tmpName = $_FILES['file']['tmp_name'];
$fileName = $_FILES['file']['name'];
$dest = $this->app->getTmpRoot() . "/extension/$fileName";
move_uploaded_file($tmpName, $dest);
if(!move_uploaded_file($tmpName, $dest))
{
$downloadPath = $this->app->getTmpRoot() . '/extension/';
$errorMessage = strip_tags(sprintf($this->lang->extension->errorDownloadPathNotWritable, $downloadPath, $downloadPath));
die(js::alert($errorMessage));
}
$extension = basename($fileName, '.zip');
$return = $this->extension->extractPackage($extension);
+6 -6
View File
@@ -187,10 +187,10 @@ class mrModel extends model
public function apiCreate()
{
$postData = fixer::input('post')
->setDefault('url,sourceBranch,targetBranch,diff,mergeStatus,hasNoConflict', '')
->setDefault('repoUrl,repoSrcBranch,repoDistBranch,diffMsg,mergeStatus,hasNoConflict', '')
->get();
$repo = $this->loadModel('repo')->getRepoByUrl($postData->url);
$repo = $this->loadModel('repo')->getRepoByUrl($postData->repoUrl);
if(!$repo || $repo->result != 'fail') return false;
$repo = (object)$repo->data;
@@ -198,13 +198,13 @@ class mrModel extends model
$MR = new stdClass();
$MR->gitlabID = $repo->client;
$MR->sourceProject = $repo->path;
$MR->sourceBranch = $postData->sourceBranch;
$MR->sourceBranch = $postData->repoSrcBranch;
$MR->targetProject = $repo->path;
$MR->targetBranch = $postData->taretBranch;
$MR->diffs = $postData->diff;
$MR->targetBranch = $postData->repoDistBranch;
$MR->diffs = $postData->diffMsg;
$MR->title = 'Merge request';
$MR->repoID = $repo->id;
$MR->jobID = $postData->jobID;
$MR->jobID = $repo->job;
$MR->synced = '0';
$MR->needCI = '1';
$MR->approvalStatus = 'approved';