OrderModel.php 783 B

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