|
|
|
@ -170,20 +170,33 @@ class EcloudController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# 用户业务开通与变更接口
|
|
|
|
|
# 授权statu为1,取消授权status为0
|
|
|
|
|
# opttype: 操作类型0:开通;1:变更;
|
|
|
|
|
|
|
|
|
|
def ps_new
|
|
|
|
|
begin
|
|
|
|
|
user_params = params['users']
|
|
|
|
|
user_params.each do |user_param|
|
|
|
|
|
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, status: 1)
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
user_params = params['users']
|
|
|
|
|
user_params.each do |user_param|
|
|
|
|
|
if user_param['opttype'] == 0 # 开通
|
|
|
|
|
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)
|
|
|
|
|
elsif user_param['opttype'] == 1 # 变更
|
|
|
|
|
ecloud_user = EcloudUser.where(custid: params['custid'], userid: user_param['userid']).first
|
|
|
|
|
ecloud_user.update_attributes!(opttype: user_param['opttype'], 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)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
render :json => {success: true, errmsg: ""}
|
|
|
|
|
# end
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
logger.error(e.message)
|
|
|
|
|
render :json => {code: 500, msg: "#{e.message}"}
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
end
|
|
|
|
|
render :json => {success: true, errmsg: ""}
|
|
|
|
|
# end
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
logger.error(e.message)
|
|
|
|
|
render :json => {code: 500, msg: "#{e.message}"}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -323,7 +336,8 @@ class EcloudController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def save_para
|
|
|
|
|
EcloudLog.create(url: request.url, para_value: params, applyno: params['applyno'], custid: params['custid'], custcode: params['custcode'])
|
|
|
|
|
EcloudLog.create(url: request.url, para_value: params, applyno: params['applyno'], custid: params['custid'],
|
|
|
|
|
custcode: params['custcode'], userid: params['userid'], username: params['username'])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|