def get(self, vendor_id): logging.info("got vendor_id %r in uri", vendor_id) _account_id = self.get_secure_cookie("account_id") _customer_profile = vendor_member_dao.vendor_member_dao().query_not_safe(vendor_id, _account_id) if not _customer_profile: _customer_profile = {"crets":0} else: try: _customer_profile['crets'] except: _customer_profile['crets'] = 0 _before = time.time() _crets = cret_dao.cret_dao().query_pagination_by_account(vendor_id, _account_id, _before, PAGE_SIZE_LIMIT) for _cret in _crets: _cret['create_time'] = timestamp_friendly_date(_cret['create_time']) _activity = activity_dao.activity_dao().query(_cret['activity_id']) _cret['activity_title'] = _activity['title'] _cret['activity_bk_img_url'] = _activity['bk_img_url'] self.render('wx/my-certs.html', vendor_id=vendor_id, crets=_crets, customer_profile=_customer_profile)
def get(self, vendor_id, cret_id): logging.info("got vendor_id %r in uri", vendor_id) logging.info("got cret_id %r in uri", cret_id) ops = self.get_ops_info() _cret = cret_dao.cret_dao().query(cret_id) _customer_profile = vendor_member_dao.vendor_member_dao().query_not_safe(vendor_id, _cret['account_id']) try: _customer_profile['account_nickname'] except: _customer_profile['account_nickname'] = '' try: _customer_profile['account_avatar'] except: _customer_profile['account_avatar'] = '' counter = self.get_counter(vendor_id) self.render('vendor/customer-cret-info.html', vendor_id=vendor_id, ops=ops, counter=counter, profile=_customer_profile, cret=_cret)
def get(self, vender_id): account_id = self.get_argument("account_id") logging.info("got _account_id %r", account_id) sBefore = self.get_argument("before", "") if sBefore != "": iBefore = float(datetime_timestamp(sBefore)) else: iBefore = time.time() logging.info("got iBefore>>>> %r in uri", iBefore) _orders = order_dao.order_dao().query_pagination_by_account( account_id, iBefore, PAGE_SIZE_LIMIT) for order in _orders: _activity = activity_dao.activity_dao().query(order['activity_id']) order['activity_title'] = _activity['title'] order['create_time'] = timestamp_datetime(order['create_time']) logging.info("got activity_title %r", order['activity_title']) order['activity_begin_time'] = timestamp_datetime( _activity['begin_time']) order['activity_distance'] = _activity['distance'] order['activity_status'] = _activity['status'] order_fees = [] for ext_fee_id in order['ext_fees']: for template in _activity['ext_fee_template']: if ext_fee_id == template['_id']: json = { "_id": ext_fee_id, "name": template['name'], "fee": template['fee'] } order_fees.append(json) break order['fees'] = order_fees order_insurances = [] for insurance_id in order['insurances']: _insurance = insurance_template_dao.insurance_template_dao( ).query(insurance_id) order_insurances.append(_insurance) order['insurances'] = order_insurances _cret = cret_dao.cret_dao().query_by_account( order['activity_id'], order['account_id']) if _cret: logging.info("got _cret_id %r", _cret['_id']) order['cret_id'] = _cret['_id'] else: order['cret_id'] = None _json = json_encode(_orders) self.write(_json) self.finish()
def get(self, vendor_id, cret_id): logging.info("got vendor_id %r in uri", vendor_id) logging.info("got cret_id %r in uri", cret_id) _cret = cret_dao.cret_dao().query(cret_id) _customer_profile = vendor_member_dao.vendor_member_dao().query_not_safe(vendor_id, _cret['account_id']) _activity = activity_dao.activity_dao().query(_cret['activity_id']) _cret['activity_title'] = _activity['title'] self.render('wx/cert-info.html', vendor_id=vendor_id, cret=_cret, profile=_customer_profile)
def post(self, vendor_id, cret_id): logging.info("got vendor_id %r in uri", vendor_id) logging.info("got cret_id %r in uri", cret_id) ops = self.get_ops_info() distance = self.get_argument("distance", "") hours = self.get_argument("hours", "") height = self.get_argument("height", "") speed = self.get_argument("speed", "") road_map_url = self.get_argument("road_map_url", "") contour_map_url = self.get_argument("contour_map_url", "") logging.info("got road_map_url %r", road_map_url) logging.info("got contour_map_url %r", contour_map_url) _timestamp = time.time() json = {"_id":cret_id, "last_update_time":_timestamp, "distance":distance, "hours":hours, "height":height, "speed":speed, "road_map_url":road_map_url, "contour_map_url":contour_map_url} cret_dao.cret_dao().update(json); self.redirect('/vendors/' + vendor_id + '/crets/' + cret_id)
def get(self, vendor_id): logging.info("got vendor_id %r in uri", vendor_id) # _session_ticket = self.get_secure_cookie("session_ticket") _keys = self.get_argument("keysValue", "") _type = self.get_argument("searchType", "") if (_type == 'order'): _array = order_dao.order_dao().query_by_order_keys( vendor_id, _keys) elif (_type == 'title'): _array = apply_dao.apply_dao().query_by_title_keys( vendor_id, _keys) elif (_type == 'nickname'): _array = order_dao.order_dao().query_by_nickname_keys( vendor_id, _keys) elif (_type == 'date'): keys_array = _keys.split('~') begin_keys = float(date_timestamp(keys_array[0])) end_keys = float(date_timestamp(keys_array[1])) logging.info("got begin_keys>>>>>>>>>>> %r in uri", begin_keys) logging.info("got end_keys>>>>>>>>>>> %r in uri", end_keys) _array = order_dao.order_dao().query_by_time_keys( vendor_id, begin_keys, end_keys) else: _array = [] if (_array): for order in _array: _activity = activity_dao.activity_dao().query( order['activity_id']) order['activity_title'] = _activity['title'] # order['activity_amount'] = _activity['amount'] if not order['base_fees']: order['activity_amount'] = 0 else: for base_fee in order['base_fees']: # 价格转换成元 order['activity_amount'] = float(base_fee['fee']) / 100 logging.info("got activity_title %r", order['activity_title']) order['create_time'] = timestamp_datetime(order['create_time']) customer_profile = vendor_member_dao.vendor_member_dao( ).query_not_safe(vendor_id, order['account_id']) if (customer_profile): try: customer_profile['account_nickname'] except: customer_profile['account_nickname'] = '' try: customer_profile['account_avatar'] except: customer_profile['account_avatar'] = '' order['account_nickname'] = customer_profile[ 'account_nickname'] order['account_avatar'] = customer_profile[ 'account_avatar'] else: order['account_nickname'] = '' order['account_avatar'] = '' try: order['bonus'] except: order['bonus'] = 0 # 价格转换成元 order['bonus'] = float(order['bonus']) / 100 try: order['prepay_id'] except: order['prepay_id'] = '' try: order['transaction_id'] except: order['transaction_id'] = '' try: order['payed_total_fee'] except: order['payed_total_fee'] = 0 for ext_fee in order['ext_fees']: # 价格转换成元 ext_fee['fee'] = float(ext_fee['fee']) / 100 for insurance in order['insurances']: # 价格转换成元 insurance['fee'] = float(insurance['fee']) / 100 for _voucher in order['vouchers']: # 价格转换成元 _voucher['fee'] = float(_voucher['fee']) / 100 _cret = cret_dao.cret_dao().query_by_account( order['activity_id'], order['account_id']) if _cret: logging.info("got _cret_id %r", _cret['_id']) order['cret_id'] = _cret['_id'] else: order['cret_id'] = None # order['activity_amount'] = float(_activity['amount']) / 100 if not order['base_fees']: order['activity_amount'] = 0 else: for base_fee in order['base_fees']: # 价格转换成元 order['activity_amount'] = float(base_fee['fee']) / 100 order['total_amount'] = float(order['total_amount']) / 100 order['payed_total_fee'] = float( order['payed_total_fee']) / 100 _json = json_encode(_array) logging.info("got _json %r", _json) self.write(JSON.dumps(_json, default=json_util.default)) self.finish()