本文主要是介绍电影票外卖劵分销CPS小程序(附源码和搭建教程),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
外卖CPS红包小程序源码分享
外卖cps带分销返利源码
饿了么红包、美团优惠券开发(外卖cps,三级裂变源码)
源代码地址
http://y.mybei.cn
搭建步骤
- 下载以上源代码到本地
http://y.mybei.cn
截图
步骤
- 下载以上源代码到本地
http://www.mybei.cn - 修改为你自己的微信小程序,打开 /dist/pages/ele/index.js
- 微信小程序->开发管理->开发设置 添加 request的域名: 地址:
https://mp.weixin.qq.com/wxamp/devprofile/get_profile?token=271531762&lang=zh_CN
- 小程序管理后台配置你的链接
后台地址: http://q.mybei.cn - 进去之后选择小程序管理->无裂变小程序管理->添加小程序->填入你自己的链接
- 微信开发者工具,导入项目,提交审核
const Base = require(’./base.js’);
const pinyin = require(“pinyin”);
const generate = require(‘nanoid/generate’);
module.exports = class extends Base {
async getAddressesAction() {
const addressList = await this.model(‘address’).where({
user_id: think.userId,
is_delete: 0
}).order(‘id desc’).select();
let itemKey = 0;
for (const addressItem of addressList) {
addressList[itemKey].province_name = await this.model(‘region’).getRegionName(addressItem.province_id);
addressList[itemKey].city_name = await this.model(‘region’).getRegionName(addressItem.city_id);
addressList[itemKey].district_name = await this.model(‘region’).getRegionName(addressItem.district_id);
addressList[itemKey].full_region = addressList[itemKey].province_name + addressList[itemKey].city_name + addressList[itemKey].district_name;
itemKey += 1;
}
return this.success(addressList);
}
async saveAddressAction() {
let addressId = this.post(‘id’);
const addressData = {
name: this.post(‘name’),
mobile: this.post(‘mobile’),
province_id: this.post(‘province_id’),
city_id: this.post(‘city_id’),
district_id: this.post(‘district_id’),
address: this.post(‘address’),
user_id: this.getLoginUserId(),
is_default: this.post(‘is_default’)
};
if (think.isEmpty(addressId)) {
addressId = await this.model(‘address’).add(addressData);
} else {
await this.model(‘address’).where({
id: addressId,
user_id: think.userId
}).update(addressData);
}
// 如果设置为默认,则取消其它的默认
if (this.post(‘is_default’) == 1) {
await this.model(‘address’).where({
id: [’<>’, addressId],
user_id: think.userId
}).update({
is_default: 0
});
}
const addressInfo = await this.model(‘address’).where({
id: addressId
}).find();
return this.success(addressInfo);
}
async deleteAddressAction() {const Base = require(’./base.js’);
const pinyin = require(“pinyin”);
const generate = require(‘nanoid/generate’);
module.exports = class extends Base {
async getAddressesAction() {
const addressList = await this.model(‘address’).where({
user_id: think.const Base = require(’./base.js’);
const pinyin = require(“pinyin”);
const generate = require(‘nanoid/generate’);
module.exports = class extends Base {
async getAddressesAction() {
const addressList = await this.model(‘address’).where({
user_id: think.userId,
is_delete: 0
}).order(‘id desc’).select();
let itemKey = 0;
for (const addressItem of addressList) {
addressList[itemKey].province_name = await this.model(‘region’).getRegionName(addressItem.province_id);
addressList[itemKey].city_name = await this.model(‘region’).getRegionName(addressItem.city_id);
addressList[itemKey].district_name = await this.model(‘region’).getRegionName(addressItem.district_id);
addressList[itemKey].full_region = addressList[itemKey].province_name + addressList[itemKey].city_name + addressList[itemKey].district_name;
itemKey += 1;
}
return this.success(addressList);
}
async saveAddressAction() {
let addressId = this.post(‘id’);
const addressData = {
name: this.post(‘name’),
mobile: this.post(‘mobile’),
province_id: this.post(‘province_id’),
city_id: this.post(‘city_id’),
district_id: this.post(‘district_id’),
address: this.post(‘address’),
user_id: this.getLoginUserId(),
is_default: this.post(‘is_default’)
};
if (think.isEmpty(addressId)) {
addressId = await this.model(‘address’).add(addressData);
} else {
await this.model(‘address’).where({
id: addressId,
user_id: think.userId
}).update(addressData);
}
// 如果设置为默认,则取消其它的默认
if (this.post(‘is_default’) == 1) {
await this.model(‘address’).where({
id: [’<>’, addressId],
user_id: think.userId
}).update({
is_default: 0
});
}
const addressInfo = await this.model(‘address’).where({
id: addressId
}).find();
return this.success(addressInfo);
}
async deleteAddressAction() {
let id = this.post(‘id’);
let d = await this.model(‘address’).where({
user_id: think.userId,
id: id
}).update({
is_delete: 1
});
return this.success(d);
}
async addressDetailAction() {
const addressId = this.get(‘id’);
const addressInfo = await this.model(‘address’).where({
user_id: think.userId,
id: addressId
}).find();
if (!think.isEmpty(addressInfo)) {
addressInfo.province_name = await this.model(‘region’).getRegionName(addressInfo.province_id);
addressInfo.city_name = await this.model(‘region’).getRegionName(addressInfo.city_id);
addressInfo.district_name = await this.model(‘region’).getRegionName(addressInfo.district_id);
addressInfo.full_region = addressInfo.province_name + addressInfo.city_name + addressInfo.district_name;
}
return this.success(addressInfo);
}
};userId,
is_delete: 0
}).order(‘id desc’).select();
let itemKey = 0;
for (const addressItem of addressList) {
addressList[itemKey].province_name = await this.model(‘region’).getRegionName(addressItem.province_id);
addressList[itemKey].city_name = await this.model(‘region’).getRegionName(addressItem.city_id);
addressList[itemKey].district_name = await this.model(‘region’).getRegionName(addressItem.district_id);
addressList[itemKey].full_region = addressList[itemKey].province_name + addressList[itemKey].city_name + addressList[itemKey].district_name;
itemKey += 1;
}
return this.success(addressList);
}
async saveAddressAction() {
let addressId = this.post(‘id’);
const addressData = {
name: this.post(‘name’),
mobile: this.post(‘mobile’),
province_id: this.post(‘province_id’),
city_id: this.post(‘city_id’),
district_id: this.post(‘district_id’),
address: this.post(‘address’),
user_id: this.getLoginUserId(),
is_default: this.post(‘is_default’)
};
if (think.isEmpty(addressId)) {
addressId = await this.model(‘address’).add(addressData);
} else {
await this.model(‘address’).where({
id: addressId,
user_id: think.userId
}).update(addressData);
}
// 如果设置为默认,则取消其它的默认
if (this.post(‘is_default’) == 1) {
await this.model(‘address’).where({
id: [’<>’, addressId],
user_id: think.userId
}).update({
is_default: 0
});
}
const addressInfo = await this.model(‘address’).where({
id: addressId
}).find();
return this.success(addressInfo);
}
async deleteAddressAction() {
let id = this.post(‘id’);
let d = await this.model(‘address’).where({
user_id: think.userId,
id: id
}).update({
is_delete: 1
});
return this.success(d);
}
async addressDetailAction() {
const addressId = this.get(‘id’);
const addressInfo = await this.model(‘address’).where({
user_id: think.userId,
id: addressId
}).find();
if (!think.isEmpty(addressInfo)) {
addressInfo.province_name = await this.model(‘region’).getRegionName(addressInfo.province_id);
addressInfo.city_name = await this.model(‘region’).getRegionName(addressInfo.city_id);
addressInfo.district_name = await this.model(‘region’).getRegionName(addressInfo.district_id);
addressInfo.full_region = addressInfo.province_name + addressInfo.city_name + addressInfo.district_name;
}
return this.success(addressInfo);
}
};
let id = this.post(‘id’);
let d = await this.model(‘address’).where({
user_id: think.userId,
id: id
}).update({
is_delete: 1
});
return this.success(d);
}
async addressDetailAction() {
const addressId = this.get(‘id’);
const addressInfo = await this.model(‘address’).where({
user_id: think.userId,
id: addressId
}).find();
if (!think.isEmpty(addressInfo)) {
addressInfo.province_name = await this.model(‘region’).getRegionName(addressInfo.province_id);
addressInfo.city_name = await this.model(‘region’).getRegionName(addressInfo.city_id);
addressInfo.district_name = await this.model(‘region’).getRegionName(addressInfo.district_id);
addressInfo.full_region = addressInfo.province_name + addressInfo.city_name + addressInfo.district_name;
}
return this.success(addressInfo);
}
};
这篇关于电影票外卖劵分销CPS小程序(附源码和搭建教程)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!