コード例 #1
0
 /// <summary>
 /// 接收订单
 /// </summary>
 /// <returns></returns>
 public JsonResult ReceiveOrder()
 {
     RequestUser();
     try
     {
         int pid = int.Parse(GetParams("pid"));
         int num = int.Parse(GetParams("num"));
         if (us.Level == 1 || us.Level == 4)
         {
             resultData.msg = "您是商家没有接单权限";
             return(this.ResultJson(resultData));
         }
         if (us.Level == 5)
         {
             resultData.msg = "您是平台用户没有接单权限";
             return(this.ResultJson(resultData));
         }
         if (us.Level == 2)
         {
             if (num > 1)
             {
                 resultData.msg = "您是个人买家接单数量不能大于1";
                 return(this.ResultJson(resultData));
             }
             else
             {
                 var data = IROC.AddOrder(pid, num, us);
                 if (data)
                 {
                     IPC.QueryReceivePower(pid, us.ID, false);
                     var result = IROC.QueryOrder(pid, us.ID);
                     resultData.res  = 200;
                     resultData.msg  = "接单成功";
                     resultData.data = result;
                     return(this.ResultJson(resultData));
                 }
                 else
                 {
                     resultData.res = 500;
                     resultData.msg = "接单失败";
                     return(this.ResultJson(resultData));
                 }
             }
         }
         //当前账户为团队买家
         if (us.Level == 3)
         {
             var data = IROC.AddOrder(pid, num, us);
             if (data)
             {
                 IPC.QueryReceivePower(pid, us.ID, false);
                 var result = IROC.QueryOrder(pid, us.ID);
                 resultData.res  = 200;
                 resultData.msg  = "接单成功";
                 resultData.data = result;
                 return(this.ResultJson(resultData));
             }
             else
             {
                 resultData.res = 500;
                 resultData.msg = "接单失败";
                 return(this.ResultJson(resultData));
             }
         }
         return(this.ResultJson(resultData));
     }
     catch
     {
         return(this.ResultJson(resultData));
     }
 }