新增数据
```
$addup = [
'amount' => $price_b, //订单金额
'status' => '1',
'finish_time' => time(), //订单支付完成时间
];
$xb_order = Db::name('contract')->insertGetId($adddata);
if ($xb_order) {
$this -> success('创建成功',"/abt/index/order_list/");
// $this->redirect("/abt/index/pay_order/?order_id={$order_id}");
}else{
$this -> error('创建失败');
}
```
修改数据
```
// 修改订单状态
$addup = [
'amount' => $price_b, //订单金额
'status' => '1',
'finish_time' => time(), //订单支付完成时间
];
$xb_order = Db::name('order')->where(["order_id" => $order_id])->update($addup);
if ($xb_order) {
$this -> success('修改成功',"/abt/index/order_list/");
// $this->redirect("/abt/index/pay_order/?order_id={$order_id}");
}else{
$this -> error('创建失败');
}
```
删除数据
```
// 删除数据
if ($_G['del']=='1'){
$where_del = [
'order_id' => trim($_G['order_id']),
'uid'=>$_W['mc_uid'],
];
$xb_del = Db::name('order')->where($where_del)->delete();
if ($xb_del){
$this -> success('删除成功');
}else{
$this -> error('删除失败');
}
}
```
其他
```
// 数字 字段值+1
Db::name('coupon')->where(["coupon_id" => $order_cb['coupon_id']])->setInc('stock',1);
// 数字 字段值-1
Db::name('coupon')->where(["coupon_id" => $order_cb['coupon_id']])->setDec('stock',1);
```