subapp_model 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e58492ead591a32ff7df21c6159a9bbaf9d0377d
4
- data.tar.gz: dd99db230db373761bbcae27897026f0803d489a
3
+ metadata.gz: 8c4e37b62f59e44df0dff7ecd7c4487ace085e21
4
+ data.tar.gz: 90fde64dd337062584c38355201cb994d607c811
5
5
  SHA512:
6
- metadata.gz: 484d55ff42b6c3ca2b20405b80a4308214ccfcb669b309a9a6aeaceb54ff99a2c9da1e14eabcb4b6fbd92199c2cb1582f136d52267f02e4996dc81000ae881c7
7
- data.tar.gz: 17367448c98d8de71629714931d90d71f0d3d962da911f2980cc89359ead8c86e6d55a39651e7f92b6770d9c3c7c05efa90111606d0464669760a5f6bc190c9a
6
+ metadata.gz: eea0c46e88c59b3dd0b49728cc17aacaa2f5ec4eee0261dd9688a50386d57d9dbbdbae3b62d7291180e6978468a6b6550f2f998320c2e3d3b4156bbf059712d1
7
+ data.tar.gz: 72cf3146872bdf44c1421dd9aef3227e404fac76c7f9e4708c9cf58bc72425503501900b988dd8ea86217941d78fb9ae44c1ec3643e92ef42cae0014792ff363
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subapp_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - gavin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-21 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,27 +44,7 @@ email:
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
- files:
48
- - lib/subapp_model.rb
49
- - lib/subapp_model/app.rb
50
- - lib/subapp_model/app_ad.rb
51
- - lib/subapp_model/app_ad_changelog.rb
52
- - lib/subapp_model/app_ad_material.rb
53
- - lib/subapp_model/app_album.rb
54
- - lib/subapp_model/app_bozhu.rb
55
- - lib/subapp_model/app_category.rb
56
- - lib/subapp_model/app_material.rb
57
- - lib/subapp_model/app_tag.rb
58
- - lib/subapp_model/font.rb
59
- - lib/subapp_model/selected_albums.rb
60
- - lib/subapp_model/selected_albums_relation.rb
61
- - lib/subapp_model/skin.rb
62
- - lib/subapp_model/sub_app_advertisement.rb
63
- - lib/subapp_model/sub_app_log.rb
64
- - lib/subapp_model/sub_app_recommend.rb
65
- - lib/subapp_model/subapp_push_app.rb
66
- - lib/subapp_model/subapp_push_msg.rb
67
- - lib/subapp_model/version.rb
47
+ files: []
68
48
  homepage: ''
69
49
  licenses:
70
50
  - MIT
