Commit 41682b63b6a19b7a5315a7c7d1a914af8f503689
1 parent
0c178f9d
Exists in
master
app-ht
1. F 版本发布和上传信息做唯一处理
Showing
3 changed files
with
28 additions
and
18 deletions
Show diff stats
app-ht/modules/production/controllers/ProductionController.php
... | ... | @@ -62,7 +62,6 @@ class ProductionController extends BaseController |
62 | 62 | $productionEndTime = strtotime($productionEndTime) + 86400; |
63 | 63 | $where[] = ['<=', 'p.name', $productionEndTime]; |
64 | 64 | } |
65 | - | |
66 | 65 | if ($type == 0) { |
67 | 66 | $pageList = ProductionRepository::getPageList($where, 0 , 0); |
68 | 67 | $pages = null; | ... | ... |
app-ht/modules/upgrade/controllers/UpgradeController.php
... | ... | @@ -653,7 +653,6 @@ class UpgradeController extends BaseController |
653 | 653 | return $this->redirect($upgradeURL); |
654 | 654 | } |
655 | 655 | |
656 | - | |
657 | 656 | if (empty($upgradeModel->manufacture_id)) { |
658 | 657 | Yii::$app->session->setFlash('error', '请先配置好厂商'); |
659 | 658 | return $this->redirect($upgradeURL); |
... | ... | @@ -668,10 +667,13 @@ class UpgradeController extends BaseController |
668 | 667 | } |
669 | 668 | $exitUpgradeModel = UpgradeRepository::findOne([ |
670 | 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 | 679 | if ($exitUpgradeModel && $upgradeModel->id != $exitUpgradeModel->id) { |
... | ... | @@ -719,6 +721,12 @@ class UpgradeController extends BaseController |
719 | 721 | $modelId = $request->post("model"); |
720 | 722 | $type = $request->post("type"); |
721 | 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 | 730 | if (empty($manufactureId)) { |
723 | 731 | $e->message = '请先选择厂商'; |
724 | 732 | return $this->renderJson($e); |
... | ... | @@ -734,19 +742,20 @@ class UpgradeController extends BaseController |
734 | 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 | 754 | return $this->renderJson($e); |
746 | 755 | } |
747 | - | |
748 | 756 | $e->success = true; |
749 | 757 | $e->message = 'ok'; |
758 | + | |
750 | 759 | return $this->renderJson($e); |
751 | 760 | } |
752 | 761 | } |
753 | 762 | \ No newline at end of file | ... | ... |
app-ht/modules/upgrade/views/upgrade/create.php
... | ... | @@ -45,13 +45,13 @@ $this->params['breadcrumbs'][] = $this->title; |
45 | 45 | <?php } ?> |
46 | 46 | </label> |
47 | 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 | 49 | </div> |
50 | 50 | </div> |
51 | 51 | <div class="form-group col-sm-12"> |
52 | 52 | <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>安装包名称:</label> |
53 | 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 | 55 | </div> |
56 | 56 | </div> |
57 | 57 | <div class="form-group col-sm-12"> |
... | ... | @@ -142,11 +142,11 @@ $this->params['breadcrumbs'][] = $this->title; |
142 | 142 | var project_id = $("#project").val(); |
143 | 143 | var model_id = $("#model").val(); |
144 | 144 | var path = $("input[name='path']").val(); |
145 | - if (a == ""){ | |
145 | + if ($.trim(a) == ""){ | |
146 | 146 | alert("APP版本号不能为空"); |
147 | 147 | return false; |
148 | 148 | } |
149 | - if (package_name == ""){ | |
149 | + if ($.trim(package_name) == ""){ | |
150 | 150 | alert("安装包名不能为空"); |
151 | 151 | return false; |
152 | 152 | } |
... | ... | @@ -268,7 +268,9 @@ $this->params['breadcrumbs'][] = $this->title; |
268 | 268 | var project = $('#project').val(); |
269 | 269 | var model = $('#model').val(); |
270 | 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 | 274 | if (res.success) { |
273 | 275 | if (that.hasClass('disabled')) { |
274 | 276 | return false; | ... | ... |