12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\store\model\groupbuy;
- use app\common\model\groupbuy\GroupBuyJoin as GroupBuyJoinModel;
- use app\common\library\helper;
- /**
- * 拼团发起模型
- * Class Coupon
- * @package app\store\model
- */
- class GroupBuyJoin extends GroupBuyJoinModel
- {
- protected $append = [];
- /**
- * @param $activityId
- * @return \think\Paginator
- * @throws \think\db\exception\DbException
- */
- public function getList($activityId){
- return self::alias('gj')->leftJoin('user us','gj.user_id=us.user_id')
- ->field('us.nick_name,gj.id,gj.group_buy_activity_id,gj.people_count,gj.end_time,gj.status,gj.user_id,
- gj.share_title,gj.create_time,(select count(id) from yoshop_group_buy_activity_help where join_id=gj.id and
- pay_state=1 and order_id >=0) as help_count')
- ->where('gj.group_buy_activity_id',$activityId)
- ->where('gj.status','<>',3)
- ->paginate(15);
- }
- /**
- * 活动参团人数
- * @param $activityId
- * @return int
- */
- public function sumActHelpCount($activityId){
- return self::where('group_buy_activity_id',$activityId)->sum('help_count');
- }
- /**
- * 活动拼团数
- * @param $activityId
- * @return int
- */
- public static function countActJoin($activityId){
- return self::where('group_buy_activity_id',$activityId)->where('status','<',3)
- ->count('id');
- }
- }
|