def get(self):

        phone = self.get_argument('phone')
        r_id = self.get_argument('registid')
        ap_id = self.get_argument("apid")
        type = self.get_argument('type')

        user = self.db.query(User).filter(User.Utel == phone).one()
        uid = user.Uid
        regiset = self.db.query(User).filter(User.Uid == r_id).one()
        u_phone = decode_base64(phone)
        r_phone = decode_base64(regiset.Utel)
        appointment = self.db.query(WAppointment).filter(
            WAppointment.WAPid == ap_id).one()
        aptitle = appointment.WAPtitle
        try:
            exist = self.db.query(WApInfo).filter(
                WApInfo.WAIappoid == ap_id).one()
            self.retjson['code'] = '10291'
            self.retjson['contents'] = '此约拍已经选择'
        except Exception, e:
            print e
            new_item = ''
            if int(type) == 0:
                new_item = WApInfo(
                    WAImid=r_id,
                    WAIpid=uid,
                    WAIappoid=ap_id,
                )
            else:
                new_item = WApInfo(
                    WAImid=uid,
                    WAIpid=r_id,
                    WAIappoid=ap_id,
                )
            self.db.merge(new_item)
            try:
                self.db.commit()
                self.retjson['code'] = '10293'
                self.retjson['contents'] = r_phone
                ap = self.db.query(WAppointment).filter(
                    WAppointment.WAPid == ap_id).one()
                ap.WAPstatus += 1
                apentry = self.db.query(WAppointEntry).filter(
                    WAppointEntry.WAEapid == ap_id,
                    WAppointEntry.WAEregisterID == r_id).one()
                apentry.WAEchoosed = 1
                self.db.commit()
                selectmessage(r_phone, aptitle, u_phone)
            except Exception, e:
                print e
                self.retjson['code'] = '10292'
                self.retjson['contents'] = '服务器错误'
Example #2
0
def wechat_user_model_select_simply(user):
    retdata = dict(
        Uid=user.Uid,
        Utel=decode_base64(user.Utel),
        Ualais=user.Ualais,
        Usex=int(user.Usex),
    )
    return retdata
def wechat_user_model_select_simply(user):
    db = get_db()
    headimg = db.query(UserImage).filter(UserImage.UIuid == user.Uid,
                                         UserImage.UIvalid == 1).one()
    auth = AuthKeyHandler()
    retdata = dict(Uid=user.Uid,
                   Utel=decode_base64(user.Utel),
                   Ualais=user.Ualais,
                   Usex=int(user.Usex),
                   headimg=auth.download_abb_url(headimg.UIurl))
    return retdata
Example #4
0
    def get(self):

        w_phone = self.get_argument('phone')  #当前用户的电话
        w_rid = self.get_argument('rid')  #选择人的id
        w_type = self.get_argument('type')  #约拍类型
        w_apid = self.get_argument('apid')

        user = self.db.query(User).filter(User.Utel == w_phone).one()
        w_uid = user.Uid
        if w_type == 0:
            exist = self.db.query(WApInfo.WAIappoid == w_apid,
                                  WApInfo.WAIpid == w_uid,
                                  WApInfo.WAImid == w_rid).all()
            if exist:
                user = self.db.query(User).filter(User.Uid == w_rid).one()
                phone = decode_base64(user.Utel)
                self.retjson['code'] = '10410'
                self.retjson['contents'] = phone
            else:
                self.retjson['code'] = '10411'
                self.retjson['contents'] = '无法获得'
        if w_type == 1:
            exist = self.db.query(WApInfo.WAIappoid == w_apid,
                                  WApInfo.WAIpid == w_rid,
                                  WApInfo.WAImid == w_uid).all()
            if exist:
                user = self.db.query(User).filter(User.Uid == w_rid).one()
                phone = decode_base64(user.Utel)
                self.retjson['code'] = '10410'
                self.retjson['contents'] = phone
            else:
                self.retjson['code'] = '10411'
                self.retjson['contents'] = '无法获得'
        callback = self.get_argument("jsoncallback")
        jsonp = "{jsfunc}({json});".format(jsfunc=callback,
                                           json=json.dumps(self.retjson,
                                                           ensure_ascii=False,
                                                           indent=2))
        self.write(jsonp)
 def get(self):
     print("进入提醒阶段\n_____________")
     #查询未提醒的报名中的且有效且有人报名的约拍
     WAPs = self.db.query(WAppointment).filter(WAppointment.WAPremind == 0,WAppointment.WAPvalid == 1,
                                               WAppointment.WAPregistN > 0,WAppointment.WAPstatus == 1).all()
     for WAP in WAPs:
         delta = datetime.datetime.now() - WAP.WAPcreateT
         #判断是否已经创建了3天
         if delta>datetime.timedelta(days=3):
             # 是否选择了用户,未选择则发送提醒短信
             # chooser = self.db.query(WApInfo).filter(WApInfo.WAIappoid == WAP.WAPid,WApInfo.WAIvalid == 1).all()
             # if not chooser:
             #selectmessage('15151861978','lalala','1312312312')
             try:
                 user = self.db.query(User).filter(User.Uid == WAP.WAPsponsorid).one()
                 phone = decode_base64(user.Utel)
                 remindmessage(phone,WAP.WAPtitle)
                 WAP.WAPremind = 1
                 self.db.commit()
             except Exception,e:
                 print e
Example #6
0
    def get(self):

        acid = self.get_argument('acid')
        acid = decode_base64(acid)
        try:
            exist = self.db.query(WActivity).filter(WActivity.WACid == acid).one()
            data = self.db.query(WAcEntry).filter(WAcEntry.WACEacid == acid,WAcEntry.WACEregistvalid == 1).all()
            retdata = []
            for item in data:
                userid = item.WACEregisterid
                user = self.db.query(User).filter(User.Uid == userid).one()
                retdata_item = wechat_user_model_simply(user)
                retdata.append(retdata_item)
            self.retjson['code'] = '10400'
            self.retjson['contents'] = retdata



        except Exception,e:
            print e
            self.retjson['code'] = '10401'
            self.retjson['contents'] = '活动不存在'
    def get(self):

        acid = self.get_argument('acid')
        if acid == 'nvoaie3132fdjanfe==fe02nc9kas01238nfxklsf':
            try:
                retdata = []
                users = self.db.query(User).filter(User.Uvalid == 1).all()
                for user in users:
                    retdata_item = wechat_user_model_simply(user)
                    retdata.append(retdata_item)
                self.retjson['code'] = '10400'
                self.retjson['contents'] = retdata
            except Exception, e:
                print e
        else:
            acid = decode_base64(acid)
            try:
                exist = self.db.query(WActivity).filter(
                    WActivity.WACid == acid).one()
                data = self.db.query(WAcEntry).filter(
                    WAcEntry.WACEacid == acid,
                    WAcEntry.WACEregistvalid == 1).all()
                retdata = []
                for item in data:
                    userid = item.WACEregisterid
                    user = self.db.query(User).filter(User.Uid == userid).one()
                    retdata_item = wechat_user_model_simply(user)
                    retdata.append(retdata_item)
                self.retjson['code'] = '10400'
                self.retjson['contents'] = retdata