|
|
@@ -0,0 +1,34 @@
|
|
|
+<?php
|
|
|
+namespace app\api\lists;
|
|
|
+
|
|
|
+use app\common\model\equity\UserEquity;
|
|
|
+
|
|
|
+class UserEquityLists extends BaseApiDataLists
|
|
|
+{
|
|
|
+ public function queryWhere()
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ $where[] = ['user_id','=',$this->userId];
|
|
|
+ $where[] = ['number','>',0];
|
|
|
+ $where[] = ['end_time','>=',time()];
|
|
|
+
|
|
|
+ if(isset($this->params['goods_id']) && !empty($this->params['goods_id'])){
|
|
|
+ $where[] = ['goods_id','=',$this->params['goods_id']];
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function lists():array
|
|
|
+ {
|
|
|
+ return UserEquity::with(['equityConfig'])->where($this->queryWhere())
|
|
|
+ ->limit($this->limitOffset, $this->limitLength)
|
|
|
+ ->order('create_time desc')
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function count(): int
|
|
|
+ {
|
|
|
+ return UserEquity::where($this->queryWhere())->count();
|
|
|
+ }
|
|
|
+}
|