...
|
...
|
@@ -23,14 +23,16 @@ class Order extends Api |
|
|
|
|
|
/**
|
|
|
* 订单板块接口
|
|
|
* @ApiTitle (生成订单)
|
|
|
* @ApiSummary (生成订单)
|
|
|
* @ApiTitle (生成订单--有更改)
|
|
|
* @ApiSummary (生成订单--有更改)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/Order/InsertOrder)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="address_id", type="integer", required=true, description="地址ID")
|
|
|
* @ApiParams (name="json", type="integer", required=true, description="json Goods_id:1,num:10")
|
|
|
* @ApiParams (name="total", type="integer", required=true, description="总价")
|
|
|
* @ApiParams (name="water_num", type="integer", required=true, description="使用氧气泡泡【新增参数】")
|
|
|
* @ApiParams (name="tick_id", type="integer", required=true, description="优惠券ID 未使用传0 【新增参数】")
|
|
|
* @ApiParams (name="shopcar_id", type="integer", required=true, description="购物车ID ,拼接成字符串 直接购买购物车ID 传0")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
...
|
...
|
@@ -71,6 +73,11 @@ class Order extends Api |
|
|
$OrderSn = $this->order_sn();
|
|
|
//计算订单总价
|
|
|
$Total = $this->Total($UserId, $params['total']);
|
|
|
if ($params['tick_id'] != 0) {
|
|
|
$tick = '是';
|
|
|
} else {
|
|
|
$tick = '否';
|
|
|
}
|
|
|
$data = [
|
|
|
'OrderSn' => $OrderSn,
|
|
|
'user_id' => $UserId,
|
...
|
...
|
@@ -82,6 +89,9 @@ class Order extends Api |
|
|
'status' => 0,
|
|
|
'you' => $params['total'] - $Total,
|
|
|
'total' => $Total,
|
|
|
'water_num' => $params['water_num'],
|
|
|
'tick_id' => $params['tick_id'],
|
|
|
'tick' => $tick,
|
|
|
'createtime' => time(),
|
|
|
'updatetime' => time()
|
|
|
];
|
...
|
...
|
@@ -241,9 +251,14 @@ class Order extends Api |
|
|
]
|
|
|
);
|
|
|
}
|
|
|
//消耗积分归还
|
|
|
//减少积分
|
|
|
$UserNum = Db::name('user')->where('id', $UserId)->find();
|
|
|
Db::name('user')->where('id', $UserId)->update(['num' => $UserNum['num'] - floor($OrderInfo['total'])]);
|
|
|
Db::name('user')->where('id', $UserId)->update(['num' => $UserNum['num'] - floor($OrderInfo['total']) + $OrderInfo['water_num']]);
|
|
|
//优惠券归还
|
|
|
if ($OrderInfo['tick_id'] != 0) {
|
|
|
Db::name('user_tick')->where('id', $OrderInfo['tick_id'])->update(['status' => 0]);
|
|
|
}
|
|
|
}
|
|
|
//更改上级活动钱包减少待入账 增加待提现
|
|
|
$FuserId = Db::name('group')->where('user_id', $UserId)->value('fuser_id');
|
...
|
...
|
|