|
@@ -11,6 +11,9 @@ module.exports = class StatisticController extends Base {
|
|
return {
|
|
return {
|
|
user_id: that.ctx.rules.default(that.service.shop.getWebUserId())
|
|
user_id: that.ctx.rules.default(that.service.shop.getWebUserId())
|
|
.number(),
|
|
.number(),
|
|
|
|
+ pid: that.ctx.rules.name('商品分类父级ID')
|
|
|
|
+ .default(4)
|
|
|
|
+ .number(),
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
@@ -54,6 +57,7 @@ module.exports = class StatisticController extends Base {
|
|
const createBrowse = await that.app.comoBean.instance({
|
|
const createBrowse = await that.app.comoBean.instance({
|
|
user_id: dataParse.user_id,
|
|
user_id: dataParse.user_id,
|
|
product_id: dataParse.product_id,
|
|
product_id: dataParse.product_id,
|
|
|
|
+ pid: dataParse.pid,
|
|
browse_count: 1,
|
|
browse_count: 1,
|
|
product_name: dataParse.product_name,
|
|
product_name: dataParse.product_name,
|
|
browse_params: dataParse.browse_params ? dataParse.browse_params : '{}',
|
|
browse_params: dataParse.browse_params ? dataParse.browse_params : '{}',
|
|
@@ -76,12 +80,13 @@ module.exports = class StatisticController extends Base {
|
|
event_count: that.app.Sequelize.literal('event_count + ' + 1),
|
|
event_count: that.app.Sequelize.literal('event_count + ' + 1),
|
|
event_params: dataParse.event_params ? dataParse.event_params : '{}',
|
|
event_params: dataParse.event_params ? dataParse.event_params : '{}',
|
|
update_time: that.app.szjcomo.date('Y-m-d H:i:s'),
|
|
update_time: that.app.szjcomo.date('Y-m-d H:i:s'),
|
|
- }, { where: { user_id: dataParse.user_id, event_name: dataParse.event_name }, transaction });
|
|
|
|
|
|
+ }, { where: { user_id: dataParse.user_id, event_name: dataParse.event_name, pid: dataParse.pid }, transaction });
|
|
await that.app.comoBean.update(updateBrowse, that.app.model.UsersEventLogs, '用户行为记录更新失败,请稍候重试');
|
|
await that.app.comoBean.update(updateBrowse, that.app.model.UsersEventLogs, '用户行为记录更新失败,请稍候重试');
|
|
} else {
|
|
} else {
|
|
// 2023/7/26 create 用户行为
|
|
// 2023/7/26 create 用户行为
|
|
const createBrowse = await that.app.comoBean.instance({
|
|
const createBrowse = await that.app.comoBean.instance({
|
|
user_id: dataParse.user_id,
|
|
user_id: dataParse.user_id,
|
|
|
|
+ pid: dataParse.pid,
|
|
event_name: dataParse.event_name,
|
|
event_name: dataParse.event_name,
|
|
event_count: 1,
|
|
event_count: 1,
|
|
event_params: dataParse.event_params ? dataParse.event_params : '{}',
|
|
event_params: dataParse.event_params ? dataParse.event_params : '{}',
|