From 8ccbbde7338200928f5a86ad93cf204c48117cba Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Fri, 22 Jun 2018 11:45:49 +0800 Subject: [PATCH] . --- B3ClientService/B3ClientService.csproj | 1 + B3ClientService/OfflinRpc/MiniProgramRpc.cs | 43 ---------------- B3ClientService/Rpcs/SupplierScreen.cs | 56 +++++++++++++++++++++ 3 files changed, 57 insertions(+), 43 deletions(-) create mode 100644 B3ClientService/Rpcs/SupplierScreen.cs diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index d458659..d5fa8c3 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -250,6 +250,7 @@ + diff --git a/B3ClientService/OfflinRpc/MiniProgramRpc.cs b/B3ClientService/OfflinRpc/MiniProgramRpc.cs index 6747859..e091212 100644 --- a/B3ClientService/OfflinRpc/MiniProgramRpc.cs +++ b/B3ClientService/OfflinRpc/MiniProgramRpc.cs @@ -18,44 +18,6 @@ namespace BWP.B3ClientService.Rpcs [Rpc] public static class MiniProgramRpc { - [Rpc(RpcFlags.SkipAuth)] - public static WeiUserBind GetBindID(string code) - { - var url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&grant_type=authorization_code&js_code={2}"; - var request = (HttpWebRequest)WebRequest.Create(string.Format(url, "wx106e1fc979e5fad5", "57883555a451434569cbcb58d2047aac", code)); - var response = request.GetResponse(); - using (var stream = response.GetResponseStream()) - { - using (var reader = new StreamReader(stream, Encoding.UTF8)) - { - var weiID = JsonConvert.DeserializeObject(reader.ReadToEnd()).openid; - var user = GetBindWeiUser(weiID); - if (user == null) - user = new WeiUserBind { WeiID = weiID }; - return user; - } - } - } - - [Rpc(RpcFlags.SkipAuth)] - public static long InsertBind(string json) - { - var entity = JsonConvert.DeserializeObject(json); - using (var session = Dmo.NewSession()) - { - session.Insert(entity); - session.Commit(); - } - return entity.ID; - } - - static WeiUserBind GetBindWeiUser(string weiID) - { - var query = new DmoQuery(typeof(WeiUserBind)); - query.Where.Conditions.Add(DQCondition.EQ("WeiID", weiID)); - return query.EExecuteScalar(); - } - [Rpc(RpcFlags.SkipAuth)] public static string GetLastInfo(long id) { @@ -291,9 +253,4 @@ namespace BWP.B3ClientService.Rpcs public string employee { get; set; } } - - class WeiSer - { - public string openid { get; set; } - } } diff --git a/B3ClientService/Rpcs/SupplierScreen.cs b/B3ClientService/Rpcs/SupplierScreen.cs new file mode 100644 index 0000000..e09ae49 --- /dev/null +++ b/B3ClientService/Rpcs/SupplierScreen.cs @@ -0,0 +1,56 @@ +using BWP.B3ClientService.BO; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.JsonRpc; +using Forks.EnterpriseServices.SqlDoms; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BWP.B3ClientService.Rpcs +{ + [Rpc] + + public static class SupplierScreen + { + [Rpc(RpcFlags.SkipAuth)] + public static string GetOrder() + { + var query = new DQueryDom(new JoinAlias(typeof(OrderDetail))); + query.Columns.Add(DQSelectColumn.Field("Order")); + query.Columns.Add(DQSelectColumn.Field("LiveColonyHouse_Name")); + query.Columns.Add(DQSelectColumn.Field("PlanNumber")); + query.Columns.Add(DQSelectColumn.Field("OrderState")); + query.Range = SelectRange.Top(15); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Date", new DateTime(2018,5,16)), + DQCondition.EQ("DeleteState", false), DQCondition.EQ("IsDrop", false))); + var list = new List(); + using (var session = Dmo.NewSession()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + { + list.Add(new Obj { Order = (int)reader[0], LiveColonyHouse_Name = (string)reader[1], PlanNumber = (int)reader[2], OrderState = (int)reader[3] }); + } + } + } + return JsonConvert.SerializeObject(list.OrderBy(x => x.Order).OrderBy(x => x.Doing)); + } + + public class Obj + { + public int Order { get; set; } + + public string LiveColonyHouse_Name { get; set; } + + public int PlanNumber { get; set; } + + public int OrderState { get; set; } + + public int Doing { get { if (OrderState == 10) return -10; else return OrderState; } } + } + } +}