From 8c6d0e3318c8cab20b1d63aab6942b98b62f4a2b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 15 Aug 2019 09:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86url?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/partner.rb | 3 +++ app/models/user.rb | 3 +++ app/views/users/get_navigation_info.json.jbuilder | 3 +++ spec/models/partner_spec.rb | 5 +++++ 4 files changed, 14 insertions(+) create mode 100644 app/models/partner.rb create mode 100644 spec/models/partner_spec.rb diff --git a/app/models/partner.rb b/app/models/partner.rb new file mode 100644 index 000000000..f2f8cca2a --- /dev/null +++ b/app/models/partner.rb @@ -0,0 +1,3 @@ +class Partner < ApplicationRecord + has_many :users +end diff --git a/app/models/user.rb b/app/models/user.rb index 07b1a564f..2cd515261 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -138,6 +138,9 @@ class User < ApplicationRecord # 视频 has_many :videos, dependent: :destroy + # 客户管理 + belongs_to :partner + # Groups and active users scope :active, lambda { where(status: STATUS_ACTIVE) } diff --git a/app/views/users/get_navigation_info.json.jbuilder b/app/views/users/get_navigation_info.json.jbuilder index 377913ccc..c7ff37e21 100644 --- a/app/views/users/get_navigation_info.json.jbuilder +++ b/app/views/users/get_navigation_info.json.jbuilder @@ -16,6 +16,9 @@ json.top do json.moop_cases_url "#{@old_domain}/moop_cases" json.crowdsourcing_url "/crowdsourcing" + # 客户管理 + json.customer_management_url "#{@old_domain}/cooperates/#{current_user.partner.try(:id)}/partner_list" if current_user.partner + json.career_url do json.array! @career.to_a do |c| if c[1].present? diff --git a/spec/models/partner_spec.rb b/spec/models/partner_spec.rb new file mode 100644 index 000000000..06cff9d9f --- /dev/null +++ b/spec/models/partner_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Partner, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end