- remove useless legacy codes.
- refactor models
This commit is contained in:
@@ -4,17 +4,17 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"github.com/astaxie/beego/orm"
|
||||
)
|
||||
|
||||
type StoreUserInfo struct {
|
||||
model.WeiXins
|
||||
ParentMobile string `json:"parentMobile"`
|
||||
Members []*model.WeiXins `orm:"-" json:"members"`
|
||||
MembersStr string `json:"-"`
|
||||
legacymodel.WeiXins
|
||||
ParentMobile string `json:"parentMobile"`
|
||||
Members []*legacymodel.WeiXins `orm:"-" json:"members"`
|
||||
MembersStr string `json:"-"`
|
||||
}
|
||||
|
||||
func GetStoreUsers(storeID int) (storeUserInfos []*StoreUserInfo, err error) {
|
||||
@@ -77,7 +77,7 @@ func GetSelfInfo(openID string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
}
|
||||
|
||||
func UnbindMobile(mobile string) (num int64, err error) {
|
||||
return dao.UpdateEntityByKV(nil, &model.WeiXins{}, map[string]interface{}{
|
||||
return dao.UpdateEntityByKV(nil, &legacymodel.WeiXins{}, map[string]interface{}{
|
||||
"JxStoreID": nil,
|
||||
"ParentID": -1,
|
||||
}, map[string]interface{}{
|
||||
@@ -104,7 +104,7 @@ func BindMobile2Store(mobile string, storeID int) (num int64, err error) {
|
||||
|
||||
func AddMobile2Mobile(parentMobile, mobile string) (num int64, err error) {
|
||||
db := dao.GetDB()
|
||||
parentUser := &model.WeiXins{}
|
||||
parentUser := &legacymodel.WeiXins{}
|
||||
parentUser.Tel = parentMobile
|
||||
if err = dao.GetEntity(db, parentUser, "Tel"); err == nil {
|
||||
if parentUser.ParentID == -1 {
|
||||
@@ -130,15 +130,15 @@ func AddMobile2Mobile(parentMobile, mobile string) (num int64, err error) {
|
||||
}
|
||||
|
||||
func ChangeMobile(curMobile, expectedMobile string) (num int64, err error) {
|
||||
return dao.UpdateEntityByKV(nil, &model.WeiXins{}, map[string]interface{}{
|
||||
return dao.UpdateEntityByKV(nil, &legacymodel.WeiXins{}, map[string]interface{}{
|
||||
"Tel": expectedMobile,
|
||||
}, map[string]interface{}{
|
||||
"Tel": curMobile,
|
||||
})
|
||||
}
|
||||
|
||||
func verifyMobileIsBlank(db *dao.DaoDB, mobile string) (user *model.WeiXins, err error) {
|
||||
user = &model.WeiXins{
|
||||
func verifyMobileIsBlank(db *dao.DaoDB, mobile string) (user *legacymodel.WeiXins, err error) {
|
||||
user = &legacymodel.WeiXins{
|
||||
Tel: mobile,
|
||||
}
|
||||
if err = dao.GetEntity(db, user, "Tel"); err == nil {
|
||||
@@ -165,7 +165,7 @@ func verifyMobileHasNoMembers(db *dao.DaoDB, mobile string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func createUserAndSetOpenIDNull(db *dao.DaoDB, user *model.WeiXins) (err error) {
|
||||
func createUserAndSetOpenIDNull(db *dao.DaoDB, user *legacymodel.WeiXins) (err error) {
|
||||
dao.Begin(db)
|
||||
if err = dao.CreateEntity(db, user); err != nil {
|
||||
dao.Rollback(db)
|
||||
|
||||
Reference in New Issue
Block a user