Commit 0af3c237 authored by mengweifu's avatar mengweifu

update:ota manage

parent 2721c9fb
...@@ -14,10 +14,10 @@ class OtaValidate extends \Validate\BaseValidate ...@@ -14,10 +14,10 @@ class OtaValidate extends \Validate\BaseValidate
protected $rule = [ protected $rule = [
'ota_name' => 'require', 'ota_name' => 'require',
'ota_id' => 'require', 'ota_id' => 'require',
'address' => 'require', // 'address' => 'require',
'location' => 'require', // 'location' => 'require',
'longitude' => 'require', // 'longitude' => 'require',
'latitude' => 'require', // 'latitude' => 'require',
'offset' => 'egt:0', 'offset' => 'egt:0',
'limit' => 'elt:100', 'limit' => 'elt:100',
]; ];
...@@ -42,7 +42,7 @@ class OtaValidate extends \Validate\BaseValidate ...@@ -42,7 +42,7 @@ class OtaValidate extends \Validate\BaseValidate
public function sceneAdd() public function sceneAdd()
{ {
return $this->only(['ota_name', 'address','longitude','latitude', 'location']); return $this->only(['ota_name']);
} }
public function sceneDelete() public function sceneDelete()
{ {
...@@ -56,7 +56,7 @@ class OtaValidate extends \Validate\BaseValidate ...@@ -56,7 +56,7 @@ class OtaValidate extends \Validate\BaseValidate
public function sceneUpdate() public function sceneUpdate()
{ {
return $this->only(['ota_id', 'ota_name', 'address','longitude','latitude', 'location']); return $this->only(['ota_id', 'ota_name']);
} }
public function sceneListByIds() public function sceneListByIds()
{ {
......
...@@ -24,9 +24,10 @@ class OtaController extends Base ...@@ -24,9 +24,10 @@ class OtaController extends Base
$printerKey = $this->params['printer_key'] ?? ''; $printerKey = $this->params['printer_key'] ?? '';
$labelPrinterSn = $this->params['label_printer_sn'] ?? ''; $labelPrinterSn = $this->params['label_printer_sn'] ?? '';
$labelPrinterKey = $this->params['label_printer_key'] ?? ''; $labelPrinterKey = $this->params['label_printer_key'] ?? '';
$isNormal = $this->params['is_normal'] ?? false;
$offset = $this->params['offset'] ?? 0; $offset = $this->params['offset'] ?? 0;
$limit = $this->params['limit'] ?? 20; $limit = $this->params['limit'] ?? 20;
$res = OtaService::list($name, $printerSn, $printerKey,$labelPrinterSn, $labelPrinterKey, $offset, $limit); $res = OtaService::list($name, $printerSn, $printerKey,$labelPrinterSn, $labelPrinterKey, $isNormal, $offset, $limit);
$this->success(['result' => $res]); $this->success(['result' => $res]);
} }
......
...@@ -19,7 +19,7 @@ class OtaService ...@@ -19,7 +19,7 @@ class OtaService
* @param int $limit * @param int $limit
* @return \Api\PhpUtils\Mysql\MysqlBase * @return \Api\PhpUtils\Mysql\MysqlBase
*/ */
public static function list($otaName='',$printerSN='',$printerKey='', $labelPrinterSN='',$labelPrinterKey='',$offset=0,$limit=20) public static function list($otaName='',$printerSN='',$printerKey='', $labelPrinterSN='',$labelPrinterKey='', $isNormal = false,$offset=0,$limit=20)
{ {
$otaName && $where['ota_name'] = $otaName; $otaName && $where['ota_name'] = $otaName;
$printerSN && $where["printer_sn"] = $printerSN; $printerSN && $where["printer_sn"] = $printerSN;
...@@ -27,7 +27,7 @@ class OtaService ...@@ -27,7 +27,7 @@ class OtaService
$labelPrinterSN && $where["label_printer_sn"] = $labelPrinterSN; $labelPrinterSN && $where["label_printer_sn"] = $labelPrinterSN;
$labelPrinterKey && $where['label_printer_key'] = $labelPrinterKey; $labelPrinterKey && $where['label_printer_key'] = $labelPrinterKey;
// $where['status'] = Ota::STATUS_NORMAL; $isNormal &&$where['status'] = Ota::STATUS_NORMAL;
$where['ORDER'] = ['ota_id' => 'DESC']; $where['ORDER'] = ['ota_id' => 'DESC'];
$where['LIMIT'] = [$offset, $limit]; $where['LIMIT'] = [$offset, $limit];
......
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