Commit 8fb550d2 by 孙龙

up

parent 91b37254
Showing with 25 additions and 3 deletions
...@@ -32,6 +32,7 @@ type LieOrderInfo struct { ...@@ -32,6 +32,7 @@ type LieOrderInfo struct {
OrderSn string `db:"order_sn"` OrderSn string `db:"order_sn"`
OrderAmount float64 ` db:"order_amount"` OrderAmount float64 ` db:"order_amount"`
CreateTime int64 `db:"create_time"` CreateTime int64 `db:"create_time"`
UserId int64 `db:"user_id"`
} }
...@@ -44,12 +45,16 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){ ...@@ -44,12 +45,16 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){
order_id := orderBomData.Order_id order_id := orderBomData.Order_id
//查询订单相关信息 //查询订单相关信息
lieOrder := &LieOrderInfo{} lieOrder := &LieOrderInfo{}
getOrderSql := "select order_id,order_sn,order_amount,create_time from lie_order where order_id = ? " getOrderSql := "select order_id,order_sn,order_amount,create_time,user_id from lie_order where order_id = ? "
err = db.DB.Get(lieOrder,getOrderSql,order_id) err = db.DB.Get(lieOrder,getOrderSql,order_id)
if err != nil{ if err != nil{
return returnError(fmt.Sprintf("没有找到相关平台订单信息 订单id: : %s",order_id)) return returnError(fmt.Sprintf("没有找到相关平台订单信息 订单id: : %s",order_id))
} }
companyName := findUserCompany(lieOrder.UserId)
//fmt.Println("公司",companyName)
tx := db.BomDB.MustBegin() tx := db.BomDB.MustBegin()
var( var(
BomId int64 BomId int64
...@@ -94,8 +99,14 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){ ...@@ -94,8 +99,14 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){
//更新首次下单时间 //更新首次下单时间
if(fcorder_time == 0){ if(fcorder_time == 0){
time_ := time.Now().Unix() time_ := time.Now().Unix()
bom_extend_sql := "update lie_bom_extend set fcorder_time = ? where bom_id = ?" bom_extend_sql := "update lie_bom_extend set fcorder_time = ?,company_name= ? where bom_id = ?"
_ =tx.MustExec(bom_extend_sql,time_,BomId) _ =tx.MustExec(bom_extend_sql,time_,companyName,BomId)
}
}else{
//更新首次下单时间
if(fcorder_time == 0){
bom_extend_sql := "update lie_bom_extend set company_name= ? where bom_id = ?"
_ =tx.MustExec(bom_extend_sql,companyName,BomId)
} }
} }
...@@ -137,6 +148,17 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){ ...@@ -137,6 +148,17 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){
} }
func findUserCompany(user_id int64) string{
var company string
sql := "select tax_title from lie_taxinfo where user_id=? and tax_title != '' order by tax_id desc "
db.DB.Get(&company,sql,user_id)
if company == ""{
sql := "select com_name from lie_user_company where user_id=? "
db.DB.Get(&company,sql,user_id)
}
return company
}
func getBomMatchTable(bom_id int64) string{ func getBomMatchTable(bom_id int64) string{
bom_idstr := strconv.FormatInt(bom_id,10) bom_idstr := strconv.FormatInt(bom_id,10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment