Files
JayuCloud/WeChatProgram/admin/api/system-message.js
T

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-05-23 18:45:41 +08:00
/**
* Purpose: request sends signed admin mini-program calls to the backend system-message endpoints.
* Usage: keep all system-message API wrappers in this module so pages do not build URLs by hand.
*/
const request = require('../utils/request')
module.exports = {
/**
* Purpose: listMessages loads admin-visible system messages including popup and business navigation metadata.
* Usage: call it from the system-message management page during initial load or refresh.
*/
listMessages() {
return request({
url: '/system-message/admin/list'
})
},
/**
* Purpose: createMessage publishes a new system message to the selected target users.
* Usage: pass validated form data with targetType, popupEnabled, and optional business fields.
*/
createMessage(data) {
return request({
url: '/system-message/admin/create',
method: 'POST',
data
})
},
/**
* Purpose: revokeMessage withdraws a previously published message when the operator has delete permission.
* Usage: call it with the message id after an explicit confirmation dialog.
*/
revokeMessage(id) {
return request({
url: `/system-message/admin/${id}/revoke`,
method: 'PUT',
data: {}
})
},
/**
* Purpose: getTargetOptions loads shops and users that the current operator may target.
* Usage: call it before showing the publish form so picker data is permission-scoped.
*/
getTargetOptions() {
return request({
url: '/system-message/admin/target-options'
})
}
}