外卖CPS红包小程序源码分享
外卖cps带分销返利源码
饿了么红包、美团优惠券开发(外卖cps,三级裂变源码)
源代码地址
搭建步骤
下载以上源代码到本地截图
步骤
下载以上源代码到本地修改为你自己的微信小程序,打开 /dist/pages/ele/index.js
微信小程序->开发管理->开发设置 添加 request的域名: 地址:
https://mp./wxamp/devprofile/get_profile?token=271531762&lang=zh_CN
小程序管理后台配置你的链接
后台地址: 进去之后选择小程序管理->无裂变小程序管理->添加小程序->填入你自己的链接
微信开发者工具,导入项目,提交审核
const Base = require(’./base.js’);
const moment = require(‘moment’);
const _ = require(‘lodash’);
module.exports = class extends Base {
/**
*
* const Base = require(’./base.js’);
const moment = require(‘moment’);
const _ = require(‘lodash’);
module.exports = class extends Base {
/**
*
* @returns {Promise<void|Promise|PreventPromise>}
/
async deleteAction() {
const footprintId = this.post(‘footprintId’);
const userId = think.userId;
// 删除当天的同一个商品的足迹
await this.model(‘footprint’).where({
user_id: userId,
id: footprintId
}).delete();
return this.success(‘删除成功’);
}
/*
* list action
* @return {Promise} []
/
async listAction() {
const page = this.get(‘page’);
const size = this.get(‘size’);
const list = await this.model(‘footprint’).alias(‘f’).join({
table: ‘goods’,
join: ‘left’,
as: ‘g’,
on: [‘f.goods_id’, ‘g.id’]
}).where({
user_id: think.userId
}).page(page, size).order({
add_time: ‘desc’
}).field(‘id,goods_id,add_time’).countSelect();
for (const item of list.data) {
let goods = await this.model(‘goods’).where({
id:item.goods_id
}).field(‘name,goods_brief,retail_price,list_pic_url,goods_number,min_retail_price’).find();
item.add_time = moment.unix(item.add_time).format(‘YYYY-MM-DD’);
item.goods = goods;
if (moment().format(‘YYYY-MM-DD’) == item.add_time) {
item.add_time = ‘今天’;
}
}
return this.success(list);
}
};@returns {Promise<void|Promise|PreventPromise>}
/const Base = require(’./base.js’);
const moment = require(‘moment’);
const _ = require(‘lodash’);
module.exports = class extends Base {
/
*
* @returns {Promise<void|Promise|PreventPromise>}
/
async deleteAction() {
const footprintId = this.post(‘footprintId’);
const userId = think.userId;
// 删除当天的同一个商品的足迹
await this.model(‘footprint’).where({
user_id: userId,
id: footprintId
}).delete();
return this.success(‘删除成功’);
}
/*
* list action
* @return {Promise} []
/
async listAction() {
const page = this.get(‘page’);
const size = this.get(‘size’);
const list = await this.model(‘footprint’).alias(‘f’).join({
table: ‘goods’,
join: ‘left’,
as: ‘g’,
on: [‘f.goods_id’, ‘g.id’]
}).where({
user_id: think.userId
}).page(page, size).order({
add_time: ‘desc’
}).field(‘id,goods_id,add_time’).countSelect();
for (const item of list.data) {
let goods = await this.model(‘goods’).where({
id:item.goods_id
}).field(‘name,goods_brief,retail_price,list_pic_url,goods_number,min_retail_price’).find();
item.add_time = moment.unix(item.add_time).format(‘YYYY-MM-DD’);
item.goods = goods;
if (moment().format(‘YYYY-MM-DD’) == item.add_time) {
item.add_time = ‘今天’;
}
}
return this.success(list);
}
};
async deleteAction() {
const footprintId = this.post(‘footprintId’);
const userId = think.userId;
// 删除当天的同一个商品的足迹
await this.model(‘footprint’).where({
user_id: userId,
id: footprintId
}).delete();
return this.success(‘删除成功’);
}
/*
* list action
* @return {Promise} []
*/
async listAction() {
const page = this.get(‘page’);
const size = this.get(‘size’);
const list = await this.model(‘footprint’).alias(‘f’).join({
table: ‘goods’,
join: ‘left’,
as: ‘g’,
on: [‘f.goods_id’, ‘g.id’]
}).where({
user_id: think.userId
}).page(page, size).order({
add_time: ‘desc’
}).field(‘id,goods_id,add_time’).countSelect();
for (const item of list.data) {
let goods = await this.model(‘goods’).where({
id:item.goods_id
}).field(‘name,goods_brief,retail_price,list_pic_url,goods_number,min_retail_price’).find();
item.add_time = moment.unix(item.add_time).format(‘YYYY-MM-DD’);
item.goods = goods;
if (moment().format(‘YYYY-MM-DD’) == item.add_time) {
item.add_time = ‘今天’;
}
}
return this.success(list);
}
};