Quellcode durchsuchen

add reverse:for v1.0.9 test

tags/v1.0.9
huangjiajun vor 2 Jahren
Ursprung
Commit
2f8f340f58
5 geänderte Dateien mit 34 neuen und 41 gelöschten Zeilen
  1. +1
    -4
      db/db.go
  2. +4
    -5
      db/db_merchant.go
  3. +1
    -2
      db/db_o2o_store.go
  4. +1
    -2
      db/db_o2o_store_fans.go
  5. +27
    -28
      db/db_user_profile.go

+ 1
- 4
db/db.go Datei anzeigen

@@ -1,7 +1,6 @@
package db

import (
zhios_o2o_business_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/utils/logx"
"database/sql"
_ "github.com/go-sql-driver/mysql" //必须导入mysql驱动,否则会panic
"xorm.io/xorm"
@@ -18,7 +17,7 @@ func DbInsertBatch(Db *xorm.Engine, m ...interface{}) error {
}
id, err := Db.Insert(m...)
if id == 0 || err != nil {
return zhios_o2o_business_logx.Warn("cannot insert data :", err)
return err
}
return nil
}
@@ -47,7 +46,6 @@ func InsertComm(Db *xorm.Engine, model interface{}) (int64, error) {
func GetComm(Db *xorm.Engine, model interface{}) (interface{}, bool, error) {
has, err := Db.Get(model)
if err != nil {
_ = zhios_o2o_business_logx.Warn(err)
return nil, false, err
}
return model, has, nil
@@ -63,7 +61,6 @@ func InsertCommWithSession(session *xorm.Session, model interface{}) (int64, err
func ExecuteOriginalSql(session *xorm.Session, sql string) (sql.Result, error) {
result, err := session.Exec(sql)
if err != nil {
_ = zhios_o2o_business_logx.Warn(err)
return nil, err
}
return result, nil


+ 4
- 5
db/db_merchant.go Datei anzeigen

@@ -2,7 +2,6 @@ package db

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/db/model"
zhios_o2o_business_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/utils/logx"
"errors"
"xorm.io/xorm"
)
@@ -32,7 +31,7 @@ func MerchantFindByMobileOrId(Db *xorm.Engine, mobileOrId string) (*model.O2oMer
var m model.O2oMerchant
if has, err := Db.Where("(phone = ? OR id = ?)", mobileOrId, mobileOrId).
Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -56,7 +55,7 @@ func MerchantFindByUId(Db *xorm.Engine, uid string) (*model.O2oMerchant, error)
var m model.O2oMerchant
if has, err := Db.Where("uid = ?", uid).
Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -76,7 +75,7 @@ func MerchantGetByMobileIgnoreDelete(Db *xorm.Engine, mobile string) (*model.O2o
m := new(model.O2oMerchant)
has, err := Db.Where("phone = ?", mobile).Get(m)
if err != nil {
return nil, false, zhios_o2o_business_logx.Warn(err)
return nil, false,err
}
return m, has, nil
}
@@ -92,7 +91,7 @@ func MerchantUpdate(Db *xorm.Engine, merchant *model.O2oMerchant, forceCols ...s
affected, err = Db.ID(merchant.Id).Update(merchant)
}
if err != nil {
return 0, zhios_o2o_business_logx.Warn(err)
return 0, err
}
return affected, nil
}


+ 1
- 2
db/db_o2o_store.go Datei anzeigen

@@ -2,7 +2,6 @@ package db

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/db/model"
zhios_o2o_business_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/utils/logx"
"xorm.io/xorm"
)

@@ -10,7 +9,7 @@ func MerchantFindByStoreManager(Db *xorm.Engine, uid string) (*model.O2oStore, e
var m model.O2oStore
if has, err := Db.Where("store_manager = ?", uid).
Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}

+ 1
- 2
db/db_o2o_store_fans.go Datei anzeigen

@@ -2,7 +2,6 @@ package db

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/db/model"
zhios_o2o_business_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/utils/logx"
"errors"
"xorm.io/xorm"
)
@@ -12,7 +11,7 @@ import (
func GetStoreFansByUid(Db *xorm.Engine, uid string, storeId string) (*model.O2oStoreFans, error) {
var m model.O2oStoreFans
if has, err := Db.Where("user_id = ?", uid).And("store_id = ?", storeId).Get(&m); err != nil || !has {
return nil, zhios_o2o_business_logx.Warn(err)
return nil,err
}
return &m, nil
}


+ 27
- 28
db/db_user_profile.go Datei anzeigen

@@ -2,7 +2,6 @@ package db

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/db/model"
zhios_o2o_business_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_o2o_business.git/utils/logx"
"xorm.io/xorm"
)

@@ -10,7 +9,7 @@ import (
func UserProfileFindByArkID(Db *xorm.Engine, id interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("arkid_uid = ?", id).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -19,7 +18,7 @@ func UserProfileFindByArkID(Db *xorm.Engine, id interface{}) (*model.UserProfile
func UserProfileFindByInviteCode(Db *xorm.Engine, code string) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("invite_code = ?", code).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -28,7 +27,7 @@ func UserProfileFindByInviteCode(Db *xorm.Engine, code string) (*model.UserProfi
func UserProfileFindByCustomInviteCode(Db *xorm.Engine, code string) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("custom_invite_code = ?", code).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -37,7 +36,7 @@ func UserProfileFindByCustomInviteCode(Db *xorm.Engine, code string) (*model.Use
func UserProfileFindByInviteCodes(Db *xorm.Engine, codes ...string) (*[]model.UserProfile, error) {
var m []model.UserProfile
if err := Db.In("invite_code", codes).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -46,7 +45,7 @@ func UserProfileFindByInviteCodes(Db *xorm.Engine, codes ...string) (*[]model.Us
func UserProfileFindByCustomInviteCodes(Db *xorm.Engine, codes ...string) (*[]model.UserProfile, error) {
var m []model.UserProfile
if err := Db.In("custom_invite_code", codes).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -55,7 +54,7 @@ func UserProfileFindByCustomInviteCodes(Db *xorm.Engine, codes ...string) (*[]mo
func UserProfileFindByID(Db *xorm.Engine, id interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("uid = ?", id).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -64,7 +63,7 @@ func UserProfileFindByID(Db *xorm.Engine, id interface{}) (*model.UserProfile, e
func UserProfileOrderByNew(Db *xorm.Engine) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("invite_code != ''").OrderBy("uid desc").Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -73,7 +72,7 @@ func UserProfileOrderByNew(Db *xorm.Engine) (*model.UserProfile, error) {
func UserProfileFindByTaobaoOpenID(Db *xorm.Engine, openid interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("third_party_taobao_oid = ?", openid).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -82,7 +81,7 @@ func UserProfileFindByTaobaoOpenID(Db *xorm.Engine, openid interface{}) (*model.
func UserProfileFindByQQOpenID(Db *xorm.Engine, openid interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("third_party_qq_openid = ?", openid).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -91,7 +90,7 @@ func UserProfileFindByQQOpenID(Db *xorm.Engine, openid interface{}) (*model.User
func UserProfileFindByAppleToken(Db *xorm.Engine, token interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("third_party_apple_token = ?", token).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -100,7 +99,7 @@ func UserProfileFindByAppleToken(Db *xorm.Engine, token interface{}) (*model.Use
func UserProfileFindByWeChatOpenID(Db *xorm.Engine, openid interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("third_party_wechat_openid = ?", openid).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -109,7 +108,7 @@ func UserProfileFindByWeChatOpenID(Db *xorm.Engine, openid interface{}) (*model.
func UserProfileFindByWeChatMiniOpenID(Db *xorm.Engine, openid interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("third_party_wechat_mini_openid = ?", openid).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -118,7 +117,7 @@ func UserProfileFindByWeChatMiniOpenID(Db *xorm.Engine, openid interface{}) (*mo
func UserProfileFindByWeChatUnionID(Db *xorm.Engine, openid interface{}) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := Db.Where("third_party_wechat_unionid = ?", openid).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -231,7 +230,7 @@ func UserProfileisExistByRelationID(Db *xorm.Engine, RelationID string) (bool, e
func UserProfileFindByIDs(Db *xorm.Engine, uids ...int) (*[]model.UserProfile, error) {
var m []model.UserProfile
if err := Db.In("uid", uids).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -240,7 +239,7 @@ func UserProfileFindByIDs(Db *xorm.Engine, uids ...int) (*[]model.UserProfile, e
func UserProfileByPuid(Db *xorm.Engine, puid interface{}) (*[]model.UserProfile, error) {
var m []model.UserProfile
if err := Db.Where("parent_uid = ?", puid).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -250,12 +249,12 @@ func UsersProfileInByIds(Db *xorm.Engine, ids []int, limit, start int) (*[]model
var m []model.UserProfile
if limit == 0 && start == 0 {
if err := Db.In("uid", ids).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
if err := Db.In("uid", ids).Limit(limit, start).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -265,7 +264,7 @@ func UsersProfileInByUIDByisVerify(Db *xorm.Engine, ids []int, isVerify interfac
var m []model.UserProfile
if err := Db.In("uid", ids).Where("is_verify = ?", isVerify).
Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -275,12 +274,12 @@ func UsersProfileInByIdsByDesc(Db *xorm.Engine, ids []int, limit, start int, c s
var m []model.UserProfile
if limit == 0 && start == 0 {
if err := Db.In("uid", ids).Desc(c).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
if err := Db.In("uid", ids).Desc(c).Limit(limit, start).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -290,12 +289,12 @@ func UsersProfileInByIdsByAsc(Db *xorm.Engine, ids []int, limit, start int, c st
var m []model.UserProfile
if limit == 0 && start == 0 {
if err := Db.In("uid", ids).Asc(c).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
if err := Db.In("uid", ids).Asc(c).Limit(limit, start).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -304,7 +303,7 @@ func UsersProfileInByIdsByAsc(Db *xorm.Engine, ids []int, limit, start int, c st
func UsersProfileByTaobaoShateIdNotNull(Db *xorm.Engine, limit, start int) (*[]model.UserProfile, error) {
var m []model.UserProfile
if err := Db.Where("acc_taobao_share_id > 0").Limit(limit, start).Find(&m); err != nil {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -357,7 +356,7 @@ func UserProfileUpdate(Db *xorm.Engine, uid interface{}, userProfile *model.User
affected, err = Db.Where("uid=?", uid).Update(userProfile)
}
if err != nil {
return 0, zhios_o2o_business_logx.Warn(err)
return 0, err
}
return affected, nil
}
@@ -374,7 +373,7 @@ func UserProfileUpdateByArkID(Db *xorm.Engine, arkid interface{}, userProfile *m
affected, err = Db.Where("arkid_uid=?", arkid).Update(userProfile)
}
if err != nil {
return 0, zhios_o2o_business_logx.Warn(err)
return 0, err
}
return affected, nil
}
@@ -387,7 +386,7 @@ func UserProfileDelete(Db *xorm.Engine, uid interface{}) (int64, error) {
func UserProfileFindByIdWithSession(session *xorm.Session, uid int) (*model.UserProfile, error) {
var m model.UserProfile
if has, err := session.Where("uid = ?", uid).Get(&m); err != nil || has == false {
return nil, zhios_o2o_business_logx.Warn(err)
return nil, err
}
return &m, nil
}
@@ -404,7 +403,7 @@ func UserProfileUpdateWithSession(session *xorm.Session, uid interface{}, userPr
affected, err = session.Where("uid=?", uid).Update(userProfile)
}
if err != nil {
return 0, zhios_o2o_business_logx.Warn(err)
return 0, err
}
return affected, nil
}

Laden…
Abbrechen
Speichern