def post(self): tmobile = self.get_argument("tmobile", "") # if not check_sql_injection(tmobile): # self.get() # return message = None url = None cid = UWEB.DUMMY_CID oid = UWEB.DUMMY_OID terminal = self.db.get( "SELECT tid, owner_mobile" " FROM T_TERMINAL_INFO" " WHERE mobile = %s" " AND service_status = %s" " AND (%s BETWEEN begintime AND endtime)", tmobile, UWEB.SERVICE_STATUS.ON, int(time.time()), ) if not terminal: message = ErrorCode.TERMINAL_NOT_FOUND self.render("delegation/delegation.html", message=message, url=url) else: user = self.db.get("SELECT uid" " FROM T_USER" " WHERE mobile = %s", terminal.owner_mobile) if user: administrator = self.db.get( "SELECT type" " FROM T_ADMINISTRATOR" " WHERE id = %s", self.current_user.id ) uid = user.uid tid = terminal.tid url = "/".join( [ ConfHelper.UWEB_CONF.url_out, UWebHelper.URLS.DELEGATION[1:], str(uid), str(tid), str(tmobile), str(cid), str(oid), ] ) sign = UWebHelper.get_sign( "".join([str(user.uid), str(terminal.tid), str(tmobile), str(cid), str(oid)]) ) url += "?s=" + sign self.log_delegation(self.current_user.id, cid, uid, tid) if administrator.type != "0": pass # sms = SMSCode.SMS_DELEGATION % (time.strftime("%Y-%m-%d %H:%M:%S"), # tmobile) # SMSHelper.send(terminal.owner_mobile, sms) self.render("delegation/delegation.html", message=message, url=url) else: message = ErrorCode.USER_NOT_ORDERED self.render("delegation/delegation.html", message=message, url=url)
def post(self): cid = self.get_argument("cid", "") message = None url = None corp = QueryHelper.get_corp_by_cid(cid, self.db) if not corp: message = ErrorCode.USER_NOT_FOUND self.render("delegation/delegation_enterprise.html", message=message, url=url) else: uid = "dummy" tid = "dummy" tmobile = "dummy" cid = cid oid = UWEB.DUMMY_OID url = "/".join( [ ConfHelper.UWEB_CONF.url_out, UWebHelper.URLS.DELEGATION[1:], str(uid), str(tid), str(tmobile), str(cid), str(oid), ] ) sign = UWebHelper.get_sign("".join([str(uid), str(tid), str(tmobile), str(cid), str(oid)])) url += "?s=" + sign self.log_delegation(self.current_user.id, cid, uid, tid) self.render("delegation/delegation_enterprise.html", message=message, url=url)