Commit 6d00090a authored by 姜登's avatar 姜登

product

parent 8d3649fe
Pipeline #22315 passed with stage
in 3 seconds
...@@ -109,7 +109,7 @@ class UserService extends Service { ...@@ -109,7 +109,7 @@ class UserService extends Service {
const last_day = moment(new Date()).subtract(1, 'day').format('YYYY-MM-DD'); const last_day = moment(new Date()).subtract(1, 'day').format('YYYY-MM-DD');
const last_month = moment(new Date()).subtract(1, 'day').format('YYYYMM'); const last_month = moment(new Date()).subtract(1, 'day').format('YYYYMM');
const lastday_data = await ctx.dataModel.YzbillCost.findOne({ const lastday_data = await ctx.dataModel.YzbillCost.findAll({
attributes: [ attributes: [
[ctx.dataModel.fn('SUM', 'pull_volumn'), 'amount'], [ctx.dataModel.fn('SUM', 'pull_volumn'), 'amount'],
[ctx.dataModel.fn('SUM', 'cost'), 'cost'], [ctx.dataModel.fn('SUM', 'cost'), 'cost'],
......
...@@ -59,8 +59,11 @@ class UserDetailService extends Service { ...@@ -59,8 +59,11 @@ class UserDetailService extends Service {
let where = { user_id }; let where = { user_id };
if (product) { if (product) {
ret.product = product; product = JSON.parse(product);
where.service = product; if (product.length > 0) {
ret.product = product;
where.service = product;
}
} }
const appKeys = await ctx.yizhiModel.UserService.findAll({ const appKeys = await ctx.yizhiModel.UserService.findAll({
...@@ -139,7 +142,11 @@ class UserDetailService extends Service { ...@@ -139,7 +142,11 @@ class UserDetailService extends Service {
let where = { user_id }; let where = { user_id };
if (product) { if (product) {
where.service = product; product = JSON.parse(product);
if (product.length > 0) {
ret.product = product;
where.service = product;
}
} }
const appKeys = await ctx.yizhiModel.UserService.findAll({ const appKeys = await ctx.yizhiModel.UserService.findAll({
...@@ -154,6 +161,9 @@ class UserDetailService extends Service { ...@@ -154,6 +161,9 @@ class UserDetailService extends Service {
appList.push(value.appkey); appList.push(value.appkey);
} }
}); });
if (end_date.length === 7) {
end_date = moment(end_date + '-01').add(1, 'month').format('YYYY-MM');
}
where = { where = {
user_id: ctx.userId, user_id: ctx.userId,
appKey: appList, appKey: appList,
......
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