接口调试

dev_SaaS
jingquan huang 6 years ago
parent 36b0e3d97f
commit cb73a97425

@ -3,6 +3,11 @@ require 'net/http'
class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :user_setup
before_filter :require_login, only: [:authorize]
skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_edit]
def index
@ -25,18 +30,28 @@ class EcloudController < ApplicationController
end
# 企业开通
# ecordercode 唯一标志一个企业的订购关系
def bs_new
begin
Ecloud.create!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'], trial: params['trial'],
bossorderid: params['bossorderid'], custid: params['custid'], custcode: params['custcode'])
render :json => {result: true, errmsg: ""}
rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}
end
end
# 企业更新
def bs_update
end
# 用户业务开通接口
def ps_new
begin
logger.info("11111######params")
ecloud_user = EcloudUser.where(:custid => params['custid'], :user_id => params['users']['userid']).first
if ecloud_user.present?
render :json => {code: 501, msg: "你已开通过该业务"}

@ -1,5 +1,5 @@
class Ecloud < ActiveRecord::Base
attr_accessible :applyno, :begintime, :bossorderid, :custcode, :custid, :custname, :custtype, :ecordercode, :endtime, :mobile, :opttype, :productcode, :registersource, :string, :trial, :useralias, :userid, :username
has_many :ecloud_users, destroy: :dependence
has_many :ecloud_services, destroy: :dependence
has_many :ecloud_users
has_many :ecloud_services
end

@ -35,6 +35,9 @@ RedmineApp::Application.routes.draw do ## oauth相关
match 'ecloud/ecloud_login_callback', to: 'ecloud#ecloud_login_callback', :via => :get
match 'ecloud/bs_new', to: 'ecloud#bs_new', :via => :post
match 'ecloud/bs_edit', to: 'ecloud#bs_edit', :via => :post
match 'ecloud/ps_new', to: 'ecloud#ps_new', :via => :post
match 'ecloud/ps_edit', to: 'ecloud#ps_edit', :via => :post
resources :ec_course_evaluations do

@ -0,0 +1,5 @@
class AddIndexToEcloud < ActiveRecord::Migration
def change
add_index :eclouds, [:ecordercode, :custcode], :unique => true, :name => 'ecorder_cust_code'
end
end
Loading…
Cancel
Save