Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
fde45653c9
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace addon\futures\model;
|
namespace addon\futures\model;
|
||||||
|
use addon\fenxiao\model\FenxiaoAccount;
|
||||||
use addon\message\model\Message;
|
use addon\message\model\Message;
|
||||||
use app\model\member\MemberAccount;
|
use app\model\member\MemberAccount;
|
||||||
use app\model\system\Config as ConfigModel;
|
use app\model\system\Config as ConfigModel;
|
||||||
|
|
@ -271,6 +272,9 @@ class Futures extends BaseModel{
|
||||||
$memberAccountModel = new MemberAccount();
|
$memberAccountModel = new MemberAccount();
|
||||||
$memberAccountModel->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['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['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();
|
return $this->success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -329,6 +333,8 @@ class Futures extends BaseModel{
|
||||||
public function setBasicsConfig($data, $is_use, $site_id)
|
public function setBasicsConfig($data, $is_use, $site_id)
|
||||||
{
|
{
|
||||||
$config = new ConfigModel();
|
$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']]);
|
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 = [];
|
$nowtimes = [];
|
||||||
|
|
||||||
$basics = $this->getBasicsConfig($site_id)['data']['value'];
|
$basics = $this->getBasicsConfig($site_id)['data']['value'];
|
||||||
|
if(empty($basics['times'])){
|
||||||
|
return $this->error('','暂无秒杀活动');
|
||||||
|
}
|
||||||
|
$recentlyTimes = [];
|
||||||
foreach($basics['times'] as $times){
|
foreach($basics['times'] as $times){
|
||||||
if($times[$startTimeKey] <= $nowTime && $times[$endTimeKey] >= $nowTime){
|
if($times[$startTimeKey] <= $nowTime && $times[$endTimeKey] >= $nowTime){
|
||||||
$is_read = TRUE;
|
$is_read = TRUE;
|
||||||
|
|
@ -383,10 +393,23 @@ class Futures extends BaseModel{
|
||||||
];
|
];
|
||||||
break;
|
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){
|
if(!$is_read){
|
||||||
return $this->error('','未到秒杀时间');
|
return error(-801,'未到秒杀时间', $recentlyTimes);
|
||||||
|
|
||||||
}
|
}
|
||||||
//判断是否是提前秒杀
|
//判断是否是提前秒杀
|
||||||
$nowtimes['is_early'] = FALSE;
|
$nowtimes['is_early'] = FALSE;
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,7 @@ class Goodssku extends BaseApi
|
||||||
$order_by = 'g.sort ' . $sort_config[ 'type' ] . ',g.create_time desc';
|
$order_by = 'g.sort ' . $sort_config[ 'type' ] . ',g.create_time desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
$field = 'gs.goods_id,gs.sku_id,gs.price,gs.market_price,gs.discount_price,g.goods_stock,(g.sale_num + g.virtual_sale) as sale_num,g.goods_name,gs.site_id,gs.is_free_shipping,g.goods_image,gs.is_virtual,g.recommend_way,gs.unit,gs.promotion_type,g.label_name';
|
$field = 'gs.goods_id,gs.sku_id,gs.price,gs.market_price,gs.discount_price,g.goods_stock,(g.sale_num + g.virtual_sale) as sale_num,g.goods_name,gs.site_id,gs.is_free_shipping,g.goods_image,gs.is_virtual,g.recommend_way,gs.unit,gs.promotion_type,g.label_name,g.give_diamond';
|
||||||
if ($token[ 'code' ] >= 0) {
|
if ($token[ 'code' ] >= 0) {
|
||||||
$field .= ',gs.is_consume_discount,gs.discount_config,gs.member_price,gs.discount_method';
|
$field .= ',gs.is_consume_discount,gs.discount_config,gs.member_price,gs.discount_method';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
$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.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.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 = [
|
$join = [
|
||||||
[ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ],
|
[ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ],
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ class MemberAccount extends BaseModel
|
||||||
|
|
||||||
$from_type[ 'balance_money' ][ 'sell' ] = [ 'type_name' => '售卖产品', 'type_url' => '' ];
|
$from_type[ 'balance_money' ][ 'sell' ] = [ 'type_name' => '售卖产品', 'type_url' => '' ];
|
||||||
$from_type[ 'balance_money' ][ 'service_price' ] = [ '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;
|
$this->from_type = $from_type;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue