我有这个 json 响应:
id: 30
tableName: "UserCredit"
keyValues: "{"Id":39}"
oldValues: "{"CoinLastUpdate":"2020-02-18T14:18:13.5155426+00:00","ScoreLastUpdate":"2020-02-18T14:18:13.5155429+00:00"}"
newValues: "{"CoinLastUpdate":"2020-02-18T14:18:15.7325823+00:00","ScoreLastUpdate":"2020-02-18T14:18:15.7325826+00:00"}"
auditType: "Update"
createdOnUtc: "2020-02-18T14:18:15.7338989Z"
createdByRefId: 39
我想找出两者之间的区别oldValues,newValues然后我编写以下代码:
setOldNewValue(item: DeiffrentModel): void {
let oldValue;
let newValue;
console.log(item.oldValues)
if (item.newValues !== null) {
newValue = item.newValues.split(',');
}
if (item.oldValues !== null) {
oldValue = item.oldValues.split(',');
}
for (let index = 0; index < newValue.length; index++) {
let addModel = {} as DeifferModel;
addModel.field = 'id';
addModel.newValue = newValue[index];
console.log(oldValue)
if (oldValue !== undefined) {
addModel.oldValue = oldValue[index]
}
this.differModel.push(addModel);
}
this.findDiffrent = _.difference(newValue, oldValue);
}
现在我有这个问题:
**** 我创建了一个值数组newValue,oldValue但它显示如下:
0:“CoinLastUpdate”:“2020-02-18T14:18:13.5155426+00:00”
1: "ScoreLastUpdate":"2020-02-18T14:18:13.5155429+00:00"}
但我只需要2020-02-18T14:18:13.5155429+00:00
我怎么解决这个问题?
米脂
偶然的你
相关分类