define(["ember","appuser","broad","moment"],function(a,b,c,d){return{url:"http://apibbc.youjiaoyun.net/api.aspx",send:function(b){var d=this;return b.method&&(b.data.Method=b.method,delete b.method),b.type||(b.type="POST"),b.type="POST",new a.RSVP.Promise(function(e,f){var g=d.ajaxOptions(b);g.success=function(b){b.Success?(b.Data&&"string"==a.typeOf(b.Data)&&(b.Data=JSON.parse(b.Data)),a.run(null,e,b.Data)):(console.log(b),"Token已过期!"==b.Result&&(b.tokenExpired=!0,c.trigger("tokenExpired",b)),b.message=b.Result,a.run(null,f,b))},g.error=function(b,c){console.log(b),a.run(null,f,{code:c,message:"error"==c?"服务器连接失败":b.responseText?b.responseText:c})},a.$.ajax(g)},"ajax "+b.type+" to "+b.url)},ajaxOptions:function(a){var c=a||{};return c.url||(c.url=this.url),c.dataType="json",c.data=$.extend({AppKey:"SGA_APPKEY",AppCode:"SGA",Format:"Json",Method:"",Timestamp:d().format("YYYY-MM-DD hh:mm:ss"),Version:"1.0",Signature:"12B66E52E52216D7124E77C4EC1EA42C"},c.data),b.get("Token")&&(c.data.Token=b.get("Token")),c}}});