|
|
@@ -1884,4 +1884,45 @@ class MemberService extends BaseService
|
|
|
return ['id'=> $id,'name'=> $machineName,'num'=> $randNum];
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的矿机(中奖记录)
|
|
|
+ * @param $userId
|
|
|
+ * @param $params
|
|
|
+ * @param int $pageSize
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getMachineList($userId, $params, $pageSize=15)
|
|
|
+ {
|
|
|
+ $page = request()->post('page',1);
|
|
|
+ $cacheKey = "caches:machine:list_{$userId}_{$page}";
|
|
|
+ $datas = RedisService::get($cacheKey);
|
|
|
+ if ($datas) {
|
|
|
+ return [
|
|
|
+ 'pageSize' => $pageSize,
|
|
|
+ 'total' => isset($datas['total']) ? $datas['total'] : 0,
|
|
|
+ 'list' => isset($datas['data']) ? $datas['data'] : []
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $where = ['a.status' => 1,'a.user_id'=> $userId, 'a.mark' => 1,'b.mark'=>1];
|
|
|
+ $field = ['a.*','b.name'];
|
|
|
+ $datas = DrawLogModel::from('draw_logs as a')
|
|
|
+ ->leftjoin('machine as b','b.id','=','a.machine_id')
|
|
|
+ ->where($where)
|
|
|
+ ->select($field)
|
|
|
+ ->orderBy('a.create_time', 'desc')
|
|
|
+ ->orderBy('a.expired_at', 'desc')
|
|
|
+ ->paginate($pageSize > 0 ? $pageSize : 9999999);
|
|
|
+ $datas = $datas ? $datas->toArray() : [];
|
|
|
+ if ($datas) {
|
|
|
+ RedisService::set($cacheKey, $datas, rand(3, 5));
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'pageSize' => $pageSize,
|
|
|
+ 'total' => isset($datas['total']) ? $datas['total'] : 0,
|
|
|
+ 'list' => isset($datas['data']) ? $datas['data'] : []
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|