|
@@ -90,6 +90,8 @@ func (c *OrderController) Order_Add() {
|
|
IsExpatriate, _ := c.GetInt("IsExpatriate")
|
|
IsExpatriate, _ := c.GetInt("IsExpatriate")
|
|
Phone := c.GetString("Phone")
|
|
Phone := c.GetString("Phone")
|
|
ChildPid := c.GetString("ChildPid")
|
|
ChildPid := c.GetString("ChildPid")
|
|
|
|
+ CouriesName := c.GetString("CouriesName")
|
|
|
|
+ CouriesId := c.GetString("CouriesId")
|
|
if len(EstimateStartTime) <= 0 || len(EstimateEndTime) <= 0 {
|
|
if len(EstimateStartTime) <= 0 || len(EstimateEndTime) <= 0 {
|
|
c.Data["json"] = lib.JSONS{Code: 207, Msg: "时间参数异常!"}
|
|
c.Data["json"] = lib.JSONS{Code: 207, Msg: "时间参数异常!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -102,6 +104,11 @@ func (c *OrderController) Order_Add() {
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if len(CouriesId) != 0 {
|
|
|
|
+ atoi, _ := strconv.Atoi(CouriesId)
|
|
|
|
+ r := Function.Read_Couriers_ById(atoi)
|
|
|
|
+ CouriesName = r.Name
|
|
|
|
+ }
|
|
var_ := Function.Order{
|
|
var_ := Function.Order{
|
|
T_pid: c.User_r.T_pid,
|
|
T_pid: c.User_r.T_pid,
|
|
T_orderid: T_orderid,
|
|
T_orderid: T_orderid,
|
|
@@ -118,12 +125,8 @@ func (c *OrderController) Order_Add() {
|
|
IsExpatriate: IsExpatriate,
|
|
IsExpatriate: IsExpatriate,
|
|
Phone: Phone,
|
|
Phone: Phone,
|
|
ChildPid: ChildPid,
|
|
ChildPid: ChildPid,
|
|
- }
|
|
|
|
- id, err := Function.Add_Order(var_)
|
|
|
|
- if err != nil {
|
|
|
|
- c.Data["json"] = lib.JSONS{Code: 301, Msg: "添加失败!"}
|
|
|
|
- c.ServeJSON()
|
|
|
|
- return
|
|
|
|
|
|
+ CouriesName: CouriesName,
|
|
|
|
+ CouriesId: CouriesId,
|
|
}
|
|
}
|
|
if var_.IsExpatriate == 2 {
|
|
if var_.IsExpatriate == 2 {
|
|
if len(var_.Phone) < 0 {
|
|
if len(var_.Phone) < 0 {
|
|
@@ -131,9 +134,12 @@ func (c *OrderController) Order_Add() {
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ var_.ExpatriateReceiving = T_receiving
|
|
|
|
+ }
|
|
|
|
+ defer func() {
|
|
s, _ := beego.AppConfig.String("orderUrl")
|
|
s, _ := beego.AppConfig.String("orderUrl")
|
|
addr := s + url.QueryEscape(lib.AesEncryptCBC(var_.T_orderid, lib.AesKey))
|
|
addr := s + url.QueryEscape(lib.AesEncryptCBC(var_.T_orderid, lib.AesKey))
|
|
- log.Println(addr)
|
|
|
|
sprintf := fmt.Sprintf("【冷链订单配送】您的订单正在配送中点击下方链接查看%v", addr)
|
|
sprintf := fmt.Sprintf("【冷链订单配送】您的订单正在配送中点击下方链接查看%v", addr)
|
|
err = lib.SendModel(Phone, sprintf)
|
|
err = lib.SendModel(Phone, sprintf)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -141,8 +147,14 @@ func (c *OrderController) Order_Add() {
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- var_.ExpatriateReceiving = T_receiving
|
|
|
|
|
|
+ }()
|
|
|
|
+ id, err := Function.Add_Order(var_)
|
|
|
|
+ if err != nil {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 301, Msg: "添加失败!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+
|
|
NatsServer.AddUserLogs(Account.User_r.T_uuid, "订单系统", "添加", var_)
|
|
NatsServer.AddUserLogs(Account.User_r.T_uuid, "订单系统", "添加", var_)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -195,6 +207,8 @@ func (c *OrderController) Order_Edit() {
|
|
Phone := c.GetString("Phone")
|
|
Phone := c.GetString("Phone")
|
|
ChildPid := c.GetString("ChildPid")
|
|
ChildPid := c.GetString("ChildPid")
|
|
T_State, _ := c.GetInt("T_State")
|
|
T_State, _ := c.GetInt("T_State")
|
|
|
|
+ CouriesName := c.GetString("CouriesName")
|
|
|
|
+ CouriesId := c.GetString("CouriesId")
|
|
if len(EstimateStartTime) <= 0 || len(EstimateEndTime) <= 0 {
|
|
if len(EstimateStartTime) <= 0 || len(EstimateEndTime) <= 0 {
|
|
c.Data["json"] = lib.JSONS{Code: 207, Msg: "时间参数异常!"}
|
|
c.Data["json"] = lib.JSONS{Code: 207, Msg: "时间参数异常!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -243,10 +257,16 @@ func (c *OrderController) Order_Edit() {
|
|
if len(ChildPid) > 0 {
|
|
if len(ChildPid) > 0 {
|
|
r.ChildPid = ChildPid
|
|
r.ChildPid = ChildPid
|
|
}
|
|
}
|
|
|
|
+ if len(CouriesName) > 0 {
|
|
|
|
+ r.CouriesName = CouriesName
|
|
|
|
+ }
|
|
|
|
+ if len(CouriesId) > 0 {
|
|
|
|
+ r.CouriesId = CouriesId
|
|
|
|
+ }
|
|
if T_State != 0 {
|
|
if T_State != 0 {
|
|
r.T_State = T_State
|
|
r.T_State = T_State
|
|
}
|
|
}
|
|
- is := Function.Update_Order(r, "waybill_no", "t_sn", "t_receiving", "shipping_unit", "estimate_start_time", "estimate_end_time", "peer_list", "device_type", "is_expatriate", "phone", "child_pid", "t__state", "t_text")
|
|
|
|
|
|
+ is := Function.Update_Order(r, "waybill_no", "t_sn", "t_receiving", "shipping_unit", "estimate_start_time", "estimate_end_time", "peer_list", "device_type", "is_expatriate", "phone", "child_pid", "t__state", "t_text", "couries_name", "couries_id")
|
|
if !is {
|
|
if !is {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|