def post(self): ps = self.get_page_config(title = '创建应用') if ps['isedit']: ps['title'] = self.get_page_title('编辑应用') app = self.get_args(['code', 'name', 'developer', 'url', 'remark'], '') app['status'] = int(self.get_arg('status', '0')) ps['app'] = app msg = self.check_str_empty_input(app, ['code', 'name', 'url']) if str_helper.is_null_or_empty(msg) == False: ps['msg'] = msg self.render('admin/application/add_or_edit_bs.html', **ps) return codeType = str_helper.check_num_abc__(app['code']) if codeType == False: ps['msg'] = state.ResultInfo.get(101006, '') self.render('admin/application/add_or_edit_bs.html', **ps) return app['user'] = self.get_oper_user() if ps['isedit']: self.check_oper_right(right = state.operEdit) try: oa = application_logic.query_one(app['code']) info = application_logic.update(name = app['name'], code = app['code'], developer = app['developer'], url = app['url'], status = app['status'], remark = app['remark'], user = app['user']) if info: na = application_logic.query_one(app['code']) self.write_oper_log(action = 'appEdit', targetType = 2, targetID = oa['code'], targetName = oa['name'], startStatus = str_helper.json_encode(oa), endStatus= str_helper.json_encode(na)) ps = self.get_ok_and_back_params(ps = ps, refUrl = ps['refUrl']) else: ps['msg'] = state.ResultInfo.get(101, '') except error.RightError as e: ps['msg'] = e.msg else: self.check_oper_right(right = state.operAdd) try: info = application_logic.add(name = app['name'], code = app['code'], developer = app['developer'], url = app['url'], status = app['status'], remark = app['remark'], user = app['user']) if info: # funcname = app['name'] + '管理' # self._add_app_func(name = funcname, code= app['code'], user = app['user']) na = application_logic.query_one(app['code']) self.write_oper_log(action = 'appCreate', targetType = 2, targetID = na['code'], targetName = na['name'], startStatus = '', endStatus= str_helper.json_encode(na)) ps = self.get_ok_and_back_params(ps = ps, refUrl = ps['refUrl']) else: ps['msg'] = state.ResultInfo.get(101, '') except error.RightError as e: ps['msg'] = e.msg ps = self.format_none_to_empty(ps) self.render('admin/application/add_or_edit_bs.html', **ps)
def post(self): func = self.get_args(['appCode', 'name', 'code', 'customJson', 'remark'], '') func['id'] = int(self.get_arg('id', '0')) func['parentID'] = int(self.get_arg('parentID', '0')) func['sort'] = int(self.get_arg('sort', '0')) msg = self.check_str_empty_input(func, ['code', 'name', 'appCode']) if str_helper.is_null_or_empty(msg) == False: self.out_fail(code = 1001, msg = msg) return btype = str_helper.check_num_abc__(func['code']) if btype == False: self.out_fail(code = 1001, msg = '编号参数只允许输入英文字母、数字和下划线') return func['user'] = self.get_oper_user() if func['id'] <= 0: self.check_oper_right(right = state.operAdd) if func['parentID'] <= 0: func['path'] = '%s.%s' % (func['appCode'], func['code']) else: func['path'] = '%s.%s' % ((func_logic.query_one_by_id(func['parentID'])).get('path'), func['code']) func['status'] = state.Boole['true'] f = func_logic.query_one_by_path(path = func['path']) if None != f: self.out_fail(code = 102003) return try: result = func_logic.add(appCode = func['appCode'], name = func['name'], code = func['code'], parentID = func['parentID'], path = func['path'], customJson = func['customJson'], sort = func['sort'], status = func['status'], remark = func['remark'], user = func['user']) nf = func_logic.query_one_by_path(func['path']) self.write_oper_log(action = 'funcCreate', targetType = 3, targetID = str(nf['id']), targetName = nf['name'], startStatus = '', endStatus= str_helper.json_encode(nf)) except error.RightError as e: self.out_fail(code=e.code) return else: self.check_oper_right(right = state.operEdit) try: of = func_logic.query_one_by_id(func['id']) func_logic.update(id = func['id'], name = func['name'],sort = func['sort'], customJson = func['customJson'],remark = func['remark'],user = func['user']) nf = func_logic.query_one_by_id(func['id']) self.write_oper_log(action = 'funcEdit', targetType = 3, targetID = str(nf['id']), targetName = nf['name'], startStatus = str_helper.json_encode(of), endStatus= str_helper.json_encode(nf)) except error.RightError as e: self.out_fail(code=e.code) return self.out_ok()
def post(self): func = self.get_args(['appCode', 'name', 'code', 'customJson', 'rights', 'remark'], '') func['id'] = int(self.get_arg('id', '0')) func['parentID'] = int(self.get_arg('parentID', '0')) func['sort'] = int(self.get_arg('sort', '0')) msg = self.check_str_empty_input(func, ['code', 'name', 'rights', 'appCode']) if str_helper.is_null_or_empty(msg) == False: self.out_fail(code = 1001, msg = msg) return btype = str_helper.check_num_abc__(func['code']) if btype == False: self.out_fail(code = 1001, msg = '编号参数只允许输入英文字母、数字和下划线') return func['user'] = self.get_oper_user() if func['id'] <= 0: self.check_oper_right(right = state.operAdd) if func['parentID'] <= 0: func['path'] = '%s.%s' % (func['appCode'], func['code']) else: func['path'] = '%s.%s' % ((func_logic.query_one_by_id(func['parentID'])).get('path'), func['code']) func['status'] = state.Boole['true'] f = func_logic.query_one_by_path(path = func['path']) if None != f: self.out_fail(code = 102003) return try: result = func_logic.add(appCode = func['appCode'], name = func['name'], code = func['code'], parentID = func['parentID'], path = func['path'], rights = func['rights'], customJson = func['customJson'], sort = func['sort'], status = func['status'], remark = func['remark'], user = func['user']) nf = func_logic.query_one_by_path(func['path']) self.write_oper_log(action = 'funcCreate', targetType = 3, targetID = str(nf['id']), targetName = nf['name'], startStatus = '', endStatus= str_helper.json_encode(nf)) except error.RightError as e: self.out_fail(code=e.code) return else: self.check_oper_right(right = state.operEdit) try: of = func_logic.query_one_by_id(func['id']) func_logic.update(id = func['id'], name = func['name'], sort = func['sort'], rights = func['rights'], customJson = func['customJson'], remark = func['remark'], user = func['user']) nf = func_logic.query_one_by_id(func['id']) self.write_oper_log(action = 'funcEdit', targetType = 3, targetID = str(nf['id']), targetName = nf['name'], startStatus = str_helper.json_encode(of), endStatus= str_helper.json_encode(nf)) except error.RightError as e: self.out_fail(code=e.code) return self.out_ok()
def post(self): params = self.get_args(['appCode', 'name', 'code', 'parentPath', 'customJson', 'rights', 'remark', 'user'], '') params['sort'] = int(self.get_arg('sort', '0')) params['status'] = int(self.get_arg('status', '0')) msg = self.check_str_empty_input(params, ['appCode', 'name', 'code', 'parentPath', 'user']) if str_helper.is_null_or_empty(msg) == False: self.out_fail(code = 1001, msg = msg) return btype = str_helper.check_num_abc__(params['code']) if btype == False: self.out_fail(code = 1001, msg = '编号参数只允许输入英文字母、数字和下划线') return parent = func_logic.query_one_by_path(path = params['parentPath']) if None == parent: self.out_fail(code = 102004) return path = parent['path']+'.'+params['code'] func = func_logic.query_one_by_path(path = path) if None != func: self.out_fail(code = 102003) return user = user_logic.query_one_by_name(params['user']) if None == user: self.out_fail(code = 103002) try: result = func_logic.add(appCode = params['appCode'], name = params['name'], code = params['code'], parentID = parent['id'], path = path, rights = params['rights'], customJson = params['customJson'], sort = params['sort'], status = params['status'], remark = params['remark'], user = params['user']) self.out_ok() self.write_oper_log(action = 'funcCreateInterface', targetType = 3, targetID = str(result), targetName = params['name'], startStatus = '', endStatus= str_helper.json_encode(params), user = user) except error.RightError as e: self.out_fail(code=e.code) return return
def post(self): ps = self.get_page_config(title='创建应用') if ps['isedit']: ps['title'] = self.get_page_title('编辑应用') app = self.get_args(['code', 'name', 'developer', 'url', 'remark'], '') app['status'] = int(self.get_arg('status', '0')) ps['app'] = app msg = self.check_str_empty_input(app, ['code', 'name', 'url']) if str_helper.is_null_or_empty(msg) == False: ps['msg'] = msg self.render('admin/application/add_or_edit_bs.html', **ps) return codeType = str_helper.check_num_abc__(app['code']) if codeType == False: ps['msg'] = state.ResultInfo.get(101006, '') self.render('admin/application/add_or_edit_bs.html', **ps) return app['user'] = self.get_oper_user() if ps['isedit']: self.check_oper_right(right=state.operEdit) try: oa = application_logic.query_one(app['code']) info = application_logic.update(name=app['name'], code=app['code'], developer=app['developer'], url=app['url'], status=app['status'], remark=app['remark'], user=app['user']) if info: na = application_logic.query_one(app['code']) self.write_oper_log(action='appEdit', targetType=2, targetID=oa['code'], targetName=oa['name'], startStatus=str_helper.json_encode(oa), endStatus=str_helper.json_encode(na)) ps = self.get_ok_and_back_params(ps=ps, refUrl=ps['refUrl']) else: ps['msg'] = state.ResultInfo.get(101, '') except error.RightError as e: ps['msg'] = e.msg else: self.check_oper_right(right=state.operAdd) try: info = application_logic.add(name=app['name'], code=app['code'], developer=app['developer'], url=app['url'], status=app['status'], remark=app['remark'], user=app['user']) if info: # funcname = app['name'] + '管理' # self._add_app_func(name = funcname, code= app['code'], user = app['user']) na = application_logic.query_one(app['code']) self.write_oper_log(action='appCreate', targetType=2, targetID=na['code'], targetName=na['name'], startStatus='', endStatus=str_helper.json_encode(na)) ps = self.get_ok_and_back_params(ps=ps, refUrl=ps['refUrl']) else: ps['msg'] = state.ResultInfo.get(101, '') except error.RightError as e: ps['msg'] = e.msg ps = self.format_none_to_empty(ps) self.render('admin/application/add_or_edit_bs.html', **ps)