| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace app\api\lists;
- use app\common\model\orders\OrderEffectiveLog;
- /**
- * @author 林海涛
- * @date 2024/7/24 下午3:29
- */
- class OrderEffectiveLogLists extends BaseApiDataLists
- {
- public function queryWhere()
- {
- $where = [];
- $where[] = ['user_id','=',$this->userId];
- $where[] = ['end_effective_time','>=',time()];
- return $where;
- }
- public function lists():array
- {
- return OrderEffectiveLog::with(['goods'=>function ($query) {
- $query->with(['goodsCategory'=>function ($query1) {
- $query1->field(['name','picture']);
- }]);
- },'serviceWork'])->where($this->queryWhere())
- ->limit($this->limitOffset, $this->limitLength)
- ->field(['*'])
- ->append(['effective_unit_text'])
- ->order('create_time desc')
- ->select()
- ->toArray();
- }
- public function count(): int
- {
- return OrderEffectiveLog::where($this->queryWhere())->count();
- }
- }
|