diff --git a/application/controllers/Api/Sysset.php b/application/controllers/Api/Sysset.php index 114b34c..0a5c529 100644 --- a/application/controllers/Api/Sysset.php +++ b/application/controllers/Api/Sysset.php @@ -29,5 +29,21 @@ class Api_SyssetController extends Ctrl_Api{ $data['excelSet'] = $this->ExcelSetModel->getsetinfo($params); Tool_Fnc::apiMsg('获取成功', '200',$data); } + /** + * 获取设置接口 + */ + public function editSetAction(){ + $uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; + $cageSet = $this->POST['cageSet']; + $squirrelSet = $this->POST['squirrelSet']; + $excelSet = $this->POST['excelSet']; + $excelSet['now_squirrel']=json_encode($excelSet['now_squirrel']); + $excelSet['handle_squirrel']=json_encode($excelSet['handle_squirrel']); + $this->CageSetModel->update($cageSet); + $this->SquirrelSetModel->update($squirrelSet); + $this->ExcelSetModel->update($excelSet); + Tool_Fnc::apiMsg('设置成功', '200'); + //写入配置 + } } \ No newline at end of file diff --git a/application/models/ExcelSet.php b/application/models/ExcelSet.php index e4845cd..838c3f1 100644 --- a/application/models/ExcelSet.php +++ b/application/models/ExcelSet.php @@ -9,7 +9,7 @@ class ExcelSetModel extends Orm_Base{ ); public $pk = 'id'; public function getsetinfo($params){ - $data = $this->field('*')->where('='.$params['user_id'])->fRow(); + $data = $this->field('*')->where('user_id='.$params['user_id'])->fRow(); if(empty($data)){ //现存鼠 $data['now_squirrel']['number'] = true; @@ -45,6 +45,9 @@ class ExcelSetModel extends Orm_Base{ $data['handle_squirrel']['father'] = true; $data['handle_squirrel']['mother'] = true; $data['handle_squirrel']['remark'] = true; + }else{ + $data['now_squirrel'] = json_decode($data['now_squirrel'],true); + $data['handle_squirrel'] = json_decode($data['handle_squirrel'],true); } return $data; }