Exemplo n.º 1
0
 def post(self):
     cuid = int(self.get_secure_cookie("_yoez_uid"))
     img = self.get_argument("avatar")
     setrst = set_image_size((200, 200), img)
     upd_sql = "update user set img='%s' where uid=%d" % (img, cuid)
     img_sql = "select img from user where uid=%d" % cuid
     if setrst:
         oldimg = self.db.get(img_sql).img
         self.db.execute(upd_sql)
         path = os.path.dirname(sys.argv[0])+oldimg
         #print path
         os.remove(path)
         result = dict(url="/"+str(cuid), status=1, code='')
     else:
         result = dict(url="/", status=0, code='set image error!')
     self.write(result)
Exemplo n.º 2
0
 def post(self):
     cuid = int(self.get_secure_cookie("_yoez_uid"))
     usertype = self.get_argument("type", "0")
     sex = self.get_argument("sex", "0")
     img = self.get_argument("avatar")
     setrst = set_image_size((200, 200), img)
     upd_sql = ("update user set img='%s',status=%d where "
                "uid=%d") % (img, USER_STATUS["normal"], cuid)
     chk_sql = "select proper_id from  property where proper_id=%d" % cuid
     chk = self.db.get(chk_sql)
     if not chk:
         pro_sql = ("insert into property(proper_id,ptype,sex) values "
                    "(%d,'%s','%s')") % (cuid, usertype, sex)
         bsc_sql = "insert into basicinfo(bsc_id) values(%d)" % (cuid)
         con_sql = "insert into contactinfo(con_id) values(%d)" % (cuid)
         self.db.execute(pro_sql)
         self.db.execute(bsc_sql)
         self.db.execute(con_sql)
     if setrst:
         self.db.execute(upd_sql)
         result = dict(url="/"+str(cuid), status=1, code='')
     else:
         result = dict(url="/", status=0, code='set image error!')
     self.write(result)
Exemplo n.º 3
0
 def post(self):
     cuid = int(self.get_secure_cookie("_yoez_uid"))
     usertype = self.get_argument("type", "0")
     sex = self.get_argument("sex", "0")
     img = self.get_argument("avatar")
     setrst = set_image_size((200, 200), img)
     upd_sql = ("update user set img='%s',status=%d where "
                "uid=%d") % (img, USER_STATUS["normal"], cuid)
     chk_sql = "select proper_id from  property where proper_id=%d" % cuid
     chk = self.db.get(chk_sql)
     if not chk:
         pro_sql = ("insert into property(proper_id,ptype,sex) values "
                    "(%d,'%s','%s')") % (cuid, usertype, sex)
         bsc_sql = "insert into basicinfo(bsc_id) values(%d)" % (cuid)
         con_sql = "insert into contactinfo(con_id) values(%d)" % (cuid)
         self.db.execute(pro_sql)
         self.db.execute(bsc_sql)
         self.db.execute(con_sql)
     if setrst:
         self.db.execute(upd_sql)
         result = dict(url="/" + str(cuid), status=1, code='')
     else:
         result = dict(url="/", status=0, code='set image error!')
     self.write(result)