|
@@ -74,7 +74,7 @@ func AutomaticallyCreatingEnt(name, phone, orderCode string, userId string) (int
|
|
|
func EntLicense(ctx context.Context, entId, empowerCount, provinceCount, orderId, userCount int, productType, st, et, phone string) (error, int64) {
|
|
|
log.Println("订单企业授权信息记录===", entId, productType)
|
|
|
e, pid := func() (error, int64) {
|
|
|
- if count, _ := g.DB().Ctx(ctx).GetCount(ctx, fmt.Sprintf(`SELECT count(1) FROM entniche_order WHERE product_id = '%d' `, orderId)); count > 0 {
|
|
|
+ if count, _ := g.DB().Ctx(ctx).GetCount(ctx, fmt.Sprintf(`SELECT count(1) FROM entniche_order WHERE order_detail_id = '%d' `, orderId)); count > 0 {
|
|
|
return nil, 0
|
|
|
}
|
|
|
var pid int64
|
|
@@ -93,7 +93,7 @@ func EntLicense(ctx context.Context, entId, empowerCount, provinceCount, orderId
|
|
|
return errors.New("企业待授权表更新失败"), 0
|
|
|
} else {
|
|
|
inData := map[string]interface{}{
|
|
|
- "product_id": orderId,
|
|
|
+ "order_detail_id": orderId,
|
|
|
"wait_empower_id": id,
|
|
|
"create_time": time.Now(),
|
|
|
}
|
|
@@ -116,7 +116,7 @@ func EntLicense(ctx context.Context, entId, empowerCount, provinceCount, orderId
|
|
|
if id > 0 {
|
|
|
pid = id
|
|
|
inData := map[string]interface{}{
|
|
|
- "product_id": orderId,
|
|
|
+ "order_detail_id": orderId,
|
|
|
"wait_empower_id": id,
|
|
|
"create_time": time.Now(),
|
|
|
}
|
|
@@ -145,14 +145,14 @@ func SaveUpEntOrder(ctx context.Context, waitEmpowerId, orderId int) error {
|
|
|
count, err := g.DB().Ctx(ctx).GetCount(ctx, fmt.Sprintf(`selet * from entniche_wait_empower where id ='%d'`, waitEmpowerId))
|
|
|
if err == nil && count > 0 {
|
|
|
_, err = g.DB().Ctx(ctx).Update(ctx, "entniche_order", map[string]interface{}{
|
|
|
- "product_id": orderId,
|
|
|
+ "order_detail_id": orderId,
|
|
|
}, map[string]interface{}{"wait_empower_id": waitEmpowerId})
|
|
|
if err != nil {
|
|
|
return errors.New(fmt.Sprintf("套餐续费失败 id: %d", waitEmpowerId))
|
|
|
}
|
|
|
} else {
|
|
|
_, err = g.DB().Ctx(ctx).Insert(ctx, "entniche_order", map[string]interface{}{
|
|
|
- "product_id": orderId,
|
|
|
+ "order_detail_id": orderId,
|
|
|
"wait_empower_id": waitEmpowerId,
|
|
|
})
|
|
|
if err != nil {
|