|
@@ -154,6 +154,14 @@ module.exports = class UserController extends shopController {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ get luckyValidate() {
|
|
|
+ const that = this;
|
|
|
+ return {
|
|
|
+ user_id: that.ctx.rules.default(that.service.shop.getWebUserId())
|
|
|
+ .number(),
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
get userTransferValidate() {
|
|
|
const that = this;
|
|
|
return {
|
|
@@ -899,7 +907,7 @@ module.exports = class UserController extends shopController {
|
|
|
* @return {Promise<void>}
|
|
|
*/
|
|
|
async commission2DiningCoin() {
|
|
|
-
|
|
|
+ // 2023/11/17 todo: 佣金转电子餐费
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -951,6 +959,36 @@ module.exports = class UserController extends shopController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * [newUserBenefits 获取每日红包]
|
|
|
+ * @return {[type]} [description]
|
|
|
+ */
|
|
|
+ async dayLucky() {
|
|
|
+ const that = this;
|
|
|
+ try {
|
|
|
+ const data = await that.ctx.validate(that.luckyValidate, await that.ctx.anyParse());
|
|
|
+ // 2023/11/17 todo: 用户今天抽奖校验
|
|
|
+ const user = await that.useModel.findOne({
|
|
|
+ where: { user_id: data.user_id },
|
|
|
+ });
|
|
|
+
|
|
|
+ // 2023/11/17 todo: 发起概率抽奖 发放奖项 (红包上限)
|
|
|
+ const seq = that.app.Sequelize;
|
|
|
+ const selectBean = await that.app.comoBean.instance(data, {
|
|
|
+ offset: (data.page - 1) * data.limit, limit: data.limit, where: {
|
|
|
+ user_id: data.user_id,
|
|
|
+ type: { [seq.Op.in]: [ 1, 2 ] },
|
|
|
+ },
|
|
|
+ order: [[ 'type', 'asc' ]],
|
|
|
+ });
|
|
|
+ const result = await that.service.base.select(selectBean, that.app.model.UsersMoneyLogs, '新用户福利查询失败,请稍候重试', true, true);
|
|
|
+ return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false));
|
|
|
+ } catch (err) {
|
|
|
+ return that.ctx.appJson(that.app.szjcomo.appResult(err.message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 更新用户信息
|
|
|
* @date:2023/10/20
|