微信:角色配置后返回角色界面、修改开发为开放、创建项目发送消息项目名称修改

This commit is contained in:
yuanke 2016-07-28 17:26:57 +08:00
parent 20d9e613b6
commit 93844e757c
11 changed files with 58 additions and 40 deletions

View File

@ -155,7 +155,6 @@ module Mobile
status = ps.createNewProject params,current_user
present :status, 0
end
@ -173,7 +172,7 @@ module Mobile
#
# present :status, status
{status:-1, message: '该功能将在近日开,敬请期待!' }
{status:-1, message: '该功能将在近日开,敬请期待!' }
end
end

View File

@ -25,8 +25,7 @@ module Mobile
when :act_id
f.id
when :comment_count
all_comments = []
get_all_children(all_comments, f).count
f.comments.count
end
end
elsif f.is_a?(Hash) && !f.key?(field)

View File

@ -238,7 +238,10 @@ class ProjectsController < ApplicationController
#end
@project.members << m
@project.project_infos << project_info
send_wechat_create_project_notice User.current,@project
p = Project.find("#{@project.id}")
ps = ProjectsService.new
ps.send_wechat_create_project_notice User.current,p
#end
respond_to do |format|
format.html {

View File

@ -145,11 +145,11 @@ class WechatsController < ActionController::Base
end
on :click, with: 'PROJECT' do |request, key|
request.reply.text "该功能将在近日开,敬请期待!"
request.reply.text "该功能将在近日开,敬请期待!"
end
on :click, with: 'JOIN_PROJECT' do |request, key|
request.reply.text "该功能将在近日开,敬请期待!"
request.reply.text "该功能将在近日开,敬请期待!"
# uw = user_binded?(request[:FromUserName])
# unless uw
# sendBind(request)

View File

@ -21,6 +21,7 @@ class ProjectsService
def send_wechat_create_project_notice user,project
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count
Rails.logger.info "!!!!!!!!!!!!!!!!!!!!!!#{project}"
if count == 0
ws = WechatService.new
title = "恭喜您创建项目成功。"
@ -47,6 +48,8 @@ class ProjectsService
# if validate_parent_id && @project.save
if project.save
p = Project.find("#{project.id}")
send_wechat_create_project_notice user,p
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => user, :roles => [r])
# project's score
@ -60,8 +63,6 @@ class ProjectsService
project.members << m
project.project_infos << project_info
status = 0
send_wechat_create_project_notice user,project
end
status
end

View File

@ -2,22 +2,22 @@ button:
-
type: "view"
name: "我的动态"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
-
name: "我的群组"
sub_button:
-
type: "view"
name: "我的课程"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
-
type: "click"
type: "view"
name: "我的项目"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=project_list#wechat_redirect"
-
type: "view"
name: "我的宝库"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
-
name: "更多"

View File

@ -2,7 +2,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
var vm = $scope;
var courseid = $routeParams.id;
var tag = $routeParams.tag;
var getUsers = function(){
@ -126,7 +126,13 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
if (response.data.status == 0){
vm.course = response.data.data;
resetMenu(vm.course.current_user_is_teacher);
vm.tab(1);
if(tag){
vm.tab(4);
tag = null;
}
else{
vm.tab(1);
}
}
else{
vm.alertService.showMessage('提示', response.data.message);

View File

@ -56,7 +56,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
} else {
vm.alertService.showMessage('提示', '修改角色成功', function(){
// window.history.back();
$location.path("/class").search({id: course_id});
$location.path("/class").search({id: course_id,tag:1});
});
}
});

View File

@ -65,7 +65,7 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
rms.save("project_report_members",[]);
rms.save('tab_num',null);
// window.history.back();
$location.path("/project").search({id: project_id});
$location.path("/project").search({id: project_id,tag:1});
});
}
});

View File

@ -5,6 +5,7 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
var vm = $scope;
var projectid = $routeParams.id;
var tag = $routeParams.tag;
vm.project_activities_page = rms.get('project_activities_page') || 0;
vm.project_activities = rms.get("project_activities") || [];
@ -24,7 +25,7 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
//跳入邀请界面
vm.invite = function(){
vm.alertService.showMessage('提示', "该功能将在近日开,敬请期待!");
vm.alertService.showMessage('提示', "该功能将在近日开,敬请期待!");
// $location.path("/project_invite_code").search({id: projectid});
@ -137,7 +138,13 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
if (response.data.status == 0){
vm.project = response.data.data;
resetMenu(vm.project.can_setting);
vm.tab(1);
if(tag){
vm.tab(2);
tag = null;
}
else{
vm.tab(1);
}
}
else{
vm.alertService.showMessage('提示', response.data.message,function(){

View File

@ -45,27 +45,29 @@ app.controller('ProjectListController', ['$scope', 'config', 'auth', '$http', '$
};
vm.joinProject = function () {
vm.alertService_3.showMessage('提示', '请输入6位项目邀请码(不区分大小写)', function(){
if (vm.alertService_3.invite && vm.alertService_3.invite.length == 6) {
$http.post(config.apiUrl + "projects/join", {
token: auth.token(),
invite_code: vm.alertService_3.invite
}).then(function (response) {
console.log(response.data);
if (response.data.status != 0) {
vm.alertService_1.showMessage('提示', response.data.message);
} else {
vm.alertService_1.showMessage('提示', '加入项目成功');
vm.alertService_3.invite = "";
loadProjectList();
}
});
} else {
if(vm.alertService_3.invite){
vm.alertService_1.showMessage('提示', '邀请码格式不正确');
}
}
});
vm.alertService_1.showMessage('提示', "该功能将在近日开放,敬请期待!");
// vm.alertService_3.showMessage('提示', '请输入6位项目邀请码(不区分大小写)', function(){
// if (vm.alertService_3.invite && vm.alertService_3.invite.length == 6) {
// $http.post(config.apiUrl + "projects/join", {
// token: auth.token(),
// invite_code: vm.alertService_3.invite
// }).then(function (response) {
// console.log(response.data);
// if (response.data.status != 0) {
// vm.alertService_1.showMessage('提示', response.data.message);
// } else {
// vm.alertService_1.showMessage('提示', '加入项目成功');
// vm.alertService_3.invite = "";
// loadProjectList();
// }
// });
// } else {
// if(vm.alertService_3.invite){
// vm.alertService_1.showMessage('提示', '邀请码格式不正确');
// }
// }
// });
};
vm.onSetting = function (project) {