Merge remote-tracking branch 'origin/mark' into jdshop
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/weixinapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/dingding"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/password"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -322,3 +324,44 @@ func (c *Auth2Controller) DeletedTokenInfoWithoutParam() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
type UserInfoWithWeixin struct {
|
||||
Mobile string `json:"mobile"`
|
||||
IsExist bool `json:"isExist"`
|
||||
}
|
||||
|
||||
// @Title 根据小程序jsCode查询用户信息
|
||||
// @Description 根据小程序jsCode查询用户信息
|
||||
// @Param token header string false "认证token"
|
||||
// @Param data formData string true "加密数据"
|
||||
// @Param iv formData string true "iv"
|
||||
// @Param jsCode formData string false "小程序jsCode"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetUserByMiniInfo [post]
|
||||
func (c *Auth2Controller) GetUserByMiniInfo() {
|
||||
c.callGetUserByMiniInfo(func(params *tAuth2GetUserByMiniInfoParams) (retVal interface{}, errCode string, err error) {
|
||||
authInfo := &auth2.AuthInfo{}
|
||||
if err == nil {
|
||||
decryptedDataBase64, err2 := weixin.AutherObjMini.DecryptData(authInfo, GetComposedCode(&c.Controller, params.JsCode), params.Data, params.Iv)
|
||||
if err = err2; err == nil {
|
||||
var userInfo *weixinapi.MiniUserInfo
|
||||
if err = utils.UnmarshalUseNumber([]byte(decryptedDataBase64), &userInfo); err == nil {
|
||||
result := &UserInfoWithWeixin{}
|
||||
result.Mobile = userInfo.PhoneNumber
|
||||
if userInfo.PhoneNumber != "" {
|
||||
if user, err := dao.GetUserByID(dao.GetDB(), "mobile", userInfo.PhoneNumber); err == nil {
|
||||
if user != nil {
|
||||
result.IsExist = true
|
||||
} else {
|
||||
result.IsExist = false
|
||||
}
|
||||
}
|
||||
}
|
||||
retVal = result
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -683,3 +683,15 @@ func (c *SkuController) LoadStoreVendorCategories() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 刷新没图的商品
|
||||
// @Description 刷新没图的商品
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /RefreshNoImgSku [post]
|
||||
func (c *SkuController) RefreshNoImgSku() {
|
||||
c.callRefreshNoImgSku(func(params *tSkuRefreshNoImgSkuParams) (retVal interface{}, errCode string, err error) {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ func (c *StoreSkuController) GetStoreSkus() {
|
||||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||||
// @Param nameIDs query string false "SkuName ID列表对象"
|
||||
// @Param skuIDs query string false "Sku ID列表对象"
|
||||
// @Param upcs query string false "upc列表对象"
|
||||
// @Param name query string false "商品名称(不要求完全一致)"
|
||||
// @Param prefix query string false "商品前缀(不要求完全一致)"
|
||||
// @Param categoryID query int false "商品所属类别ID"
|
||||
@@ -99,8 +100,9 @@ func (c *StoreSkuController) GetStoreSkus() {
|
||||
func (c *StoreSkuController) GetStoresSkus() {
|
||||
c.callGetStoresSkus(func(params *tStoreSkuGetStoresSkusParams) (retVal interface{}, errCode string, err error) {
|
||||
var storeIDs, skuIDs []int
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs); err == nil {
|
||||
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, params.IsFocus, params.IsHighPrice, params.PriceType, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize)
|
||||
var upcs []string
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.Upcs, &upcs); err == nil {
|
||||
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, upcs, params.IsFocus, params.IsHighPrice, params.PriceType, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
@@ -923,3 +925,39 @@ func (c *StoreSkuController) GetSpecialtyStoreSkus() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 拉取平台标品
|
||||
// @Description 拉取平台标品
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorID formData int true "平台id"
|
||||
// @Param storeID formData int true "门店ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetVendorStoreSkus [post]
|
||||
func (c *StoreSkuController) GetVendorStoreSkus() {
|
||||
c.callGetVendorStoreSkus(func(params *tStoreSkuGetVendorStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.GetVendorStoreSkus(params.Ctx, params.StoreID, params.VendorID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到商家商品信息
|
||||
// @Description 得到商家商品信息,如下条件之间是与的关系。对于没有认领的商品,按城市限制。但对于已经认领的商品就不限制了,因为已经在平台上可售,可以操作(改价等等)
|
||||
// @Param token header string false "认证token"
|
||||
// @Param storeID query int true "门店ID"
|
||||
// @Param isFocus query bool true "是否已关注(认领)"
|
||||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||||
// @Param categoryID query int false "商品所属类别ID"
|
||||
// @Param status query int false "查询起始状态(0:不可售,1:可售,-1 全部)"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||
// @Param isAct query bool false "是否活动商品(包括正常活动与补贴)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoresSkusForStore [get]
|
||||
func (c *StoreSkuController) GetStoresSkusForStore() {
|
||||
c.callGetStoresSkusForStore(func(params *tStoreSkuGetStoresSkusForStoreParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetStoresSkusForStore(params.Ctx, params.StoreID, params.IsFocus, params.IsAct, params.Keyword, params.CategoryID, params.Status, params.Offset, params.PageSize)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ func (c *DjswController) Token() {
|
||||
if err == nil {
|
||||
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
|
||||
}
|
||||
jd.OnTokenChange(urlValues)
|
||||
c.Data["json"] = c.transferResponse("Token", nil)
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ type ReportController struct {
|
||||
// @Title 查询订单统计信息
|
||||
// @Description 根据门店idlist和时间范围查询
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeIDs formData string true "京西门店ID列表[1,2,3]"
|
||||
// @Param storeIDs formData string false "京西门店ID列表[1,2,3]"
|
||||
// @Param vendorIDs formData string false "平台ID列表[1,2,3]"
|
||||
// @Param fromDate formData string true "开始日期(包含),格式(2006-01-02 00:00:00)"
|
||||
// @Param toDate formData string true "结束日期(包含),格式(2006-01-02 00:00:00)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -23,9 +24,9 @@ type ReportController struct {
|
||||
// @router /StatisticsReportForOrders [post]
|
||||
func (c *ReportController) StatisticsReportForOrders() {
|
||||
c.callStatisticsReportForOrders(func(params *tReportStatisticsReportForOrdersParams) (retVal interface{}, errCode string, err error) {
|
||||
var storeIDList []int
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
|
||||
retVal, err = report.GetStatisticsReportForOrders(params.Ctx, storeIDList, params.FromDate, params.ToDate)
|
||||
var storeIDList, vendorIDs []int
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList, params.VendorIDs, &vendorIDs); err == nil {
|
||||
retVal, err = report.GetStatisticsReportForOrders(params.Ctx, storeIDList, vendorIDs, params.FromDate, params.ToDate)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
@@ -114,3 +115,25 @@ func (c *ReportController) GetManageState() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 查询门店经营数据
|
||||
// @Description 查询门店经营数据
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeIDs query string false "门店ID列表[1,2,3]"
|
||||
// @Param brandIDs query string false "品牌ID列表[1,2,3]"
|
||||
// @Param vendorID query int true "平台ID"
|
||||
// @Param sortType query int false "排序类型,1 覆盖范围,2市场规模,3营业时长,4商品数,5虚高商品数,6活动丰富度,7无效订单数,8拒绝订单数,9门店评分,正升序,负倒序"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreManageState [get]
|
||||
func (c *ReportController) GetStoreManageState() {
|
||||
c.callGetStoreManageState(func(params *tReportGetStoreManageStateParams) (retVal interface{}, errCode string, err error) {
|
||||
var storeIDs, brandIDs []int
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.BrandIDs, &brandIDs); err == nil {
|
||||
retVal, err = report.GetStoreManageState(params.Ctx, storeIDs, brandIDs, params.VendorID, params.SortType, params.Offset, params.PageSize)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -161,3 +161,20 @@ func (c *SysController) UpdateVendorOrgCode() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 添加平台账号信息
|
||||
// @Description 添加平台账号信息
|
||||
// @Param token header string true "token"
|
||||
// @Param payload formData string true "json数据,vendorOrgCode对象()"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /AddVendorOrgCode [post]
|
||||
func (c *SysController) AddVendorOrgCode() {
|
||||
c.callAddVendorOrgCode(func(params *tSysAddVendorOrgCodeParams) (retVal interface{}, errCode string, err error) {
|
||||
vendorOrgCode := &model.VendorOrgCode{}
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &vendorOrgCode); err == nil {
|
||||
err = common.AddVendorOrgCode(params.Ctx, vendorOrgCode)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user