def post(self): name = self.get_argument("name", "") phone = self.get_argument("phone", "") email = self.get_argument("email", "") sex = self.get_argument("sex", "") degree = self.get_argument("degree", "") major = self.get_argument("major", "") school = self.get_argument("school", "") city = self.get_argument("city", "") attention_job = self.get_argument("attention_job", "") marry = self.get_argument("marry", "") birthday = self.get_argument("birthday", "") id_card = self.get_argument("id_card", "") remarks = self.get_argument("remarks", "") from bin.base import get_id_name #获取用户名和id user_id = get_id_name(self.current_user)[0] columns = "user_id,name,sex,birthday,phone,email,marry,degree,major,school,city,attention_job,id_card,remarks" values = {"user_id": user_id, "name": name, "sex": sex, "birthday": birthday, "phone": phone, "email": email, "marry": marry, "degree": degree, "major": major, "school": school, "city": city, "attention_job": attention_job, "id_card": id_card, "remarks": remarks} table = "user_baseinfo" from optsql.insertMySQL import insert_baseinfo insert_id = insert_baseinfo(columns, values, table) #把信息插入数据库,并返回该行数据的id if insert_id: rtinfo = {"status": 0, "result": insert_id} else: rtinfo = {"status": 1, "result": "添加失败!"} self.write(base.get_json(rtinfo))
def post(self): user_id = base.get_id_name(self.current_user)[0] baseinfo_id = self.get_argument("baseinfo_id", "") table = "user_baseinfo" from optsql.updateMySQL import update_info_state rt_info = update_info_state(user_id=user_id, info_id=baseinfo_id, table=table) if rt_info: result = {"status": 0, "rt_info": rt_info} else: result = {"status": 1, "rt_info": "更改失败!"} self.write(base.get_json(result))
def post(self): img_id = self.get_argument("img_id", "") if img_id: user_id = base.get_id_name(self.current_user)[0] from optsql.updateMySQL import update_info_state rt_info = update_info_state(user_id=user_id, info_id=img_id, table="images") #更改对应img_id的state为1 if rt_info: result = {"status": 0, "rt_info": "更改成功!"} else: result = {"status": 1, "rt_info": "更改失败!"} else: result = {"status": 2, "rt_info": "网络连接错误~"} self.write(base.get_json(result))
def post(self): user_id = base.get_id_name(self.current_user)[0] skill_name = self.get_argument("skill_name", "") master_degree = self.get_argument("master_degree", "") from optsql.insertMySQL import insert_one_skill insert_id = insert_one_skill(user_id=user_id, skill_name=skill_name, master_degree=master_degree) #把专业技能信息插入数据库 if insert_id: from optsql.searchMySQL import search_one_info insert_info = search_one_info(id=insert_id, table="skill") #查询刚插入行的信息 rt_info = {"status": 0, "result": insert_info} else: rt_info = {"status": 1, "result": "添加失败!"} return self.write(base.get_json(rt_info))
def post(self): if self.request.files: id_name = base.get_id_name(self.current_user) #获取id和用户名列表 user_id = id_name[0] dir_path = "static/img/headimg/" + user_id #存储图片的文件目录 if_mkdir(dir_path) #判断是否创建目录 img_name = str(time.time())[:10] + ".jpg" #以当前时间戳给图片命名 img_url = dir_path + "/" + img_name imgfile = self.request.files['img'][0] #从前台获取图片文件 imgfile_open = open(img_url, "w") imgfile_open.write(imgfile["body"]) imgfile_open.close() from optsql.insertMySQL import insert_one_imgurl insert_id = insert_one_imgurl(user_id=user_id, img_url=img_url) #把图片路径写进数据库 print "insert_id.......", insert_id self.redirect("/") return
def post(self): project_name = self.get_argument("project_name", "") project_starttime = self.get_argument("project_starttime", "") project_endtime = self.get_argument("project_endtime", "") project_detail = self.get_argument("project_detail", "") values = dict(project_name=project_name, project_starttime=project_starttime, project_endtime=project_endtime, project_detail=project_detail ) print values user_id = base.get_id_name(self.current_user)[0] from optsql.insertMySQL import insert_one_project_experience insert_id = insert_one_project_experience(user_id=user_id, values=values) if insert_id: rt_info = dict(status=0, insert_id=insert_id) else: rt_info = dict(status=1, insert_id=0) self.write(base.get_json(rt_info))
def post(self): coperation_name = self.get_argument("coperation_name", "") coperation_position = self.get_argument("coperation_position", "") coperation_starttime = self.get_argument("coperation_starttime", "") coperation_endtime = self.get_argument("coperation_endtime", "") coperation_operating_duty = self.get_argument("coperation_operating_duty", "") user_id = base.get_id_name(self.current_user)[0] values = dict(coperation_name=coperation_name, coperation_position=coperation_position, coperation_starttime=coperation_starttime, coperation_endtime=coperation_endtime, coperation_operating_duty=coperation_operating_duty ) from optsql.insertMySQL import insert_one_job_experience insert_id = insert_one_job_experience(user_id=user_id, values=values) if insert_id: rtinfo = {"status": 0, "insert_id": insert_id} else: rtinfo = {"status": 1, "result": "保存失败!"} self.write(base.get_json(rtinfo))
def get(self): user_id = base.get_id_name(self.current_user)[0] user_skill_info = get_skill_info(user_id=user_id) #查询该用户专业技能的所有信息 self.write(base.get_json(user_skill_info))