|
|
@ -68,8 +68,12 @@ class Api_CageController extends Ctrl_Api{ |
|
|
|
public function addAction(){ |
|
|
|
public function addAction(){ |
|
|
|
//查询笼位号 |
|
|
|
//查询笼位号 |
|
|
|
$data['c_user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; |
|
|
|
$data['c_user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; |
|
|
|
$CageNum = $this->Cagemodel->field('count(*) as num')->where("c_user_id={$data['c_user_id']}")->fRow(); |
|
|
|
$CageNum = $this->Cagemodel->field('count(*) as num')->where("c_user_id={$data['c_user_id']} and is_delete=0")->fRow(); |
|
|
|
$CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; |
|
|
|
if(!empty($this->POST['number'])){ |
|
|
|
|
|
|
|
$uni = $this->Cagemodel->field('*')->where("c_user_id={$data['c_user_id']} and is_delete=0 and number='{$this->POST['number']}'")->fRow(); |
|
|
|
|
|
|
|
if($uni) Tool_Fnc::apiMsg('笼位号已存在', '500'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$CageNum = empty($this->POST['number'])?(int) $CageNum['num']+1:$this->POST['number']; |
|
|
|
$data['type'] = $this->POST['type']; |
|
|
|
$data['type'] = $this->POST['type']; |
|
|
|
$data['number'] = $CageNum; |
|
|
|
$data['number'] = $CageNum; |
|
|
|
$data['strains'] =empty($this->POST['strains'])||!isset($this->POST['strains'])?Tool_Fnc::apiMsg('请选择笼位品系', '500'):Tool_Fnc::safe_string($this->POST['strains']); |
|
|
|
$data['strains'] =empty($this->POST['strains'])||!isset($this->POST['strains'])?Tool_Fnc::apiMsg('请选择笼位品系', '500'):Tool_Fnc::safe_string($this->POST['strains']); |
|
|
|