miniapp-web-jsapi
Version:
JSAPI/View adapter for miniprogram running on the web
23 lines • 797 B
JavaScript
export function getServerTime(options) {
var _success = options.success,
_fail = options.fail,
complete = options.complete;
my.call('rpc', {
operationType: 'ac.mobilepayment.basic.time.tick',
requestData: [{}],
success: function success(res) {
if (res && res.success && res.timestamp != null && res.timestamp > 0) {
_success === null || _success === void 0 ? void 0 : _success({
time: res.timestamp
});
} else {
_fail === null || _fail === void 0 ? void 0 : _fail();
}
complete === null || complete === void 0 ? void 0 : complete();
},
fail: function fail(err) {
_fail === null || _fail === void 0 ? void 0 : _fail();
complete === null || complete === void 0 ? void 0 : complete();
}
});
}