diff --git a/addon/futures/model/Futures.php b/addon/futures/model/Futures.php index 878f33d6..b621a94a 100644 --- a/addon/futures/model/Futures.php +++ b/addon/futures/model/Futures.php @@ -1,6 +1,7 @@ addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', $date['price'], 'sell', $date['id'], '售卖产品', $date['id']); $memberAccountModel->addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', -$date['service_price'], 'service_price', $date['id'], '服务费', $date['id']); + + //赠送积分 + $memberAccountModel->addMemberAccount($date['site_id'], $date['member_id'], 'point', $date['price'], 'sell', $date['id'], '秒杀赠送积分', $date['id']); return $this->success(); } @@ -329,6 +333,8 @@ class Futures extends BaseModel{ public function setBasicsConfig($data, $is_use, $site_id) { $config = new ConfigModel(); + $miaosha_start_time_arr = array_column($data['times'], 'miaosha_start_time'); + array_multisort($miaosha_start_time_arr, SORT_ASC, $data['times']); return $config->setConfig($data, '秒杀基本配置', $is_use, [['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'MIAOSHA_BASICS_CONFIG']]); } @@ -373,6 +379,10 @@ class Futures extends BaseModel{ $nowtimes = []; $basics = $this->getBasicsConfig($site_id)['data']['value']; + if(empty($basics['times'])){ + return $this->error('','暂无秒杀活动'); + } + $recentlyTimes = []; foreach($basics['times'] as $times){ if($times[$startTimeKey] <= $nowTime && $times[$endTimeKey] >= $nowTime){ $is_read = TRUE; @@ -383,10 +393,23 @@ class Futures extends BaseModel{ ]; break; } + if(empty($recentlyTimes) && $times['miaosha_start_time'] >= $nowTime){ + $recentlyTimes = $times; + foreach($recentlyTimes as $timeKey => $time){ + $recentlyTimes[$timeKey] += strtotime(date("Y-m-d", time())); + } + } + } + if(empty($recentlyTimes)){ + $recentlyTimes = $basics['times'][0]; + foreach($recentlyTimes as $timeKey => $time){ + $recentlyTimes[$timeKey] += strtotime(date("Y-m-d", time())) + 24 * 60 * 60; + } } if(!$is_read){ - return $this->error('','未到秒杀时间'); + return error(-801,'未到秒杀时间', $recentlyTimes); + } //判断是否是提前秒杀 $nowtimes['is_early'] = FALSE; diff --git a/app/model/goods/Goods.php b/app/model/goods/Goods.php index 27fb80ef..42716a6c 100644 --- a/app/model/goods/Goods.php +++ b/app/model/goods/Goods.php @@ -821,7 +821,7 @@ class Goods extends BaseModel $field = 'gs.goods_id,gs.sku_id,gs.qr_id,gs.goods_name,gs.sku_name,gs.sku_spec_format,gs.price,gs.market_price,gs.discount_price,gs.promotion_type,gs.start_time ,gs.end_time,gs.stock,gs.click_num,(g.sale_num + g.virtual_sale) as sale_num,gs.collect_num,gs.sku_image,gs.sku_images ,gs.goods_content,gs.goods_state,gs.is_free_shipping,gs.goods_spec_format,gs.goods_attr_format,gs.introduction,gs.unit,gs.video_url - ,gs.is_virtual,gs.goods_service_ids,gs.max_buy,gs.min_buy,gs.is_limit,gs.limit_type,gs.support_trade_type,g.goods_image,g.keywords,g.stock_show,g.sale_show,g.market_price_show,g.barrage_show,g.evaluate,g.goods_class'; + ,gs.is_virtual,gs.goods_service_ids,gs.max_buy,gs.min_buy,gs.is_limit,gs.limit_type,gs.support_trade_type,g.goods_image,g.keywords,g.stock_show,g.sale_show,g.market_price_show,g.barrage_show,g.evaluate,g.goods_class,g.give_diamond'; } $join = [ [ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ], diff --git a/app/model/member/MemberAccount.php b/app/model/member/MemberAccount.php index 64f546b4..4a0beb66 100644 --- a/app/model/member/MemberAccount.php +++ b/app/model/member/MemberAccount.php @@ -126,6 +126,7 @@ class MemberAccount extends BaseModel $from_type[ 'balance_money' ][ 'sell' ] = [ 'type_name' => '售卖产品', 'type_url' => '' ]; $from_type[ 'balance_money' ][ 'service_price' ] = [ 'type_name' => '服务费', 'type_url' => '' ]; + $from_type[ 'point' ][ 'sell' ] = [ 'type_name' => '秒杀赠送积分', 'type_url' => '' ]; $this->from_type = $from_type; }