Exemplo n.º 1
0
    def update_configure(self, request):

        conf_info = request_api.get_param(request)

        app_setting_api.update_system_setting(conf_info)

        return Result.success()
Exemplo n.º 2
0
    def update_data_field(self, request):

        field_info = request_api.get_param(request)

        app_data_field_api.update_data_field(field_info)

        return Result.success()
Exemplo n.º 3
0
    def edit_dtu_user(self, request):

        dtu_user_info = request_api.get_param(request)

        app_user_api.edit_dtu_user(dtu_user_info)

        return Result.success()
Exemplo n.º 4
0
    def create_admin(self, request):

        admin_info = request_api.get_param(request)

        app_user_api.create_admin(admin_info)

        return Result.success()
Exemplo n.º 5
0
    def del_batch_meter(self, request):

        param = request_api.get_param(request)

        app_meter_api.del_batch_meter(param.get('meter_ids'))

        return Result.success()
Exemplo n.º 6
0
    def update_recharge_state(self, request):

        meter_info = request_api.get_param(request)

        app_meter_api.update_recharge_state(meter_info,
                                            request_api.get_user(request))
        return Result.success()
Exemplo n.º 7
0
    def query_meter_state(self, request):

        param = request_api.get_param(request)
        user = request_api.get_user(request)
        state = app_meter_api.find_meter_state_by_id(param['state_id'], user)

        return Result.success(data=state)
Exemplo n.º 8
0
    def check_email_unique(self, request):

        param = request_api.get_param(request)
        email = param.get('email')
        is_unique = app_user_api.check_email_unique(email)

        return Result.success(data=is_unique)
Exemplo n.º 9
0
    def edit_role_auth(self, request):

        param = request_api.get_param(request)
        app_auth_api.edit_role_auth(param.get('role_name'),
                                    param.get('auth_ids'))

        return Result.success()
Exemplo n.º 10
0
    def edit_manufacturer(self, request):

        manufacturer_info = request_api.get_param(request)

        app_user_api.edit_manufacturer(manufacturer_info)

        return Result.success()
Exemplo n.º 11
0
    def query_man_region(self, request):

        param = request_api.get_param(request)

        regions = app_region_api.find_regions_by_man_id(int(param.get('id')))

        return Result.success(data=regions, count=len(regions))
Exemplo n.º 12
0
    def add_meter(self, request):

        param = request_api.get_param(request)

        app_meter_api.add_meter(param)

        return Result.success()
Exemplo n.º 13
0
    def query_dtu_by_user_id(self, request):

        param = request_api.get_param(request)

        dtus = app_user_api.find_dtu_by_user_id(param.get('user_id'))

        return Result.success(data=dtus, count=len(dtus))
Exemplo n.º 14
0
    def update_control_register(self, request):

        register_info = request_api.get_param(request)

        app_register_api.update_control_register(register_info)

        return Result.success()
Exemplo n.º 15
0
    def add_dtu(self, request):

        param = request_api.get_param(request)

        app_dtu_api.add_dtu(param)

        return Result.success()
Exemplo n.º 16
0
    def update_dtu_region(self, request):

        param = request_api.get_param(request)

        app_region_api.update_dtu_region(param)

        return Result.success()
Exemplo n.º 17
0
    def del_batch_dtu_user(self, request):

        param = request_api.get_param(request)
        dtu_user_ids = param.get('dtu_user_ids')

        app_user_api.del_batch_dtu_user(dtu_user_ids)

        return Result.success()
Exemplo n.º 18
0
    def del_batch_admin(self, request):

        param = request_api.get_param(request)
        admin_ids = param.get('admin_ids')

        app_user_api.del_batch_admin(admin_ids)

        return Result.success()
Exemplo n.º 19
0
    def switch_manufacturer_state(self, request):

        param = request_api.get_param(request)
        manufacturer_id = param.get('manufacturer_id')

        app_user_api.switch_manufacturer_state_by_id(manufacturer_id)

        return Result.success()
Exemplo n.º 20
0
    def switch_dtu_user_state(self, request):

        param = request_api.get_param(request)
        dtu_user_id = param.get('dtu_user_id')

        app_user_api.switch_dtu_user_state_by_id(dtu_user_id)

        return Result.success()
Exemplo n.º 21
0
    def check_phone_unique(self, request):

        param = request_api.get_param(request)
        phone = param.get('phone')

        is_unique = app_user_api.check_phone_unique(phone)

        return Result.success(data=is_unique)
Exemplo n.º 22
0
    def del_batch_dtu_region(self, request):

        param = request_api.get_param(request)
        dtu_region_ids = param.get('dtu_region_ids')

        app_region_api.del_batch_region(dtu_region_ids)

        return Result.success()
Exemplo n.º 23
0
    def del_batch_manufacturer(self, request):

        param = request_api.get_param(request)
        manufacturer_ids = param.get('manufacturer_ids')

        app_user_api.del_batch_manufacturer(manufacturer_ids)

        return Result.success()
Exemplo n.º 24
0
    def switch_admin_state(self, request):

        param = request_api.get_param(request)
        admin_id = param.get('admin_id')

        app_user_api.switch_admin_state_by_id(admin_id)

        return Result.success()
Exemplo n.º 25
0
    def query_dtu_region(self, request):

        param = request_api.get_param(request)
        page = request_api.get_page(request)

        regions, num = app_region_api.find_regions_by_query_terms(param, page)

        return Result.success(data=regions, count=num)
Exemplo n.º 26
0
    def query_dtu_user(self, request):

        param = request_api.get_param(request)
        page = request_api.get_page(request)
        dtu_users, num = app_user_api.find_dtu_users_by_query_terms(
            param, page)

        return Result.success(data=dtu_users, count=num)
Exemplo n.º 27
0
    def process_request(self, request):

        action = request_api.get_action(request)

        if action is not None:
            params = request_api.get_param(request)
            action_type = LogMiddleware.__render_action_type_str(
                action, params)
            request_api.set_param(request, 'action_type', action_type)
Exemplo n.º 28
0
    def update_dtu(self, request):

        param = request_api.get_param(request)

        param['id'] = int(param['id'])

        app_dtu_api.update_dtu_region(param)

        return Result.success()
Exemplo n.º 29
0
    def export_manufacturer(self, request):

        param = request_api.get_param(request)
        name = app_file_api.generate_excel_file_name()
        filename = os.path.join(TMP_FILE_DIRECTORY_PATH, name)

        app_user_api.manufacturer_export(param['man_ids'], filename)

        return Result.success(data=name)
Exemplo n.º 30
0
    def import_manufacturer(self, request):

        param = request_api.get_param(request)
        name = param.get('filename')
        filename = os.path.join(TMP_FILE_DIRECTORY_PATH, name)

        app_user_api.manufacturer_import(filename)
        app_file_api.del_file(filename)

        return Result.success()