Example #1
0
 def put(self):
     c1 = copy.deepcopy(self.args) if self.args else {}
     uid = c1.pop('t_uid', None)
     mul = c1.pop('t_mul', None)
     if uid and mul:
         Requestcmd.update('busi_tzcord', dict(t_uid=uid), dict(t_mul=mul))
         self.write(dict(errcode=RET.OK, errmsg=RMS.OK))
     else:
         self.write(dict(errcode=RET.PARAMERR, errmsg=RMS.PARAMERR))
Example #2
0
 def get(self):
     ret = yield Requestcmd.find4and(
         'busi_msginfo', dict(i_id='b176eb55eefc413a8a4aca2d059948d1'))
     self.write(
         dict(errcode=RET.OK,
              errmsg=RMS.OK,
              data=json.loads(json.dumps(ret, cls=MyEncoder))))
Example #3
0
 def post(self):
     try:
         c1 = copy.deepcopy(self.args)
         bt_treeid = uuid.uuid4().hex
         c1.setdefault('bt_treeid', bt_treeid)
         yield Requestcmd.insert('base_tree', c1)
     except Exception as e:
         self.write(dict(errcode=RET.SERVERERR, errmsg=RMS.SERVERERR))
     else:
         self.write(dict(errcode=RET.OK, errmsg=RMS.OK, data=bt_treeid))
Example #4
0
 def post(self):
     c1 = copy.deepcopy(self.args)
     b_id = uuid.uuid4().hex
     c1.setdefault('b_id', b_id)
     try:
         yield Requestcmd.insert('busi_open', c1)
     except Exception as e:
         self.write(
             dict(errcode=RET.SERVERERR, errmsg=RMS.SERVERERR, data=str(e)))
     else:
         self.write(dict(errcode=RET.OK, errmsg=RMS.OK, data=b_id))
Example #5
0
 def post(self):
     t_uid = uuid.uuid4().hex
     c1 = copy.deepcopy(self.args)
     c1.setdefault('t_uid', t_uid)
     c1.setdefault('t_from', 1)
     try:
         yield Requestcmd.insert('busi_tzcord', c1)
     except Exception as e:
         self.write(
             dict(errcode=RET.SERVERERR, errmsg=RMS.SERVERERR, data=str(e)))
     else:
         self.write(dict(errcode=RET.OK, errmsg=RMS.OK, data=t_uid))
Example #6
0
 def put(self):
     try:
         c1 = copy.deepcopy(self.args)
         treeid = c1.pop('bt_treeid', None)
         if treeid:
             ret = yield Requestcmd.update('base_tree',
                                           dict(bt_treeid=treeid), c1)
         else:
             self.write(dict(errcode=RET.PARAMERR, errmsg=RMS.PARAMERR))
     except Exception as e:
         self.write(dict(errcode=RET.SERVERERR, errmsg=RMS.SERVERERR))
     else:
         self.write(dict(errcode=RET.OK, errmsg=RMS.OK, data=ret))
Example #7
0
 def delete(self):
     try:
         bc_id = self.args.get('bc_id')
         if bc_id:
             userinfo = Session(self)
             uid = userinfo.data.get('uid')
             if uid == '627263a4feba11e8bab15254005c9e8b':
                 ret = yield Requestcmd.del4and('base_code', self.args)
             else:
                 self.write(dict(errcode=RET.ROLEERR, errmsg=RMS.ROLEERR))
         else:
             self.write(dict(errcode=RET.PARAMERR, errmsg=RMS.PARAMERR))
     except Exception as e:
         self.write(dict(errcode=RET.SERVERERR, errmsg=RMS.SERVERERR))
     else:
         self.write(dict(errcode=RET.OK, errmsg=RMS.OK, data=ret))
Example #8
0
 def put(self):
     c1 = copy.deepcopy(self.args)
     troduce = c1.get('i_troduce', None)
     content = c1.get('i_content', None)
     activedate = c1.get('i_activedate', None)
     if all((troduce, content)):
         yield Requestcmd.update(
             'busi_msginfo', dict(i_id='b176eb55eefc413a8a4aca2d059948d1'),
             dict(i_troduce=troduce,
                  i_content=content,
                  i_activedate=activedate))
         self.write(
             dict(errcode=RET.OK,
                  errmsg=RMS.OK,
                  data='b176eb55eefc413a8a4aca2d059948d1'))
     else:
         self.write(dict(errcode=RET.PARAMERR, errmsg=RMS.PARAMERR))
