1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package crontab
- import (
- "kpt-pasture/config"
- "kpt-pasture/model"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- "gitee.com/xuyiping_admin/pkg/xerr"
- )
- func (e *Entry) NeckRingData() error {
- cfg := config.Options()
- limit := cfg.NeckRingLimit
- if limit <= 0 {
- limit = 10000
- }
- neckRingList := make([]*model.NeckRingOriginalData, 0)
- if err := e.DB.Model(new(model.NeckRingOriginalData)).
- Where("is_show = ?", pasturePb.IsShow_No).
- Order("id asc").Limit(int(limit)).
- Find(&neckRingList).Error; err != nil {
- return xerr.WithStack(err)
- }
- if len(neckRingList) <= 0 {
- return nil
- }
- neckRingIds := make([]int64, len(neckRingList))
- // 更新已处理过的id
- defer func() {
- if len(neckRingIds) > 0 {
- e.DB.Model(new(model.NeckRingOriginalData)).
- Where("id IN ?", neckRingIds).
- Update("is_show", pasturePb.IsShow_Ok)
- }
- }()
- for i, v := range neckRingList {
- neckRingIds[i] = v.Id
- if v.Imei == "" {
- continue
- }
- }
- return nil
- }
- func (e *Entry) NeckRingOriginalDataMerge(dataList []*model.NeckRingLog) {
- if len(dataList) <= 0 {
- return
- }
- }
|