Commit 41682b63b6a19b7a5315a7c7d1a914af8f503689

Authored by xu
1 parent 0c178f9d
Exists in master

app-ht

1. F 版本发布和上传信息做唯一处理
app-ht/modules/production/controllers/ProductionController.php
@@ -62,7 +62,6 @@ class ProductionController extends BaseController @@ -62,7 +62,6 @@ class ProductionController extends BaseController
62 $productionEndTime = strtotime($productionEndTime) + 86400; 62 $productionEndTime = strtotime($productionEndTime) + 86400;
63 $where[] = ['<=', 'p.name', $productionEndTime]; 63 $where[] = ['<=', 'p.name', $productionEndTime];
64 } 64 }
65 -  
66 if ($type == 0) { 65 if ($type == 0) {
67 $pageList = ProductionRepository::getPageList($where, 0 , 0); 66 $pageList = ProductionRepository::getPageList($where, 0 , 0);
68 $pages = null; 67 $pages = null;
app-ht/modules/upgrade/controllers/UpgradeController.php
@@ -653,7 +653,6 @@ class UpgradeController extends BaseController @@ -653,7 +653,6 @@ class UpgradeController extends BaseController
653 return $this->redirect($upgradeURL); 653 return $this->redirect($upgradeURL);
654 } 654 }
655 655
656 -  
657 if (empty($upgradeModel->manufacture_id)) { 656 if (empty($upgradeModel->manufacture_id)) {
658 Yii::$app->session->setFlash('error', '请先配置好厂商'); 657 Yii::$app->session->setFlash('error', '请先配置好厂商');
659 return $this->redirect($upgradeURL); 658 return $this->redirect($upgradeURL);
@@ -668,10 +667,13 @@ class UpgradeController extends BaseController @@ -668,10 +667,13 @@ class UpgradeController extends BaseController
668 } 667 }
669 $exitUpgradeModel = UpgradeRepository::findOne([ 668 $exitUpgradeModel = UpgradeRepository::findOne([
670 'manufacture_id' => $upgradeModel->manufacture_id, 669 'manufacture_id' => $upgradeModel->manufacture_id,
671 - 'project_id' => $upgradeModel->project_id,  
672 - 'model_id' => $upgradeModel->model_id,  
673 - 'is_delete' => 0,  
674 - 'status' => UpgradeStatus::STATUS_ON 670 + 'project_id' => $upgradeModel->project_id,
  671 + 'model_id' => $upgradeModel->model_id,
  672 + 'is_delete' => 0,
  673 + 'type' => $upgradeModel->type,
  674 + 'version' => $upgradeModel->version,
  675 + 'package_name' => $upgradeModel->package_name,
  676 + 'status' => UpgradeStatus::STATUS_ON
675 ]); 677 ]);
676 678
677 if ($exitUpgradeModel && $upgradeModel->id != $exitUpgradeModel->id) { 679 if ($exitUpgradeModel && $upgradeModel->id != $exitUpgradeModel->id) {
@@ -719,6 +721,12 @@ class UpgradeController extends BaseController @@ -719,6 +721,12 @@ class UpgradeController extends BaseController
719 $modelId = $request->post("model"); 721 $modelId = $request->post("model");
720 $type = $request->post("type"); 722 $type = $request->post("type");
721 $id = $request->post('id'); 723 $id = $request->post('id');
  724 + $version = $request->post('version');
  725 + $package_name = $request->post('package_name');
  726 + if (empty($package_name)) {
  727 + $e->message = '请先录入一个包名';
  728 + return $this->renderJson($e);
  729 + }
722 if (empty($manufactureId)) { 730 if (empty($manufactureId)) {
723 $e->message = '请先选择厂商'; 731 $e->message = '请先选择厂商';
724 return $this->renderJson($e); 732 return $this->renderJson($e);
@@ -734,19 +742,20 @@ class UpgradeController extends BaseController @@ -734,19 +742,20 @@ class UpgradeController extends BaseController
734 return $this->renderJson($e); 742 return $this->renderJson($e);
735 } 743 }
736 744
737 - $upgradeModel = UpgradeRepository::findOne(['manufacture_id' => $manufactureId, 'project_id' => $projectId, 'model_id' => $modelId, 'is_delete' => 0, 'status' => UpgradeStatus::STATUS_ON, 'type' => $type]);  
738 - if ($upgradeModel && empty($id)) {  
739 - $e->message = '该厂商该批次已经存在一个版本号为:'.$upgradeModel->version.'的发布版本,请先取消发布的版本再上传'.$upgradeModel->id;  
740 - return $this->renderJson($e); 745 + $upgradeModel = UpgradeRepository::findOne(['manufacture_id' => $manufactureId, 'project_id' => $projectId, 'model_id' => $modelId, 'is_delete' => 0, 'package_name' => $package_name, 'type' => $type]);
  746 + if ($upgradeModel && empty($id) ) {
  747 + $e->message = '该厂商该批次已经存在一个版本号为:'.$upgradeModel->version.' 包名为'.$package_name.'的版本,请先确认再上传';
  748 + return $this->renderJson($e);
  749 +
741 } 750 }
742 751
743 - if ($upgradeModel && !empty($id) && $id != $upgradeModel->id) {  
744 - $e->message = '该厂商该批次已经存在一个版本号为:'.$upgradeModel->version.'的发布版本,请先取消发布的版本再上传!'; 752 + if ($upgradeModel && !empty($id) && $id != $upgradeModel->id ) {
  753 + $e->message = '该厂商该批次已经存在一个版本号为:'.$upgradeModel->version.' 包名为'.$package_name.'的版本,请先确认再上传!';
745 return $this->renderJson($e); 754 return $this->renderJson($e);
746 } 755 }
747 -  
748 $e->success = true; 756 $e->success = true;
749 $e->message = 'ok'; 757 $e->message = 'ok';
  758 +
750 return $this->renderJson($e); 759 return $this->renderJson($e);
751 } 760 }
752 } 761 }
753 \ No newline at end of file 762 \ No newline at end of file
app-ht/modules/upgrade/views/upgrade/create.php
@@ -45,13 +45,13 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -45,13 +45,13 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
45 <?php } ?> 45 <?php } ?>
46 </label> 46 </label>
47 <div class="col-sm-4 text-left"> 47 <div class="col-sm-4 text-left">
48 - <input type="text" value="<?= (isset($gets["version"]) ? $gets["version"] : "") ?>" name="version" placeholder="请填写APP版本号" style="margin-top: -6px;" class="form-control""> 48 + <input type="text" value="<?= (isset($gets["version"]) ? $gets["version"] : "") ?>" id="version" name="version" placeholder="请填写APP版本号" style="margin-top: -6px;" class="form-control"">
49 </div> 49 </div>
50 </div> 50 </div>
51 <div class="form-group col-sm-12"> 51 <div class="form-group col-sm-12">
52 <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>安装包名称:</label> 52 <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>安装包名称:</label>
53 <div class="col-sm-4 text-left"> 53 <div class="col-sm-4 text-left">
54 - <input type="text" value="<?= (isset($gets["package_name"]) ? $gets["package_name"] : "") ?>" name="package_name" placeholder="请填写安装包名称" style="margin-top: -6px;" class="form-control""> 54 + <input type="text" value="<?= (isset($gets["package_name"]) ? $gets["package_name"] : "") ?>" id="package_name" name="package_name" placeholder="请填写安装包名称" style="margin-top: -6px;" class="form-control"">
55 </div> 55 </div>
56 </div> 56 </div>
57 <div class="form-group col-sm-12"> 57 <div class="form-group col-sm-12">
@@ -142,11 +142,11 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -142,11 +142,11 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
142 var project_id = $("#project").val(); 142 var project_id = $("#project").val();
143 var model_id = $("#model").val(); 143 var model_id = $("#model").val();
144 var path = $("input[name='path']").val(); 144 var path = $("input[name='path']").val();
145 - if (a == ""){ 145 + if ($.trim(a) == ""){
146 alert("APP版本号不能为空"); 146 alert("APP版本号不能为空");
147 return false; 147 return false;
148 } 148 }
149 - if (package_name == ""){ 149 + if ($.trim(package_name) == ""){
150 alert("安装包名不能为空"); 150 alert("安装包名不能为空");
151 return false; 151 return false;
152 } 152 }
@@ -268,7 +268,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -268,7 +268,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
268 var project = $('#project').val(); 268 var project = $('#project').val();
269 var model = $('#model').val(); 269 var model = $('#model').val();
270 var type = $('#type').val(); 270 var type = $('#type').val();
271 - $.post(checkUpgradeUrl, {manufacture:manufacture, project:project,model:model,type:type}, function(res){ 271 + var package_name = $('#package_name').val();
  272 + var version = $('#version').val();
  273 + $.post(checkUpgradeUrl, {manufacture:manufacture, project:project,model:model,type:type, package_name:package_name, version:version}, function(res){
272 if (res.success) { 274 if (res.success) {
273 if (that.hasClass('disabled')) { 275 if (that.hasClass('disabled')) {
274 return false; 276 return false;