Skip to content

Commit 8e0f07a

Browse files
author
agile.zhou
committed
Update Chinese to English
1 parent 03be3c5 commit 8e0f07a

File tree

22 files changed

+1430
-139
lines changed

22 files changed

+1430
-139
lines changed

src/AgileConfig.Server.Apisite/Controllers/AdminController.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Threading.Tasks;
33
using AgileConfig.Server.Apisite.Models;
44
using AgileConfig.Server.Common;
5+
using AgileConfig.Server.Common.Resources;
56
using AgileConfig.Server.Data.Entity;
67
using AgileConfig.Server.IService;
78
using Microsoft.AspNetCore.Authentication;
@@ -56,7 +57,7 @@ public async Task<IActionResult> Login4AntdPro([FromBody] LoginVM model)
5657
return Json(new
5758
{
5859
status = "error",
59-
message = "密码不能为空"
60+
message = Messages.PasswordCannotBeEmpty
6061
});
6162
}
6263

@@ -70,7 +71,7 @@ public async Task<IActionResult> Login4AntdPro([FromBody] LoginVM model)
7071
return Json(new
7172
{
7273
status = "error",
73-
message = "密码错误"
74+
message = Messages.PasswordError
7475
});
7576
}
7677

@@ -146,7 +147,7 @@ public async Task<IActionResult> OidcLoginByCode(string code)
146147
return Json(new
147148
{
148149
status = "error",
149-
message = "该用户已被删除"
150+
message = Messages.UserDeleted
150151
});
151152
}
152153

@@ -183,7 +184,7 @@ public IActionResult InitPassword([FromBody] InitPasswordVM model)
183184
{
184185
return Json(new
185186
{
186-
message = "密码不能为空",
187+
message = Messages.PasswordCannotBeEmpty,
187188
success = false
188189
});
189190
}
@@ -192,7 +193,7 @@ public IActionResult InitPassword([FromBody] InitPasswordVM model)
192193
{
193194
return Json(new
194195
{
195-
message = "密码最长不能超过50位",
196+
message = Messages.PasswordMaxLength50,
196197
success = false
197198
});
198199
}
@@ -201,7 +202,7 @@ public IActionResult InitPassword([FromBody] InitPasswordVM model)
201202
{
202203
return Json(new
203204
{
204-
message = "输入的两次密码不一致",
205+
message = Messages.PasswordMismatch,
205206
success = false
206207
});
207208
}
@@ -210,7 +211,7 @@ public IActionResult InitPassword([FromBody] InitPasswordVM model)
210211
{
211212
return Json(new
212213
{
213-
message = "密码已经设置过,不需要再次设置",
214+
message = Messages.PasswordAlreadySet,
214215
success = false
215216
});
216217
}
@@ -230,7 +231,7 @@ public IActionResult InitPassword([FromBody] InitPasswordVM model)
230231
{
231232
return Json(new
232233
{
233-
message = "初始化密码失败",
234+
message = Messages.InitPasswordFailed,
234235
success = false
235236
});
236237
}
@@ -245,7 +246,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
245246
return Json(new
246247
{
247248
success = false,
248-
message = "演示模式请勿修改管理密码"
249+
message = Messages.DemoModeNoPasswordChange
249250
});
250251
}
251252

