Procházet zdrojové kódy

add bind user function

abiao před 5 roky
rodič
revize
e49c81adf5

+ 35 - 0
app/models/bind_user.rb

@@ -0,0 +1,35 @@
+# encoding: utf-8
+class BIndUser < ActiveRecord::Base
+  has_paper_trail
+  self.table_name = "bind_users"
+  rails_admin do
+    navigation_label '老会员绑定记录'
+    weight -500
+    parent WxUser
+    list do
+      filters [:wx_uid,:user_no,:remark]
+      field :id
+      field :wx_uid
+      field :user_no
+      field :remark
+      field :created_at
+      field :updated_at
+    end
+
+    show do
+      field :id
+      field :wx_uid
+      field :user_no
+      field :remark
+      field :created_at
+      field :updated_at
+    end
+
+    edit do
+      field :wx_uid
+      field :user_no
+      field :remark
+    end
+  end
+
+end

+ 11 - 0
config/locales/models/bind_user.yml

@@ -0,0 +1,11 @@
+zh-CN:
+  activerecord:
+    models:
+      bind_user: 老会员绑定记录
+    attributes:
+      bind_user:
+        wx_uid: 微信ID
+        user_no: 会员编号
+        remark: 备注
+        created_at: 创建时间
+        updated_at: 更新时间

+ 35 - 0
db/migrate/20201124114698_create_bind_users.rb

@@ -0,0 +1,35 @@
+# encoding:utf-8
+class CreateBindUsers < ActiveRecord::Migration
+  def up
+    #用户绑定记录
+    create_table :bind_users do |t|
+      #用户ID
+      t.column :wx_uid, :integer, :null=>false
+      #老用户编号
+      t.column :user_no, :string
+      #备注
+      t.column :remark,:string
+      t.timestamps
+    end
+    #系统会员表
+    create_table :sys_users do |t|
+      #邀请人ID
+      t.column :invite_id, :integer, :null=>false
+      #会员编号
+      t.column :user_no, :string, :limit=>128
+      #邀请人编号
+      t.column :invite_no,:string, :limit=>128
+      t.timestamps
+    end
+    add_index :bind_users, :wx_uid
+    add_index :sys_users, :invite_id
+    add_column :wx_users, :user_no,:string,:limit => 128
+  end
+
+  def down
+    drop_table :bind_users
+    drop_table :sys_users
+    remove_column :wx_users, :user_no
+  end
+
+end