接口添加抢购时间和状态限制
This commit is contained in:
parent
b1dea3ef22
commit
edd5772c82
@ -68,7 +68,7 @@ use think\facade\Env;
|
||||
use weixin\Getgzopenid;
|
||||
use app\common\model\after_sale\AfterSale;
|
||||
use app\common\logic\expressage\Kd100Logic;
|
||||
|
||||
use app\common\model\groupbuy\GroupbuyConfig;
|
||||
|
||||
/**
|
||||
* Class OrderLogic
|
||||
@ -299,6 +299,25 @@ class OrderLogic extends Logic
|
||||
*/
|
||||
public static function settlement($post)
|
||||
{
|
||||
// 如果是抢购订单(改为了好物直降),判断是否活动开启和开始状态
|
||||
if ($post['order_type'] == OrderEnum::GROUP_BUY) {
|
||||
$group = GroupbuyConfig::field('name, value')->select()->toArray();
|
||||
foreach ($group as &$v) {
|
||||
if ($v['name'] == 'status' && intval($v['value']) == 0) {
|
||||
self::$error = '活动暂未开启';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($v['name'] == 'end_time') {
|
||||
$time = strtotime($v['value']);
|
||||
if (time() > $time) {
|
||||
self::$error = '活动时间已结束';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($post['goods'])) {
|
||||
$goods = json_decode($post['goods'], true);
|
||||
$post['goods'] = $goods;
|
||||
@ -425,7 +444,6 @@ class OrderLogic extends Logic
|
||||
self::$order_type = OrderEnum::SECKILL_ORDER; //秒杀订单
|
||||
}
|
||||
|
||||
//
|
||||
$value['is_groupbuy'] = 0;
|
||||
$groupBuy_price = GoodsItem::isGroupbuy($value['item_id']);
|
||||
if ($groupBuy_price != 0) {
|
||||
|
||||
@ -74,7 +74,7 @@ class OrderEnum
|
||||
const SECKILL_ORDER = 1;//秒杀订单
|
||||
const TEAM_ORDER = 2;//拼团订单
|
||||
const BARGAIN_ORDER = 3;//砍价订单
|
||||
const GROUP_BUY = 4;//抢购订单
|
||||
const GROUP_BUY = 4;//抢购订单(改为了好物直降)
|
||||
|
||||
//结算状态
|
||||
const SETTLE_WAIT = 0; //待结算
|
||||
|
||||
Loading…
Reference in New Issue
Block a user