def get_summary(thisDayStart, thisDayEnd, thisMonthStart, thisMonthEnd): newUserToday = UserService.get_newuser_amount(thisDayStart, thisDayEnd) totalUser = UserService.get_user_amount() membershipDAU = KService.get_user_DAU('102', thisDayStart, thisDayEnd) VipDAU = KService.get_user_DAU('103', thisDayStart, thisDayEnd) incomeDay = OrderService.get_paidOrder_sum(thisDayStart, thisDayEnd) incomeMonth = OrderService.get_paidOrder_sum(thisMonthStart, thisMonthEnd) data = { "newUserToday": newUserToday, "totalUser": totalUser, "membershipDAU": membershipDAU, "VipDAU": VipDAU, "incomeDay": incomeDay, "incomeMonth": incomeMonth } return data
def process(self): pageNum = request.args.get('pageNum', 1, type=int) pageSize = request.args.get('pageSize', 10, type=int) logging.info("GetUsersView. pageNum:{},pageSize:{}".format( pageNum, pageSize)) totals = UserService.get_user_amount() - 1 totalPages = (totals + pageSize - 1) // pageSize users = UserService.get_users(pageNum, pageSize) usersview = list() for user in users: # print (user) #(<UserModel 1>, <ThunderserviceModel 1>) usersview.append({ 'user_id': user.UserModel.id, 'user_register_source': user.UserModel.register_source, 'user_email': user.UserModel.email, 'user_email_verified': user.UserModel.email_verified, 'user_register_datetime': user.UserModel.register_datetime, 'user_thunderservice': user.UserModel.thunderservice_id, 'user_usergroup': user.UserModel.usergroup_id, 'user_account_status': user.UserModel.account_status, 'user_service_endtime': user.UserModel.thunderservice_endtime, 'user_thunderservice_name': user.ThunderserviceModel.membershipCN }) return { "code": 200, "message": "get users success", "results": { "totals": totals, "totalPages": totalPages, "list": usersview } }