You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: contact_way.go
    path of file: ./repos/api-server/app/models
    
    the code of the file until where you have to start completion: package models

import (
	"fmt"
	"github.com/gogf/gf/crypto/gmd5"
	"github.com/jinzhu/copier"
	"github.com/pkg/errors"
	"github.com/thoas/go-funk"
	"gorm.io/gorm"
	"gorm.io/gorm/clause"
	"openscrm/app/constants"
	"openscrm/app/requests"
	"openscrm/common/delay_queue"
	"openscrm/common/ecode"
	"openscrm/common/id_generator"
	"openscrm/common/log"
	"openscrm/common/util"
	"openscrm/common/we_work"
	"openscrm/pkg/easywework"
	"time"
)

// ContactWay 渠道码
type ContactWay struct {
	ExtCorpModel
	Name string `gorm:"type:varchar(255);index;comment:'渠道码名称'" json:"name"`
	// ConfigID 渠道码配置ID
	ConfigID string `json:"config_id" gorm:"index;comment:渠道码配置ID" validate:"alpha"`
	// GroupID 渠道码分组ID
	GroupID string `json:"group_id" gorm:"index;type:bigint;comment:活码分组ID"`
	// QrCode 联系二维码的URL，仅在scene为2时返回
	QrCode string `json:"qr_code" gorm:"comment:联系二维码的URL"`
	// Remark 渠道码的备注信息，用于助记
	Remark string `json:"remark" gorm:"comment:渠道码的备注信息"`
	// SkipVerify 外部客户添加时是否无需验证，假布尔类型
	SkipVerify constants.Boolean `json:"skip_verify" gorm:"default:1;comment:外部客户添加时是否无需验证，假布尔类型" validate:"oneof=1 2"`
	// State 企业自定义的state参数，用于区分不同的添加渠道，在调用“<a href="#13878"
    
func (o ContactWay) Create(param ContactWay, extCorpID string) (item ContactWay, err error) {
	err = copier.Copy(&item, param)
	if err != nil {
		err = errors.Wrap(err, "copier.Copy failed")
		return
	}
	item.ExtCorpID = extCorpID
	if item.ID == "" {
		item.ID = id_generator.StringID()
	}
	item.State = constants.ContactWayStatePrefix + item.ID

	err = o.CalLatestStatus(&item)
	if err != nil {
		err = errors.Wrap(err, "CalLatestStatus failed")
		return
	}

	client, err := we_work.Clients.Get(extCorpID)
	if err != nil {
		err = errors.Wrap(err, "get Client failed")
		return
	}

	item.ConfigID, err = client.Customer.AddContactWay(workwx.AddContactWay{
		IsTemp:     false,
		Remark:     item.Remark,
		Scene:      2,
		SkipVerify: item.SkipVerify == constants.True,
		State:      item.State,
		Type:       workwx.ContactWayTypeMultiple,
		User:       item.ExtStaffIDs,
	})
	if err != nil {
		err = errors.Wrap(err, "wx AddContactWay failed")
		return
	}

	wxContactWay, err := client.Customer.GetContactWay(item.ConfigID)
	if err != nil {
		err = errors.Wrap(err, "wx GetContactWay failed")
		return
	}

	item.QrCode = wxContactWay.QrCode

	err = DB.Create(&item).Error
	if err != nil {
		err = errors.Wrap(err, "Create ContactWay failed")
		return
	}

	return
}