def POST(self):
        req  = protocol.ReportComment_Req(web.input())
        resp = protocol.ReportComment_Resp()

        if req.userid == 0:
            task = TaskOfDevice()
            task.device_id = req.device_id
            task.task_id = Task.ID_COMMENT
            task.type = TaskType.T_COMMENT
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_COMMENT
            n = db_helper.insert_task_of_device(task)
        else:
            task = TaskOfUser()
            task.userid = req.userid
            task.device_id = req.device_id
            task.task_id = Task.ID_COMMENT
            task.type = TaskType.T_COMMENT
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_COMMENT
            n = db_helper.insert_task_of_user(task)

        if n > 0:
            #奖励0.1元
            BillingClient.instance().recharge(req.device_id, req.userid, TASK_REWARD_COMMENT, '好评旺财')

            resp.income = TASK_REWARD_COMMENT

        return resp.dump_json()
Ejemplo n.º 2
0
    def POST(self):
        req  = protocol.ReportComment_Req(web.input())
        resp = protocol.ReportComment_Resp()

        if req.userid == 0:
            task = TaskOfDevice()
            task.device_id = req.device_id
            task.task_id = Task.ID_COMMENT
            task.type = TaskType.T_COMMENT
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_COMMENT
            n = db_helper.insert_task_of_device(task)
        else:
            task = TaskOfUser()
            task.userid = req.userid
            task.device_id = req.device_id
            task.task_id = Task.ID_COMMENT
            task.type = TaskType.T_COMMENT
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_COMMENT
            n = db_helper.insert_task_of_user(task)

        if n > 0:
            #奖励0.1元
            BillingClient.instance().recharge(req.device_id, req.userid, TASK_REWARD_COMMENT, '好评小猪', 0)

            resp.income = TASK_REWARD_COMMENT

        return resp.dump_json()
    def POST(self):
        req = protocol.ReportUserInfo_Req(web.input())
        resp = protocol.ReportUserInfo_Resp()

        if req.userid == 0:
            task = TaskOfDevice()
            task.device_id = req.device_id
            task.task_id = Task.ID_INFO
            task.type = TaskType.T_INFO
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_INFO
            n = db_helper.insert_task_of_device(task)
        else:
            task = TaskOfUser()
            task.userid = req.userid
            task.device_id = req.device_id
            task.task_id = Task.ID_INFO
            task.type = TaskType.T_INFO
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_INFO
            n = db_helper.insert_task_of_user(task)

        if n > 0:
            #奖励1元
            BillingClient.instance().recharge(req.device_id, req.userid, TASK_REWARD_INFO, '填写个人资料')

        return resp.dump_json()
Ejemplo n.º 4
0
    def POST(self):
        req = protocol.ReportUserInfo_Req(web.input())
        resp = protocol.ReportUserInfo_Resp()

        if req.userid == 0:
            task = TaskOfDevice()
            task.device_id = req.device_id
            task.task_id = Task.ID_INFO
            task.type = TaskType.T_INFO
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_INFO
            n = db_helper.insert_task_of_device(task)
        else:
            task = TaskOfUser()
            task.userid = req.userid
            task.device_id = req.device_id
            task.task_id = Task.ID_INFO
            task.type = TaskType.T_INFO
            task.status = TaskStatus.S_DONE
            task.money = TASK_REWARD_INFO
            n = db_helper.insert_task_of_user(task)

        if n > 0:
            #奖励1元
            BillingClient.instance().recharge(req.device_id, req.userid,
                                              TASK_REWARD_INFO, '填写个人资料', 0)

        return resp.dump_json()
Ejemplo n.º 5
0
    def POST(self):
        req = protocol.ReportInvite_Req(web.input())
        resp = protocol.ReportInvite_Resp()

        task = TaskInvite()
        task.userid = req.userid
        task.invitee = req.invitee
        task.invite_code = req.invite_code

        n = db_helper.insert_task_invite(task)
        if n == 0:
            #已经邀请过
            return resp.dump_json()

        task = TaskOfUser()
        task.userid = req.invitee
        task.device_id = ''
        task.task_id = Task.ID_INVITE
        task.type = TaskType.T_INVITE
        task.status = TaskStatus.S_DONE
        task.money = TASK_REWARD_INVITEE
        n = db_helper.insert_task_of_user(task)

        if n == 0:
            return resp.dump_json()

        #被邀请者奖励2元
        BillingClient.instance().recharge('', req.invitee, TASK_REWARD_INVITEE,
                                          '被邀请奖励1元', 0)

        #        n = db_helper.count_task_invite(req.userid)
        #        if n <= TASK_INVITE_NUM_MAX:
        #            #邀请者奖励1元
        #            BillingClient.instance().recharge(req.device_id, req.userid, TASK_REWARD_INVITE, '邀请奖励1元')

        #        resp.total_invite = n
        return resp.dump_json()
Ejemplo n.º 6
0
    def POST(self):
        req = protocol.ReportInvite_Req(web.input())
        resp = protocol.ReportInvite_Resp()

        task = TaskInvite()
        task.userid = req.userid
        task.invitee = req.invitee
        task.invite_code = req.invite_code

        n = db_helper.insert_task_invite(task)
        if n == 0:
            # 已经邀请过
            return resp.dump_json()

        task = TaskOfUser()
        task.userid = req.invitee
        task.device_id = ""
        task.task_id = Task.ID_INVITE
        task.type = TaskType.T_INVITE
        task.status = TaskStatus.S_DONE
        task.money = TASK_REWARD_INVITEE
        n = db_helper.insert_task_of_user(task)

        if n == 0:
            return resp.dump_json()

        # 被邀请者奖励2元
        BillingClient.instance().recharge("", req.invitee, TASK_REWARD_INVITEE, "被邀请奖励2元")

        #        n = db_helper.count_task_invite(req.userid)
        #        if n <= TASK_INVITE_NUM_MAX:
        #            #邀请者奖励1元
        #            BillingClient.instance().recharge(req.device_id, req.userid, TASK_REWARD_INVITE, '邀请奖励1元')

        #        resp.total_invite = n
        return resp.dump_json()