Skip to content

Commit

Permalink
优化UI,创意工坊加入工具选择
Browse files Browse the repository at this point in the history
  • Loading branch information
MayDay-wpf committed May 9, 2024
1 parent 8f20958 commit 078b6c4
Show file tree
Hide file tree
Showing 37 changed files with 725 additions and 158 deletions.
32 changes: 29 additions & 3 deletions aibotPro/aibotPro/Controllers/PayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using RestSharp.Authenticators;
using System.Text.RegularExpressions;

namespace aibotPro.Controllers
{
Expand Down Expand Up @@ -69,7 +70,12 @@ public IActionResult Return(string money, string out_trade_no, string trade_stat
PayResultDto payRes = _financeService.PayResult(out_trade_no);
if (payRes.status == "1")
{
var username = _systemService.UrlDecode(param.Split('|')[1]);
var username = GetMail(_systemService.UrlDecode(param));
if (username == null)
{
_systemService.WriteLogUnAsync("在支付结果回调时,账号出现null", Dtos.LogLevel.Fatal, "system");
return Ok("fail");
}
string goodCode = string.Empty;
if (_systemService.UrlDecode(param).Split('|').Length == 3)
goodCode = _systemService.UrlDecode(param).Split('|')[0];
Expand Down Expand Up @@ -271,12 +277,32 @@ public IActionResult Return(string money, string out_trade_no, string trade_stat
return Redirect("/Pay/PayRes?success=0");
}
}
//VIP%7C15%7Cmaymay5jace%2540gmail.com
static string GetMail(string str)
{
// 使用正则表达式匹配邮箱
Regex regex = new Regex(@"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b");
Match match = regex.Match(str);
if (match.Success)
{
return match.Value; // 返回匹配的邮箱
}
else
{
return null;
}
}
public IActionResult Notify(string money, string out_trade_no, string trade_status, string param)
{
PayResultDto payRes = _financeService.PayResult(out_trade_no);
if (payRes.status == "1")
{
var username = _systemService.UrlDecode(param.Split('|')[1]);
var username = GetMail(_systemService.UrlDecode(param));
if (username == null)
{
_systemService.WriteLogUnAsync("在支付结果回调时,账号出现null", Dtos.LogLevel.Fatal, "system");
return Ok("fail");
}
string goodCode = string.Empty;
if (_systemService.UrlDecode(param).Split('|').Length == 3)
goodCode = _systemService.UrlDecode(param).Split('|')[0];
Expand Down Expand Up @@ -438,7 +464,7 @@ public IActionResult Notify(string money, string out_trade_no, string trade_stat
_context.VIPs.Add(vip);
}
}

_financeService.UpdateGoodsStock(goodCode, 1);
_context.Users.Update(user);
order.OrderStatus = "YES";
_context.Orders.Update(order);
Expand Down
16 changes: 15 additions & 1 deletion aibotPro/aibotPro/Controllers/WorkShopController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public IActionResult PostPlugin(WorkShopPlugin plugin)
_context.PluginsParams.RemoveRange(oldParam);
}
//删除原有的Json模板
var oldPrJson=_context.PluginsJsonPrs.Where(x => x.PrCode == oldPlugin.Pcode);
var oldPrJson = _context.PluginsJsonPrs.Where(x => x.PrCode == oldPlugin.Pcode);
if (oldPrJson != null)
{
_context.PluginsJsonPrs.RemoveRange(oldPrJson);
Expand Down Expand Up @@ -386,6 +386,20 @@ public IActionResult GetMyInstall()
}
[Authorize]
[HttpPost]
public IActionResult SetMandatoryHit(int id, bool mustHit)
{
string username = _jwtTokenManager.ValidateToken(Request.Headers["Authorization"].ToString().Replace("Bearer ", "")).Identity?.Name;
bool status = _workShop.SetMandatoryHit(username, id, mustHit);
//返回数据
return Json(new
{
success = status,
msg = status ? "更新成功" : "更新失败"
});

}
[Authorize]
[HttpPost]
//获取自己的插件列表
public IActionResult GetMyPlugins()
{
Expand Down
31 changes: 31 additions & 0 deletions aibotPro/aibotPro/Dtos/PluginDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace aibotPro.Dtos
{
public class PluginDto
{
public int Id { get; set; }
public int InstallId { get; set; }
public string Pcode { get; set; }
public string Account { get; set; }
public string Pavatar { get; set; }
public string Pnickname { get; set; }
public string Pfunctionname { get; set; }
public string Pfunctioninfo { get; set; }
public string Popensource { get; set; }
public decimal? Pluginprice { get; set; }
public string Pcodemodel { get; set; }
public string Papiurl { get; set; }
public string Pmethod { get; set; }
public string ParamCode { get; set; }
public string PheadersCode { get; set; }
public string PcookiesCode { get; set; }
public string Pjscode { get; set; }
public string PrunLocation { get; set; }
public string Pusehtml { get; set; }
public string IsPublic { get; set; }
public DateTime? CreateTime { get; set; }
public bool? MustHit { get; set; }
}
}
1 change: 1 addition & 0 deletions aibotPro/aibotPro/Dtos/PluginResDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public class PluginResDto
{
public string result { get; set; }
public string dallprompt { get; set; }
public bool doubletreating { get; set; } = true;
public string doubletype { get; set; }
public string errormsg { get; set; }
Expand Down
1 change: 1 addition & 0 deletions aibotPro/aibotPro/Interface/ISystemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ public interface ISystemService
bool CreateSystemCfg();//创建系统配置
bool SaveSystemUI(UISettingDto uISettingDto, string account);//保存系统UI配置
UISettingDto GetSystemUI(string account);//获取系统UI配置
void CopyPropertiesTo<T, TU>(T source, TU dest);//反射赋值
}
}
6 changes: 5 additions & 1 deletion aibotPro/aibotPro/Interface/IWorkShop.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using aibotPro.Dtos;
using aibotPro.Models;
using OpenAI.ObjectModels.RequestModels;
using System.Security.Principal;

namespace aibotPro.Interface
{
Expand Down Expand Up @@ -28,7 +29,7 @@ public interface IWorkShop
WorkShopPlugin GetPlugin(int pluginId, string account, string pcode = "", string pfunctionName = "");

//获取插件安装列表
List<Plugin> GetPluginInstall(string account);
List<PluginDto> GetPluginInstall(string account);

//获取插件的参数列表
List<PluginParamDto> GetPluginParams(int pluginId);
Expand All @@ -45,5 +46,8 @@ public interface IWorkShop

//获取工作流节点数据
Task<string> GetWorkFlowNodeData(string workflowcode);

//更新插件的命中
bool SetMandatoryHit(string account,int id, bool mustHit);
}
}
5 changes: 5 additions & 0 deletions aibotPro/aibotPro/Models/AIBotProContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.ToView("IPlook_Stats_View");
});

