BoxModel.php 971 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\index\model;
  3. use think\Model;
  4. class BoxModel extends Model {
  5. // 确定链接表名
  6. protected $name = 'box';
  7. /**
  8. * 根据柜号箱号获取箱子信息
  9. * @cabinet_number $param
  10. * @box_number $param
  11. */
  12. public function getOneCabinetBox($cabinet_number,$box_number)
  13. {
  14. return $this->where(['cabinet_number' => $cabinet_number, 'box_number'=>$box_number])->find();
  15. }
  16. /**
  17. * 根据既定条件修改信息
  18. * @where $param
  19. * @update $param
  20. */
  21. public function editData($where,$update)
  22. {
  23. try{
  24. $result = $this->save($update, $where);
  25. if(false === $result){
  26. // 验证失败 输出错误信息
  27. return msg(-1, '', $this->getError());
  28. }else{
  29. return msg(1, '', 'success');
  30. }
  31. }catch(\Exception $e){
  32. return msg(-2, '', $e->getMessage());
  33. }
  34. }
  35. }