123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- declare (strict_types=1);
- namespace app\dao\wechat;
- use think\model;
- use app\dao\BaseDao;
- use app\model\wechat\WechatQrcodeRecord;
- class WechatQrcodeRecordDao extends BaseDao
- {
-
- protected function setModel(): string
- {
- return WechatQrcodeRecord::class;
- }
-
- public function getList($where, $page = 0, $limit = 0, $is_distinct = 0)
- {
- return $this->search($where)->with(['user'])->when($page && $limit, function ($query) use ($page, $limit) {
- $query->page($page, $limit);
- })->when($is_distinct, function ($query) {
- $query->distinct(true)->field('uid');
- })->order('id desc')->select()->toArray();
- }
-
- public function getRecordTrend($qid, $time, $timeType, $field, $str, $orderStatus = '')
- {
- return $this->getModel()->where(function ($query) use ($field, $orderStatus) {
- if ($orderStatus == 'yes') {
- $query->where('is_follow', 1);
- }
- })->where(function ($query) use ($time, $field) {
- if ($time[0] == $time[1]) {
- $query->whereDay($field, $time[0]);
- } else {
- $query->whereTime($field, 'between', $time);
- }
- })->where('qid', $qid)->field("FROM_UNIXTIME($field,'$timeType') as days,$str as num")->group('days')->select()->toArray();
- }
- }
|