- add jxcontext.Context to all public API.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"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"
|
||||
@@ -17,7 +18,7 @@ type StoreUserInfo struct {
|
||||
MembersStr string `json:"-"`
|
||||
}
|
||||
|
||||
func GetStoreUsers(storeID int) (storeUserInfos []*StoreUserInfo, err error) {
|
||||
func GetStoreUsers(ctx *jxcontext.Context, storeID int) (storeUserInfos []*StoreUserInfo, err error) {
|
||||
sql := `
|
||||
SELECT t1.id, t1.jxstoreid, t1.openid, t1.tel, t1.nickname, t1.parentid, t3.tel parent_mobile,
|
||||
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"parentID":', t2.parentid, ',"openID":"', IF(t2.openid IS NULL, "", t2.openid), '","tel":"', t2.tel, '","nickname":"', IF(t2.nickname IS NULL, "", t2.nickname), '"}')), "]") members_str
|
||||
@@ -37,7 +38,7 @@ func GetStoreUsers(storeID int) (storeUserInfos []*StoreUserInfo, err error) {
|
||||
return storeUserInfos, err
|
||||
}
|
||||
|
||||
func GetUserInfo(mobile string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
func GetUserInfo(ctx *jxcontext.Context, mobile string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
sql := `
|
||||
SELECT t1.id, t1.jxstoreid, t1.openid, t1.tel, t1.nickname, t1.parentid, t3.tel parent_mobile,
|
||||
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"openID":"', IF(t2.openid IS NULL, "", t2.openid), '","tel":"', t2.tel, '","nickname":"', IF(t2.nickname IS NULL, "", t2.nickname), '"}')), "]") members_str
|
||||
@@ -56,7 +57,7 @@ func GetUserInfo(mobile string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
return storeUserInfo, err
|
||||
}
|
||||
|
||||
func GetSelfInfo(openID string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
func GetSelfInfo(ctx *jxcontext.Context, openID string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
sql := `
|
||||
SELECT t1.id, t1.jxstoreid, t1.openid, t1.tel, t1.nickname, t1.parentid, t3.tel parent_mobile,
|
||||
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"openID":"', IF(t2.openid IS NULL, "", t2.openid), '","tel":"', t2.tel, '","nickname":"', IF(t2.nickname IS NULL, "", t2.nickname), '"}')), "]") members_str
|
||||
@@ -76,7 +77,7 @@ func GetSelfInfo(openID string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
return storeUserInfo, err
|
||||
}
|
||||
|
||||
func UnbindMobile(mobile string) (num int64, err error) {
|
||||
func UnbindMobile(ctx *jxcontext.Context, mobile string) (num int64, err error) {
|
||||
return dao.UpdateEntityByKV(nil, &legacymodel.WeiXins{}, map[string]interface{}{
|
||||
"JxStoreID": nil,
|
||||
"ParentID": -1,
|
||||
@@ -85,7 +86,7 @@ func UnbindMobile(mobile string) (num int64, err error) {
|
||||
})
|
||||
}
|
||||
|
||||
func BindMobile2Store(mobile string, storeID int) (num int64, err error) {
|
||||
func BindMobile2Store(ctx *jxcontext.Context, mobile string, storeID int) (num int64, err error) {
|
||||
db := dao.GetDB()
|
||||
user, err2 := verifyMobileIsBlank(db, mobile)
|
||||
if err = err2; err == nil || err == orm.ErrNoRows {
|
||||
@@ -102,7 +103,7 @@ func BindMobile2Store(mobile string, storeID int) (num int64, err error) {
|
||||
return num, err
|
||||
}
|
||||
|
||||
func AddMobile2Mobile(parentMobile, mobile string) (num int64, err error) {
|
||||
func AddMobile2Mobile(ctx *jxcontext.Context, parentMobile, mobile string) (num int64, err error) {
|
||||
db := dao.GetDB()
|
||||
parentUser := &legacymodel.WeiXins{}
|
||||
parentUser.Tel = parentMobile
|
||||
@@ -129,7 +130,7 @@ func AddMobile2Mobile(parentMobile, mobile string) (num int64, err error) {
|
||||
return num, err
|
||||
}
|
||||
|
||||
func ChangeMobile(curMobile, expectedMobile string) (num int64, err error) {
|
||||
func ChangeMobile(ctx *jxcontext.Context, curMobile, expectedMobile string) (num int64, err error) {
|
||||
return dao.UpdateEntityByKV(nil, &legacymodel.WeiXins{}, map[string]interface{}{
|
||||
"Tel": expectedMobile,
|
||||
}, map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user