Example #9
0
 def post(self):
     try:
         c1 = copy.deepcopy(self.args)
         bc_id = uuid.uuid4().hex
         c1.setdefault('bc_id', bc_id)
         userinfo = Session(self)
         bc_createuid = userinfo.data.get('uid')
         c1.setdefault('bc_createuid', bc_createuid)
         yield Requestcmd.insert('base_code', c1)
     except Exception as e:
         self.write(dict(errcode=RET.SERVERERR, errmsg=RMS.SERVERERR))
     else:
         self.write(
             dict(errcode=RET.OK,
                  errmsg=RMS.OK,
                  data=dict(bc_id=bc_id,
                            bc_createmen=userinfo.data.get('username'))))
Example #10
0
 def post(self):
     shareid = self.args.get('b_shareid', None)
     if shareid:
         try:
             yield Requestcmd.insert('busi_share', dict(b_shareid=shareid))
             access = yield AccessToken.get_access_token()
             wechat = WechatBasic(
                 access_token=access.get('access_token'),
                 access_token_expires_at=access.get('expires_at'))
             templateid = '13EKjS77LsOXHfj11bDjbl2yePO-rr9Vy9_EWvTNobw'
             url = 'http://dftp.ystsj.net/tz/wx#/activityintro'
             data = {
                 'first': {
                     'value': u'你的分享已生效,可以进行投注\n',
                     "color": "#173177"
                 },
                 'keyword1': {
                     'value': u'分享生效通知'
                 },
                 'keyword2': {
                     'value':
                     datetime.datetime.now().strftime('%Y-%m-%d %H:%M'),
                     "color": "#173177"
                 },
                 'keyword3': {
                     'value': u'--'
                 },
                 'remark': {
                     'value': u'\n点击查看详细信息'
                 }
             }
             try:
                 yield wechat.send_template_message(shareid,
                                                    templateid,
                                                    data,
                                                    url=url)
             except Exception as e:
                 pass
         except Exception as e:
             pass
         finally:
             self.write(dict(errcode=RET.OK, errmsg=RMS.OK))
     else:
         self.write(dict(errcode=RET.PARAMERR, errmsg=RMS.PARAMERR))
Example #11
0
 def post(self):
     c1 = copy.deepcopy(self.args) if self.args else {}
     t_uid = c1.get('t_uid', None)
     t_name = c1.get('t_name', None)
     t_tel = c1.get('t_tel', None)
     t_carid = c1.get('t_carid', None)
     t_tzcode = c1.get('t_tzcode', None)
     if all((t_uid, t_name, t_tel, t_carid, t_tzcode)):
         ret = yield db.callproc('wx_check_tz', (t_uid, ))
         if str(ret[0].get('errcode')) == '0':
             try:
                 yield Requestcmd.insert(
                     'busi_tzcord',
                     dict(t_uid=t_uid,
                          t_name=t_name,
                          t_tel=t_tel,
                          t_carid=t_carid,
                          t_tzcode=t_tzcode))
             except Exception as e:
                 self.write(
                     dict(errcode=RET.DATAEXIST,
                          errmsg=[u'该用户已投注,不允许再次投注']))
             else:
                 access = yield AccessToken.get_access_token()
                 wechat = WechatBasic(
                     access_token=access.get('access_token'),
                     access_token_expires_at=access.get('expires_at'))
                 templateid = 'leNIrs_hrXB9ksN1Mkac7-M3b0uRcCWdp_w9NLfNIi0'
                 url = 'http://dftp.ystsj.net/tz/wx#/myactivity'
                 data = {
                     'first': {
                         'value': u'%s你好,恭喜你投注成功\n' % t_name,
                         "color": "#173177"
                     },
                     'keyword1': {
                         'value': u'投注号码-%s' % t_tzcode,
                         "color": "#173177"
                     },
                     'keyword2': {
                         'value':
                         datetime.datetime.now().strftime('%Y-%m-%d %H:%M'),
                         "color":
                         "#173177"
                     },
                     'remark': {
                         'value': u'\n点击查看详细信息'
                     }
                 }
                 try:
                     yield wechat.send_template_message(t_uid,
                                                        templateid,
                                                        data,
                                                        url=url)
                 except Exception as e:
                     pass
                 self.write(dict(errcode=RET.OK, errmsg=RMS.OK))
         else:
             self.write(
                 dict(errcode=ret[0].get('errcode'),
                      errmsg=[ret[0].get('errmsg')]))
     else:
         self.write(dict(errcode=RET.PARAMERR, errmsg=RMS.PARAMERR))
Example #12
0
 def get(self):
     ret = yield Requestcmd.find4and('busi_attach', self.args)
     self.write(
         dict(errcode=RET.OK,
              errmsg=RMS.OK,
              data=json.loads(json.dumps(ret, cls=MyEncoder))))
Example #13
0
 def get(self):
     ret = yield Requestcmd.find4or('base_tree', self.args)
     self.write(dict(errcode=RET.OK, errmsg=RMS.OK, data=ret))