def handler_function(self):
        args = self.get_request_data()

        DBOps.setOneDoc(
            DBCollonfig.options,
            {'_id': DBCollonfig.orderOption},
            {
                '$pull': {
                    args['optionType']: {
                        'name': args['name']
                    }
                }
            }
        )

        # 记录日志
        LogDBOps.writeLog(args['opsUserId'], self.LogAction[args['optionType']])

        return self.response_success()
    def handler_function(self):
        args = self.get_request_data()

        now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        DBOps.setOneDoc(
            DBCollonfig.options,
            {'_id': DBCollonfig.orderHelpInfo},
            {
                '$set': {
                    'helpInfo': [{
                        'content': args['helpInfo'],
                        'createTime': now,
                        'createTimeStamp': TimeUtil.time_conversion(now, 1)
                    }]
                }
            }
        )

        # 记录日志
        LogDBOps.writeLog(args['opsUserId'], LogDBConfig.doEditHelpInfo)

        return self.response_success()
 def handler_function(self):
     args = self.get_request_data()
     # 记录日志
     LogDBOps.writeLog(args['opsUserId'], LogDBConfig.doDownloadTable)
    def handler_function(self):
        args = self.get_request_data()
        option = args['option']
        createUser = args['createUser']
        now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        if args['optionType'] == 'contacts':
            oldContact = DBOps.getOneDoc(
                DBCollonfig.options,
                {
                    '_id': DBCollonfig.orderContact,
                    'contacts.name': option['oldName']
                }
            )
            if not oldContact:
                return self.response_failure(msg=u'外包人员不存在')
            DBOps.setOneDoc(
                DBCollonfig.options,
                {
                    '_id': DBCollonfig.orderContact,
                    'contacts.name': option['oldName']
                },
                {
                    '$set': {
                        'contacts.$.name': option['name'],
                        'contacts.$.realName': option['realName'],
                        'contacts.$.tel': option['tel'],
                        'contacts.$.email': option['email'],
                        'contacts.$.workClass': option['workClass'],
                        'contacts.$.payInfo': option['payInfo'],
                        'contacts.$.qq': option['qq'],
                        'contacts.$.createUser': createUser,
                        'contacts.$.createTime': now,
                        'contacts.$.createTimeStamp': TimeUtil.time_conversion(
                            now, 1
                        ),
                    }
                }
            )

            # 记录日志
            LogDBOps.writeLog(args['opsUserId'], LogDBConfig.doEditContact)

            return self.response_success()
        elif args['optionType'] == 'customers':
            DBOps.setOneDoc(
                DBCollonfig.options,
                {
                    '_id': DBCollonfig.orderCustomer,
                    'customers.name': option['name']
                },
                {
                    '$set': {
                        'customers.$.billInfo': option['billInfo'],
                        'customers.$.mailAddress': option['mailAddress'],
                        'customers.$.createUser': createUser,
                        'customers.$.createTime': now,
                        'customers.$.createTimeStamp': TimeUtil.time_conversion(
                            now, 1
                        ),
                    }
                }
            )

            # 记录日志
            LogDBOps.writeLog(args['opsUserId'], LogDBConfig.doEditCustomer)

            return self.response_success()
        else:
            return self.response_failure(msg=u'没有需要修改的信息')
    def handler_function(self):
        args = self.get_request_data()

        setStatus = args.get('status', None)
        orderId = args.get('orderId', None)

        nowStatus = DBOps.getOneDoc(
            DBCollonfig.orders,
            {'_id': orderId}
        )['status']

        if nowStatus == setStatus:
            return self.response_failure(msg='订单状态已被修改!')

        logAction = None

        nowString = datetime.now().strftime(DATETIME_FORMAT)
        setParams = {}
        if setStatus == 1:
            setParams = self.setStatus1(setStatus, args)
            logAction = LogDBConfig.doEditOrder
            if args['opsUserId'] != args['userId']:
                content = {
                    'status': setStatus,
                    'sendUserId': args['opsUserId'],
                    'rcvUserId': args['userId'],
                    'orderTitle': args['title'],
                    'createUser': args['createUser']
                }
                AccountMsg.setOrderMsg(content)

        elif setStatus == 2:
            setParams = self.setStatus2(setStatus, nowString, args)
            logAction = LogDBConfig.doCompleteOrder
            content = {
                'status': setStatus,
                'sendUserId': args['opsUserId'],
                'rcvUserId': 'summaryUser',
                'orderTitle': args['title'],
                'createUser': args['createUser']
            }
            AccountMsg.setOrderMsg(content)

        elif setStatus == 3:
            setParams = self.setStatus3(setStatus, nowString, args)
            logAction = LogDBConfig.doPaymentOrder
            if args['opsUserId'] != args['userId']:
                content = {
                    'status': setStatus,
                    'sendUserId': args['opsUserId'],
                    'rcvUserId': args['userId'],
                    'orderTitle': args['title'],
                    'createUser': args['createUser']
                }
                AccountMsg.setOrderMsg(content)

        DBOps.setOneDoc(
            DBCollonfig.orders,
            {'_id': orderId},
            {'$set': setParams}
        )

        # 记录日志
        LogDBOps.writeLog(args['opsUserId'], logAction)
        self.result['result'] = {'opsTime': nowString}
        return self.response_success(msg='订单状态修改成功!')