...
|
...
|
@@ -12,7 +12,7 @@ import ( |
|
|
"opp/protocol"
|
|
|
)
|
|
|
|
|
|
const LoopSize = 1
|
|
|
const LoopSize = 20
|
|
|
|
|
|
const (
|
|
|
Uploaded = "已上传,跳过"
|
...
|
...
|
@@ -31,12 +31,13 @@ func MigrateChanceDataToAliYun() { |
|
|
log.Info("【迁移机会媒体数据】开始迁移")
|
|
|
defer log.Info("【迁移机会媒体数据】结束迁移")
|
|
|
var (
|
|
|
datas []*models.ChanceData
|
|
|
query = `select * from chance_data order by id limit ?,?`
|
|
|
pageInfo = protocol.PageInfo{PageSize: LoopSize}
|
|
|
)
|
|
|
o := orm.NewOrm()
|
|
|
for {
|
|
|
var datas []*models.ChanceData
|
|
|
log.Info("当前页:", pageInfo.PageIndex, "起始:", pageInfo.Offset())
|
|
|
if _, e := o.Raw(query, pageInfo.Offset(), pageInfo.PageSize).QueryRows(&datas); e != nil {
|
|
|
if e == orm.ErrNoRows {
|
|
|
break
|
...
|
...
|
@@ -44,6 +45,9 @@ func MigrateChanceDataToAliYun() { |
|
|
log.Error(e)
|
|
|
break
|
|
|
}
|
|
|
if len(datas) == 0 {
|
|
|
break
|
|
|
}
|
|
|
|
|
|
for i := range datas {
|
|
|
data := datas[i]
|
...
|
...
|
@@ -53,12 +57,12 @@ func MigrateChanceDataToAliYun() { |
|
|
//上传视频
|
|
|
data.Videos = utils.JsonMarsh(uploadVideos(data, data.Videos))
|
|
|
//上传音频
|
|
|
data.Speechs = utils.JsonMarsh(uploadVoice(data, data.Speechs))
|
|
|
//data.Speechs = utils.JsonMarsh(uploadVoice(data, data.Speechs))
|
|
|
//更新数据
|
|
|
o.Update(data)
|
|
|
}
|
|
|
pageInfo.PageIndex += 1
|
|
|
break
|
|
|
//break
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|