Commit cca85da2 authored by mengweifu's avatar mengweifu

update:ota manage

parent 0af3c237
...@@ -90,7 +90,7 @@ class OtaController extends Base ...@@ -90,7 +90,7 @@ class OtaController extends Base
public function updateAction() public function updateAction()
{ {
(new OtaValidate())->scene('update')->validate(); (new OtaValidate())->scene('update')->validate();
$res = OtaService::update($this->params); $res = OtaService::update($this->params, true);
$this->success(['status' => $res ? 'success' : 'failed']); $this->success(['status' => $res ? 'success' : 'failed']);
} }
......
...@@ -167,7 +167,7 @@ class OtaService ...@@ -167,7 +167,7 @@ class OtaService
* @return \Api\PhpUtils\Mysql\MysqlBase * @return \Api\PhpUtils\Mysql\MysqlBase
* @throws GoodsException * @throws GoodsException
*/ */
public static function update($params) public static function update($params, $canUnBind = false)
{ {
if(empty($params['ota_id'])) { if(empty($params['ota_id'])) {
...@@ -245,12 +245,12 @@ class OtaService ...@@ -245,12 +245,12 @@ class OtaService
isset($params['status']) && $data['status'] = $params['status']; isset($params['status']) && $data['status'] = $params['status'];
// 解绑 // 解绑
if (!empty($otaDetail['printer_sn']) && empty($params['printer_sn']) && empty($params['printer_key'])) { if ($canUnBind && !empty($otaDetail['printer_sn']) && empty($params['printer_sn']) && empty($params['printer_key'])) {
$data['printer_sn'] = $params['printer_key'] = ''; $data['printer_sn'] = $data['printer_key'] = '';
} }
if (!empty($otaDetail['label_printer_sn']) && empty($params['label_printer_sn']) && empty($params['label_printer_key'])) { if ($canUnBind && !empty($otaDetail['label_printer_sn']) && empty($params['label_printer_sn']) && empty($params['label_printer_key'])) {
$data['label_printer_sn'] = $params['label_printer_key'] = ''; $data['label_printer_sn'] = $data['label_printer_key'] = '';
} }
return Ota::update( return Ota::update(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment