|
@@ -71,4 +71,28 @@ class CabinetModel extends Model{
|
|
|
return $this->count();
|
|
|
}
|
|
|
|
|
|
+ public function DelCabinetBox($cabinet_number){
|
|
|
+ try {
|
|
|
+ $this->startTrans();
|
|
|
+ $ret = $this->where('id' , $cabinet_number)->delete($cabinet_number);
|
|
|
+ if(false === $ret){
|
|
|
+ $this->rollback();
|
|
|
+ return msg(-1, '', $this->getError());
|
|
|
+ }else{
|
|
|
+ $BoxModel = new BoxModel();
|
|
|
+ $ret = $BoxModel->where('cabinet_number' , $cabinet_number)->delete();
|
|
|
+ if(false === $ret){
|
|
|
+ $this->rollback();
|
|
|
+ return msg(-1, '', $this->getError());
|
|
|
+ }else{
|
|
|
+ $this->commit();
|
|
|
+ return msg(1, '', '删除成功');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch(PDOException $e){
|
|
|
+ $this->rollback();
|
|
|
+ return msg(-2, '', $e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|