コード例 #1
0
 def POST(self):
     per = users.get_permission_by_douid(user.douban_id)
     rights = per[0].rights
     if rights > 1:
         data = web.input()
         douban_id = data.douban_id
         rights = data.rights
         operator = user.id
         operating_ts = datetime.datetime.now()
         users.change_user_permission(douban_id, rights, operator, operating_ts)
コード例 #2
0
    def POST(self):
        per = users.get_permission_by_douid(user.douban_id)
        rights = per[0].rights
        if rights > 1:
            data = web.input()
            id = data.apply_id #申请记录的id
            douban_id = data.douban_id  #申请用户的豆瓣id
            apply_email = data.apply_email #申请时留的邮箱
            apply_result = int(data.apply_result) #申请结果 1 通过 0 未通过

            operator = user.id
            operating_ts = datetime.datetime.now()
            rights = apply_result

            #修改Log管理操作信息
            users.update_user_apply_permission_log(id, operator, operating_ts, apply_result)

            
            apply_user = users.get_douban_user_by_doubanid(douban_id)
            if apply_result == -1: #忽略申请 鉴于可能有乱填邮件地址的情况 note 其实可以去掉这个判断
                pass
            elif apply_result == 1: #申请通过
                #修改用户权限
                users.change_user_permission(douban_id, rights, operator, operating_ts)
                #发送通知邮件
                email_templates.email_to_user_for_apply_success(apply_user, apply_email)
                #
            elif apply_result == 0: #申请未通过
                #修改用户权限
                users.change_user_permission(douban_id, rights, operator, operating_ts)
                #发送通知邮件
                email_templates.email_to_user_for_apply_fail(apply_user, apply_email)

            mes = '处理完毕'
            return mes
        else:
            raise web.notfound