|
7502 | 7502 | return query; |
7503 | 7503 | }; |
7504 | 7504 |
|
| 7505 | + /** |
| 7506 | + * Retrieves a list of AVObjects that satisfy the CQL. |
| 7507 | + * CQL syntax please see https://cn.avoscloud.com/docs/cql_guide.html |
| 7508 | + * Either options.success or options.error is called when the find |
| 7509 | + * completes. |
| 7510 | + * |
| 7511 | + * @param {String} cql, A CQL string, see https://cn.avoscloud.com/docs/cql_guide.html |
| 7512 | + * @return {AV.Promise} A promise that is resolved with the results when |
| 7513 | + * the query completes. |
| 7514 | + */ |
| 7515 | + AV.Query.doCloudQuery = function(cql, options) { |
| 7516 | + var params = { cql: cql }; |
| 7517 | + var request = AV._request("cloudQuery", null, null, 'GET', params) |
| 7518 | + return request.then(function(response) { |
| 7519 | + //query to process results. |
| 7520 | + var query = new AV.Query(response.className); |
| 7521 | + var results = _.map(response.results, function(json) { |
| 7522 | + var obj = query._newObject(response); |
| 7523 | + obj._finishFetch(query._processResult(json), true); |
| 7524 | + return obj; |
| 7525 | + }); |
| 7526 | + return { |
| 7527 | + results: results, |
| 7528 | + count: response.count, |
| 7529 | + className: response.className |
| 7530 | + }; |
| 7531 | + })._thenRunCallbacks(options); |
| 7532 | + }; |
| 7533 | + |
7505 | 7534 | AV.Query._extend = AV._extend; |
7506 | 7535 |
|
7507 | 7536 | AV.Query.prototype = { |
|
8839 | 8868 | })._thenRunCallbacks(options); |
8840 | 8869 | }, |
8841 | 8870 |
|
8842 | | - /** |
8843 | | - * Retrieves a list of AVObjects that satisfy the CQL. |
8844 | | - * CQL syntax please see https://cn.avoscloud.com/docs/cql_guide.html |
8845 | | - * Either options.success or options.error is called when the find |
8846 | | - * completes. |
8847 | | - * |
8848 | | - * @param {String} cql, A CQL string, see https://cn.avoscloud.com/docs/cql_guide.html |
8849 | | - * @return {AV.Promise} A promise that is resolved with the results when |
8850 | | - * the query completes. |
8851 | | - */ |
8852 | | - doCloudQuery: function(cql, options) { |
8853 | | - var params = { cql: cql }; |
8854 | | - var request = AV._request("cloudQuery", null, null, 'GET', params) |
8855 | | - return request.then(function(response) { |
8856 | | - //query to process results. |
8857 | | - var query = new AV.Query(response.className); |
8858 | | - var results = _.map(response.results, function(json) { |
8859 | | - var obj = query._newObject(response); |
8860 | | - obj._finishFetch(query._processResult(json), true); |
8861 | | - return obj; |
8862 | | - }); |
8863 | | - return { |
8864 | | - results: results, |
8865 | | - count: response.count, |
8866 | | - className: response.className |
8867 | | - }; |
8868 | | - })._thenRunCallbacks(options); |
8869 | | - }, |
8870 | | - |
8871 | 8871 | /** |
8872 | 8872 | * Makes a call to request a sms code for operation verification. |
8873 | 8873 | * @param {Object} data The mobile phone number string or a JSON object contains mobilePhoneNumber,op,ttl,name etc. |
|
0 commit comments