Commit 380228451c9e4cabe5af0605c18db9cdddddb950
1 parent
cf8b0fb9
Exists in
master
update moment
Showing
5 changed files
with
21 additions
and
85 deletions
Show diff stats
common/models/customer.js
| 1 | 1 | var console = process.console; |
| 2 | 2 | module.exports = function(Customer) { |
| 3 | 3 | Customer.getName =function(ctx,cb){ |
| 4 | + console.tag('input').error(ctx); | |
| 4 | 5 | var respone = { |
| 5 | 6 | "resultCode":"20000", |
| 6 | 7 | "resultDescription":"Success", |
| ... | ... | @@ -8,6 +9,7 @@ module.exports = function(Customer) { |
| 8 | 9 | "Name": ctx.name |
| 9 | 10 | } |
| 10 | 11 | }; |
| 12 | + console.tag('response').warning(respone); | |
| 11 | 13 | cb(null,respone); |
| 12 | 14 | }; |
| 13 | 15 | Customer.remoteMethod('getName',{ | ... | ... |
common/models/item.js
| 1 | 1 | var console = process.console; |
| 2 | 2 | var unirest = require('unirest'); |
| 3 | +var moment = require('moment'); | |
| 3 | 4 | module.exports = function(Item) { |
| 4 | 5 | Item.disableRemoteMethod("create", true);// post |
| 5 | 6 | Item.disableRemoteMethod("find", false);// get |
| ... | ... | @@ -48,8 +49,7 @@ module.exports = function(Item) { |
| 48 | 49 | var data = { |
| 49 | 50 | "name":ctx |
| 50 | 51 | }; |
| 51 | - unirest.post("http://localhost:3000/api/AddChannels/getName").send(data).end(function(response){ | |
| 52 | - console.log(response.body); | |
| 52 | + unirest.post("http://localhost:3000/api/customer/getName").send(data).end(function(response){ | |
| 53 | 53 | cb(null,response.body) |
| 54 | 54 | }); |
| 55 | 55 | }; |
| ... | ... | @@ -94,8 +94,20 @@ module.exports = function(Item) { |
| 94 | 94 | "price": 0 |
| 95 | 95 | },http: { source: 'body' }}, |
| 96 | 96 | returns: {arg: 'data', type: 'object', root: true} |
| 97 | + }); | |
| 97 | 98 | |
| 98 | - }) | |
| 99 | 99 | |
| 100 | + Item.Moment = function(cb){ | |
| 101 | + var this_time = { | |
| 102 | + "default": moment().format(), | |
| 103 | + "DD-MM-YYY":moment().format("DD-MM-YYYY"), | |
| 104 | + "HH:MM:SS":moment().format("HH:mm:ss") | |
| 105 | + }; | |
| 106 | + cb(null,this_time); | |
| 107 | + }; | |
| 108 | + Item.remoteMethod('Moment',{ | |
| 109 | + http:{path:'/Moment',verb:'get'}, | |
| 110 | + returns: {arg: 'data', type: 'object', root: true} | |
| 111 | + }) | |
| 100 | 112 | |
| 101 | 113 | }; | ... | ... |
common/models/order.js
| ... | ... | @@ -8,7 +8,9 @@ module.exports = function(Order) { |
| 8 | 8 | Order.disableRemoteMethod("create", true);// post |
| 9 | 9 | Order.AddOrder = function(ctx,cb){ |
| 10 | 10 | console.log(ctx); |
| 11 | - findCustomer(ctx,cb,findItems) | |
| 11 | + findCustomer(ctx,cb,findItems); | |
| 12 | + | |
| 13 | + | |
| 12 | 14 | }; |
| 13 | 15 | function findCustomer(ctx,cb,next){ |
| 14 | 16 | console.tag('Input').log(ctx); |
| ... | ... | @@ -52,7 +54,6 @@ module.exports = function(Order) { |
| 52 | 54 | } |
| 53 | 55 | }) |
| 54 | 56 | } |
| 55 | - | |
| 56 | 57 | Order.remoteMethod('AddOrder',{ |
| 57 | 58 | http:{path:'/customer/:customer_id/item/:item_id',verb:'get'}, |
| 58 | 59 | accepts: { arg: 'ctx', type: 'object', http: function(ctx) { | ... | ... |
package.json
server/datasources.json
| ... | ... | @@ -13,16 +13,6 @@ |
| 13 | 13 | "user": "", |
| 14 | 14 | "connector": "mongodb" |
| 15 | 15 | }, |
| 16 | - "account": { | |
| 17 | - "host": "server8.sourcecode.co.th", | |
| 18 | - "port": 3306, | |
| 19 | - "url": "", | |
| 20 | - "database": "account", | |
| 21 | - "password": "A83kKhoAH4jcEHMY", | |
| 22 | - "name": "account", | |
| 23 | - "user": "npm_account", | |
| 24 | - "connector": "mysql" | |
| 25 | - }, | |
| 26 | 16 | "radius": { |
| 27 | 17 | "host": "server8.sourcecode.co.th", |
| 28 | 18 | "port": 3306, |
| ... | ... | @@ -32,75 +22,5 @@ |
| 32 | 22 | "name": "radius", |
| 33 | 23 | "user": "npm_radius", |
| 34 | 24 | "connector": "mysql" |
| 35 | - }, | |
| 36 | - "refill": { | |
| 37 | - "host": "server8.sourcecode.co.th", | |
| 38 | - "port": 3306, | |
| 39 | - "url": "", | |
| 40 | - "database": "refill", | |
| 41 | - "password": "Fe8Vf63LtdGQaFtd", | |
| 42 | - "name": "refill", | |
| 43 | - "user": "npm_refill", | |
| 44 | - "connector": "mysql" | |
| 45 | - }, | |
| 46 | - "smartquotation": { | |
| 47 | - "host": "server8.sourcecode.co.th", | |
| 48 | - "port": 3306, | |
| 49 | - "url": "", | |
| 50 | - "database": "smartquotation", | |
| 51 | - "password": "Bwa7Z6ZRosU4RuAH", | |
| 52 | - "name": "smartquotation", | |
| 53 | - "user": "npm_smtquot", | |
| 54 | - "connector": "mysql" | |
| 55 | - }, | |
| 56 | - "smartzone": { | |
| 57 | - "host": "server8.sourcecode.co.th", | |
| 58 | - "port": 3306, | |
| 59 | - "url": "", | |
| 60 | - "database": "smartzone", | |
| 61 | - "password": "pADobokFAoPC384B", | |
| 62 | - "name": "account", | |
| 63 | - "user": "npm_szv3", | |
| 64 | - "connector": "mysql" | |
| 65 | - }, | |
| 66 | - "smartzonev4": { | |
| 67 | - "host": "server8.sourcecode.co.th", | |
| 68 | - "port": 3306, | |
| 69 | - "url": "", | |
| 70 | - "database": "smartzonev4", | |
| 71 | - "password": "Q7TsWo7UNbCsi3sb", | |
| 72 | - "name": "smartzonev4", | |
| 73 | - "user": "npm_szv4", | |
| 74 | - "connector": "mysql" | |
| 75 | - }, | |
| 76 | - "thespecialdress": { | |
| 77 | - "host": "server8.sourcecode.co.th", | |
| 78 | - "port": 3306, | |
| 79 | - "url": "", | |
| 80 | - "database": "thespecialdress", | |
| 81 | - "password": "bXGhkLoTJ9atAx72", | |
| 82 | - "name": "thespecialdress", | |
| 83 | - "user": "npm_tsd", | |
| 84 | - "connector": "mysql" | |
| 85 | - }, | |
| 86 | - "thespecialdress_wp": { | |
| 87 | - "host": "server8.sourcecode.co.th", | |
| 88 | - "port": 3306, | |
| 89 | - "url": "", | |
| 90 | - "database": "thespecialdress_wp", | |
| 91 | - "password": "gAUmK7Jcvq4F7CUs", | |
| 92 | - "name": "thespecialdress_wp", | |
| 93 | - "user": "npm_tsdwp", | |
| 94 | - "connector": "mysql" | |
| 95 | - }, | |
| 96 | - "vtigercrm510": { | |
| 97 | - "host": "server8.sourcecode.co.th", | |
| 98 | - "port": 3306, | |
| 99 | - "url": "", | |
| 100 | - "database": "vtigercrm510", | |
| 101 | - "password": "X6UUfWM8GJEPBzv3", | |
| 102 | - "name": "vtigercrm510", | |
| 103 | - "user": "npm_vtiger", | |
| 104 | - "connector": "mysql" | |
| 105 | 25 | } |
| 106 | 26 | } | ... | ... |