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
module CM | |
class Print | |
class << self | |
def print(order) | |
#TODO: 以后需要做改进 | |
return false if order.blank? || order.user.machine_code.blank? || order.user.msign.blank? | |
created_at = order.created_at.strftime('%Y-%m-%d %H:%M') | |
print_name = order.user.real_name |
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
# find promotion's products with promotion_id = 2 | |
# if product ids result is 2,7 | |
select product_id from spree_product_promotion_rules | |
where promotion_rule_id=(select id from spree_promotion_rules where type='Spree::Promotion::Rules::Product' and promotion_id=2) | |
# find the promotion product's quantity if order_id = 3 | |
select distinct(spree_line_items.variant_id), spree_line_items.quantity from spree_product_promotion_rules | |
left join spree_line_items on spree_product_promotion_rules.product_id = spree_line_items.variant_id | |
where spree_product_promotion_rules.product_id in (2,7) and spree_line_items.order_id=3 |
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_dependency 'spree/calculator' | |
module Spree | |
class Calculator::FlatWithProducts < Calculator | |
preference :amount, :decimal, default: 0 | |
preference :currency, :string, default: ->{ Spree::Config[:currency] } | |
def self.description | |
Spree.t(:flat_with_products) | |
end |
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
# encoding: utf-8 | |
require 'JPush' | |
# 消息推送类 | |
class MessagePush | |
def initialize | |
master_secret = 'xxxxxx'; | |
app_key = 'xxxxx'; | |
@client = JPush::JPushClient.new(app_key, master_secret); |
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
str = <<EOF | |
<li class="cc"> | |
<a href="#" class="cover"> | |
<img src="public/images/food-1.png" alt=""></a> | |
<div class="info"> | |
<h1>Food One</h1> | |
</div> | |
</li> | |
<li class="cc"> |
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
/** | |
* bootbox.js v3.3.0 | |
* | |
* http://bootboxjs.com/license.txt | |
*/ | |
var bootbox = window.bootbox || (function(document, $) { | |
/*jshint scripturl:true sub:true */ | |
var _locale = 'en', | |
_defaultLocale = 'en', |
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
# coding:utf-8 | |
#类似java import class | |
require 'faraday' | |
require 'nokogiri' | |
require 'json' | |
# http://www.taobao.com/index_inc/2013c/php/ajax/tms.php?ids=cat_1 | |
#用来进行http操作,例get post | |
conn = Faraday.new(:url =>'http://www.taobao.com') do |f| |