def delete_proj(proj_id): proj = ProjMgr.get(proj_id) if proj is None: return dict(status='error', msg='要删除的项目不存在') ProjMgr.delete(proj) PicMgr.clear_pic_list(proj.id) # 新增操作记录 __add_proj_op_log(web_util.get_operator_id(), proj.id, proj_constant.PROJ_OP_TYPE_DELETE, "删除项目", proj.proj_status, proj.proj_status) return dict(status='ok')
def create_pic(bus_type, bus_id, img_type, url, override=False): if override: PicMgr.clear_pic_list(bus_type, bus_id, img_type) sequence = 1 else: sequence = PicMgr.get_last_sequence_by_type(bus_type, bus_id, img_type) + 1 return PicMgr.create(bus_type=bus_type, bus_id=bus_id, img_type=img_type, url=url, sequence=sequence)
def create_pic(bus_type, bus_id, img_type, url, override): if override: PicMgr.clear_pic_list(bus_type, bus_id, img_type) sequence = 1 else: sequence = PicMgr.get_last_sequence_by_type(bus_type, bus_id, img_type) + 1 if bus_type == 'post': ProjRecruitPostMgr.modified(bus_id) return PicMgr.create(bus_type=bus_type, bus_id=bus_id, img_type=img_type, url=url, sequence=sequence)
def add_intro_list_pics(id, data): """ 获取项目介绍图片链接列表,格式为{url: 'xx', id: '1'} """ intro_pic_list = PicMgr.get_img_by_type('post', id, 'intro') result = [] for item in intro_pic_list: result.append({'url': item.url, 'id': item.id}) data['intro_list_pics'] = result
def add_recruit_post_details(id, data): """ 获取项目招工贴中的招工详情介绍,为富文本+图片集的形式 """ rich_text_list = RichTextMgr.get_richtext_by_type( 'post', id, 'proj_recruit_detail') result = [] for item in rich_text_list: rich_text = to_dict(item) intro_pic_list = PicMgr.get_img_by_type('post', id, item.title) rich_text['pic_list'] = [] for pic in intro_pic_list: rich_text['pic_list'].append({'url': pic.url, 'id': pic.id}) result.append(rich_text) data['recruit_post_details'] = result
def add_recruit_post_highlight(id, data): """ 获取项目招工贴中的高亮信息,为富文本+图片集的形式, 范围一个dict """ rich_text = RichTextMgr.query_first( { 'bus_type': 'post', 'bus_id': id, 'text_type': 'proj_highlight' }, order_list=[RichTextMgr.model.sequence.desc()]) if not rich_text: return None rich_text = to_dict(rich_text) intro_pic_list = PicMgr.get_img_by_type('post', id, 'proj_highlight') rich_text['pic_list'] = [] for pic in intro_pic_list: rich_text['pic_list'].append({ 'url': pic.url, 'sequence': pic.sequence }) data['recruit_post_highlight'] = rich_text
def add_logo_url(id, data): """ 获取项目logo图片链接 """ logo_pic = PicMgr.get_img_by_type('post', id, 'logo') data['logo_url'] = logo_pic[0].url if len(logo_pic) else ''
def delete_pic(pic_id): pic = PicMgr.get(pic_id) if pic: PicMgr.delete(pic) if pic.bus_type == 'post': ProjRecruitPostMgr.modified(pic.bus_id)
def delete_pic(pic_id): pic = PicMgr.get(pic_id) if pic: PicMgr.delete(pic)