예제 #1
0
 def load_by_openid(cls, openid):
     where = {'openid': openid}
     keep_fields = [
         'syssn',
         'consumer_name',
         'consumer_mobile',
         'order_name',
         'order_desc',
         'openid',
         'txamt',
         'retcd',
         'status',
         'cancel',
         'origssn',
         'sysdtm',
     ]
     other = ' order by ctime desc '
     with get_connection_exception(TOKEN_HOUSE_CORE) as conn:
         records = conn.select(table=cls.TABLE,
                               fields=keep_fields,
                               where=where,
                               other=other)
         log.info('openid=%s|records=%s', openid, records)
         if records:
             for record in records:
                 # cls.to_string(record)
                 if record['retcd'] == '':
                     record['retcd'] = define.XC_ERR_ORDER_WAIT_PAY
                 tools.trans_time(record, cls.DATETIME_KEY)
                 tools.trans_amt(record)
         return records
예제 #2
0
 def load_three_carousel(cls):
     where = {'available': 1}
     other = ' order by priority '
     with get_connection_exception(TOKEN_HOUSE_CORE) as conn:
         records = conn.select(table=cls.TABLE, where=where, other=other)
         if records:
             for record in records:
                 record['id'] = str(record['id'])
                 tools.trans_time(record, cls.DATETIME_KEY)
         return records
예제 #3
0
 def load_all(cls):
     keep_fields = copy.deepcopy(RateInfo.KEYS)
     if RateInfo.TABLE_ID not in keep_fields:
         keep_fields.append(RateInfo.TABLE_ID)
     with get_connection_exception(TOKEN_HOUSE_CORE) as conn:
         records = conn.select(table=RateInfo.TABLE, fields=keep_fields)
         if records:
             for data in records:
                 cls.to_string(data)
                 tools.trans_time(data, cls.DATETIME_KEY)
         return records
예제 #4
0
 def load(self):
     where = {'id': self.id}
     keep_fields = copy.deepcopy(RateInfo.KEYS)
     if RateInfo.TABLE_ID not in keep_fields:
         keep_fields.append(RateInfo.TABLE_ID)
     with get_connection_exception(TOKEN_HOUSE_CORE) as conn:
         record = conn.select_one(table=RateInfo.TABLE,
                                  fields=keep_fields,
                                  where=where)
         self.data = record
         self.to_string(self.data)
         tools.trans_time(self.data, RateInfo.DATETIME_KEY)
예제 #5
0
 def load(self):
     where = {'id': self.userid}
     keep_fields = copy.deepcopy(self.keys)
     with get_connection_exception(TOKEN_HOUSE_CORE) as conn:
         record = conn.select_one(table=User.TABLE,
                                  fields=keep_fields,
                                  where=where)
         self.data = tools.trans_time(record, User.DATETIME_KEY)
예제 #6
0
 def load(self):
     keep_fields = copy.deepcopy(self.keys)
     keep_fields.append(Profile.TABLE_ID)
     where = {'userid': self.userid}
     with get_connection_exception(TOKEN_HOUSE_CORE) as conn:
         record = conn.select_one(table=Profile.TABLE,
                                  fields=keep_fields,
                                  where=where)
         self.data = tools.trans_time(record, Profile.DATETIME_KEY)
예제 #7
0
 def to_string(cls, data):
     if not data:
         return
     data['id'] = str(data['id'])
     tools.trans_time(data, Order.DATETIME_KEY)
예제 #8
0
 def to_string(self, data):
     if not data:
         return
     data['id'] = str(data['id'])
     tools.trans_time(data, BoxList.DATETIME_KEY)