@@ -257,7 +258,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
257258
{
258259
return Json(new
259260
{
260-
message = "原始密码不能为空",
261+
message = Messages.OriginalPasswordCannotBeEmpty,
261262
err_code = "err_resetpassword_01",
262263
success = false
263264
});
@@ -270,7 +271,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
270271
{
271272
return Json(new
272273
{
273-
message = "原始密码错误,请重新再试",
274+
message = Messages.OriginalPasswordError,
274275
err_code = "err_resetpassword_02",
275276
success = false
276277
});
@@ -280,7 +281,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
280281
{
281282
return Json(new
282283
{
283-
message = "新密码不能为空",
284+
message = Messages.NewPasswordCannotBeEmpty,
284285
err_code = "err_resetpassword_03",
285286
success = false
286287
});
@@ -290,7 +291,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
290291
{
291292
return Json(new
292293
{
293-
message = "新密码最长不能超过50位",
294+
message = Messages.NewPasswordMaxLength50,
294295
err_code = "err_resetpassword_04",
295296
success = false
296297
});
@@ -300,7 +301,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
300301
{
301302
return Json(new
302303
{
303-
message = "输入的两次新密码不一致",
304+
message = Messages.NewPasswordMismatch,
304305
err_code = "err_resetpassword_05",
305306
success = false
306307
});
@@ -313,7 +314,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
313314
{
314315
return Json(new
315316
{
316-
message = "未找到对应的用户",
317+
message = Messages.UserNotFound,
317318
err_code = "err_resetpassword_06",
318319
success = false
319320
});
@@ -335,7 +336,7 @@ public async Task<IActionResult> ChangePassword([FromBody] ChangePasswordVM mode
335336
{
336337
return Json(new
337338
{
338-
message = "修改密码失败",
339+
message = Messages.ChangePasswordFailed,
339340
success = false
340341
});
341342
}

src/AgileConfig.Server.Apisite/Controllers/AppController.cs

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using AgileConfig.Server.Common.EventBus;
1313
using AgileConfig.Server.Event;
1414
using AgileConfig.Server.Apisite.Models.Mapping;
15+
using AgileConfig.Server.Common.Resources;
1516

1617
namespace AgileConfig.Server.Apisite.Controllers
1718
{
@@ -40,12 +41,12 @@ public async Task<IActionResult> Search(string name, string id, string group, st
4041
{
4142
if (current < 1)
4243
{
43-
throw new ArgumentException("current cant less then 1 .");
44+
throw new ArgumentException(Messages.CurrentCannotBeLessThanOne);
4445
}
4546

4647
if (pageSize < 1)
4748
{
48-
throw new ArgumentException("pageSize cant less then 1 .");
49+
throw new ArgumentException(Messages.PageSizeCannotBeLessThanOne);
4950
}
5051

5152
var appListVms = new List<AppListVM>();
@@ -124,7 +125,7 @@ public async Task<IActionResult> Add([FromBody] AppVM model)
124125
return Json(new
125126
{
126127
success = false,
127-
message = "应用Id已存在,请重新输入。"
128+
message = Messages.AppIdExists
128129
});
129130
}
130131

@@ -148,16 +149,11 @@ public async Task<IActionResult> Add([FromBody] AppVM model)
148149
}
149150

150151
var result = await _appService.AddAsync(app, inheritanceApps);
151-
if (result)
152-
{
153-
_tinyEventBus.Fire(new AddAppSuccessful(app, this.GetCurrentUserName()));
154-
}
155-
156152
return Json(new
157153
{
158154
data = app,
159155
success = result,
160-
message = !result ? "新建应用失败,请查看错误日志" : ""
156+
message = !result ? Messages.CreateAppFailed : ""
161157
});
162158
}
163159

@@ -173,7 +169,7 @@ public async Task<IActionResult> Edit([FromBody] AppVM model)
173169
return Json(new
174170
{
175171
success = false,
176-
message = "未找到对应的应用程序。"
172+
message = Messages.AppNotFound
177173
});
178174
}
179175

@@ -182,13 +178,12 @@ public async Task<IActionResult> Edit([FromBody] AppVM model)
182178
return Json(new
183179
{
184180
success = false,
185-
message = "演示模式请勿修改Test_App"
181+
message = Messages.DemoModeNoTestAppEdit
186182
});
187183
}
188184

189-
model.ToApp(app);
185+
app = model.ToApp(app);
190186
app.UpdateTime = DateTime.Now;
191-
192187
var inheritanceApps = new List<AppInheritanced>();
193188
if (!model.Inheritanced && model.inheritancedApps != null)
194189
{
@@ -205,37 +200,11 @@ public async Task<IActionResult> Edit([FromBody] AppVM model)
205200
});
206201
}
207202

208-
var result = await _appService.UpdateAsync(app, inheritanceApps);
209-
if (result)
210-
{
211-
_tinyEventBus.Fire(new EditAppSuccessful(app, this.GetCurrentUserName()));
212-
}
213-
203+
var result = await _appService.UpdateAsync(app,inheritanceApps);
214204
return Json(new
215205
{
216206
success = result,
217-
message = !result ? "修改应用失败,请查看错误日志" : ""
218-
});
219-
}
220-
221-
[HttpGet]
222-
public async Task<IActionResult> All()
223-
{
224-
var apps = await _appService.GetAllAppsAsync();
225-
var vms = new List<AppListVM>();
226-
foreach (var app in apps)
227-
{
228-
var vm = app.ToAppListVM();
229-
vm.inheritancedAppNames = app.Type == AppType.Inheritance
230-
? new List<string>()
231-
: (await _appService.GetInheritancedAppsAsync(app.Id)).Select(ia => ia.Id).ToList();
232-
vms.Add(vm);
233-
}
234-
235-
return Json(new
236-
{
237-
success = true,
238-
data = vms
207+
message = !result ? Messages.UpdateAppFailed : ""
239208
});
240209
}
241210

@@ -256,7 +225,7 @@ public async Task<IActionResult> Get(string id)
256225
return NotFound(new
257226
{
258227
success = false,
259-
message = "未找到对应的应用程序。"
228+
message = Messages.AppNotFound
260229
});
261230
}
262231

@@ -267,11 +236,6 @@ public async Task<IActionResult> Get(string id)
267236
});
268237
}
269238

270-
/// <summary>
271-
/// 在启动跟禁用之间进行切换
272-
/// </summary>
273-
/// <param name="id"></param>
274-
/// <returns></returns>
275239
[TypeFilter(typeof(PermissionCheckAttribute),
276240
Arguments = new object[] { "App.DisableOrEnable", Functions.App_Edit })]
277241
[HttpPost]
@@ -285,23 +249,17 @@ public async Task<IActionResult> DisableOrEnable(string id)
285249
return NotFound(new
286250
{
287251
success = false,
288-
message = "未找到对应的应用程序。"
252+
message = Messages.AppNotFound
289253
});
290254
}
291255

292256
app.Enabled = !app.Enabled;
293-
294257
var result = await _appService.UpdateAsync(app);
295258

296-
if (result)
297-
{
298-
_tinyEventBus.Fire(new DisableOrEnableAppSuccessful(app, this.GetCurrentUserName()));
299-
}
300-
301259
return Json(new
302260
{
303261
success = result,
304-
message = !result ? "修改应用失败,请查看错误日志" : ""
262+
message = !result ? Messages.UpdateAppFailed : ""
305263
});
306264
}
307265

@@ -317,7 +275,7 @@ public async Task<IActionResult> Delete(string id)
317275
return NotFound(new
318276
{
319277
success = false,
320-
message = "未找到对应的应用程序。"
278+
message = Messages.AppNotFound
321279
});
322280
}
323281

@@ -331,7 +289,7 @@ public async Task<IActionResult> Delete(string id)
331289
return Json(new
332290
{
333291
success = result,
334-
message = !result ? "修改应用失败,请查看错误日志" : ""
292+
message = !result ? Messages.UpdateAppFailed : ""
335293
});
336294
}
337295

0 commit comments

Comments
 (0)