用户统计接口
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
package localjx
|
package localjx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
@@ -14,12 +13,11 @@ import (
|
|||||||
|
|
||||||
type GetJxShopUsersResult struct {
|
type GetJxShopUsersResult struct {
|
||||||
model.User
|
model.User
|
||||||
RegisterTime time.Time `json:"registerTime"`
|
BuyCount int `json:"buyCount"`
|
||||||
BuyCount int `json:"buyCount"`
|
ActualPayPrice int `json:"actualPayPrice"`
|
||||||
ActualPayPrice int `json:"actualPayPrice"`
|
GoodCommentCount int `json:"goodCommentCount"`
|
||||||
GoodComment string `json:"goodComment"`
|
BadCommentCount int `json:"badCommentCount"`
|
||||||
BadComment string `json:"badComment"`
|
UserMembers []*model.UserMember `json:"userMembers"`
|
||||||
UserMembers []*model.UserMember `json:"userMembers"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||||
@@ -28,23 +26,24 @@ func GetJxShopUsers(ctx *jxcontext.Context, keyword string, offset, pageSize int
|
|||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
sql := `
|
sql := `
|
||||||
SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, b.name user_name, c.name city_name
|
SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, b.buy_count, b.actual_pay_price
|
||||||
FROM store_audit a
|
FROM user a,
|
||||||
JOIN user b ON b.user_id = a.user_id
|
(SELECT a.user_id, COUNT(*) buy_count, SUM(c.actual_pay_price) actual_pay_price
|
||||||
JOIN place c ON c.code = a.city_code
|
FROM user a
|
||||||
WHERE a.deleted_at = ?
|
JOIN auth_bind b ON b.user_id = a.user_id AND b.deleted_at = ? AND b.type_id = ?
|
||||||
|
JOIN goods_order c ON c.user_id = a.user_id AND c.status <> ?
|
||||||
|
WHERE a.deleted_at = ?
|
||||||
|
GROUP BY 1) b
|
||||||
|
WHERE a.user_id = b.user_id
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
|
utils.DefaultTimeValue, api.WeixinMiniAppID2,
|
||||||
|
model.OrderStatusCanceled,
|
||||||
utils.DefaultTimeValue,
|
utils.DefaultTimeValue,
|
||||||
}
|
}
|
||||||
// if len(statuss) > 0 {
|
|
||||||
// sql += " AND a.audit_status IN (" + GenQuestionMarks(len(statuss)) + ")"
|
|
||||||
// sqlParams = append(sqlParams, statuss)
|
|
||||||
// }
|
|
||||||
|
|
||||||
if keyword != "" {
|
if keyword != "" {
|
||||||
sql += " AND (a.user_id LIKE ? OR a.name LIKE ? OR a.tel1 LIKE ? OR a.tel2 LIKE ? OR a.address LIKE ?)"
|
sql += " AND (a.user_id LIKE ? OR a.name LIKE ? OR a.moblie LIKE ? OR a.user_id2 LIKE ?)"
|
||||||
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%")
|
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%")
|
||||||
}
|
}
|
||||||
sql += "LIMIT ? OFFSET ?"
|
sql += "LIMIT ? OFFSET ?"
|
||||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jsonerr"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jsonerr"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -533,3 +534,19 @@ func (c *User2Controller) GetUserAgreement() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 查询京西商城用户信息
|
||||||
|
// @Description 查询京西商城用户信息
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param keyword query string false "关键字"
|
||||||
|
// @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 /GetJxShopUsers [get]
|
||||||
|
func (c *User2Controller) GetJxShopUsers() {
|
||||||
|
c.callGetJxShopUsers(func(params *tUser2GetJxShopUsersParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = localjx.GetJxShopUsers(params.Ctx, params.Keyword, params.Offset, params.PageSize)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -283,18 +283,3 @@ func (c *JxOrderController) TestDefend() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Title 查询京西商城用户信息
|
|
||||||
// @Description 查询京西商城用户信息
|
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param keyword query string false "关键字"
|
|
||||||
// @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 /GetJxShopUsers [get]
|
|
||||||
func (c *JxOrderController) GetJxShopUsers() {
|
|
||||||
c.callGetJxShopUsers(func(params *tJxorderGetJxShopUsersParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
return retVal, "", err
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -700,15 +700,6 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
|
||||||
beego.ControllerComments{
|
|
||||||
Method: "GetJxShopUsers",
|
|
||||||
Router: `/GetJxShopUsers`,
|
|
||||||
AllowHTTPMethods: []string{"get"},
|
|
||||||
MethodParams: param.Make(),
|
|
||||||
Filters: nil,
|
|
||||||
Params: nil})
|
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetMatterOrderStatus",
|
Method: "GetMatterOrderStatus",
|
||||||
@@ -2952,6 +2943,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetJxShopUsers",
|
||||||
|
Router: `/GetJxShopUsers`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetMyJxStoreList",
|
Method: "GetMyJxStoreList",
|
||||||
|
|||||||
Reference in New Issue
Block a user