ecloud授权和取消授权的一些修改

dev_SaaS
huang 6 years ago
parent f1a3459a83
commit 0f4886906a

@ -81,15 +81,13 @@ class EcloudController < ApplicationController
# 用户业务开通与变更接口
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
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)
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)
end
render :json => {success: true, errmsg: ""}
# end
rescue Exception => e
@ -99,13 +97,15 @@ class EcloudController < ApplicationController
end
# 用户业务状态变更
# 授权statu为1取消授权status为0
def ps_update
begin
ecloud = Ecloud.where(applyno: params['applyno']).first
user_param = params['users'].first
ecloud_user = EcloudUser.where(userid: user_param['userid'], status: 1).first
user_params = params['users']
user_params.each do |user_param|
ecloud_user = EcloudUser.where(userid: user_param['userid'], status: 1).first
ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid'], status: 0)
end
ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid'], status: 0)
render :json => {success: true, errmsg: ""}
# else
# render :json => {code: 404, msg: "企业ID不存在"}

Loading…
Cancel
Save