Commit bef8127a authored by mengweifu's avatar mengweifu

add:ota manage

parent 8b138e41
......@@ -49,6 +49,11 @@ class OtaValidate extends \Validate\BaseValidate
return $this->only(['ota_id']);
}
public function sceneUndelete()
{
return $this->only(['ota_id']);
}
public function sceneUpdate()
{
return $this->only(['ota_id', 'ota_name', 'address','longitude','latitude', 'location']);
......
......@@ -69,6 +69,18 @@ class OtaController extends Base
$this->success(['status' => $res ? 'success' : 'failed']);
}
/**
* 删除一个供应商
* @throws \App\Exception\custom\ParamException
*/
public function undeleteAction()
{
(new OtaValidate())->scene('undelete')->validate();
$res = OtaService::undeleteOne($this->params['ota_id']);
$this->success(['status' => $res ? 'success' : 'failed']);
}
/**
* 更新供应商
......
......@@ -145,6 +145,16 @@ class OtaService
return self::update(['ota_id'=>$otaId,'status'=>Ota::STATUS_DELETE]);
}
/**
* 取消删除供应商
* @param $otaId
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public static function unDeleteOne($otaId)
{
return self::update(['ota_id'=>$otaId,'status'=>Ota::STATUS_NORMAL]);
}
/**
* 更新供应商信息
* @param $params
......
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