123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- declare (strict_types=1);
- namespace app\dao\activity\bargain;
- use app\dao\BaseDao;
- use app\model\activity\bargain\StoreBargainUserHelp;
- class StoreBargainUserHelpDao extends BaseDao
- {
-
- protected function setModel(): string
- {
- return StoreBargainUserHelp::class;
- }
-
- public function getHelpAllCount(array $where = [])
- {
- return $this->getModel()->where($where)->group('bargain_id')->column('count(*)', 'bargain_id');
- }
-
- public function getHelpList(int $bid, int $page = 0, int $limit = 0)
- {
- return $this->getModel()->with('getUser')
- ->where('bargain_user_id', $bid)
- ->order('add_time desc')
- ->when($page && $limit, function ($query) use ($page, $limit) {
- $query->page($page, $limit);
- })->field("uid,price,from_unixtime(add_time,'%Y-%m-%d %H:%i:%s') as add_time")->select()->toArray();
- }
-
- public function getNums()
- {
- return $this->getModel()->field('count(id) as num,bargain_user_id')->group('bargain_user_id')->select()->toArray();
- }
-
- public function getBargainPeople(array $where, string $field = '*', string $key = 'bargain_id')
- {
- return $this->getModel()->where($where)->group($key)->column($field, $key);
- }
- }
|