- TmpGetSelfInfo
This commit is contained in:
@@ -56,6 +56,25 @@ func GetUserInfo(mobile string) (storeUserInfo *StoreUserInfo, err error) {
|
||||
return storeUserInfo, err
|
||||
}
|
||||
|
||||
func GetSelfInfo(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
|
||||
FROM weixins t1
|
||||
LEFT JOIN weixins t2 ON t2.parentid = t1.id
|
||||
LEFT JOIN weixins t3 ON t1.parentid = t3.id
|
||||
WHERE t1.openid = ?
|
||||
GROUP BY t1.id, t1.jxstoreid, t1.openid, t1.tel, t1.nickname, t1.parentid;
|
||||
`
|
||||
storeUserInfo = new(StoreUserInfo)
|
||||
if err = dao.GetRow(nil, storeUserInfo, sql, openID); err == nil {
|
||||
if storeUserInfo.MembersStr != "" {
|
||||
err = utils.UnmarshalUseNumber([]byte(storeUserInfo.MembersStr), &storeUserInfo.Members)
|
||||
}
|
||||
}
|
||||
return storeUserInfo, err
|
||||
}
|
||||
|
||||
func UnbindMobile(mobile string) (num int64, err error) {
|
||||
return dao.UpdateEntityByKV(nil, &model.WeiXins{}, map[string]interface{}{
|
||||
"JxStoreID": nil,
|
||||
|
||||
@@ -52,7 +52,7 @@ func UpdateEntityByKV(db *DaoDB, item interface{}, kvs map[string]interface{}, c
|
||||
}
|
||||
globals.SugarLogger.Debugf("UpdateEntityByKV befor item:%s, kvs:%s, conditions:%s", utils.Format4Output(item, false), utils.Format4Output(kvs, false), utils.Format4Output(conditions, false))
|
||||
num, err = qs.Update(kvs)
|
||||
globals.SugarLogger.Debugf("UpdateEntityByKV fater update, num:%d", num)
|
||||
globals.SugarLogger.Debugf("UpdateEntityByKV after update, num:%d", num)
|
||||
return err
|
||||
}, reflect.TypeOf(item).Name())
|
||||
return num, err
|
||||
|
||||
@@ -9,6 +9,19 @@ func (p *PurchaseHandler) SyncStoreSkus(db *dao.DaoDB, storeIDs []int, skuIDs []
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) syncOneStoreSkus(db *dao.DaoDB, storeID, skuIDs []int, isForce bool, userName string) (err error) {
|
||||
// sql := `
|
||||
// SELECT *
|
||||
// FROM store_sku_bind t1
|
||||
// JOIN sku t2 ON t1.sku_id = t2.skuIDs
|
||||
// JOIN sku_name t3 ON t2.name_id = t3.id
|
||||
// JOIN sku_category t4 ON t3.category_id = t4.id
|
||||
// LEFT JOIN store_sku_category_map t5 ON t5.store_id = t1.store_id AND t5.sku_category_id = t4.id
|
||||
// WHERE t1.ebai_sync_status <> 0 AND t1.store_id = ?
|
||||
// `
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) SyncStoreCategories(db *dao.DaoDB, storeIDs []int, catIDs []int) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
@@ -281,3 +282,20 @@ func (c *SkuController) GetVendorSku() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 同步商家SKU
|
||||
// @Description 同步商家SKU
|
||||
// @Param token header string true "认证token"
|
||||
// @Param nameID query int true "name ID, -1表示所有"
|
||||
// @Param skuID query int true "sku ID, -1表示所有"
|
||||
// @Param isForce query bool false "是否强制刷新,缺省为否"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /SyncSkus [put]
|
||||
func (c *SkuController) SyncSkus() {
|
||||
c.callSyncSkus(func(params *tSkuSyncSkusParams) (retVal interface{}, errCode string, err error) {
|
||||
db := dao.GetDB()
|
||||
err = cms.CurVendorSync.SyncSku(db, params.NameID, params.SkuID, params.IsForce, GetUserNameFromToken(params.Token))
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/auth"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -37,6 +38,22 @@ func (c *UserController) TmpGetUserInfo() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到用户自己的门店及成员信息
|
||||
// @Description 得到用户自己的门店及成员信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /TmpGetSelfInfo [get]
|
||||
func (c *UserController) TmpGetSelfInfo() {
|
||||
c.callTmpGetSelfInfo(func(params *tUserTmpGetSelfInfoParams) (retVal interface{}, errCode string, err error) {
|
||||
tokenInfo, err2 := auth.GetUserInfo(params.Token)
|
||||
if err = err2; err == nil {
|
||||
retVal, err = cms.GetSelfInfo(tokenInfo.ID)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 取消手机门店绑定
|
||||
// @Description 此操作会将此手机关联的所有门店信息清除(取消组长,取消自己为他组组员),如果此人为组长,取消后组员也相应会取消门店绑定(但组员的成员关系还在)
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
@@ -271,6 +271,14 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
|
||||
beego.ControllerComments{
|
||||
Method: "SyncSkus",
|
||||
Router: `/SyncSkus`,
|
||||
AllowHTTPMethods: []string{"put"},
|
||||
MethodParams: param.Make(),
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
|
||||
beego.ControllerComments{
|
||||
Method: "UpdateCategory",
|
||||
@@ -415,6 +423,14 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:UserController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:UserController"],
|
||||
beego.ControllerComments{
|
||||
Method: "TmpGetSelfInfo",
|
||||
Router: `/TmpGetSelfInfo`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:UserController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:UserController"],
|
||||
beego.ControllerComments{
|
||||
Method: "TmpGetStoreUsers",
|
||||
|
||||
Reference in New Issue
Block a user