def customer_info(customer_id): """获取客户信息""" try: ret = get_customer_info(customer_id) return Response.success_with_data('data', ret) except Exception as e: return Response.error(str(e))
def login(): try: token = salesman_login() if token: return Response.success_with_data('data', token) except Exception as e: return Response.error(str(e))
def get_customer_list(salesman_id): """获取客户列表""" try: ret = get_customer_basic_list(salesman_id) return Response.success_with_data('data', ret) except Exception as e: return Response.error(str(e))
def customer_add(): """客户录入""" try: if customer_data_save(): return Response.success() except Exception as e: return Response.error(str(e))
def customer_record_add(customer_id): """跟进客户小记""" try: if customer_record_save(customer_id): return Response.success() except Exception as e: return Response.error(str(e))
def customer_update(customer_id): """修改客户信息""" try: if customer_data_update(customer_id): return Response.success() except Exception as e: return Response.error(str(e))
def wrapper(*args, **kwargs): salesman_id = session.get("salesman_id") if salesman_id is None: return Response.not_login() else: g.salesman_id = salesman_id return func(*args, **kwargs)
def register(): try: if salesman_register(): return Response.success() except Exception as e: return Response.error(str(e))
def before_request(): try: Auth.identify(Auth, request) except Exception as e: return Response.error(str(e))