def api_export_activity_user(request): try: cur_user_id = getp(request.POST.get("cur_user_id"), u"当前用户id", nullable=True) activity_id = getp(request.POST.get("activity_id"), u"活动的id", nullable=False) user_id_list = getp(request.POST.get("user_id_list"), u"用户ID列表", nullable=True, default=[]) user_flag = getp(request.POST.get("user_flag"), u"被导入用户的标识(0:用户,1:专家)", nullable=True, default=0) name = getp(request.POST.get("name"), u"用户名", nullable=True) area_id = getp(request.POST.get("area_id"), u"区域ID", nullable=True) direct_level = getp(request.POST.get("direct_level"), u"直属等级(4:省直属,2市直属)", nullable=True) item_id_list = getp(request.POST.get("item_id_list"), u"查询的id列表,JSON", nullable=True) qry_all_user = getp(request.POST.get("qry_all_user"), u"是否查询全部用户", nullable=True) if user_id_list: account_id_list = json.loads(user_id_list) else: account_id_list = [] result = services.export_activity_user(user=request.user, activity_id=activity_id, account_id_list=account_id_list, name=name, user_flag=user_flag, area_id=area_id, cur_user_id=cur_user_id, direct_level=direct_level, item_id_list=item_id_list, qry_all_user=qry_all_user) if result["c"] != ERR_SUCCESS[0]: return response200(result) file_path = result["d"] response = gen_file_reponse(file_path) return response except Exception as ex: logger.exception(ex) return response_exception(ex, ex.message)
def api_download_activity_user_template(request): try: activity_id = getp(request.POST.get("activity_id"), u"活动的id", nullable=True) user_flag = getp(request.POST.get("user_flag"), u"模板中用户的标识(0:普通用户或管理员,1:专家,默认为0)", nullable=True, default="0") result = services.download_activity_user_template() if result["c"] != ERR_SUCCESS[0]: return response200(result) file_path = result["d"][0] response = gen_file_reponse(file_path) return response except Exception as ex: logger.exception(ex) return response_exception(ex, ex.message)
def api_export_user(request): try: area_name = getp(request.POST.get("area_name"), u"区域名称", nullable=True) name = getp(request.POST.get("name"), u"名字", nullable=True) user_id = getp(request.POST.get("user_id"), u"用户id", nullable=False) item_id_list = getp(request.POST.get("item_id_list"), u"查询的id列表,JSON", nullable=True) result = services.api_export_user(user=request.user, user_id=user_id, area_name=area_name, name=name, item_id_list=item_id_list) if result["c"] != ERR_SUCCESS[0]: return response200(result) file_path = result["d"] response = gen_file_reponse(file_path) return response except Exception as ex: logger.exception(ex) return response_exception(ex, ex.message)
def api_export_expert(request): try: cur_user_id = getp(request.POST.get("cur_user_id"), u"当前用户的id", nullable=False) name = getp(request.POST.get("name"), u"姓名", nullable=True) area_id = getp(request.POST.get("area_id"), u"地域id", nullable=True) manage_direct = getp(request.POST.get("manage_direct"), u"直属标志", nullable=True) item_id_list = getp(request.POST.get("item_id_list"), u"查询的id列表,JSON", nullable=True) result = services.api_export_expert(user=request.user, cur_user_id=cur_user_id, name=name, area_id=area_id, manage_direct=manage_direct, item_id_list=item_id_list) if result["c"] != ERR_SUCCESS[0]: return response200(result) file_path = result["d"] response = gen_file_reponse(file_path) return response except Exception as ex: logger.exception(ex) return response_exception(ex, ex.message)
def api_export_activity_expert(request): try: activity_id = getp(request.POST.get("activity_id"), u"活动的id", nullable=False) area_id = getp(request.POST.get("area_id"), u"区域的id", nullable=True) name = getp(request.POST.get("name"), u"用户名", nullable=True) cur_user_id = getp(request.POST.get("cur_user_id"), u"当前用户的id", nullable=True) only_can_add = getp(request.POST.get("only_can_add"), u"是否仅查询可添加的专家", nullable=True) direct_level = getp(request.POST.get("direct_level"), u"直属等级(4:省直属,2市直属)", nullable=True) institution = getp(request.POST.get("institution"), u"机构名称", nullable=True) item_id_list = getp(request.POST.get("item_id_list"), u"查询时的id的JSON列表", nullable=True) result = services.export_activity_expert(user=request.user, activity_id=activity_id, area_id=area_id, name=name, cur_user_id=cur_user_id, only_can_add=only_can_add, direct_level=direct_level, institution=institution, item_id_list=item_id_list) if result["c"] != ERR_SUCCESS[0]: return response200(result) file_path = result["d"] response = gen_file_reponse(file_path) return response except Exception as ex: logger.exception(ex) return response_exception(ex, ex.message)