123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- 'use strict';
- const shopController = require('./shop.js');
- module.exports = class PartnerInfoController extends shopController {
-
- get useModel() {
- const that = this;
- return that.app.model.PartnerInfo;
- }
-
- get selectValidate() {
- const that = this;
- return {
-
- county_name: that.ctx.rules.default('市辖区')
- .trim(),
- };
- }
-
- async selectAll() {
- const that = this;
- try {
- const options = {
- where: { online: true },
- order: [[ 'top', 'desc' ], [ 'order_amount', 'desc' ]],
- };
- const selectBean = await that.app.comoBean.instance({}, options);
- const result = await that.service.base.select(selectBean, that.useModel, '合作餐店查询失败,请稍候重试', true, true);
- return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false));
- } catch (err) {
- return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', false, false));
- }
- }
-
- async select() {
- const that = this;
- try {
- const data = await that.ctx.validate(that.selectValidate, await that.ctx.getParse());
- const options = {
- where: { county_name: data.county_name, online: true },
- order: [[ 'top', 'desc' ], [ 'order_amount', 'desc' ]],
- };
- const selectBean = await that.app.comoBean.instance(data, options);
- const result = await that.service.base.select(selectBean, that.useModel, '合作餐店查询失败,请稍候重试', true, true);
- return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false));
- } catch (err) {
- return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', false, false));
- }
- }
-
- };
|