/**
* 配置相关api
* 使用: seajs.use("dbfen/client/api/user", function(User){
	
		User.login({userId:33});
	});
*@author kenny
*/
(function() {
	define("dbfen/client/api/device", function(require, exports, module) {
		var dbfen = require("dbfen/client/com/dbfen");
		var Module = {
			//取配置信息
			get: function(callback) {
				dbfen.ajax({
					url: "/device/get",
					data: {},
					success: callback
				});
			},
			//设置配置信息
			set: function(info, callback){
				info.encrptKey = (info.encrptKey||"").trim();
				/*if(!/^[0-9a-zA-Z]+$/.test(info.encrptKey)){
					return callback({
						code: 101,
						msg: '密匙只能包含英文字母和数字'
					});
				}
				if(info.encrptKey.length != 16){
					return callback({
						code: 102,
						msg: '密匙长度要有16位'
					});
				}*/
				dbfen.ajax({
					url:"/device/set",
					data: info,
					success: callback
				});
			}
		};
		module.exports = Module;
	});

})();