Beispiel #1
0
func (this *profileManagerImpl) getAll() []*merchant.EnterpriseInfo {
	if this._list == nil {
		this._list = []*merchant.EnterpriseInfo{}
		tmp.Db().GetOrm().Select(&this._list, "mch_id=?", this.GetAggregateRootId())
	}
	return this._list
}
Beispiel #2
0
// 审核实名认证,若重复审核将返回错误
func (this *profileManagerImpl) ReviewTrustedInfo(pass bool, remark string) error {
	this.GetTrustedInfo()
	if pass {
		this._trustedInfo.Reviewed = 1
	} else {
		this._trustedInfo.Reviewed = 0
	}
	this._trustedInfo.IsHandle = 1 //标记为已处理
	this._trustedInfo.Remark = remark
	this._trustedInfo.ReviewTime = time.Now().Unix()
	_, _, err := tmp.Db().GetOrm().Save(nil, this._trustedInfo)
	return err
}
Beispiel #3
0
// 实名认证信息
func (this *profileManagerImpl) GetTrustedInfo() member.TrustedInfo {
	if this._trustedInfo == nil {
		this._trustedInfo = &member.TrustedInfo{
			MemberId: this._memberId,
		}
		//如果还没有实名信息,则新建
		orm := tmp.Db().GetOrm()
		if err := orm.Get(this._memberId, this._trustedInfo); err != nil {
			orm.Save(nil, this._trustedInfo)
		}
	}
	return *this._trustedInfo
}
Beispiel #4
0
// 保存企业信息
func (this *profileManagerImpl) SaveEnterpriseInfo(v *merchant.EnterpriseInfo) (int, error) {
	e := this.GetReviewingEnterpriseInfo()
	if e == nil {
		e = &merchant.EnterpriseInfo{}
	}
	this.copy(v, e)
	dt := time.Now().Unix()
	e.Reviewed = 0
	e.IsHandled = 0
	e.ReviewTime = dt
	e.UpdateTime = dt
	this._list = nil //clean cache
	return orm.Save(tmp.Db().GetOrm(), e, e.Id)
}
Beispiel #5
0
// 保存实名认证信息
func (this *profileManagerImpl) SaveTrustedInfo(v *member.TrustedInfo) error {
	this.GetTrustedInfo()
	v.TrustImage = strings.TrimSpace(v.TrustImage)
	v.BodyNumber = strings.TrimSpace(v.BodyNumber)
	v.RealName = strings.TrimSpace(v.RealName)
	if len(v.TrustImage) == 0 || len(v.RealName) == 0 ||
		len(v.BodyNumber) == 0 {
		return member.ErrMissingTrustedInfo
	}
	this.copyTrustedInfo(v, this._trustedInfo)
	this._trustedInfo.IsHandle = 0 //标记为未处理
	this._trustedInfo.UpdateTime = time.Now().Unix()
	_, _, err := tmp.Db().GetOrm().Save(nil, this._trustedInfo)
	return err
}
Beispiel #6
0
// 标记企业为审核通过
func (this *profileManagerImpl) ReviewEnterpriseInfo(pass bool, message string) error {
	var err error
	e := this.GetReviewingEnterpriseInfo()
	if e != nil {
		e.ReviewTime = time.Now().Unix()
		e.IsHandled = 1

		// 通过审核,将审批的记录删除,同时更新到审核数据
		if pass {
			v := this.GetReviewedEnterpriseInfo()
			if v != nil {
				this.copy(e, v)
				tmp.Db().GetOrm().DeleteByPk(e, e.Id)
				err = this.save(v)
			} else {
				e.Reviewed = 1
				e.Remark = ""
				err = this.save(e)
			}
			if err == nil {
				// 保存省、市、区到Merchant
				v := this.MerchantImpl.GetValue()
				v.Province = e.Province
				v.City = e.City
				v.District = e.District
				err = this.SetValue(&v)
				if err == nil {
					_, err = this.MerchantImpl.Save()
				}
			}
		} else {
			e.Reviewed = 0
			e.Remark = message
			err = this.save(e)
		}
	}
	return err
}
Beispiel #7
0
func (this *profileManagerImpl) save(e *merchant.EnterpriseInfo) error {
	_, err := orm.Save(tmp.Db().GetOrm(), e, e.Id)
	return err
}