diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index f5e97720..04d0050b 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -86,11 +86,11 @@ class EcloudController < ApplicationController # 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: ""} + 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) + render :json => {success: true, errmsg: ""} # end rescue Exception => e logger.error(e.message) @@ -103,9 +103,9 @@ class EcloudController < ApplicationController begin ecloud = Ecloud.where(applyno: params['applyno']).first user_param = params['users'].first - ecloud_user = EcloudUser.where(ecloud_id: ecloud.id).first + ecloud_user = EcloudUser.where(userid: user_param['userid'], status: 0).first - ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid']) + 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不存在"} diff --git a/app/models/ecloud_user.rb b/app/models/ecloud_user.rb index 9266adb7..dd4a5584 100644 --- a/app/models/ecloud_user.rb +++ b/app/models/ecloud_user.rb @@ -1,3 +1,3 @@ class EcloudUser < ActiveRecord::Base - attr_accessible :begintime, :email, :endtime, :mobile, :opttype, :paras, :useralias, :userid, :username, :custid + attr_accessible :begintime, :email, :endtime, :mobile, :opttype, :paras, :useralias, :userid, :username, :custid, :status, :ecloud_id end diff --git a/db/migrate/20190313062414_add_status_to_ecloud_user.rb b/db/migrate/20190313062414_add_status_to_ecloud_user.rb new file mode 100644 index 00000000..bedecfb3 --- /dev/null +++ b/db/migrate/20190313062414_add_status_to_ecloud_user.rb @@ -0,0 +1,5 @@ +class AddStatusToEcloudUser < ActiveRecord::Migration + def change + add_column :ecloud_users, :status, :integer, :limit => 1 + end +end