竞拍电商系统的核心业务逻辑如下:
用户注册购买积分,有积分后必须兑换成提货券, 兑换提货券后会获得 1:1 的广告值,广告值在进行预约活动和寄售活动销毁。
1、购物积分:通过平台商城商品区购买原价商品或通过向推荐人线下转账直接购买积分。2、提货劵:获得积分后在平台商城兑换区 1:1 兑换成提货券,提货劵是平台商城提货“唯一凭证“,当提货券达到平台自定义数值,用户必须消除提货券进行商品交割,否则用户将不能继续参加预约活动。3、广告值:兑换提货劵时平台额外赠送 1:1 广告值,有了广告值才能参与预约抢购活动,预约前需要冻结广告值(可冻结,可解冻)。
以下是竞拍秒购电商核心源码分享
if(!$spirit_id)return app(‘json’)->fail(‘参数错误’);
$data1 = YueOrder::where([‘uid’=>$request->uid(),’cid’=>$spirit_id,’is_del’=>0])->whereDay(‘add_time’)->find();
if($data1 ) return app(‘json’)->fail(‘重复预约’);
$quYuInfo = ActiveModel::find($spirit_id);
$user = $request->user();
if($quYuInfo->helpCard > $user->help_card)return app(‘json’)->fail(‘帮抢卡不足’);
$user = $request->user();
if($quYuInfo->jifen > $user[‘integral’] )return app(‘json’)->fail(‘积分不足’);
$cache_name = ‘cache_purchase_’.$request->uid();
if( cache($cache_name) )
return app(‘json’)->fail(‘请勿频繁请求’);
cache($cache_name,1,2);
$redis = Redis::instance();
$s1 = ExperienceModel::where([‘uid’=>$request->uid(),’status’=>1,’order_id’=>0])->where(‘end_time’,’>’,time())->find();
if(!$s1)return app(‘json’)->fail(‘该场次没有预约记录’);
$s2 =ExperienceModel::where([‘uid’=>$request->uid(),’status’=>1])->where(‘order_id’,’>’,0)->where(‘end_time’,’>’,time())->find();
if($s2)return app(‘json’)->fail(‘已经抢过了’);//判断今天预约的记录是否抢购过
$yid = ExperienceModel::where([‘status’=>1,’order_id’=>0])->where(‘end_time’,’>’,time())->where(‘uid’,$request->uid())->value(‘id’);
$pid = $redis->rPop(‘T’);
if(!$pid)return app(‘json’)->fail(‘没有抢到,请稍后再试’);$cache_name = ‘cache_purchase_’.$request->uid();
if( cache($cache_name) )
return app(‘json’)->fail(‘请勿频繁请求’);
cache($cache_name,1,2);
$redis = Redis::instance();
$s1 = ExperienceModel::where([‘uid’=>$request->uid(),’status’=>1,’order_id’=>0])->where(‘end_time’,’>’,time())->find();
if(!$s1)return app(‘json’)->fail(‘该场次没有预约记录’);
$s2 =ExperienceModel::where([‘uid’=>$request->uid(),’status’=>1])->where(‘order_id’,’>’,0)->where(‘end_time’,’>’,time())->find();
if($s2)return app(‘json’)->fail(‘已经抢过了’);//判断今天预约的记录是否抢购过
$yid = ExperienceModel::where([‘status’=>1,’order_id’=>0])->where(‘end_time’,’>’,time())->where(‘uid’,$request->uid())->value(‘id’);
$pid = $redis->rPop(‘T’);
if(!$pid)return app(‘json’)->fail(‘没有抢到,请稍后再试’);