yangsai@163.com 7 months ago
parent 6a53f3ecbf
commit 3dfb75055a
  1. 11
      application/controllers/Api/Squirrel.php
  2. 13
      application/models/Squirrel.php

@ -260,12 +260,17 @@ class Api_SquirrelController extends Ctrl_Api{
Tool_Fnc::apiMsg('获取成功', '200',$data);
}
public function operateAction(){
$data['jianwei_time'] = $this->POST['jianwei_time'];
$data['id'] = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID缺失', '500'):$this->POST['id'];
$data['test_time'] = $this->POST['test_time'];
$data['jianwei_time'] = $this->POST['jianwei_time'];
$data['kill_time'] = $this->POST['kill_time'];
$data['del_time'] = $this->POST['del_time'];
$data['jianwei_show'] = $this->POST['jianwei_show'];
$data['test_show'] = $this->POST['test_show'];
$data['del_show'] = $this->POST['del_show'];
$data['kill_show'] = $this->POST['kill_show'];
$this->Squirrelmodel->operate($data);
Tool_Fnc::apiMsg('操作已更新', '200');
}
}

@ -27,6 +27,10 @@ class SquirrelModel extends Orm_Base{
'test_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'kill_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'del_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'jianwei_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'test_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'kill_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'del_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
);
public $pk = 'id';
public function getModelList($params){
@ -87,5 +91,14 @@ class SquirrelModel extends Orm_Base{
}
return $data;
}
public function operate($params){
foreach($params as $key => $val){
if(empty($val)){
unset($params[$key]);
}
}
if(!$this->update($params)) return false;
return true;
}
}

Loading…
Cancel
Save