@@ -1,111 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class App < ActiveRecord::Base
3
- self.table_name = 'tb_app' # 子app
4
- establish_connection SUBAPP_DB
5
- attr_accessible :title,
6
- :name, # 拼音
7
- :content_type, # 1:多人 2:单人 3:单专辑
8
- :is_published, # 是否发布过
9
- :app_icon_path,
10
- :app_icon_default,
11
- :app_icon_57_path,
12
- :app_icon_124_path,
13
- :background_path,
14
- :default_background,
15
- :loading_icon_path,
16
- :loading_default,
17
- :loading_320x480_path,
18
- :loading_640x960_path,
19
- :loading_640x1136_path,
20
- :loading_480x800_path,
21
- :loading_1280x720_path,
22
- :loading_music_path,
23
- :loading_music_default,
24
- :apple_appid,
25
- :talkingdata_iphone_key,
26
- :talkingdata_android_key,
27
- :duomeng_ios_key, # 多盟广告ios版key
28
- :duomeng_android_key, # 多盟广告android版key
29
- :googlead_ios_key,
30
- :googlead_android_key,
31
- :weixin_ios_key,
32
- :weixin_android_key,
33
- :irateid,
34
- :certificate_name, #打包用的苹果证书名
35
- :envir, #环境 0:开发 1:测试
36
- :app_icon_72_path, #android用
37
- :app_icon_144_path, #android用
38
- :channel_num, #渠道号
39
- :baidu_ios_id, :baidu_ios_key, :baidu_android_id, :baidu_android_key, :ios_ads, :android_ads, :ios_is_upgraded, :android_is_upgraded,
40
- :ios_is_recommended, :android_is_recommended, :ad_id, :is_push, :ios_version, :android_version, :production_id, :skin, :font,
41
- :is_lite, :ios_is_search, :android_is_search,
42
- :qq_ios_key, :qq_android_key,
43
- :qq_ios_id, :qq_android_id,
44
- :app_icon_120_path, :app_type, :file_url, :certificate_url,
45
- :ios_is_chaping, :android_is_chaping, :ios_ad_time, :and_ad_time,
46
- :ios_comment_lock, :android_comment_lock,
47
- :ios_integral_wall, :android_integral_wall,
48
- :count, :unlock, :comment, :ximalaya, :other, :ios_force_comment, :android_force_comment,
49
- :ios_comment_time, :android_comment_time,
50
- :android_480_skin, :android_720_skin, :android_font, :download,
51
- :ios_is_bookstore, :android_is_bookstore, :ios_is_upgrade_in_download, :android_is_upgrade_in_download, :ios_is_upgrade_in_play, :android_is_upgrade_in_play,
52
- :ios_is_rate_pop, :android_is_rate_pop, :ios_time_to_rate, :android_time_to_rate, :old_version_switch, :ios_is_you_mi, :android_is_you_mi, :weixin_share, :is_audit,
53
- :pad_loading_icon_path, :ios_icon_72_path, :ios_icon_144_path, :ios_icon_76_path, :ios_icon_152_path, :pack_type, :init, :ios_is_audit_bookstore, :ios_is_banner,
54
- :ios_is_audit_banner
55
-
56
- validates :title, :apple_appid, :name, :certificate_name, :presence => true
57
- CONTENT_TYPES = {MUTI_BOZHU: 1, SINGLE_PERSON: 2, SINGLE_ALBUM: 3, MUTI_CATEGORY: 4, SINGLE_CATEGORY: 5, ALL_CATEGORY: 6}
58
- # json:
59
- # {
60
- # id: app.id,
61
- # title: app.title, # app名
62
- # name: app.name, # app名
63
- # content_type: app.content_type,
64
- # app_icon_57_url: File.join(Settings.fdfs_root, app.app_icon_57_path), # app图标1
65
- # app_icon_124_url: File.join(Settings.fdfs_root, app.app_icon_124_path), # app图标2
66
- # loading_icon_320_url: picture_url('app_loading', app.loading_icon_path, '320'), # loading图标1
67
- # loading_icon_640_960_url: picture_url('app_loading', app.loading_icon_path, '640_960'), # loading图标2
68
- # loading_icon_640_1136_url: picture_url('app_loading', app.loading_icon_path, '640_1136'), # loading图标3
69
- # loading_icon_480_url: picture_url('app_loading', app.loading_icon_path, '480'), # loading图标4
70
- # loading_icon_1280_url: picture_url('app_loading', app.loading_icon_path, '1280'), # loading图标5
71
- # talkingdata_iphone_key: app.talkingdata_iphone_key,
72
- # talkingdata_android_key: app.talkingdata_android_key,
73
- # duomeng_ios_key: app.duomeng_ios_key,
74
- # duomeng_android_key: app.duomeng_android_key,
75
- # apple_appid: app.apple_appid, # 苹果appid
76
- # googlead_ios_key: app.googlead_ios_key,
77
- # googlead_android_key: app.googlead_android_key,
78
- # weixin_ios_key: app.weixin_ios_key,
79
- # weixin_android_key: app.weixin_android_key,
80
- # irateid: app.irateid,
81
- # certificate_name: app.certificate_name
82
- # }
83
-
84
- #APP类型显示
85
- def content_type_disp
86
- case self.content_type
87
- when 1
88
- "多用户"
89
- when 2
90
- "单用户多专辑"
91
- when 3
92
- "单用户单专辑"
93
- when 4
94
- "多分类"
95
- when 5
96
- "单分类"
97
- when 6
98
- "全分类"
99
- end
100
- end
101
-
102
- def envir_disp
103
- case self.envir
104
- when true
105
- "测试"
106
- when false
107
- "开发"
108
- end
109
- end
110
-
111
- end
@@ -1,6 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class AppAd < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_app_ad' # 子App广告
5
- attr_accessible :name, :description, :is_delete
6
- end
@@ -1,6 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class AppAdChangelog < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_app_ad_changelog' # 子App广告配置修改日志
5
- attr_accessible :user, :op, :action
6
- end
@@ -1,6 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class AppAdMaterial < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_app_ad_material' # 子App广告物料关系
5
- attr_accessible :ad_id, :material_id, :start_time, :end_time, :is_active
6
- end
@@ -1,16 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class AppAlbum < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_app_album' # 子App专辑
5
-
6
- attr_accessible :album_id,
7
- :app_id,
8
- :uid,
9
- :order_num,
10
- :cover_path,
11
- :album_title,
12
- :album_intro
13
-
14
- #belongs_to :app_bozhu,:foreign_key=>"uid"
15
- #belongs_to :app
16
- end
@@ -1,20 +0,0 @@
1
- class AppBozhu < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = 'tb_app_bozhu'
4
-
5
- attr_accessible :app_id,
6
- :uid,
7
- :bozhu_name,
8
- :is_all_album,
9
- :is_auto_update,
10
- :order_num,
11
- :bozhu_pic
12
-
13
- # has_many :app_album
14
- # belongs_to :app
15
- # has_many :app_album,:association_foreign_key=>"uid", :limit=>Settings.per_page.app_album
16
-
17
- def self.find_by_appid(appid, limit)
18
- return AppBozhu.where(app_id: appid).page(limit[:page_id]).per(limit[:page_size]).order("order_num asc, created_at desc")
19
- end
20
- end
@@ -1,6 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class AppCategory < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_app_category' # 子App分类类型
5
- attr_accessible :app_id, :category_id, :category_version, :is_all_tags, :order_num
6
- end
@@ -1,5 +0,0 @@
1
- class AppMaterial < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = 'tb_app_material' # 子App物料
4
- attr_accessible :pic_url, :web_url, :name
5
- end
@@ -1,6 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class AppTag < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_app_tag' # 子App标签类型
5
- attr_accessible :app_id, :tag_name, :is_all_albums, :order_num
6
- end
@@ -1,5 +0,0 @@
1
- class Font < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = 'tb_font' #字体包配置
4
- attr_accessible :name, :url, :terminal, :color
5
- end
@@ -1,44 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class SelectedAlbums < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_selected_albums' # 子App分类类型
5
- attr_accessible :title, :tags, :album_extra_tags, :extra_tags, :order_num, :cover_path, :category_id, :last_uptrack_at, :created_at, :updated_at
6
-
7
- def self.get(selected_album_cache, id)
8
- selected_album = selected_album_cache.get(id)
9
- selected_album = self.where(id: id).first if selected_album.nil?
10
- selected_album_cache.put(selected_album) unless selected_album.nil?
11
- selected_album
12
- end
13
-
14
- def self.mget(selected_album_cache, ids)
15
- selected_albums = selected_album_cache.multi_get(ids)
16
- fetch_ids_hash= {}
17
- fetch_ids = []
18
- selected_albums.each_with_index do |selected_album, i|
19
- if selected_album.nil?
20
- fetch_ids << ids[i]
21
- fetch_ids_hash[ids[i]] = i
22
- end
23
- end
24
-
25
- if fetch_ids.length > 0
26
- selected_albums_not_hit = self.find(fetch_ids)
27
- cached_selected_albums = []
28
-
29
- selected_albums_not_hit.each_with_index do |selected_album, i|
30
- if !selected_album.nil?
31
- selected_albums[fetch_ids_hash[selected_album.id]] = selected_album
32
- cached_selected_albums << selected_album
33
- end
34
- end
35
-
36
- selected_album_cache.multi_put(cached_selected_albums) if cached_selected_albums.length > 0
37
- end
38
- selected_albums
39
- end
40
-
41
- def self.disable_cache(selected_album_cache, id)
42
- selected_album_cache.evict(id)
43
- end
44
- end
@@ -1,29 +0,0 @@
1
- #-*- encoding: utf-8 -*-
2
- class SelectedAlbumsRelation < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = 'tb_selected_albums_relation' # 子App分类类型
5
- attr_accessible :selected_id, :album_id, :updated_at
6
-
7
- def self.get_album_ids(list_ids_cache, selected_album, page, limit)
8
- id = selected_album.id
9
- album_ids = nil
10
- if page == 1
11
- album_ids = list_ids_cache.get(id, page, limit)
12
- album_ids = album_ids.collect {|id| id.to_i unless id.nil? || id.empty?}
13
- end
14
-
15
- if album_ids.nil? || album_ids.length == 0
16
- select = "album_id"
17
- album_relations = self.select(select).where(:selected_id=>id).order("field(album_id,#{selected_album.order_num})").offset((page-1)*limit).limit(limit)
18
- album_ids = album_relations.collect{|album_relation| album_relation.album_id unless album_relation.nil?}
19
- if page == 1 && album_ids.length > 0
20
- list_ids_cache.put(id, album_ids)
21
- end
22
- end
23
- album_ids
24
- end
25
-
26
- def self.disable_cache(list_ids_cache, id)
27
- list_ids_cache.evict(id)
28
- end
29
- end
@@ -1,5 +0,0 @@
1
- class Skin < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = 'tb_skin' #皮肤包配置
4
- attr_accessible :name, :url, :terminal, :size, :color
5
- end
@@ -1,7 +0,0 @@
1
- class SubAppAdvertisement < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = "tb_sub_app_advertisement" #子APP广告显示
4
- attr_accessible :channel, :column_type, :link_url, :position, :sub_app_recommend_id, :terminal, :time_at
5
-
6
- belongs_to :sub_app_recommend
7
- end
@@ -1,21 +0,0 @@
1
- class SubAppLog < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = "tb_sub_app_log" #子APP日志
4
- attr_accessible :app_download_url, :app_id, :operator, :version, :certificate_name, :status, :backtrace, :device_type, :version_code
5
-
6
- # status 1: 正在打包 2:打包成功 3:打包失败
7
- # backtrace 打包日志
8
- # device_type 1: iphone 2: ipad 3: android
9
-
10
- def status_disp
11
- case self.status
12
- when 1
13
- "打包中"
14
- when 2
15
- "打包成功"
16
- when 3
17
- "打包失败"
18
- end
19
- end
20
-
21
- end
@@ -1,55 +0,0 @@
1
- # encoding: utf-8
2
- class SubAppRecommend < ActiveRecord::Base
3
- establish_connection SUBAPP_DB
4
- self.table_name = "tb_sub_app_recommend" #子APP广告配置
5
- attr_accessible :app_name, :channel, :column_type, :cover_path, :intro, :link_url, :name, :terminal, :is_deleted
6
-
7
- has_many :sub_app_advertisements, dependent: :destroy
8
- validates_uniqueness_of :name, message: "广告名称已经存在!"
9
-
10
- def terminal_disp
11
- case self.terminal
12
- when 1
13
- "ios"
14
- when 2
15
- "android"
16
- else
17
- ""
18
- end
19
- end
20
-
21
- def channel_disp
22
- case self.channel
23
- when 1
24
- "应用推荐"
25
- when 2
26
- "Feed广告"
27
- else
28
- ""
29
- end
30
- end
31
-
32
- def is_deleted_disp
33
- case self.is_deleted
34
- when true
35
- "是"
36
- when false
37
- "否"
38
- else
39
- ""
40
- end
41
- end
42
-
43
- def column_type_disp
44
- case self.column_type
45
- when 1
46
- "今日推荐"
47
- when 2
48
- "热门推荐"
49
- when 3
50
- "装机必备"
51
- else
52
- ""
53
- end
54
- end
55
- end
@@ -1,5 +0,0 @@
1
- class SubappPushApp < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = "tb_subapp_push_app" #子APP推送消息与子APP关联表
4
- attr_accessible :msg_id, :subapp_id
5
- end
@@ -1,5 +0,0 @@
1
- class SubappPushMsg < ActiveRecord::Base
2
- establish_connection SUBAPP_DB
3
- self.table_name = "tb_subapp_push_msg" #子APP消息推送
4
- attr_accessible :content, :link, :send_at, :terminal, :title
5
- end
@@ -1,3 +0,0 @@
1
- module SubappModel
2
- VERSION = "1.0.5"
3
- end
data/lib/subapp_model.rb DELETED
@@ -1,39 +0,0 @@
1
- require "subapp_model/version"
2
-
3
- # load Rails/Railtie
4
- begin
5
- require 'rails'
6
- rescue LoadError
7
- #do nothing
8
- end
9
- # if not using Railtie, call `Kaminari::Hooks.init` directly
10
- if defined? Rails
11
- if (!defined? RAILS_APP_MODULE) || RAILS_APP_MODULE.nil?
12
- %w{subapp_model}.each do |dir|
13
- puts __FILE__
14
- Dir.glob(File.expand_path("../#{dir}", __FILE__) + '/**/*.rb').each do |file|
15
- puts file
16
- require file
17
- end
18
- end
19
- else
20
- current_file = __FILE__
21
- load_str = "module " + RAILS_APP_MODULE + "; class Application < Rails::Application; config.autoload_paths += [File.expand_path(\"../subapp_model\", \"#{current_file}\")]; end; end"
22
- eval(load_str)
23
- end
24
- else
25
- %w{subapp_model}.each do |dir|
26
- Dir.glob(File.expand_path("../#{dir}", __FILE__) + '/**/*.rb').each do |file|
27
- # if(file.index("home_controller") == nil)
28
- # $LOAD_PATH.unshift(file)
29
-
30
- require_file = File.basename(file, ".rb")
31
- require_class = require_file.split('_').map {|w| w.capitalize}.join
32
-
33
- # puts "#{require_class} : #{file}"
34
-
35
- autoload "#{require_class}".to_sym,file
36
- end
37
- end
38
- end
39
-