123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\index\model;
- use think\Model;
- class OrderModel extends Model{
- // 确定链接表名
- protected $name = 'order';
- public function getOne($order_sn){
- return $this->where('order_sn' , $order_sn)->find();
- }
- /**
- * 根据既定条件修改信息
- * @where $param
- * @update $param
- */
- public function editData($where,$update)
- {
- try{
- $result = $this->save($update, $where);
- if(false === $result){
- // 验证失败 输出错误信息
- return msg(-1, '', $this->getError());
- }else{
- return msg(1, '', 'success');
- }
- }catch(\Exception $e){
- return msg(-2, '', $e->getMessage());
- }
- }
- }
|