shan
This commit is contained in:
@@ -3,29 +3,18 @@ package cms
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jd"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals/api/apimanager"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/excel"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/dingding"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jsonerr"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -209,7 +198,7 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
|
||||
}
|
||||
if err = CreateUser(user, utils.LimitUTF8StringLen(createName, 32)); err == nil {
|
||||
userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP())
|
||||
TryAddStoreBossRole4User(ctx, user)
|
||||
// TryAddStoreBossRole4User(ctx, user)
|
||||
if mobileAuth != nil {
|
||||
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
||||
err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo)
|
||||
@@ -223,146 +212,6 @@ func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVeri
|
||||
return outAuthInfo, err
|
||||
}
|
||||
|
||||
func TryAddStoreBossRole4User(ctx *jxcontext.Context, user *model.User) (err error) {
|
||||
if user.Type&model.UserTypeStoreBoss != 0 {
|
||||
userMobile := user.GetMobile()
|
||||
if userMobile != "" {
|
||||
if storeList, err := dao.GetStoreList(dao.GetDB(), nil, nil, nil, []string{userMobile}, ""); err == nil && len(storeList) > 0 {
|
||||
roleList := make([]*authz.RoleInfo, len(storeList))
|
||||
for k, v := range storeList {
|
||||
roleList[k] = autils.NewStoreBossRole(v.ID)
|
||||
}
|
||||
err = AddRoles4User(ctx, user.GetID(), roleList)
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func TryAddStoreBossRole4StoreByMobile(ctx *jxcontext.Context, storeID int, mobileList []string) (err error) {
|
||||
if storeID > 0 {
|
||||
var userIDs []string
|
||||
for _, v := range mobileList {
|
||||
if v != "" {
|
||||
if userList, _, err := dao.GetUsers(dao.GetDB(), model.UserTypeStoreBoss, "", nil, nil, []string{v}, 0, -1); err == nil && len(userList) > 0 {
|
||||
userIDs = append(userIDs, userList[0].GetID())
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(userIDs) > 0 {
|
||||
role := autils.NewStoreBossRole(storeID)
|
||||
err = AddUsers4Role(ctx, role, userIDs)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func HandleOrder4Consignee(order *model.GoodsOrder) (err error) {
|
||||
var user *model.User
|
||||
mobileNumber := jxutils.GetRealMobile4Order(order)
|
||||
if mobileNumber == "" && order.VendorUserID == "" {
|
||||
return fmt.Errorf("订单:%s手机号与平台用户标识都是空", order.VendorOrderID)
|
||||
}
|
||||
authType := dao.GetAuthType4Vendor(order.VendorID)
|
||||
if authType == "" {
|
||||
msg := fmt.Sprintf("平台ID:%d当前不被支持,请联系开发", order.VendorID)
|
||||
globals.SugarLogger.Warn(msg)
|
||||
return fmt.Errorf(msg)
|
||||
}
|
||||
|
||||
oeratorName := order.VendorOrderID
|
||||
db := dao.GetDB()
|
||||
if mobileNumber != "" {
|
||||
userList, _, err2 := dao.GetUsers(db, 0, "", nil, nil, []string{mobileNumber}, 0, 0)
|
||||
if err = err2; err != nil {
|
||||
return err
|
||||
}
|
||||
if len(userList) > 0 {
|
||||
user = userList[0]
|
||||
}
|
||||
}
|
||||
|
||||
vendorUserID := order.VendorUserID
|
||||
if vendorUserID != "" {
|
||||
authInfo, err2 := dao.GetAuthBind(db, model.AuthBindTypeID, authType, vendorUserID)
|
||||
if err = err2; err != nil && !dao.IsNoRowsError(err) {
|
||||
return err
|
||||
}
|
||||
if err == nil {
|
||||
vendorUserID = ""
|
||||
if user == nil {
|
||||
if user, err = dao.GetUserByID(db, "user_id", authInfo.UserID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
|
||||
const Remark = "fromOrder"
|
||||
if user == nil {
|
||||
user = &model.User{
|
||||
UserID2: mobileNumber,
|
||||
Name: order.ConsigneeName,
|
||||
Mobile: &mobileNumber,
|
||||
Type: model.UserTypeConsumer,
|
||||
Address: order.ConsigneeAddress,
|
||||
Remark: Remark,
|
||||
}
|
||||
setUserAddress(db, user, order)
|
||||
|
||||
if user.GetID2() == "" {
|
||||
user.UserID2 = order.VendorUserID
|
||||
}
|
||||
if user.GetID2() == "" {
|
||||
user.UserID2 = order.VendorOrderID
|
||||
}
|
||||
|
||||
user.Type = model.UserTypeConsumer
|
||||
err = CreateUser(user, oeratorName)
|
||||
} else {
|
||||
if user.GetMobile() == "" && mobileNumber != "" {
|
||||
user.Mobile = &mobileNumber
|
||||
dao.UpdateEntity(db, user, "Mobile")
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
order.UserID = user.GetID()
|
||||
if vendorUserID != "" {
|
||||
authBind := &model.AuthBind{
|
||||
UserID: user.GetID(),
|
||||
BindType: model.AuthBindTypeID,
|
||||
AuthID: vendorUserID,
|
||||
Type: authType,
|
||||
Remark: Remark,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(authBind, oeratorName)
|
||||
authBind.Status = model.AuthBindStatusNormal
|
||||
err = dao.CreateEntity(nil, authBind)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func setUserAddress(db *dao.DaoDB, user *model.User, order *model.GoodsOrder) {
|
||||
user.Address = order.ConsigneeAddress
|
||||
store := &model.Store{}
|
||||
store.ID = jxutils.GetSaleStoreIDFromOrder(order)
|
||||
if err := dao.GetEntity(db, store); err == nil {
|
||||
user.CityCode = store.CityCode
|
||||
user.DistrictCode = store.DistrictCode
|
||||
} else if dao.IsNoRowsError(err) {
|
||||
if order.ConsigneeLng != 0 && order.ConsigneeLat != 0 {
|
||||
if user.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat)); user.DistrictCode > 0 {
|
||||
if placeInfo, err := dao.GetPlaceByCode(db, user.DistrictCode); err == nil {
|
||||
user.CityCode = placeInfo.ParentCode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func GetUserBindAuthInfo(ctx *jxcontext.Context) (authList []*model.AuthBind, err error) {
|
||||
authInfo, err := ctx.GetV2AuthInfo()
|
||||
if err == nil {
|
||||
@@ -435,55 +284,6 @@ func GetUsers(ctx *jxcontext.Context, userType int, keyword string, userIDs []st
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
func GetStoreList4User(ctx *jxcontext.Context, mobileNum, userID string) (storeList []*dao.StoreWithCityName, err error) {
|
||||
roleList, err := api2.RoleMan.GetUserRoleList(userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var (
|
||||
storeIDs []int
|
||||
shortRoleNameList []string
|
||||
)
|
||||
for _, v := range roleList {
|
||||
if v.StoreID == 0 {
|
||||
shortRoleNameList = append(shortRoleNameList, v.Name)
|
||||
} else {
|
||||
storeIDs = append(storeIDs, v.StoreID)
|
||||
}
|
||||
}
|
||||
storeList, err = dao.GetStoreListByMobileOrStoreIDs(dao.GetDB(), mobileNum, shortRoleNameList, storeIDs)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
func GetMyStoreListNew(ctx *jxcontext.Context) (storesInfo interface{}, errCode string, err error) {
|
||||
if !auth2.IsV2Token(ctx.GetToken()) {
|
||||
return nil, model.ErrCodeTokenIsInvalid, model.ErrTokenIsInvalid
|
||||
}
|
||||
mobileNum, userID := ctx.GetMobileAndUserID()
|
||||
if mobileNum == "" {
|
||||
return nil, "", fmt.Errorf("不能得到用户手机号")
|
||||
}
|
||||
var storeList []*dao.StoreWithCityName
|
||||
if storeList, err = GetStoreList4User(ctx, mobileNum, userID); err == nil && len(storeList) > 0 {
|
||||
// todo,应该用通用方法
|
||||
mapDataList := make([]map[string]interface{}, len(storeList))
|
||||
for k, v := range storeList {
|
||||
mapDataList[k] = map[string]interface{}{
|
||||
"id": v.ID,
|
||||
"address": v.Address,
|
||||
"cityName": v.CityName,
|
||||
"name": v.Name,
|
||||
"tel1": v.Tel1,
|
||||
"tel2": v.Tel2,
|
||||
"payeeName": v.PayeeName,
|
||||
"status": v.Status,
|
||||
}
|
||||
}
|
||||
storesInfo = mapDataList
|
||||
}
|
||||
return storesInfo, "", err
|
||||
}
|
||||
|
||||
func GetStoreRoleList(ctx *jxcontext.Context) (roleList []*authz.RoleInfo, err error) {
|
||||
return authz.StoreRoleList, nil
|
||||
}
|
||||
@@ -523,68 +323,6 @@ func checkUserType(userID string, userType int8) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func AddRoles4User(ctx *jxcontext.Context, userID string, rList []*authz.RoleInfo) (err error) {
|
||||
errList := errlist.New()
|
||||
if err = checkUserType(userID, model.UserTypeNonConsumer); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, v := range rList {
|
||||
if err = autils.ValidateRole(v.Name, v.StoreID); err == nil {
|
||||
if err = api2.RoleMan.AddRole4User(userID, v); err != nil {
|
||||
errList.AddErr(err)
|
||||
} else if v.StoreID > 0 {
|
||||
HandleUserWXRemark(dao.GetDB(), userID, true)
|
||||
}
|
||||
} else {
|
||||
errList.AddErr(err)
|
||||
}
|
||||
}
|
||||
return errList.GetErrListAsOne()
|
||||
}
|
||||
|
||||
func DeleteRoles4User(ctx *jxcontext.Context, userID string, rList []*authz.RoleInfo) (err error) {
|
||||
errList := errlist.New()
|
||||
for _, v := range rList {
|
||||
if err = api2.RoleMan.DeleteRole4User(userID, v); err != nil {
|
||||
errList.AddErr(err)
|
||||
} else if v.StoreID > 0 {
|
||||
HandleUserWXRemark(dao.GetDB(), userID, true)
|
||||
}
|
||||
}
|
||||
return errList.GetErrListAsOne()
|
||||
}
|
||||
|
||||
func AddUsers4Role(ctx *jxcontext.Context, r *authz.RoleInfo, userIDList []string) (err error) {
|
||||
if err = autils.ValidateRole(r.Name, r.StoreID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
errList := errlist.New()
|
||||
for _, v := range userIDList {
|
||||
if err = checkUserType(v, model.UserTypeNonConsumer); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = api2.RoleMan.AddRole4User(v, r); err != nil {
|
||||
errList.AddErr(err)
|
||||
} else if r.StoreID > 0 {
|
||||
HandleUserWXRemark(dao.GetDB(), v, true)
|
||||
}
|
||||
}
|
||||
return errList.GetErrListAsOne()
|
||||
}
|
||||
|
||||
func DeleteUsers4Role(ctx *jxcontext.Context, r *authz.RoleInfo, userIDList []string) (err error) {
|
||||
errList := errlist.New()
|
||||
for _, v := range userIDList {
|
||||
if err = api2.RoleMan.DeleteRole4User(v, r); err != nil {
|
||||
errList.AddErr(err)
|
||||
} else if r.StoreID > 0 {
|
||||
HandleUserWXRemark(dao.GetDB(), v, true)
|
||||
}
|
||||
}
|
||||
return errList.GetErrListAsOne()
|
||||
}
|
||||
|
||||
func getAddressInfoFromCoord(db *dao.DaoDB, lng, lat float64) (formattedAddress string, districtCode, cityCode int, err error) {
|
||||
regeoInfo, err := api.AutonaviAPI.GeoCodeRegeoSingle(lng, lat, 0, false, nil, 0, 0)
|
||||
if err == nil {
|
||||
@@ -792,167 +530,6 @@ func GetSelfInfo(ctx *jxcontext.Context) (getSelfInfoResult *dao.GetSelfInfoResu
|
||||
return getSelfInfoResult, err
|
||||
}
|
||||
|
||||
func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err error) {
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
openIDs := []string{}
|
||||
storeID := 0
|
||||
remark := ""
|
||||
|
||||
// if !globals.DisableWXAuth1 {
|
||||
// wxinfo, err := dao.GetUserStoreInfo(db, "tel", mobile)
|
||||
// if err == nil {
|
||||
// openIDs = []string{wxinfo.OpenID}
|
||||
// storeID = wxinfo.JxStoreID
|
||||
// }
|
||||
// }
|
||||
if globals.EnableWXAuth2 {
|
||||
userID := ""
|
||||
if mobileIsUerID {
|
||||
userID = mobile
|
||||
} else {
|
||||
userList, _, err2 := dao.GetUsers(db, model.UserTypeStoreBoss, "", nil, nil, []string{mobile}, 0, -1)
|
||||
if err = err2; len(userList) > 0 {
|
||||
userID = userList[0].GetID()
|
||||
}
|
||||
}
|
||||
if userID != "" {
|
||||
authBindList, err2 := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "", "")
|
||||
if err = err2; err == nil {
|
||||
for _, v := range authBindList {
|
||||
openIDs = append(openIDs, v.AuthID)
|
||||
}
|
||||
}
|
||||
roleList, err2 := api2.RoleMan.GetUserRoleList(userID)
|
||||
if err = err2; err == nil && len(roleList) > 0 {
|
||||
storeID = roleList[0].StoreID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(openIDs) > 0 {
|
||||
if storeID > 0 {
|
||||
store := &model.Store{}
|
||||
store.ID = storeID
|
||||
if err = dao.GetEntity(db, store); err == nil {
|
||||
city := &model.Place{
|
||||
Code: store.CityCode,
|
||||
}
|
||||
if err = dao.GetEntity(db, city, "Code"); err == nil {
|
||||
remark = city.Name + "-" + store.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
if globals.EnableStoreWrite {
|
||||
for _, openID := range openIDs {
|
||||
err = api.WeixinAPI.CBUpdateRemark(openID, remark)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetJdUsers(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
var (
|
||||
jxVendorIDsMap = make(map[string]string)
|
||||
pageNoList []int
|
||||
storeUserList []interface{}
|
||||
disabledIdList []interface{}
|
||||
)
|
||||
db := dao.GetDB()
|
||||
jdUsersStruct.userMap = jdUsersStruct.userMap[0:0]
|
||||
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
switch step {
|
||||
case 0:
|
||||
//获取京东商城所有用户
|
||||
apiList := apimanager.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD)
|
||||
for _, v := range apiList {
|
||||
_, _, toatlPage, _ := jd.GetAPI(v).PrivilegeSearchUser(1)
|
||||
for i := 1; i <= toatlPage; i++ {
|
||||
pageNoList = append(pageNoList, i)
|
||||
}
|
||||
storeMapList, _ := dao.GetStoreMapsListWithoutDisabled(db, []int{model.VendorIDJD}, model.StoreStatusDisabled)
|
||||
for _, v := range storeMapList {
|
||||
jxVendorIDsMap[v.VendorStoreID] = utils.Int64ToStr(int64(v.StoreID))
|
||||
}
|
||||
taskFunc1 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
pageNo := batchItemList[0].(int)
|
||||
storeUserLists, _, _, err := jd.GetAPI(v).PrivilegeSearchUser(pageNo)
|
||||
retVal = storeUserLists
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel1 := tasksch.NewParallelTask("获取京东商城所有用户列表", tasksch.NewParallelConfig(), ctx, taskFunc1, pageNoList)
|
||||
tasksch.HandleTask(taskParallel1, task, true).Run()
|
||||
storeUserList, err = taskParallel1.GetResult(0)
|
||||
|
||||
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vv := batchItemList[0].(*jdapi.StoreUserInfo)
|
||||
vendorStoreIDs, err := jd.GetAPI(v).GetJdUserBindStoreIDs(vv.ID)
|
||||
var vendorStoreIDsMap = make(map[string]string, len(vendorStoreIDs))
|
||||
var vendorStoreIDsResult []string
|
||||
var roleNameStr string
|
||||
for _, v := range vendorStoreIDs {
|
||||
if jxVendorIDsMap[v] == "" {
|
||||
continue
|
||||
}
|
||||
vendorStoreIDsMap[v] = jxVendorIDsMap[v]
|
||||
}
|
||||
if vv.RoleNameStr != "" {
|
||||
roleNameStr = strings.ReplaceAll(vv.RoleNameStr, " ", "")
|
||||
if roleNameStr != jdapi.JdUserRoleJHYName && roleNameStr != jdapi.JdUserRolesName && roleNameStr != jdapi.JdUserNoRole {
|
||||
jd.GetAPI(v).UpdateJdUserRoles(int64(vv.ID), []string{jdapi.JdUserRoleJHYId})
|
||||
}
|
||||
}
|
||||
if len(vendorStoreIDsMap) == 0 {
|
||||
isManager, _ := jd.GetAPI(v).IsJdManagerUser(int64(vv.ID))
|
||||
if isManager {
|
||||
jdStruct := JdUserStruct{vv.LoginName, "商家管理员", vv.RoleNameStr, vv.LockStatus}
|
||||
jdUsersStruct.AppendData(jdStruct)
|
||||
} else {
|
||||
retVal = []int64{int64(vv.ID)}
|
||||
}
|
||||
} else {
|
||||
for _, m := range vendorStoreIDsMap {
|
||||
vendorStoreIDsResult = append(vendorStoreIDsResult, m)
|
||||
}
|
||||
sort.Strings(vendorStoreIDsResult[:])
|
||||
jdStruct := JdUserStruct{vv.LoginName, strings.Join(vendorStoreIDsResult, ","), vv.RoleNameStr, vv.LockStatus}
|
||||
jdUsersStruct.AppendData(jdStruct)
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel := tasksch.NewParallelTask("获取京东商城用户关联门店列表", tasksch.NewParallelConfig(), ctx, taskFunc, storeUserList)
|
||||
tasksch.HandleTask(taskParallel, task, true).Run()
|
||||
disabledIdList, err = taskParallel.GetResult(0)
|
||||
|
||||
taskFunc2 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
id := batchItemList[0].(int64)
|
||||
jd.GetAPI(v).PrivilegeUpdateJdUserStatus(id, jdapi.JdUserStatusDisable)
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel2 := tasksch.NewParallelTask("禁用未关联活跃门店用户", tasksch.NewParallelConfig(), ctx, taskFunc2, disabledIdList)
|
||||
tasksch.HandleTask(taskParallel2, task, true).Run()
|
||||
_, err = taskParallel2.GetResult(0)
|
||||
}
|
||||
case 1:
|
||||
WriteToExcelJd(task, jdUsersStruct.userMap)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
taskSeq := tasksch.NewSeqTask2("获取京东商城用户关联门店列表-序列任务", ctx, isContinueWhenError, taskSeqFunc, 2)
|
||||
tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||
if !isAsync {
|
||||
_, err = taskSeq.GetResult(0)
|
||||
hint = "1"
|
||||
} else {
|
||||
hint = taskSeq.GetID()
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func (d *GetJdUsersStruct) AppendData(jd JdUserStruct) {
|
||||
d.locker.RLock()
|
||||
defer d.locker.RUnlock()
|
||||
@@ -1069,34 +646,6 @@ func DeleteUserInfo(ctx *jxcontext.Context, userID string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func GetMyJxStoreList(ctx *jxcontext.Context, mobile string) (storesInfo interface{}, err error) {
|
||||
db := dao.GetDB()
|
||||
user, err := dao.GetUserByID(db, "mobile", mobile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
userID := user.UserID
|
||||
var storeList []*dao.StoreWithCityName
|
||||
if storeList, err = GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 {
|
||||
// todo,应该用通用方法
|
||||
mapDataList := make([]map[string]interface{}, len(storeList))
|
||||
for k, v := range storeList {
|
||||
mapDataList[k] = map[string]interface{}{
|
||||
"id": v.ID,
|
||||
"address": v.Address,
|
||||
"cityName": v.CityName,
|
||||
"name": v.Name,
|
||||
"tel1": v.Tel1,
|
||||
"tel2": v.Tel2,
|
||||
"payeeName": v.PayeeName,
|
||||
"status": v.Status,
|
||||
}
|
||||
}
|
||||
storesInfo = mapDataList
|
||||
}
|
||||
return storesInfo, err
|
||||
}
|
||||
|
||||
func CreateUserAgreement(ctx *jxcontext.Context, userAgrs []*model.UserAgreement) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
|
||||
Reference in New Issue
Block a user