From 6121b985f005d3509f46be9ed4404b8b08ea82ad Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Mar 2019 13:53:55 +0800 Subject: [PATCH] =?UTF-8?q?ecloud=E4=B8=80=E4=BA=9B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ecloud_controller.rb | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index eb81603b..ebbd8c1c 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -5,7 +5,7 @@ require 'digest' class EcloudController < ApplicationController skip_before_filter :verify_authenticity_token - before_filter :check_sign + # before_filter :check_sign before_filter :user_setup # before_filter :require_login, only: [:authorize] @@ -13,7 +13,6 @@ class EcloudController < ApplicationController skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_update, :bs_new, :bs_update, :ecloud_login_callback] def index - render file: 'public/react-oschina/build/index.html', :layout => false end @@ -34,6 +33,7 @@ class EcloudController < ApplicationController # 企业开通 + # applyno 申请单号,唯一 # ecordercode 唯一标志一个企业的订购关系 def bs_new ActiveRecord::Base.transaction do @@ -61,7 +61,7 @@ class EcloudController < ApplicationController def bs_update ActiveRecord::Base.transaction do begin - ecloud = Ecloud.where(custid: params['custid']).first + ecloud = Ecloud.where(applyno: params['applyno']).first ecloud.update_attributes!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'], custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'], operatime: params['operatime'], effecttime: params['effecttime']) @@ -77,37 +77,38 @@ class EcloudController < ApplicationController end end - # 用户业务开通接口 + # 用户业务开通与变更接口 def ps_new begin user_param = params['users'].first - ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first - if ecloud_user.present? - render :json => {code: 500, msg: "你已开通过该业务"} - else + # ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first + # if ecloud_user.present? + # render :json => {code: 500, msg: "你已开通过该业务"} + # else EcloudUser.create!(custid: params['custid'], opttype: user_param['opttype'], userid: user_param['userid'], username: user_param['username'], useralias: user_param['useralias'], mobile: user_param['mobile'], email: user_param['email'], begintime: user_param['begintime'].to_s, endtime: user_param['endtime'].to_s) render :json => {success: true, errmsg: ""} - end + # end rescue Exception => e logger.error(e.message) render :json => {code: 500, msg: "#{e.message}"} end end - # 用户业务变更、销毁接口 + # 用户业务状态变更 def ps_update begin + ecloud = Ecloud.where(applyno: params['applyno']).first user_param = params['users'].first - ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first - if ecloud_user.present? - ecloud_user.update_attributes(opttype: user_param['opttype']) + ecloud_user = ecloud.ecloud_user + + ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid']) render :json => {success: true, errmsg: ""} - else - render :json => {code: 404, msg: "企业ID不存在"} - end + # else + # render :json => {code: 404, msg: "企业ID不存在"} + # end rescue Exception => e logger.error(e.message) render :json => {code: 500, msg: "#{e.message}"}