modelBuilder.Entity<PluginsInstall>(entity =>
{
entity.Property(e => e.MustHit).HasDefaultValueSql("((0))");
});

modelBuilder.Entity<UISetting>(entity =>
{
entity.Property(e => e.Id).ValueGeneratedNever();
Expand Down
1 change: 1 addition & 0 deletions aibotPro/aibotPro/Models/PluginsInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public partial class PluginsInstall
public string Account { get; set; }
[StringLength(50)]
public string PluginsCode { get; set; }
public bool? MustHit { get; set; }
[Column(TypeName = "datetime")]
public DateTime? CreateTime { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\VSdemoPush\AIBotPRO</_PublishTargetUrl>
<History>True|2024-04-13T11:21:59.0302533Z;True|2024-04-13T18:58:28.9264697+08:00;True|2024-04-13T05:33:26.4813048+08:00;True|2024-04-13T05:13:20.9770193+08:00;True|2024-04-10T02:24:18.6295740+08:00;True|2024-04-10T00:39:48.6198222+08:00;True|2024-04-08T00:24:19.4359801+08:00;True|2024-04-07T23:50:43.6071658+08:00;True|2024-04-07T01:12:26.5533469+08:00;True|2024-04-07T00:43:56.5552998+08:00;True|2024-04-07T00:39:21.3379439+08:00;True|2024-04-06T17:21:04.3043952+08:00;True|2024-04-05T02:55:32.9429986+08:00;True|2024-04-04T04:07:41.2501774+08:00;True|2024-04-04T03:53:10.8291446+08:00;True|2024-04-03T22:43:45.5710990+08:00;True|2024-04-03T00:10:26.4855901+08:00;True|2024-04-02T23:33:44.5375815+08:00;True|2024-04-02T02:07:31.8671366+08:00;True|2024-04-02T01:57:06.9534372+08:00;True|2024-04-02T00:36:02.0548374+08:00;True|2024-04-02T00:15:55.8075496+08:00;True|2024-04-01T23:57:31.1397373+08:00;True|2024-04-01T23:52:36.9511083+08:00;True|2024-04-01T23:40:50.9679343+08:00;True|2024-03-25T22:59:45.7135876+08:00;True|2024-03-25T01:37:33.2347496+08:00;True|2024-03-21T01:10:45.8809381+08:00;True|2024-03-20T23:42:34.4221941+08:00;True|2024-03-19T22:19:17.3268675+08:00;True|2024-03-19T22:15:25.0722518+08:00;True|2024-03-19T22:08:15.4905716+08:00;True|2024-03-19T01:04:44.9760500+08:00;True|2024-03-17T23:39:34.0352088+08:00;True|2024-03-17T08:31:23.5063725+08:00;True|2024-03-17T06:37:59.4183114+08:00;True|2024-03-17T06:37:27.0050941+08:00;True|2024-03-17T06:32:51.6628157+08:00;True|2024-03-17T06:03:58.9767100+08:00;True|2024-03-17T05:09:18.9285417+08:00;True|2024-03-17T05:03:51.1403040+08:00;True|2024-03-15T21:54:20.7306218+08:00;True|2024-03-15T02:27:06.3007171+08:00;True|2024-03-15T02:18:16.5382941+08:00;True|2024-03-15T02:16:34.5159231+08:00;True|2024-03-15T01:47:40.6505319+08:00;True|2024-03-15T01:38:52.4149526+08:00;True|2024-03-13T22:26:16.3031907+08:00;True|2024-03-13T17:22:18.3512709+08:00;True|2024-03-13T10:21:25.5131621+08:00;True|2024-03-11T17:34:04.8687102+08:00;True|2024-03-11T17:26:27.3873869+08:00;True|2024-03-08T17:17:06.8450054+08:00;True|2024-03-08T11:37:37.1180423+08:00;True|2024-03-07T15:56:21.1999674+08:00;True|2024-03-05T01:10:10.0710862+08:00;True|2024-03-04T14:01:44.6177022+08:00;True|2024-03-03T19:55:06.1013727+08:00;True|2024-03-03T18:15:37.8484692+08:00;True|2024-03-03T12:21:48.1679155+08:00;True|2024-03-03T00:16:48.7641081+08:00;True|2024-03-02T04:52:08.4562277+08:00;True|2024-03-02T04:40:24.4469334+08:00;True|2024-03-02T04:19:45.9907382+08:00;True|2024-03-02T03:44:02.2101754+08:00;True|2024-03-02T03:41:50.6931359+08:00;True|2024-03-02T02:25:10.1162115+08:00;True|2024-03-02T02:21:16.3141505+08:00;True|2024-03-01T19:01:47.7699379+08:00;True|2024-02-29T00:38:11.1475979+08:00;True|2024-02-29T00:07:26.2023452+08:00;True|2024-02-28T11:35:07.4493871+08:00;True|2024-02-28T00:11:57.8127307+08:00;True|2024-02-27T23:56:01.8247049+08:00;True|2024-02-27T03:02:45.6356824+08:00;True|2024-02-27T02:20:07.5872428+08:00;True|2024-02-27T00:10:42.5668925+08:00;True|2024-02-26T22:55:38.5102933+08:00;True|2024-02-26T17:05:49.6500813+08:00;</History>
<History>True|2024-05-08T08:15:02.7510137Z;True|2024-05-08T16:05:33.2817801+08:00;True|2024-05-08T10:45:32.6120649+08:00;True|2024-05-07T17:27:07.9517535+08:00;True|2024-05-07T15:45:55.7947649+08:00;True|2024-04-30T15:10:48.3519647+08:00;True|2024-04-29T14:18:00.7201205+08:00;True|2024-04-29T11:27:37.7933453+08:00;True|2024-04-26T12:08:36.5779770+08:00;True|2024-04-25T09:55:33.6674798+08:00;True|2024-04-07T14:49:26.0087123+08:00;True|2024-04-03T18:35:24.9009550+08:00;True|2024-03-27T12:42:52.9905280+08:00;True|2024-03-21T18:06:06.2977252+08:00;True|2024-03-21T18:04:15.6270935+08:00;True|2024-03-20T15:53:25.4186730+08:00;True|2024-03-20T15:43:42.5128022+08:00;True|2024-03-20T15:23:11.0469171+08:00;False|2024-03-20T15:21:23.6832015+08:00;True|2024-03-20T15:19:24.4437216+08:00;True|2024-03-20T09:42:39.9943648+08:00;True|2024-03-19T01:04:44.9760500+08:00;True|2024-03-17T23:39:34.0352088+08:00;True|2024-03-17T08:31:23.5063725+08:00;True|2024-03-17T06:37:59.4183114+08:00;True|2024-03-17T06:37:27.0050941+08:00;True|2024-03-17T06:32:51.6628157+08:00;True|2024-03-17T06:03:58.9767100+08:00;True|2024-03-17T05:09:18.9285417+08:00;True|2024-03-17T05:03:51.1403040+08:00;True|2024-03-15T21:54:20.7306218+08:00;True|2024-03-15T02:27:06.3007171+08:00;True|2024-03-15T02:18:16.5382941+08:00;True|2024-03-15T02:16:34.5159231+08:00;True|2024-03-15T01:47:40.6505319+08:00;True|2024-03-15T01:38:52.4149526+08:00;True|2024-03-13T22:26:16.3031907+08:00;True|2024-03-13T17:22:18.3512709+08:00;True|2024-03-13T10:21:25.5131621+08:00;True|2024-03-11T17:34:04.8687102+08:00;True|2024-03-11T17:26:27.3873869+08:00;True|2024-03-08T17:17:06.8450054+08:00;True|2024-03-08T11:37:37.1180423+08:00;True|2024-03-07T15:56:21.1999674+08:00;True|2024-03-05T01:10:10.0710862+08:00;True|2024-03-04T14:01:44.6177022+08:00;True|2024-03-03T19:55:06.1013727+08:00;True|2024-03-03T18:15:37.8484692+08:00;True|2024-03-03T12:21:48.1679155+08:00;True|2024-03-03T00:16:48.7641081+08:00;True|2024-03-02T04:52:08.4562277+08:00;True|2024-03-02T04:40:24.4469334+08:00;True|2024-03-02T04:19:45.9907382+08:00;True|2024-03-02T03:44:02.2101754+08:00;True|2024-03-02T03:41:50.6931359+08:00;True|2024-03-02T02:25:10.1162115+08:00;True|2024-03-02T02:21:16.3141505+08:00;True|2024-03-01T19:01:47.7699379+08:00;True|2024-02-29T00:38:11.1475979+08:00;True|2024-02-29T00:07:26.2023452+08:00;True|2024-02-28T11:35:07.4493871+08:00;True|2024-02-28T00:11:57.8127307+08:00;True|2024-02-27T23:56:01.8247049+08:00;True|2024-02-27T03:02:45.6356824+08:00;True|2024-02-27T02:20:07.5872428+08:00;True|2024-02-27T00:10:42.5668925+08:00;True|2024-02-26T22:55:38.5102933+08:00;True|2024-02-26T17:05:49.6500813+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion aibotPro/aibotPro/Service/AiServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public bool DelChatGroup(string account, string groupId)
x.IsDel = 1;
});
//清除缓存
if (chatHistories != null)
if (chatHistories != null && chatHistories.Count > 0)
_redis.DeleteAsync(chatHistories[0].ChatId);
return _context.SaveChanges() > 0;
}
Expand Down
Loading

0 comments on commit 078b6c4

Please sign in to comment.