ecloud相关接口修正

dev_SaaS
huang 6 years ago
parent e4caf5da9d
commit b72c93074a

@ -7,10 +7,10 @@ class EcloudController < ApplicationController
# before_filter :check_sign
before_filter :user_setup
before_filter :require_login, only: [:authorize]
# before_filter :require_login, only: [:authorize]
skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_edit, :ecloud_login_callback]
skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_update, :bs_new, :bs_update, :ecloud_login_callback]
def index
@ -63,10 +63,11 @@ class EcloudController < ApplicationController
begin
ecloud = Ecloud.where(custid: params['custid']).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'])
services = params['ervices'].first
ecloud.ecloud_services.update_attributes!(packagecode: services['packagecode'], bossorderid: services['bossorderid'])
custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'],
operatime: params['operatime'], effecttime: params['effecttime'])
services = params['services'].first
ecloud.ecloud_service.update_attributes!(packagecode: services['packagecode'], bossorderid: services['bossorderid'])
render :json => {result: true, errmsg: ""}
rescue Exception => e
logger.error(e.message)
@ -79,15 +80,15 @@ class EcloudController < ApplicationController
# 用户业务开通接口
def ps_new
begin
logger.info("11111######params")
ecloud_user = EcloudUser.where(:custid => params['custid'], :user_id => params['users']['userid']).first
user_param = params['users'].first
ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first
if ecloud_user.present?
render :json => {code: 501, msg: "你已开通过该业务"}
render :json => {code: 500, msg: "你已开通过该业务"}
else
EcloudUser.create!(custid: params['custid'], opttype: params['users']['opttype'], userid: params['users']['userid'],
username: params['users']['username'], useralias: params['users']['useralias'],
mobile: params['users']['mobile'], email: params['users']['email'], begintime: params['users']['begintime'].to_s,
endtime: params['users']['endtime'].to_s)
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
rescue Exception => e
@ -99,12 +100,13 @@ class EcloudController < ApplicationController
# 用户业务变更、销毁接口
def ps_update
begin
ecloud_user = EcloudUser.where(:custid => params['custid'], :user_id => params['users']['userid']).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: params['users']['opttype'])
render :json => {code: 501, msg: "你已开通过该业务"}
ecloud_user.update_attributes(opttype: user_param['opttype'])
render :json => {success: true, errmsg: ""}
else
render :json => {code: 404, errmsg: ""}
render :json => {code: 404, msg: "企业ID不存在"}
end
rescue Exception => e
logger.error(e.message)

@ -1,6 +1,7 @@
class Ecloud < ActiveRecord::Base
attr_accessible :applyno, :begintime, :bossorderid, :custcode, :custid, :custname, :custtype, :ecordercode, :endtime,
:mobile, :opttype, :productcode, :registersource, :string, :trial, :useralias, :userid, :username, :email
has_one :ecloud_users
has_one :ecloud_services
:mobile, :opttype, :productcode, :registersource, :string, :trial, :useralias, :userid, :username, :email,
:effecttime, :operatime
has_one :ecloud_user
has_one :ecloud_service
end

@ -0,0 +1,6 @@
class AddOperatimeToEcloud < ActiveRecord::Migration
def change
add_column :eclouds, :operatime, :string
add_column :eclouds, :effecttime, :string
end
end
Loading…
Cancel
Save