def get(category): print(PRINT_API_NAME.format(category)) apis = { "get_all_category": "self.control_category.get_all_category()", "get_category_by_sid": "self.control_category.get_category_by_sid()", } return eval(apis[category])
def get(locations): print(PRINT_API_NAME.format(locations)) apis = {"get_city_location": "control_location.get_city_location()"} if locations in apis: return eval(apis[locations]) return APIS_WRONG
def get(card): print(PRINT_API_NAME.format(card)) apis = {"get_cardpkg": "control_coupon.get_cart_pkg()"} if card in apis: return eval(apis[card]) return APIS_WRONG
def post(shop): print(PRINT_API_NAME.format(shop)) apis = {} if shop in apis: return eval(apis[shop]) return
def post(self, category): print(PRINT_API_NAME.format(category)) apis = {} if category in apis: return eval(apis[category]) return
def post(votes): print(PRINT_API_NAME.format(votes)) apis = {"make_vote": "self.cvote.make_vote()"} if votes in apis: return eval(apis[votes]) return APIS_WRONG
def get(self, users): print(PRINT_API_NAME.format(users)) control_user = CUsers() apis = {"all_info": "control_user.all_info()"} if users in apis: return eval(apis[users]) return APIS_WRONG
def get(product): print(PRINT_API_NAME.format(product)) apis = { "get_info_by_id": "self.control_product.get_info_by_id()", "get_all": "self.control_product.get_all()" } if product in apis: return eval(apis[product]) return APIS_WRONG
def get(self, review): print(PRINT_API_NAME.format(review)) apis = { "get_review": "self.control_review.get_review()", "get_user_review": "self.control_review.get_user_review()", "get_product_review": "self.control_review.get_product_review()" } if review in apis: return eval(apis[review]) return APIS_WRONG
def post(card): print(PRINT_API_NAME.format(card)) apis = { "update_coupons": "control_coupon.add_cardpackage()", } if card in apis: return eval(apis[card]) return APIS_WRONG
def get(cart): print(PRINT_API_NAME.format(cart)) apis = { "get_all": "self.ccart.get_carts_by_uid_caid()" } if cart in apis: return eval(apis[cart]) return APIS_WRONG
def get(shop): print(PRINT_API_NAME.format(shop)) apis = { "get_all_shops": "self.control_shop.get_all_shops()", "get_shop_detail": "self.control_shop.get_shop_detail()", "get_category_and_product": "self.control_shop.get_category_and_product()" } return eval(apis[shop])
def post(self, review): print(PRINT_API_NAME.format(review)) apis = { "create_review": "self.control_review.create_review()", "delete_user_review": "self.control_review.delete_user_review()" } if review in apis: return eval(apis[review]) return APIS_WRONG
def get(orders): print(PRINT_API_NAME.format(orders)) apis = { "get_order_list": "control_order.get_order_list()", "get_order_abo": "control_order.get_order_abo()", "get_order_user": "******" } if orders not in apis: return APIS_WRONG return eval(apis[orders])
def get(votes): print(PRINT_API_NAME.format(votes)) apis = { "get_all": "self.cvote.get_all()", "get_host": "self.cvote.get_host()", "get_vote": "self.cvote.get_vote()", } if votes in apis: return eval(apis[votes]) return APIS_WRONG
def post(product): print(PRINT_API_NAME.format(product)) apis = { "create_pro": "control_product.create_pro()", "update_pro_info": "control_product.update_pro_info()", "put_on_sale": "control_product.put_on_sale()", "put_off_sale": "control_product.put_off_sale()" } if product in apis: return eval(apis[product]) return APIS_WRONG
def post(cart): print() print(PRINT_API_NAME.format(cart)) apis = { "delete_product": "self.ccart.del_product()", "update": "self.ccart.add_or_update_cart()", "get_select_product": "self.ccart.get_carts_by_uid_caid()" } if cart in apis: return eval(apis[cart]) return APIS_WRONG
def post(orders): print(PRINT_API_NAME.format(orders)) apis = { "make_main_order": "control_order.make_main_order()", "add_order_items": "control_order.add_order_items()", "update_order_info": 'control_order.update_order_info()', "update_order_status": "control_order.update_order_status()", "order_price": "control_order.get_order_price()" } if orders not in apis: return APIS_WRONG return eval(apis[orders])
def post(users): print(PRINT_API_NAME.format(users)) apis = { "register": "control_user.register()", "login": "******", "update_info": "control_user.update_info()", "update_pwd": "control_user.update_pwd()", "get_inforcode": "control_user.get_inforcode()", "forget_pwd": "control_user.forget_pwd()" } if users in apis: return eval(apis[users]) return APIS_WRONG