This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = User.all[2] | |
# 同步最新的店铺会员 | |
user.members_sync | |
# 设定时间区间 | |
start_at='2012-04-01'.to_date | |
end_at='2012-05-09'.to_date | |
range = start_at.beginning_of_day..end_at.end_of_day | |
members = user.members.where(last_trade_time: range) | |
# 获得交易集合 | |
trade_ids = members.distinct(:biz_order_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = User.all[2] | |
# 同步最新的店铺会员 | |
user.members_sync | |
# 设定时间区间 | |
start_at='2012-04-01'.to_date | |
end_at='2012-05-09'.to_date | |
range = start_at.beginning_of_day..end_at.end_of_day | |
members = user.members.where(last_trade_time: range) | |
# 获得交易集合 | |
trade_ids = members.distinct(:biz_order_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SKU转码 | |
user = User.all[0] | |
user.items_sync | |
user.skus_sync | |
skus_data = { | |
'AWLT932900100L' => 6946401914277, | |
} | |
counter = 0 | |
puts skus_data.count | |
user.items.each do |item| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 同步现有数据 | |
require 'csv' | |
user = User.all[0] | |
user.items_sync | |
user.skus_sync | |
# 导入数据 | |
file_csv = File.join(PADRINO_ROOT, "items.csv") | |
items = CSV.read(file_csv, "rb:GB18030:UTF-8", headers: true, col_sep: ',') | |
skus_data = {} | |
items.each do |item| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
user = User.all[0] | |
user_id = user.nick.to_s | |
start_at = "2012-03-01".to_date | |
end_at = "2012-03-31".to_date | |
range = (start_at.beginning_of_day..end_at.end_of_day) | |
trades = Trade.where(seller_nick: user_id, pay_time: range, is_brand_sale: true) | |
CSV.open("./#{Time.now.to_i}.csv", "wb:GB18030") do |csv| | |
csv << ['订单号', '宝贝ID', '款式', '商家SKU', '数量','应付', '折扣', '实付', '付款时间', '发货时间', '退款ID'] | |
trades.each do |trade| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_props(str) | |
props = str.split(';') # 切割 | |
if props.is_a?(Array) | |
str = "<dl class='props'>" | |
props.each do |property| | |
prop_arr = property.split(':') # 切割 | |
if prop_arr.is_a?(Array) && prop_arr.count == 4 | |
str += "<dt title='#{prop_arr[0]}'>#{prop_arr[2]}</dt><dd title='#{prop_arr[1]}'>#{prop_arr[3]}</dd>" | |
else | |
str += "<dt class='warning'>提示:</dt><dd>无属性</dd>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weekly = 4.weeks.ago.beginning_of_day..4.weeks.ago.end_of_day # 时间段 | |
conditions = Order.where(created_at:weekly).selector # 查询条件 | |
reduce = <<javascript | |
function(doc, prev) { | |
if(doc.paid_at == '') { | |
prev.quantity += doc.quantity; | |
prev.payment += doc.payment; | |
} | |
if(prev.skus[doc.sku_id] == undefined) { | |
prev.skus[doc.sku_id] = {quantity: 0, payment:0}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** 隐藏对象 ****/ | |
function hide(el){ | |
el.style.display='none'; | |
} | |
/**** 找对象 ****/ | |
function find(id){ | |
return document.getElementById(id); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>库存更新结果</title> | |
<link href="../css/base.css" type="text/css" rel="stylesheet"> | |
<style type="text/css"> | |
body { | |
background: url('../images/allbg.gif'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<sign signid='0'> | |
<style type='text/css'> | |
#signature{font-size:13px;font-family:'STHeiti Light';color:#9fa0a0} | |
#signature .b{font-size:21px;font-weight:700;margin-right:60px} | |
#signature .s{font-size:11px;font-style:italic} | |
#signature dl,#signature a{line-height:2;color:#9fa0a0} | |
#signature dl dt{width:60px;float:left;text-align:right;margin:0 .5em} | |
#signature dl dt:after{content:" : "} | |
#signature .logo{padding-right:13px;background:#fff;border-bottom-right-radius:18px;margin-bottom:-27px} |