|
@@ -180,6 +180,7 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
// 免费领样
|
|
|
updateData := gorm_model.YounggeeSecTaskInfo{
|
|
@@ -193,14 +194,28 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
+ // 3.2 更新带货任务待发货人数
|
|
|
+ err = tx.Model(gorm_model.YounggeeSelectionInfo{}).Where("selection_id = ?", selectionId).Updates(
|
|
|
+ map[string]interface{}{"before_delivery_num": gorm.Expr("before_delivery_num + ?", 1)}).Error
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- // 3. 更新选品剩余数量
|
|
|
+ // 3.1 更新选品剩余数量
|
|
|
err = tx.Model(gorm_model.YounggeeSelectionInfo{}).Where("selection_id = ?", selectionId).Updates(
|
|
|
map[string]interface{}{"remain_num": gorm.Expr("remain_num - ?", 1)}).Error
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
+ // 3.2 更新带货任务已选人数
|
|
|
+ err = tx.Model(gorm_model.YounggeeSelectionInfo{}).Where("selection_id = ?", selectionId).Updates(
|
|
|
+ map[string]interface{}{"choose_num": gorm.Expr("choose_num + ?", 1)}).Error
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
// 4. 生成达人消息
|
|
|
for _, talendId := range talentIds {
|
|
|
err = CreateMessage(ctx, 1, 1, talendId, selection.SelectionName)
|