├── light ├── detailres.aardio ├── data │ └── a.json ├── images │ ├── 卫龙.jpg │ ├── 008.jpg │ ├── 周黑鸭.jpg │ ├── 男士内裤.jpg │ ├── 雷蛇键盘.jpg │ ├── 361运动鞋.jpg │ ├── 李宁运动鞋.jpg │ └── lightsmile.png ├── session.aardio ├── testdb.aardio ├── dealorder.aardio ├── test.aardio ├── response.aardio ├── login.aardio ├── user.aardio ├── index.aardio ├── admin.aardio ├── detail.aardio └── js │ ├── jquery.spinner.js │ ├── bootstrap.min.js │ └── jquery-3.1.1.slim.min.js ├── lib ├── img.aardio ├── config.aardio └── dblink.aardio ├── .build └── default.main.aardio ├── .gitattributes ├── .gitignore ├── main.aardio ├── config └── app$.log └── default.aproj /light/detailres.aardio: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /light/data/a.json: -------------------------------------------------------------------------------- 1 | { 2 | "test":"haha", 3 | "test2":"adfsdasf" 4 | } -------------------------------------------------------------------------------- /light/images/卫龙.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/卫龙.jpg -------------------------------------------------------------------------------- /light/images/008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/008.jpg -------------------------------------------------------------------------------- /light/images/周黑鸭.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/周黑鸭.jpg -------------------------------------------------------------------------------- /light/images/男士内裤.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/男士内裤.jpg -------------------------------------------------------------------------------- /light/images/雷蛇键盘.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/雷蛇键盘.jpg -------------------------------------------------------------------------------- /light/images/361运动鞋.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/361运动鞋.jpg -------------------------------------------------------------------------------- /light/images/李宁运动鞋.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/李宁运动鞋.jpg -------------------------------------------------------------------------------- /lib/img.aardio: -------------------------------------------------------------------------------- 1 | namespace img{ 2 | path = function(res){ 3 | return "images/" ++ res ++".jpg"; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /light/images/lightsmile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smilelight/MyShoppingWeb/HEAD/light/images/lightsmile.png -------------------------------------------------------------------------------- /light/session.aardio: -------------------------------------------------------------------------------- 1 | namespace Seesion{ 2 | state = null; 3 | identity = null; 4 | username = null; 5 | password = null; 6 | email = null; 7 | phone = null; 8 | address = null; 9 | count = null; 10 | } 11 | -------------------------------------------------------------------------------- /light/testdb.aardio: -------------------------------------------------------------------------------- 1 | import console; 2 | import dblink; 3 | if(dblink.link()){ 4 | //console.log(dblink.login("user1","user1123")); 5 | //console.dump(dblink.queryUserInfo("user1")); 6 | dblink.test(); 7 | dblink.close(); 8 | } 9 | 10 | console.pause(true); -------------------------------------------------------------------------------- /.build/default.main.aardio: -------------------------------------------------------------------------------- 1 | //此触发器在生成EXE以后执行 2 | import ide; 3 | import fsys; 4 | 5 | //把main.aau复制到目标目录 6 | var pubMain = io.joinpath(ide.getPublisDir(),"/main.aardio"); 7 | if( !..io.exist(pubMain) ){ 8 | fsys.copy( io.joinpath( ide.getProjectDir(),"/main.aardio"),pubMain) 9 | } -------------------------------------------------------------------------------- /light/dealorder.aardio: -------------------------------------------------------------------------------- 1 | import dblink; 2 | var username = request.query("username"); 3 | var goodname = request.query("goodname"); 4 | var num = request.query("num"); 5 | import console; 6 | console.log(username,goodname,num); 7 | res = { 8 | result : dblink.newGoodOrder(username,goodname,num) 9 | } 10 | response.write(res); -------------------------------------------------------------------------------- /light/test.aardio: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Test 5 | 6 | 7 | 8 |
9 |
10 | 11 | 19 | 20 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /lib/config.aardio: -------------------------------------------------------------------------------- 1 | //config 配置文件 2 | import fsys.config; 3 | config = ..fsys.config("/config/"); 4 | 5 | //不需要序列化的配置名字前请添加下划线 6 | namespace config { 7 | __appName = "应用程序名"; 8 | __appVersion = "1.0.0.01"; 9 | __appDescription = "这是一个测试程序"; 10 | __website = "http://www.aardio.com/"; 11 | } 12 | 13 | /** 14 | config = ..fsys.config( 15 | ..fsys.joinpath( ..fsys.getSpecial( 0x1c /*_CSIDL_LOCAL_APPDATA*/ ),"应用程序名" ) 16 | ); 17 | **/ 18 | 19 | /**intellisense(config) 20 | __appName = 应用程序名 21 | __appVersion = 应用程序内部版本号 22 | __appDescription = 程序说明 23 | __website = 官方网站 24 | 25 | saveAll() = 写入所有配置到文件 26 | default.load() = 从配置文件(文件名"default")载入\n加载成功返回对象,加载失败返回null空值\n!fsys_table. 27 | default.save() = 存储到配置文件(文件名"default") 28 | default.mixin = @.mixin(\n 键名 = 值__;\n 键名 = 值;\n);//该数会自动调用save函数保存配置到文件 29 | default.属性名 = 自配置文件(文件名"default")读写属性\n属性值可以是支持序列化的普通变量,支持table对象.\n配置文件在首次使用时自动加载,退出程序时自动保存. 30 | end intellisense**/ 31 | -------------------------------------------------------------------------------- /light/response.aardio: -------------------------------------------------------------------------------- 1 | import dblink; 2 | if(request){ 3 | var username = request.query("username"); 4 | var password = request.query("password"); 5 | var result = dblink.login(username,password); 6 | if(!result ){ 7 | ?> 8 | 9 | 51 | -------------------------------------------------------------------------------- /light/login.aardio: -------------------------------------------------------------------------------- 1 | 2 | 3 | login 4 | 5 | 6 | 28 | 29 | 30 |
31 |
32 |
33 |

网上购物系统

34 |
35 |
36 | 37 |
38 |
39 | 40 |
41 | 42 | 43 | 44 | 忘记密码? 45 | 46 | 47 |

48 | 没有账号? 49 |

50 | 创建账号 51 |
52 |

53 | made by lightsmile 54 |

55 |
56 |
57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /config/app$.log: -------------------------------------------------------------------------------- 1 | 2 | {Line}:#22 3 | {File}:[string "..."]: 4 | ---------------------- 5 | 6 | {Attempt to}: _get table 7 | {Kind}:variable(local) 8 | {Name}:'server' 9 | {Type}:null 10 | 调用栈 11 | [string "..."]:22: in main chunk 12 | 13 | {Line}:#22 14 | {File}:[string "..."]: 15 | ---------------------- 16 | 17 | {Attempt to}: _get table 18 | {Kind}:variable(local) 19 | {Name}:'server' 20 | {Type}:null 21 | 调用栈 22 | [string "..."]:22: in main chunk 23 | 24 | {Line}:#22 25 | {File}:[string "..."]: 26 | ---------------------- 27 | 28 | {Attempt to}: _get table 29 | {Kind}:variable(local) 30 | {Name}:'server' 31 | {Type}:null 32 | 调用栈 33 | [string "..."]:22: in main chunk 34 | 35 | {Line}:#21 36 | {File}:[string "..."]: 37 | ---------------------- 38 | 39 | {Attempt to}: _get table 40 | {Kind}:variable(local) 41 | {Name}:'server' 42 | {Type}:null 43 | 调用栈 44 | [string "..."]:21: in main chunk 45 | 46 | {Line}:#21 47 | {File}:[string "..."]: 48 | ---------------------- 49 | 50 | {Attempt to}: _get table 51 | {Kind}:variable(local) 52 | {Name}:'server' 53 | {Type}:null 54 | 调用栈 55 | [string "..."]:21: in main chunk 56 | 57 | {Line}:#21 58 | {File}:[string "..."]: 59 | ---------------------- 60 | 61 | {Attempt to}: _get table 62 | {Kind}:variable(local) 63 | {Name}:'server' 64 | {Type}:null 65 | 调用栈 66 | [string "..."]:21: in main chunk 67 | 68 | {Line}:#21 69 | {File}:[string "..."]: 70 | ---------------------- 71 | 72 | {Attempt to}: _get table 73 | {Kind}:variable(local) 74 | {Name}:'server' 75 | {Type}:null 76 | 调用栈 77 | [string "..."]:21: in main chunk 78 | 79 | {Line}:#21 80 | {File}:[string "..."]: 81 | ---------------------- 82 | 83 | {Attempt to}: _get table 84 | {Kind}:variable(local) 85 | {Name}:'server' 86 | {Type}:null 87 | 调用栈 88 | [string "..."]:21: in main chunk 89 | -------------------------------------------------------------------------------- /default.aproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /light/user.aardio: -------------------------------------------------------------------------------- 1 | ?> 2 | 3 | 4 | user 5 | 6 | 7 | 60 | 61 | 62 |
63 |
64 | 首页 65 | 66 |
67 |
68 | 84 |
85 |
86 |
87 | 90 |
91 |
92 | 96 |
97 |
98 |
99 | 109 |

110 |

111 |

112 |
113 |
114 | 124 |

125 |

126 |

127 |

128 | 131 |
132 |
133 |
134 |
135 |
136 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /light/index.aardio: -------------------------------------------------------------------------------- 1 | ?> 2 | 3 | 4 | index 5 | 6 | 7 | 70 | 71 | 72 |
73 |
74 | 96 |
97 |
98 |
99 | 102 |
103 | 109 | 116 | 119 |
120 |
121 | 124 | 125 | 126 | 151 | 152 | -------------------------------------------------------------------------------- /light/admin.aardio: -------------------------------------------------------------------------------- 1 | 2 | 3 | admin 4 | 5 | 6 | 59 | 60 | 61 |
62 |
63 | 首页 64 | 65 |
66 |
67 | 83 |
84 |
85 |
86 | 89 |
90 |
91 | 96 |
97 |
98 |
99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 128 |
会员ID会员用户名会员密码会员邮箱会员地址会员电话会员账户余额
129 |
130 |
131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 158 |
商品ID商品类型商品名称剩余数量商品价格(¥)商品描述
159 |
160 |
161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 184 |
订单ID用户名商品名购买数量
185 |
186 |
187 |
188 |
189 |
190 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /light/detail.aardio: -------------------------------------------------------------------------------- 1 | if(request){ 2 | import dblink; 3 | var good = dblink.queryGoodInfo(request.query("goodname")); 4 | import img; 5 | ?> 6 | 7 | 8 | detail 9 | 10 | 11 | 101 | 102 | 103 |
104 |
105 | 首页 106 | 107 |
108 |
109 | 124 |
125 |
126 |
127 | 130 |
131 |
132 | 133 |
134 |

135 |

136 |
137 | 138 | 139 |
140 | - 141 | 142 | + 143 |
144 | 145 |
146 |
147 |
148 |
149 |
150 |
151 | 155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 166 | 167 | 168 | 169 | 179 | 213 | 214 | 215 | 0 ? parseFloat(v, 10) : parseInt(v, 10); 112 | 113 | // If the variable is a number 114 | if (isFinite(v)) { 115 | return v; 116 | } 117 | 118 | return v || this.options.min || 0; 119 | }, 120 | 121 | validate: function(val) { 122 | if (this.options.min !== null && val < this.min) { 123 | return -1; 124 | } 125 | 126 | if (this.options.max !== null && val > this.max) { 127 | return 1; 128 | } 129 | 130 | return 0; 131 | } 132 | }; 133 | 134 | Spinner = function(element, options) { 135 | this.$el = $(element); 136 | this.$spinning = this.$el.find('[data-spin="spinner"]'); 137 | 138 | if (this.$spinning.length === 0) { 139 | this.$spinning = this.$el.find(':input[type="text"]'); 140 | } 141 | 142 | options = $.extend({}, options, this.$spinning.data()); 143 | 144 | this.spinning = new Spinning(this.$spinning, options); 145 | 146 | this.$el 147 | .on('click.spinner', '[data-spin="up"], [data-spin="down"]', $.proxy(this, 'spin')) 148 | .on('mousedown.spinner', '[data-spin="up"], [data-spin="down"]', $.proxy(this, 'spin')); 149 | 150 | $(document).on('mouseup.spinner', $.proxy(function() { 151 | clearTimeout(this.spinTimeout); 152 | clearInterval(this.spinInterval); 153 | }, this)); 154 | 155 | if (options.delay) { 156 | this.delay(options.delay); 157 | } 158 | 159 | if (options.changed) { 160 | this.changed(options.changed); 161 | } 162 | 163 | if (options.changing) { 164 | this.changing(options.changing); 165 | } 166 | }; 167 | 168 | Spinner.delay = 500; 169 | 170 | Spinner.prototype = { 171 | constructor: Spinner, 172 | 173 | spin: function(e) { 174 | var dir = $(e.currentTarget).data('spin'); 175 | 176 | switch (e.type) { 177 | case 'click': 178 | e.preventDefault(); 179 | this.spinning.spin(dir); 180 | break; 181 | case 'mousedown': 182 | if (e.which === 1) { 183 | this.spinTimeout = setTimeout($.proxy(this, 'beginSpin', dir), 300); 184 | } 185 | break; 186 | } 187 | }, 188 | 189 | delay: function(ms) { 190 | var delay = Number(ms); 191 | 192 | if (delay >= 0) { 193 | this.constructor.delay = delay + 100; 194 | } 195 | }, 196 | 197 | value: function() { 198 | return this.spinning.value(); 199 | }, 200 | 201 | changed: function(fn) { 202 | this.bindHandler('changed.spinner', fn); 203 | }, 204 | 205 | changing: function(fn) { 206 | this.bindHandler('changing.spinner', fn); 207 | }, 208 | 209 | bindHandler: function(t, fn) { 210 | if ($.isFunction(fn)) { 211 | this.$spinning.on(t, fn); 212 | } 213 | else { 214 | this.$spinning.off(t); 215 | } 216 | }, 217 | 218 | beginSpin: function(dir) { 219 | this.spinInterval = setInterval($.proxy(this.spinning, 'spin', dir), 100); 220 | } 221 | }; 222 | 223 | var old = $.fn.spinner; 224 | 225 | $.fn.spinner = function(options, value) { 226 | return this.each(function() { 227 | var data = $.data(this, 'spinner'); 228 | 229 | if (!data) { 230 | data = new Spinner(this, options); 231 | 232 | $.data(this, 'spinner', data); 233 | } 234 | if (options === 'delay' || options === 'changed' || options === 'changing') { 235 | data[options](value); 236 | } 237 | else if (options === 'step' && value) { 238 | data.spinning.step = value; 239 | } 240 | else if (options === 'spin' && value) { 241 | data.spinning.spin(value); 242 | } 243 | }); 244 | }; 245 | 246 | $.fn.spinner.Constructor = Spinner; 247 | $.fn.spinner.noConflict = function() { 248 | $.fn.spinner = old; 249 | return this; 250 | }; 251 | 252 | $(function() { 253 | $('[data-trigger="spinner"]').spinner(); 254 | }); 255 | 256 | return $.fn.spinner; 257 | }); 258 | -------------------------------------------------------------------------------- /lib/dblink.aardio: -------------------------------------------------------------------------------- 1 | 2 | namespace dblink{ 3 | import sqlServer; 4 | db = null; 5 | err = null; 6 | link = function(){ 7 | db,err = sqlServer( 8 | server= ".\SQLEXPRESS"; 9 | database= "WebShop"; 10 | uid = "light"; 11 | pwd= "123"; 12 | ); 13 | if (!db) { 14 | return false; 15 | } 16 | return true; 17 | } 18 | 19 | close = function(){ 20 | if (db) { 21 | db.close(); 22 | } 23 | } 24 | 25 | test = function(){ 26 | import console; 27 | try{ 28 | for(rs,fields in db.each("SELECT * FROM admin") ){ 29 | if (rs) { 30 | console.log("adimn works!"); 31 | break ; 32 | } 33 | } 34 | for(rs,fields in db.each("SELECT * FROM good") ){ 35 | if (rs) { 36 | console.log("good works!"); 37 | break ; 38 | } 39 | } 40 | for(rs,fields in db.each("SELECT * FROM goodtype") ){ 41 | if (rs) { 42 | console.log("goodtype works!"); 43 | break ; 44 | } 45 | } 46 | for(rs,fields in db.each("SELECT * FROM customer") ){ 47 | if (rs) { 48 | console.log("customer works!"); 49 | break ; 50 | } 51 | } 52 | 53 | for(rs,fields in db.each("SELECT * FROM goodorder") ){ 54 | if (rs) { 55 | console.log("order works!"); 56 | break ; 57 | } 58 | } 59 | }catch (e) { 60 | console.log(e); 61 | } 62 | } 63 | 64 | 65 | login = function(username,password){ 66 | link(); 67 | var tabadmin = db.getTable("SELECT * FROM admin"); 68 | for(k,v in tabadmin){ 69 | if(v.username == username && v.password == password){ 70 | return "admin"; 71 | } 72 | 73 | } 74 | var tabcustomer = db.getTable("SELECT * FROM customer"); 75 | for(k,v in tabcustomer){ 76 | if(v.username == username && v.password == password){ 77 | return "user"; 78 | } 79 | 80 | } 81 | close(); 82 | return null; 83 | } 84 | 85 | queryUserInfo = function(username){ 86 | link(); 87 | var tabcustomer = db.getTable("SELECT * FROM customer"); 88 | for(k,v in tabcustomer){ 89 | if(v.username == username){ 90 | return v; 91 | } 92 | } 93 | close(); 94 | return null; 95 | } 96 | 97 | queryGoodInfo = function(goodname){ 98 | link(); 99 | var tabgood = db.getTable("SELECT * FROM good"); 100 | for(k,v in tabgood){ 101 | if(v.goodname == goodname){ 102 | //v.type = db.getTable("SELECT type FROM goodtype WHERE id = "++v.type)[1].type; 103 | return v; 104 | } 105 | } 106 | close(); 107 | return null; 108 | } 109 | 110 | goodInfo = function(){ 111 | link(); 112 | var goodinfo = db.getTable("SELECT * FROM good"); 113 | import console; 114 | for(k,v in goodinfo){ 115 | //console.log(type(v.type),":",v.type); 116 | } 117 | var goodtype = null; 118 | var goodtypelist = db.getTable("SELECT * FROM goodtype"); 119 | for(k,v in goodtypelist){ 120 | ..console.dump(v); 121 | } 122 | for(i=1;#goodinfo;1){ 123 | for(k,v in goodtypelist){ 124 | if(goodinfo[i].type == v.id){ 125 | goodinfo[i].type = v.type; 126 | } 127 | } 128 | } 129 | return goodinfo; 130 | close(); 131 | } 132 | 133 | userInfo = function(){ 134 | link(); 135 | return db.getTable("SELECT * FROM customer"); 136 | close(); 137 | } 138 | 139 | orderInfo = function(){ 140 | link(); 141 | var orderinfo = db.getTable("SELECT * FROM goodorder"); 142 | var goodlist = db.getTable("SELECT * FROM good"); 143 | for(k,v in goodlist){ 144 | ..console.dump(v); 145 | } 146 | for(i=1;#orderinfo;1){ 147 | for(k,v in goodlist){ 148 | if(orderinfo[i].goodid == v.id){ 149 | orderinfo[i].goodid = v.goodname; 150 | } 151 | } 152 | } 153 | var userlist = db.getTable("SELECT * FROM customer"); 154 | for(k,v in userlist){ 155 | ..console.dump(v); 156 | } 157 | for(i=1;#orderinfo;1){ 158 | for(k,v in userlist){ 159 | if(orderinfo[i].userid == v.id){ 160 | orderinfo[i].userid = v.username; 161 | } 162 | } 163 | } 164 | return orderinfo; 165 | close(); 166 | } 167 | 168 | queryOrderInfo = function(username){ 169 | link(); 170 | var orderinfo = db.getTable("SELECT * FROM goodorder"); 171 | var goodlist = db.getTable("SELECT * FROM good"); 172 | for(k,v in goodlist){ 173 | ..console.dump(v); 174 | } 175 | for(i=1;#orderinfo-1;1){ 176 | for(k,v in goodlist){ 177 | if(orderinfo[i].goodid == v.id){ 178 | orderinfo[i].goodid = v.goodname; 179 | } 180 | } 181 | } 182 | var userlist = db.getTable("SELECT * FROM customer"); 183 | for(k,v in userlist){ 184 | ..console.dump(v); 185 | } 186 | for(i=1;#orderinfo-1;1){ 187 | for(k,v in userlist){ 188 | if(orderinfo[i].userid == v.id){ 189 | orderinfo[i].userid = v.username; 190 | } 191 | } 192 | } 193 | var neworderinfo = {}; 194 | for(k,v in orderinfo){ 195 | if(v.userid == username){ 196 | ..table.push(neworderinfo,v); 197 | } 198 | } 199 | return neworderinfo; 200 | close(); 201 | } 202 | newGoodOrder = function(username,goodname,num){ 203 | link(); 204 | import console; 205 | var count = tonumber(db.getTable("SELECT count FROM customer WHERE username = '%s'",username)[1].count); 206 | ..console.log("count:",db.getTable("SELECT count FROM customer WHERE username = '%s'",username)[1].count); 207 | ..console.dump(db.getTable("SELECT count FROM customer WHERE username = '%s'",username)); 208 | var price = tonumber(db.getTable("SELECT price FROM good WHERE goodname = '%s'",goodname)[1].price); 209 | ..console.log("price:",price); 210 | var leftnum = tonumber(db.getTable("SELECT leftnum FROM good WHERE goodname = '%s'",goodname)[1].leftnum); 211 | ..console.log("leftnum:",leftnum); 212 | var goodid = tonumber(db.getTable("SELECT id FROM good WHERE goodname = '%s'",goodname)[1].id); 213 | ..console.log("goodid:",goodid); 214 | num = tonumber(num); 215 | if(leftnum < num){ 216 | return false; 217 | } 218 | elseif(count < price * num){ 219 | return false; 220 | } 221 | else { 222 | //改 223 | count = count - price * num; 224 | leftnum = leftnum - num; 225 | var onum = num; 226 | var ogoodid = goodid; 227 | db.exec("update customer set count='%s' WHERE username='%s' ",tostring(count),username); 228 | db.exec("update good set leftnum='%s' WHERE goodname='%s' ",tostring(leftnum),goodname); 229 | var ouserid = db.getTable("SELECT id FROM customer WHERE username = '%s'",username)[1].id; 230 | var orderlist = db.getTable("SELECT * FROM goodorder"); 231 | var goodorder = orderlist[#orderlist].id; 232 | goodorder = tostring(tonumber(goodorder) + 1); 233 | db.exec( "INSERT INTO goodorder(id,userid,goodid,num) VALUES(@id,@userid,@goodid,@num)",{ 234 | id = goodorder; 235 | userid = ouserid; 236 | goodid = ogoodid; 237 | num = onum; 238 | } ); 239 | return true; 240 | } 241 | close(); 242 | 243 | } 244 | 245 | 246 | } 247 | /** 248 | import sqlServer; 249 | import console; 250 | 251 | //创建数据库 252 | var db,err = sqlServer( 253 | server= ".\SQLEXPRESS"; 254 | database= "WebShop"; 255 | uid = "light"; 256 | pwd= "123"; 257 | ) 258 | assert( db,err ); 259 | 260 | /* 261 | //创建表 262 | if(!db.existsTable("homepage2") ){ 263 | db.exec("create table homepage2 (url char(30), comment char(20))") 264 | } 265 | 266 | //使用命令参数 - 参数化可避免SQL注入 267 | var cmd = db.createCommand( "INSERT INTO homepage2(url,comment) VALUES(@url,@comment)" ); 268 | cmd.bind("homepage2").parameters( 269 | url = "http://www.ecranesoft.com"; 270 | comment = "hi!"; 271 | ) 272 | cmd.Execute() //执行命令 273 | 274 | //增 - 调用 access.formatParameter() 格式化命名参数生成SQL语句 275 | db.exec( "INSERT INTO homepage2(url,comment) VALUES(@url,@comment)",{ 276 | url = "http://www.aardio.net"; 277 | comment = "字符串包含'单引号' 测试一下" 278 | } ) 279 | 280 | //删 - 自动调用 string.format() 函数格式化SQL语句,简单拼接字符串应避免包含单引号 281 | db.exec("delete from homepage2 where url='%s'","http://www.ecranesoft.com"); 282 | 283 | //改 284 | db.exec("update homepage2 set url='%s' WHERE comment='%s' ","http://www.aardio.com","这是说明") 285 | 286 | //查 287 | for(rs,fields in db.each("SELECT * FROM good") ){ 288 | console.log( rs("goodname").value,rs("price").value ) 289 | } 290 | 291 | */ 292 | /* 293 | //将查询结果转换为普通数组 294 | var tab = db.getTable("SELECT goodname FROM good where price = 200"); 295 | console.varDump(tab); 296 | */ 297 | 298 | 299 | for(rs,fields in db.each("SELECT * FROM good") ){ 300 | console.log( rs("goodname").value,rs("price").value ) 301 | } 302 | //关闭数据库连接 303 | db.close(); 304 | console.pause(); 305 | **/ -------------------------------------------------------------------------------- /light/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.0 (http://getbootstrap.com) 3 | * Copyright 2011-2014 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.0",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus","focus"==b.type)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.0",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c="prev"==a?-1:1,d=this.getItemIndex(b),e=(d+c)%this.$items.length;return this.$items.eq(e)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i="next"==b?"first":"last",j=this;if(!f.length){if(!this.options.wrap)return;f=this.$element.find(".item")[i]()}if(f.hasClass("active"))return this.sliding=!1;var k=f[0],l=a.Event("slide.bs.carousel",{relatedTarget:k,direction:h});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var m=a(this.$indicators.children()[this.getItemIndex(f)]);m&&m.addClass("active")}var n=a.Event("slid.bs.carousel",{relatedTarget:k,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),j.sliding=!1,setTimeout(function(){j.$element.trigger(n)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(n)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a(this.options.trigger).filter('[href="#'+b.id+'"], [data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.0",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0,trigger:'[data-toggle="collapse"]'},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.find("> .panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":a.extend({},e.data(),{trigger:this});c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('