|
@@ -0,0 +1,37 @@
|
|
|
+const req = require('../../utils/request')
|
|
|
+// let Parse = getApp().Parse;
|
|
|
+const company = getApp().globalData.company
|
|
|
+
|
|
|
+async function getStores(params) {
|
|
|
+ let {
|
|
|
+ uid,
|
|
|
+ skip,
|
|
|
+ limit
|
|
|
+ } = params
|
|
|
+ let sql = `SELECT * ,
|
|
|
+ ("perCapita" * 1) price,
|
|
|
+ (SELECT room."price" FROM "ShopRoom" room
|
|
|
+ WHERE room."shop" = store."objectId"
|
|
|
+ AND room."isDeleted" IS NOT TRUE
|
|
|
+ ORDER BY room."price" ASC LIMIT 1
|
|
|
+ ) "minPrice",
|
|
|
+ (SELECT clt."isCollect" FROM "DramaShopCollect" clt
|
|
|
+ WHERE clt."homestayStore" = store."objectId"
|
|
|
+ AND clt."isCollect" = TRUE
|
|
|
+ AND clt."isDeleted" IS NOT TRUE
|
|
|
+ AND clt."user" = '${uid}'
|
|
|
+ LIMIT 1
|
|
|
+ ) "iscollect"
|
|
|
+
|
|
|
+ FROM "ShopStore" store
|
|
|
+ WHERE "company" = '${company}'
|
|
|
+ AND "type" = 'stay'
|
|
|
+ AND "isDeleted" IS NOT TRUE
|
|
|
+ ORDER BY "iscollect"
|
|
|
+ OFFSET ${skip ?? 0} LIMIT ${limit ?? 10}`
|
|
|
+ let res = await req.customSQL(sql);
|
|
|
+ return res
|
|
|
+}
|
|
|
+module.exports = {
|
|
|
+ getStores
|
|
|
+};
|