Commit 23b82378 authored by ml's avatar ml

返佣时间周期配置

parent c87db480
......@@ -33,3 +33,9 @@ export const ADDRESS_INFO_REDIS_KEY_OBJ = "b029.addressInfo.service.get.obj";
export const APP_SPECIAL_MODEL_REDIS_KEY = "b029.app.sepecial.model.redis.key";
/**
* 返佣时间周期配置
*/
export const REWARD_TIME_PERIOD_REDIS_KEY = "bk_reward_time_period_config";
import { AppVersionPageVO } from "../service/appVersion.service";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert, datetimeUtils } = require('@madex/ex-js-public');
import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
import { APP_VERSION_KEY, REWARD_TIME_PERIOD_REDIS_KEY } from "../../../constant/redis-val";
import { addOptLog } from "../service/userOptLog.service";
let { authCommon: AuthCommon, redisUtilsCommon: RedisClient, } = require('@madex/ex-js-common');
let isIp = require('is-ip');
export interface ParamVO {
period_type?: number;// 1:半年;2:一年;3:2年;4:永久;
}
/**
* 时间周期设置
* @param req
* @param authConfigVO
*/
export const set = async (req: any, paramVO: ParamVO) => {
let func_name = "rewardTimePeriod.control.set";
try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
if (!paramVO.period_type || ![1,2,3,4].includes(Number(paramVO.period_type))) {
throw ErrorCode.PARAM_MISS
}
let key = REWARD_TIME_PERIOD_REDIS_KEY;
await RedisClient.writeSync(key, paramVO.period_type);
//管理后台操作日志
addOptLog(currentUserId, 0, '返佣时间周期设置', ip, `key:${key},value:${paramVO.period_type}`, '返佣时间周期设置');
return Res3Utils.result('ok');
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* 时间周期配置查询
* @param req
* @param authConfigVO
*/
export const get = async (req: any, paramVO: ParamVO) => {
let func_name = "rewardTimePeriod.control.get";
try {
let key = REWARD_TIME_PERIOD_REDIS_KEY;
let period_type = await RedisClient.getSync(key);
//管理后台操作日志
return Res3Utils.result({
period_type: period_type ? period_type : ""
});
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
......@@ -47,6 +47,7 @@ import * as pairApplyCtrl from "../../mvc/control/pairApply.control";
import * as cronApplyCtrl from "../../mvc/control/cronApply.control";
import * as spotDataCtrl from "../../mvc/control/spotData.control";
import * as exBusinessAreaCtrl from "../../mvc/control/exBusinessArea.control";
import * as rewardTimePeriodCtrl from "../../mvc/control/rewardTimePeriod.control";
const getFunc = {
'user/info': userController.getUserInfo,
......@@ -283,6 +284,10 @@ const postFunc = {
'operate/other/business/area/router/update': exBusinessAreaCtrl.routerUpdate,
'operate/other/business/area/router/delete': exBusinessAreaCtrl.routerDel,
'operate/other/business/area/router/list': exBusinessAreaCtrl.routerList,
//技术部-其他管理-返佣时间配置
'tech/other/reward/time/period/set': rewardTimePeriodCtrl.set,
'tech/other/reward/time/period/get': rewardTimePeriodCtrl.get,
};
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
......
......@@ -224,6 +224,9 @@ let cmdWhiteList = {
'operate/other/business/area/router/update': 1,
'operate/other/business/area/router/delete': 1,
'operate/other/business/area/router/list': 1,
//技术部-其他管理-返佣时间配置
'tech/other/reward/time/period/set': 1,
'tech/other/reward/time/period/get': 1,
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment