Commit 0af3c237 authored by mengweifu's avatar mengweifu

update:ota manage

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