Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
f8fc656920
6
Gemfile
6
Gemfile
|
@ -50,16 +50,16 @@ gem 'elasticsearch-model'
|
|||
gem 'elasticsearch-rails'
|
||||
|
||||
#rails 3.2.22.2 bug
|
||||
# gem "test-unit", "~>3.0"
|
||||
gem "test-unit", "~>3.0"
|
||||
|
||||
### profile
|
||||
# gem 'oneapm_rpm'
|
||||
gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'better_errors', '~> 1.1.0'
|
||||
# gem "query_reviewer"
|
||||
# gem 'rack-mini-profiler', '~> 0.9.3'
|
||||
gem 'rack-mini-profiler', '~> 0.9.3'
|
||||
if RUBY_PLATFORM =~ /w32/
|
||||
gem 'win32console'
|
||||
end
|
||||
|
|
|
@ -23,7 +23,21 @@ module Mobile
|
|||
refresh_token = session[:refresh_token]
|
||||
|
||||
if access_token.present? && refresh_token.present?
|
||||
begin
|
||||
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
|
||||
rescue
|
||||
info = Wechat.api.web_access_token(session[:wechat_code])
|
||||
openid =info["openid"]
|
||||
access_token =info["access_token"]
|
||||
if access_token
|
||||
session[:access_token] = access_token
|
||||
end
|
||||
refresh_token = info["refresh_token"]
|
||||
if refresh_token
|
||||
session[:refresh_token] = refresh_token
|
||||
end
|
||||
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
|
||||
end
|
||||
|
||||
access_token = refreshinfo["access_token"]
|
||||
refresh_token = refreshinfo["refresh_token"]
|
||||
|
@ -42,9 +56,16 @@ module Mobile
|
|||
user = us.register ({:login=>openid, :mail=>"#{openid}@163.com",
|
||||
:password=>"12345678", :password_confirmation=>"12345678",
|
||||
:should_confirmation_password => true})
|
||||
user.update_attributes(:lastname=>name)
|
||||
|
||||
raise user.errors.full_messages.first if user.new_record?
|
||||
user.update_attributes(:lastname=>name)
|
||||
#自动激活
|
||||
if Setting.self_registration != '3'
|
||||
user.activate
|
||||
user.last_login_on = Time.now
|
||||
if user.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
end
|
||||
end
|
||||
UserWechat.create!(
|
||||
openid: openid,
|
||||
user: user,
|
||||
|
|
|
@ -47,7 +47,7 @@ module Mobile
|
|||
end
|
||||
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.login+"("+user.show_name+")", Time.now.strftime("%Y-%m-%d"))
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.show_name+"("+user.login+")", Time.now.strftime("%Y-%m-%d"))
|
||||
present status: 0, message: '您已成功绑定Trustie平台'
|
||||
end
|
||||
|
||||
|
@ -68,6 +68,15 @@ module Mobile
|
|||
user = us.register params.merge(:password_confirmation => params[:password],
|
||||
:should_confirmation_password => true)
|
||||
raise user.errors.full_messages.first if user.new_record?
|
||||
#自动激活
|
||||
if Setting.self_registration != '3'
|
||||
# user = automatically_register(user)
|
||||
user.activate
|
||||
user.last_login_on = Time.now
|
||||
if user.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
end
|
||||
end
|
||||
|
||||
if uw && !uw.real?
|
||||
user.update_attributes(:lastname=>uw.user[:lastname])
|
||||
|
@ -80,7 +89,7 @@ module Mobile
|
|||
end
|
||||
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.login+"("+user.show_name+")", Time.now.strftime("%Y-%m-%d"))
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.show_name+"("+user.login+")", Time.now.strftime("%Y-%m-%d"))
|
||||
present :data, user, with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
|
|
|
@ -386,7 +386,7 @@ class WechatsController < ActionController::Base
|
|||
user: user
|
||||
)
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台!", user.login+"("+user.show_name+")", format_time(Time.now))
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台!", user.show_name+"("+user.login+")", format_time(Time.now))
|
||||
render :json => {status:0, msg: "绑定成功"}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
|
@ -416,7 +416,10 @@ class WechatsController < ActionController::Base
|
|||
render 'wechats/open_wechat', layout: nil and return
|
||||
end
|
||||
|
||||
# unless user_binded?(open_id)
|
||||
logger.info "user_activities!!!!!!!!!!!!!!"
|
||||
logger.info params
|
||||
|
||||
# unless (user_binded?(open_id) || params[:state] == "invite_code" || params[:state] == "project_invite_code" || params[:state] == "blog_comment" || params[:state] == "course_notice" || params[:state] == "project_discussion" || params[:state] == "course_discussion" || params[:state] == "homework" || params[:state] == "issues" || params[:state] == "journal_for_message")
|
||||
# @path = '/login'
|
||||
# else
|
||||
if params[:state] == 'myclass'
|
||||
|
@ -470,7 +473,11 @@ class WechatsController < ActionController::Base
|
|||
|
||||
def user_binded?(openid)
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
uw && uw.bindtype == 0
|
||||
if uw && uw.bindtype == 0
|
||||
uw
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def current_url
|
||||
|
|
|
@ -22,5 +22,6 @@ class UserWechat < ActiveRecord::Base
|
|||
Comment.where(author_id: old_user).update_all(author_id: u.id)
|
||||
Message.where(author_id: old_user).update_all(author_id: u.id)
|
||||
BlogComment.where(author_id: old_user).update_all(author_id: u.id)
|
||||
UserActivity.where(user_id: old_user).update_all(user_id: u.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<div class="member-banner f13 c-grey3">授课老师</div>
|
||||
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="teacher in teachers|filter:searchText">
|
||||
<img ng-src="{{teacher.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{teacher.name}}</span><img ng-src="/images/wechat/{{teacher.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{teacher.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{teacher.name}}</span><img ng-src="/images/wechat/{{teacher.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img src="/images/wechat/setting.png" ng-show = "course.is_creator && teacher.id != course.tea_id" width="15" class="fr mr10" style="margin-top:7px;" ng-click="onSetting(teacher)" />
|
||||
<span class = "fr mr25 mt5" ng-show ="teacher.id == course.tea_id">管理员</span>
|
||||
<span ng-class="['fr','mt5',{'mr10': course.is_creator,'mr25': !course.is_creator}]" ng-show ="teacher.id != course.tea_id && teacher.roles_id == 7">助教</span>
|
||||
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
|
||||
<div ng-show ="course.is_creator" class="class-member-row f13 c-grey3" ng-repeat="reviewer in reviewers|filter:searchText">
|
||||
<img ng-src="{{reviewer.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{reviewer.name}}</span><img ng-src="/images/wechat/{{reviewer.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{reviewer.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{reviewer.name}}</span><img ng-src="/images/wechat/{{reviewer.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<span ng-click="review(reviewer)" class = "fr mr10 mt5 c-red">待审批 ▶</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
<div class="member-banner f13 mt10 c-grey3">我的同学</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="student in students|filter:searchText">
|
||||
<img ng-src="{{student.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{student.name}}</span><img ng-src="/images/wechat/{{student.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{student.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{student.name}}</span><img ng-src="/images/wechat/{{student.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img src="/images/wechat/setting.png" ng-show = "course.is_creator" width="15" class="class-list-setting" ng-click="onSetting(student)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -108,30 +108,30 @@
|
|||
</div>
|
||||
<div class="member-banner f13 c-grey3">管理人员({{project_master_members.length}})</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="master in project_master_members|filter:searchText">
|
||||
<img ng-src="{{master.user.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{master.user.real_name == "" ? master.user.name : master.user.real_name }}</span><img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{master.user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{master.user.real_name == "" ? master.user.name : master.user.real_name }}</span><img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img src="/images/wechat/setting.png" ng-show = "master.user.id != project.user_id && project.can_setting" width="15" class="class-list-setting" ng-click="onSetting(master)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div ng-show="project.can_setting" class="class-member-row f13 c-grey3" ng-repeat="user in review_master_members|filter:searchText">
|
||||
<img ng-src="{{user.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name }}</span><span class="fr mr10 c-grey2"></span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name }}</span><span class="fr mr10 c-grey2"></span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<span ng-click="review(user)" class = "fr mr10 mt5 c-red">待审批 ▶</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="member-banner f13 mt10 c-grey3">开发人员({{project_develop_members.length}})</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="develop in project_develop_members|filter:searchText">
|
||||
<img ng-src="{{develop.user.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}</span><img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{develop.user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}</span><img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img src="/images/wechat/setting.png" ng-show = "master.user.id != project.user_id && project.can_setting " width="15" class="class-list-setting" ng-click="onSetting(develop)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div ng-show="project.can_setting" class="class-member-row f13 c-grey3" ng-repeat="user in review_develop_members|filter:searchText">
|
||||
<img ng-src="{{user.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name}}</span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name}}</span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<span ng-click="review(user)" class = "fr mr10 mt5 c-red">待审批 ▶</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="member-banner f13 mt10 c-grey3">报告人员({{project_report_members.length}})</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="report in project_report_members|filter:searchText">
|
||||
<img ng-src="{{report.user.img_url}}" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{report.user.real_name == "" ? report.user.name : report.user.real_name}}</span><img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="{{report.user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{report.user.real_name == "" ? report.user.name : report.user.real_name}}</span><img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img src="/images/wechat/setting.png" ng-show = "master.user.id != project.user_id && project.can_setting " width="15" class="class-list-setting" ng-click="onSetting(report)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
|
|||
console.log(response.data);
|
||||
vm.course = response.data.data;
|
||||
|
||||
var desc = "您的好友邀请您加入班级:\n"+vm.course.name+"\n和小伙伴一起踏上便捷的学习之旅吧!";
|
||||
var desc = "您的好友邀请您加入班级:【"+vm.course.name+"】,和小伙伴一起踏上便捷的学习之旅吧!";
|
||||
var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid+
|
||||
"&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+vm.course.id+
|
||||
"&response_type=code&scope=snsapi_base&state=invite_code&connect_redirect=1#wechat_redirect";
|
||||
|
|
|
@ -13,7 +13,7 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
|
|||
console.log(response.data);
|
||||
vm.project = response.data.data;
|
||||
|
||||
var desc = "您的好友邀请您加入项目:\n"+vm.project.name+"\n和小伙伴一起踏上便捷的研发之旅吧!";
|
||||
var desc = "您的好友邀请您加入项目:【"+vm.project.name+"】,和小伙伴一起踏上便捷的研发之旅吧!";
|
||||
var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid+
|
||||
"&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+vm.project.id+
|
||||
"&response_type=code&scope=snsapi_base&state=project_invite_code&connect_redirect=1#wechat_redirect";
|
||||
|
|
Loading…
Reference in New Issue