2024-09-25 14:09:04 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\logic;
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\basics\Logic;
|
|
|
|
|
|
use app\common\model\groupbuy\GroupbuyGoods;
|
|
|
|
|
|
use app\common\server\UrlServer;
|
|
|
|
|
|
|
|
|
|
|
|
class GroupBuyLogic extends Logic
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @param $get
|
|
|
|
|
|
* @return array
|
|
|
|
|
|
* 抢购商品列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static function getGroupBuyGoods($get):array
|
|
|
|
|
|
{
|
|
|
|
|
|
$where = [
|
|
|
|
|
|
'gu.del'=>'1',
|
|
|
|
|
|
'gu.status'=> '1'
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$field = 'gu.*,g.id as goods_id,g.name as goods_name,g.image as goods_image,g.min_price as goods_min_price';
|
|
|
|
|
|
|
|
|
|
|
|
//查询抢购商品
|
|
|
|
|
|
$lists = GroupbuyGoods::alias('gu')
|
|
|
|
|
|
->leftJoin('goods g', 'g.id=gu.goods_id')
|
|
|
|
|
|
->group('g.id')
|
|
|
|
|
|
->field($field)
|
|
|
|
|
|
->where($where)
|
2024-10-02 17:36:34 +08:00
|
|
|
|
->order("gu.activity_price asc")
|
2024-09-25 14:09:04 +08:00
|
|
|
|
->select()
|
|
|
|
|
|
->toArray();
|
|
|
|
|
|
|
|
|
|
|
|
//分页处理
|
|
|
|
|
|
$count = count($lists);
|
|
|
|
|
|
$index = ($get['page_no']-1) * $get['page_size'];
|
|
|
|
|
|
$lists = array_slice($lists, $index, $get['page_size']);
|
|
|
|
|
|
|
|
|
|
|
|
//处理列表数据
|
|
|
|
|
|
foreach($lists as &$item) {
|
|
|
|
|
|
// 图片加域名
|
|
|
|
|
|
$item['goods_image'] = UrlServer::getFileUrl($item['goods_image']);
|
2024-09-28 15:44:33 +08:00
|
|
|
|
|
2024-09-25 14:09:04 +08:00
|
|
|
|
}
|
2024-09-29 18:09:23 +08:00
|
|
|
|
$lists = [];
|
2024-09-25 14:09:04 +08:00
|
|
|
|
return [
|
|
|
|
|
|
'count' => $count,
|
|
|
|
|
|
'lists' => $lists,
|
|
|
|
|
|
'page_no' => $get['page_no'],
|
|
|
|
|
|
'page_size' => $get['page_size'],
|
2024-09-28 15:44:33 +08:00
|
|
|
|
'more' => is_more($count, $get['page_no'], $get['page_size']),
|
2024-09-30 16:28:08 +08:00
|
|
|
|
'rule'=>'抢购规则:<br/>
|
2024-09-30 16:24:15 +08:00
|
|
|
|
1、抢购活动时间:10月1号至10月7号;<br/>
|
|
|
|
|
|
2、抢购场次:活动期内每天上午12点及晚上8点各一场,抢完即止;<br/>
|
|
|
|
|
|
3、抢购权限:活动期间内每人及每个身份证只能抢购一次;<br/>
|
|
|
|
|
|
4、确认抢购成功条件:以付款成功为确认抢购成功;抢购成功后5分钟内不支付款项的,则视为放弃。<br/>
|
|
|
|
|
|
5、抢购活动产生的订单也参与平台消费返补活动;<br/>
|
2024-10-01 09:22:28 +08:00
|
|
|
|
6、所有抢购成功并支付款项的,对应抢购商品统一于节后全部发出,运费自付!<br/>
|
2024-09-30 16:20:52 +08:00
|
|
|
|
7、抢购商品,非质量问题,不接受退货!'
|
2024-09-25 14:09:04 +08:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-27 14:15:02 +08:00
|
|
|
|
public static function isGroupbuy($item_id){
|
|
|
|
|
|
|
|
|
|
|
|
$where = [
|
|
|
|
|
|
'item_id'=>$item_id,
|
|
|
|
|
|
'status'=>1,
|
|
|
|
|
|
'del'=>1
|
|
|
|
|
|
];
|
|
|
|
|
|
$groupBuy = GroupbuyGoods::where($where)->find();
|
|
|
|
|
|
|
|
|
|
|
|
return $groupBuy;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-25 14:09:04 +08:00
|
|
|
|
|
|
|
|
|
|
}
|