|
@@ -280,4 +280,54 @@ class BetService extends BaseService
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * @description: 投注记录
|
|
|
+ * @param {*} $memberId
|
|
|
+ * @param {*} $page
|
|
|
+ * @param {*} $limit
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+ public static function record($memberId ,$page = 1 ,$limit = 5)
|
|
|
+ {
|
|
|
+ $msg['chat_id'] = $memberId;
|
|
|
+ $list = self::model()::where('member_id',$memberId)->whereIn('status',[self::model()::STATUS_STAY,self::model()::STATUS_SETTLED])->orderBy('id','desc')->forPage($page, $limit)->get();
|
|
|
+ $count = self::model()::where('member_id',$memberId)->whereIn('status',[self::model()::STATUS_STAY,self::model()::STATUS_SETTLED])->count();
|
|
|
+
|
|
|
+ $keyboard = [];
|
|
|
+
|
|
|
+ $text = "历史注单 \n";
|
|
|
+
|
|
|
+ foreach($list as $k => $v){
|
|
|
+ $text .= "-------------------------------------\n";
|
|
|
+ $text .= "期数:{$v->issue_no} \n";
|
|
|
+ $text .= "内容:{$v->keywords} \n";
|
|
|
+ $text .= "金额:{$v->amount} \n";
|
|
|
+ $text .= "盈亏:{$v->profit} \n";
|
|
|
+ }
|
|
|
+
|
|
|
+ $msg['text'] = $text;
|
|
|
+
|
|
|
+ if ($page > 1) {
|
|
|
+ $keyboard[] = [
|
|
|
+ ['text' => "👆上一页", 'callback_data' => "betRecordNextPage@@" . ($page - 1)]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $allPage = ceil($count / $limit);
|
|
|
+ if ($allPage > $page) {
|
|
|
+ if ($page > 1) {
|
|
|
+ $keyboard[count($keyboard) - 1][] = ['text' => "👇下一页", 'callback_data' => "betRecordNextPage@@" . ($page + 1)];
|
|
|
+ } else {
|
|
|
+ $keyboard[] = [
|
|
|
+ ['text' => "👇下一页", 'callback_data' => "betRecordNextPage@@" . ($page + 1)]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($keyboard){
|
|
|
+ $msg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
|
|
|
+ }
|
|
|
+ return $msg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|