统一推送前Python代码格式
This commit is contained in:
@@ -139,10 +139,14 @@ class ActInfoItem(TafStruct):
|
||||
|
||||
def read_from(self, ins: TafInputStream):
|
||||
for tag, attr, reader in (
|
||||
(0, "actId", ins.read_int64), (1, "name", ins.read_string),
|
||||
(2, "startTime", ins.read_int64), (3, "endTime", ins.read_int64),
|
||||
(4, "moduleId", ins.read_int64), (5, "outerActId", ins.read_string),
|
||||
(6, "gameIdList", ins.read_string), (8, "gid", ins.read_int64),
|
||||
(0, "actId", ins.read_int64),
|
||||
(1, "name", ins.read_string),
|
||||
(2, "startTime", ins.read_int64),
|
||||
(3, "endTime", ins.read_int64),
|
||||
(4, "moduleId", ins.read_int64),
|
||||
(5, "outerActId", ins.read_string),
|
||||
(6, "gameIdList", ins.read_string),
|
||||
(8, "gid", ins.read_int64),
|
||||
):
|
||||
setattr(self, attr, reader(tag, default=getattr(self, attr)))
|
||||
|
||||
@@ -157,10 +161,16 @@ class ActInfoItem(TafStruct):
|
||||
os.write_int64(8, self.gid)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {"act_id": self.actId, "name": self.name, "start_time": self.startTime,
|
||||
"end_time": self.endTime, "module_id": self.moduleId,
|
||||
"outer_act_id": self.outerActId, "game_id_list": self.gameIdList,
|
||||
"gid": self.gid}
|
||||
return {
|
||||
"act_id": self.actId,
|
||||
"name": self.name,
|
||||
"start_time": self.startTime,
|
||||
"end_time": self.endTime,
|
||||
"module_id": self.moduleId,
|
||||
"outer_act_id": self.outerActId,
|
||||
"game_id_list": self.gameIdList,
|
||||
"gid": self.gid,
|
||||
}
|
||||
|
||||
|
||||
class GetActInfoResp(TafStruct):
|
||||
@@ -181,8 +191,11 @@ class GetActInfoResp(TafStruct):
|
||||
os.write_struct(2, self.info)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {"status": self.status, "msg": self.msg,
|
||||
"info": self.info.to_dict() if self.info else None}
|
||||
return {
|
||||
"status": self.status,
|
||||
"msg": self.msg,
|
||||
"info": self.info.to_dict() if self.info else None,
|
||||
}
|
||||
|
||||
|
||||
class GetActPrizeListReq(TafStruct):
|
||||
@@ -298,18 +311,30 @@ class ActPrizeDetailItem(TafStruct):
|
||||
|
||||
def read_from(self, ins: TafInputStream):
|
||||
readers = {
|
||||
0: ("prizeId", ins.read_int64), 2: ("name", ins.read_string),
|
||||
3: ("score", ins.read_int64), 5: ("icon", ins.read_string),
|
||||
6: ("frequency", ins.read_int32), 7: ("frequencyLimit", ins.read_int32),
|
||||
8: ("num", ins.read_int64), 9: ("status", ins.read_int32),
|
||||
10: ("leftNum", ins.read_int64), 11: ("isShowNum", ins.read_int32),
|
||||
12: ("percent", ins.read_string), 13: ("newScore", ins.read_int64),
|
||||
14: ("categoryId", ins.read_string), 17: ("usedNum", ins.read_int64),
|
||||
18: ("goodType", ins.read_int32), 22: ("commonPrizeId", ins.read_int64),
|
||||
23: ("updateTime", ins.read_int64), 24: ("isCanExchange", ins.read_int32),
|
||||
25: ("exchangeStartTime", ins.read_int64), 26: ("exchangeEndTime", ins.read_int64),
|
||||
27: ("startTimeSlot", ins.read_string), 28: ("endTimeSlot", ins.read_string),
|
||||
29: ("isTodayLimit", ins.read_int32), 30: ("isUserLimit", ins.read_int32),
|
||||
0: ("prizeId", ins.read_int64),
|
||||
2: ("name", ins.read_string),
|
||||
3: ("score", ins.read_int64),
|
||||
5: ("icon", ins.read_string),
|
||||
6: ("frequency", ins.read_int32),
|
||||
7: ("frequencyLimit", ins.read_int32),
|
||||
8: ("num", ins.read_int64),
|
||||
9: ("status", ins.read_int32),
|
||||
10: ("leftNum", ins.read_int64),
|
||||
11: ("isShowNum", ins.read_int32),
|
||||
12: ("percent", ins.read_string),
|
||||
13: ("newScore", ins.read_int64),
|
||||
14: ("categoryId", ins.read_string),
|
||||
17: ("usedNum", ins.read_int64),
|
||||
18: ("goodType", ins.read_int32),
|
||||
22: ("commonPrizeId", ins.read_int64),
|
||||
23: ("updateTime", ins.read_int64),
|
||||
24: ("isCanExchange", ins.read_int32),
|
||||
25: ("exchangeStartTime", ins.read_int64),
|
||||
26: ("exchangeEndTime", ins.read_int64),
|
||||
27: ("startTimeSlot", ins.read_string),
|
||||
28: ("endTimeSlot", ins.read_string),
|
||||
29: ("isTodayLimit", ins.read_int32),
|
||||
30: ("isUserLimit", ins.read_int32),
|
||||
}
|
||||
while True:
|
||||
pos = ins.buf.tell()
|
||||
@@ -353,19 +378,30 @@ class ActPrizeDetailItem(TafStruct):
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {
|
||||
"product_id": str(self.prizeId), "name": self.name, "score": self.score,
|
||||
"icon": self.icon, "frequency": self.frequency,
|
||||
"frequency_limit": self.frequencyLimit, "num": self.num,
|
||||
"status": self.status, "left_num": self.leftNum,
|
||||
"is_show_num": self.isShowNum, "percent": self.percent,
|
||||
"new_score": self.newScore, "category_id": self.categoryId,
|
||||
"used_num": self.usedNum, "good_type": self.goodType,
|
||||
"common_prize_id": self.commonPrizeId, "update_time": self.updateTime,
|
||||
"product_id": str(self.prizeId),
|
||||
"name": self.name,
|
||||
"score": self.score,
|
||||
"icon": self.icon,
|
||||
"frequency": self.frequency,
|
||||
"frequency_limit": self.frequencyLimit,
|
||||
"num": self.num,
|
||||
"status": self.status,
|
||||
"left_num": self.leftNum,
|
||||
"is_show_num": self.isShowNum,
|
||||
"percent": self.percent,
|
||||
"new_score": self.newScore,
|
||||
"category_id": self.categoryId,
|
||||
"used_num": self.usedNum,
|
||||
"good_type": self.goodType,
|
||||
"common_prize_id": self.commonPrizeId,
|
||||
"update_time": self.updateTime,
|
||||
"is_can_exchange": self.isCanExchange,
|
||||
"exchange_start_time": self.exchangeStartTime,
|
||||
"exchange_end_time": self.exchangeEndTime,
|
||||
"start_time_slot": self.startTimeSlot, "end_time_slot": self.endTimeSlot,
|
||||
"is_today_limit": self.isTodayLimit, "is_user_limit": self.isUserLimit,
|
||||
"start_time_slot": self.startTimeSlot,
|
||||
"end_time_slot": self.endTimeSlot,
|
||||
"is_today_limit": self.isTodayLimit,
|
||||
"is_user_limit": self.isUserLimit,
|
||||
}
|
||||
|
||||
|
||||
@@ -395,9 +431,12 @@ class GetActPrizeDetailResp(TafStruct):
|
||||
os.write_struct(2, envelope)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {"status": self.status, "msg": self.msg,
|
||||
"prize": self.prize.to_dict() if self.prize else None,
|
||||
"detail_status": self.detailStatus}
|
||||
return {
|
||||
"status": self.status,
|
||||
"msg": self.msg,
|
||||
"prize": self.prize.to_dict() if self.prize else None,
|
||||
"detail_status": self.detailStatus,
|
||||
}
|
||||
|
||||
|
||||
class _ActPrizeDetailEnvelope(TafStruct):
|
||||
@@ -666,10 +705,14 @@ class UserActTaskItem(TafStruct):
|
||||
|
||||
def read_from(self, ins: TafInputStream):
|
||||
for tag, attr, reader in (
|
||||
(0, "actId", ins.read_int64), (1, "taskId", ins.read_int64),
|
||||
(2, "taskStatus", ins.read_int32), (3, "prizeStatus", ins.read_int32),
|
||||
(4, "taskValue", ins.read_string), (5, "taskCount", ins.read_int64),
|
||||
(6, "prizeCount", ins.read_int64), (8, "subTaskDetail", ins.read_int64),
|
||||
(0, "actId", ins.read_int64),
|
||||
(1, "taskId", ins.read_int64),
|
||||
(2, "taskStatus", ins.read_int32),
|
||||
(3, "prizeStatus", ins.read_int32),
|
||||
(4, "taskValue", ins.read_string),
|
||||
(5, "taskCount", ins.read_int64),
|
||||
(6, "prizeCount", ins.read_int64),
|
||||
(8, "subTaskDetail", ins.read_int64),
|
||||
(9, "extraStatus", ins.read_int64),
|
||||
):
|
||||
setattr(self, attr, reader(tag, default=getattr(self, attr)))
|
||||
@@ -695,11 +738,17 @@ class UserActTaskItem(TafStruct):
|
||||
return item
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {"act_id": self.actId, "task_id": self.taskId,
|
||||
"task_status": self.taskStatus, "prize_status": self.prizeStatus,
|
||||
"task_value": self.taskValue, "task_count": self.taskCount,
|
||||
"prize_count": self.prizeCount, "sub_task_detail": self.subTaskDetail,
|
||||
"extra_status": self.extraStatus}
|
||||
return {
|
||||
"act_id": self.actId,
|
||||
"task_id": self.taskId,
|
||||
"task_status": self.taskStatus,
|
||||
"prize_status": self.prizeStatus,
|
||||
"task_value": self.taskValue,
|
||||
"task_count": self.taskCount,
|
||||
"prize_count": self.prizeCount,
|
||||
"sub_task_detail": self.subTaskDetail,
|
||||
"extra_status": self.extraStatus,
|
||||
}
|
||||
|
||||
|
||||
class GetActUserTaskDetailResp(TafStruct):
|
||||
@@ -719,9 +768,12 @@ class GetActUserTaskDetailResp(TafStruct):
|
||||
os.write_list(2, self.tasks)
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {"status": self.status, "msg": self.msg,
|
||||
"task_count": len(self.tasks),
|
||||
"tasks": [item.to_dict() for item in self.tasks]}
|
||||
return {
|
||||
"status": self.status,
|
||||
"msg": self.msg,
|
||||
"task_count": len(self.tasks),
|
||||
"tasks": [item.to_dict() for item in self.tasks],
|
||||
}
|
||||
|
||||
|
||||
class ActTaskPrizeInfo(TafStruct):
|
||||
|
||||
Reference in New Issue
Block a user