Browse Source

Merge remote-tracking branch 'origin/debug' into debug

zwxi 10 months ago
parent
commit
530f318633

+ 15 - 9
controllers/cygx/order.go

@@ -76,7 +76,7 @@ func (this *OrderController) OrderList() {
 
 
 	if startDate != "" && endDate != "" { //时间范围
 	if startDate != "" && endDate != "" { //时间范围
 		condition += ` 	AND create_time  BETWEEN ?   AND  ? `
 		condition += ` 	AND create_time  BETWEEN ?   AND  ? `
-		pars = append(pars, startDate, endDate)
+		pars = append(pars, startDate+" 00:00:01", endDate+" 23:59:59")
 	}
 	}
 
 
 	if adminId != "" { //所属销售筛选
 	if adminId != "" { //所属销售筛选
@@ -151,11 +151,11 @@ func (this *OrderController) OrderList() {
 		item.SourceTitle = v.SourceTitle
 		item.SourceTitle = v.SourceTitle
 		switch v.Source {
 		switch v.Source {
 		case utils.CYGX_OBJ_ARTICLE: //文章详情
 		case utils.CYGX_OBJ_ARTICLE: //文章详情
-			item.HttpUrl = utils.CYGX_WEB_URL + "/material/info/" + strconv.Itoa(v.SourceId)
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_ACTIVITY: //活动详情
 		case utils.CYGX_OBJ_ACTIVITY: //活动详情
-			item.HttpUrl = utils.CYGX_WEB_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //专栏详情
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //专栏详情
-			item.HttpUrl = utils.CYGX_WEB_URL + "/column/detail/" + strconv.Itoa(v.SourceId)
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.SourceId)
 		}
 		}
 		item.OrderStatus = v.OrderStatus
 		item.OrderStatus = v.OrderStatus
 
 
@@ -215,6 +215,9 @@ func (this *OrderController) OrderList() {
 		item.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
 		item.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
 		resp.List = append(resp.List, item)
 		resp.List = append(resp.List, item)
 	}
 	}
+	if len(resp.List) == 0 {
+		resp.List = make([]*cygx.OrderListResp, 0)
+	}
 
 
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp.Paging = page
 	resp.Paging = page
@@ -292,7 +295,7 @@ func (this *UserController) OrderRefund() {
 	}
 	}
 	br.Ret = 200
 	br.Ret = 200
 	br.Success = true
 	br.Success = true
-	br.Msg = "操作成功"
+	br.Msg = "已提交退款,请到退款记录页面查看"
 }
 }
 
 
 // @Title 退款记录列表
 // @Title 退款记录列表
@@ -355,7 +358,7 @@ func (this *OrderController) OrderRefundList() {
 
 
 	if startDate != "" && endDate != "" { //时间范围
 	if startDate != "" && endDate != "" { //时间范围
 		condition += ` 	AND create_time  BETWEEN ?   AND  ? `
 		condition += ` 	AND create_time  BETWEEN ?   AND  ? `
-		pars = append(pars, startDate, endDate)
+		pars = append(pars, startDate+" 00:00:01", endDate+" 23:59:59")
 	}
 	}
 
 
 	if adminId != "" { //所属销售筛选
 	if adminId != "" { //所属销售筛选
@@ -429,11 +432,11 @@ func (this *OrderController) OrderRefundList() {
 		item.SourceTitle = v.SourceTitle
 		item.SourceTitle = v.SourceTitle
 		switch v.Source {
 		switch v.Source {
 		case utils.CYGX_OBJ_ARTICLE: //文章详情
 		case utils.CYGX_OBJ_ARTICLE: //文章详情
-			item.HttpUrl = utils.CYGX_WEB_URL + "/material/info/" + strconv.Itoa(v.SourceId)
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_ACTIVITY: //活动详情
 		case utils.CYGX_OBJ_ACTIVITY: //活动详情
-			item.HttpUrl = utils.CYGX_WEB_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //专栏详情
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //专栏详情
-			item.HttpUrl = utils.CYGX_WEB_URL + "/column/detail/" + strconv.Itoa(v.SourceId)
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.SourceId)
 		}
 		}
 		//OrderStatus      int       `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"`
 		//OrderStatus      int       `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"`
 		item.OrderStatus = v.OrderStatus
 		item.OrderStatus = v.OrderStatus
@@ -489,6 +492,9 @@ func (this *OrderController) OrderRefundList() {
 		item.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
 		item.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
 		resp.List = append(resp.List, item)
 		resp.List = append(resp.List, item)
 	}
 	}
+	if len(resp.List) == 0 {
+		resp.List = make([]*cygx.OrderListResp, 0)
+	}
 
 
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp.Paging = page
 	resp.Paging = page

+ 31 - 10
controllers/cygx/yanxuan_special.go

@@ -539,10 +539,10 @@ func (this *YanxuanSpecialController) Enable() {
 		go cygxService.SendWxMsgSpecialFollow(req.Id)
 		go cygxService.SendWxMsgSpecialFollow(req.Id)
 		go services.SendWxCategoryMsgSpecialFollow(req.Id)
 		go services.SendWxCategoryMsgSpecialFollow(req.Id)
 	}
 	}
-	go cygxService.SendWxMsgSpecialAuthor(req.Id, req.Status) // 研选专栏审核完成时,给提交人发送模板消息
+	go cygxService.SendWxMsgSpecialAuthor(req.Id, req.Status)      // 研选专栏审核完成时,给提交人发送模板消息
 	go services.SendWxCategoryMsgSpecialAuthor(req.Id, req.Status) // 研选专栏审核完成时,给提交人发送模板消息
 	go services.SendWxCategoryMsgSpecialAuthor(req.Id, req.Status) // 研选专栏审核完成时,给提交人发送模板消息
-	go cygxService.UpdateYanxuanSpecialResourceData(req.Id)   //  写入首页最新  cygx_resource_data 表
-	go elastic.EsAddYanxuanSpecial(req.Id)                    //  写入es 综合搜索
+	go cygxService.UpdateYanxuanSpecialResourceData(req.Id)        //  写入首页最新  cygx_resource_data 表
+	go elastic.EsAddYanxuanSpecial(req.Id)                         //  写入es 综合搜索
 	br.Msg = "审批成功"
 	br.Msg = "审批成功"
 	br.Ret = 200
 	br.Ret = 200
 	br.Success = true
 	br.Success = true
@@ -801,25 +801,46 @@ func (this *YanxuanSpecialController) ShowButton() {
 	}
 	}
 
 
 	resp := new(cygx.CygxYanxuanSpecialShowButton)
 	resp := new(cygx.CygxYanxuanSpecialShowButton)
-	configCode := utils.TPL_MSG_NEI_RONG_ZU
-	cnfNeiRong, err := cygx.GetConfigByCode(configCode)
+	//configCode := utils.TPL_MSG_NEI_RONG_ZU
+	//cnfNeiRong, err := cygx.GetConfigByCode(configCode)
+	//if err != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取失败,Err:" + err.Error()
+	//	return
+	//}
+	////汪洋王芳手机号
+	//configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	//cnfWang, err := cygx.GetConfigByCode(configCode)
+	//if err != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取失败,Err:" + err.Error()
+	//	return
+	//}
+
+	//文章管理专栏是否可见
+	cnfArticle, err := cygx.GetConfigByCode(utils.YANXUAN_SPECIAL_ARTICLE_BUTTON_MOBILE)
 	if err != nil {
 	if err != nil {
 		br.Msg = "获取失败"
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 		return
 	}
 	}
-	//汪洋王芳手机号
-	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
-	cnfWang, err := cygx.GetConfigByCode(configCode)
+	articleMobileSlice := strings.Split(cnfArticle.ConfigValue, ",")
+	if utils.InArrayByStr(articleMobileSlice, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
+		resp.IsShowYanXuanSpecial = true
+	}
+
+	//作者管理专栏是否可见
+	cnfAuthor, err := cygx.GetConfigByCode(utils.YANXUAN_SPECIAL_AUTHOR_BUTTON_MOBILE)
 	if err != nil {
 	if err != nil {
 		br.Msg = "获取失败"
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 		return
 	}
 	}
-	//作者管理栏,只有内容组、汪洋、王芳、超管可见
-	if strings.Contains(cnfNeiRong.ConfigValue, sysUser.Mobile) || strings.Contains(cnfWang.ConfigValue, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
+	authorMobileSlice := strings.Split(cnfAuthor.ConfigValue, ",")
+	if utils.InArrayByStr(authorMobileSlice, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
 		resp.IsShowSpecialAuthor = true
 		resp.IsShowSpecialAuthor = true
 	}
 	}
+
 	br.Data = resp
 	br.Data = resp
 	br.Ret = 200
 	br.Ret = 200
 	br.Success = true
 	br.Success = true

+ 2 - 1
models/cygx/cygx_yanxuan_special.go

@@ -188,7 +188,8 @@ func GetCygxYanxuanSpecialCount(condition string, pars []interface{}) (count int
 }
 }
 
 
 type CygxYanxuanSpecialShowButton struct {
 type CygxYanxuanSpecialShowButton struct {
-	IsShowSpecialAuthor bool // 作者管理的按钮是否
+	IsShowYanXuanSpecial bool // 研选专栏文章管理按钮是否展示
+	IsShowSpecialAuthor  bool // 作者管理的按钮是否展示
 }
 }
 
 
 func GetYanxuanSpecialBySpecialId(specialId int) (item *CygxYanxuanSpecialItem, err error) {
 func GetYanxuanSpecialBySpecialId(specialId int) (item *CygxYanxuanSpecialItem, err error) {

+ 1 - 0
models/cygx/orde.go

@@ -42,6 +42,7 @@ type CygxOrder struct {
 type CygxOrderResp struct {
 type CygxOrderResp struct {
 	OrderId          int       `orm:"column(order_id);pk";comment:"订单id"`
 	OrderId          int       `orm:"column(order_id);pk";comment:"订单id"`
 	OrderCode        string    `comment:"订单编号"`
 	OrderCode        string    `comment:"订单编号"`
+	OutTradeNo       string    `comment:"【商户订单号】 商户系统内部订单号"`
 	OutTradeCode     string    `comment:"外部交易号"`
 	OutTradeCode     string    `comment:"外部交易号"`
 	PaymentType      int       `comment:"支付类型。取值范围:1微信支付,2支付宝支付。"`
 	PaymentType      int       `comment:"支付类型。取值范围:1微信支付,2支付宝支付。"`
 	TradeType        string    `comment:"交易类型,枚举值:JSAPI:公众号支付 、 NATIVE:扫码支付 、 App:App支付 、 MICROPAY:付款码支付 、 MWEB:H5支付 、 FACEPAY:刷脸支付"`
 	TradeType        string    `comment:"交易类型,枚举值:JSAPI:公众号支付 、 NATIVE:扫码支付 、 App:App支付 、 MICROPAY:付款码支付 、 MWEB:H5支付 、 FACEPAY:刷脸支付"`

+ 18 - 4
services/cygx/industry_fllow.go

@@ -6,12 +6,13 @@ import (
 	"hongze/hz_crm_api/models"
 	"hongze/hz_crm_api/models"
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/services/alarm_msg"
 	"hongze/hz_crm_api/services/alarm_msg"
+	"hongze/hz_crm_api/utils"
 	"strconv"
 	"strconv"
 	"time"
 	"time"
 )
 )
 
 
 //func init() {
 //func init() {
-//	AddUserFllowCompanyLossToTryOut(1431)
+//	AddUserFllowCompanyLossToTryOut(12841)
 //}
 //}
 
 
 // 流失客户转试用给下面的用户自动添加产业关注
 // 流失客户转试用给下面的用户自动添加产业关注
@@ -30,6 +31,10 @@ func AddUserFllowCompanyLossToTryOut(companyId int) {
 		err = errors.New("GetWxUserListByUserMobileHaveCompany" + e.Error())
 		err = errors.New("GetWxUserListByUserMobileHaveCompany" + e.Error())
 		return
 		return
 	}
 	}
+
+	if len(userList) == 0 {
+		return
+	}
 	var condition string
 	var condition string
 	var pars []interface{}
 	var pars []interface{}
 	//所有的产业
 	//所有的产业
@@ -38,8 +43,15 @@ func AddUserFllowCompanyLossToTryOut(companyId int) {
 		err = errors.New("GetTopOneMonthArtReadNumIndustryAll, Err: " + e.Error())
 		err = errors.New("GetTopOneMonthArtReadNumIndustryAll, Err: " + e.Error())
 		return
 		return
 	}
 	}
-	condition = " AND company_id =  ? "
-	pars = append(pars, companyId)
+
+	var userIds []int
+
+	for _, v := range userList {
+		userIds = append(userIds, v.UserId)
+	}
+
+	condition = " AND user_id IN  (" + utils.GetOrmInReplace(len(userIds)) + ")  "
+	pars = append(pars, userIds)
 	userFllowList, e := cygx.GetCygxIndustryFllowList(condition, pars, 0, 0)
 	userFllowList, e := cygx.GetCygxIndustryFllowList(condition, pars, 0, 0)
 	if e != nil {
 	if e != nil {
 		err = errors.New("GetCygxIndustryFllowList, Err: " + e.Error())
 		err = errors.New("GetCygxIndustryFllowList, Err: " + e.Error())
@@ -75,7 +87,7 @@ func AddUserFllowCompanyLossToTryOut(companyId int) {
 			Items = append(Items, item)
 			Items = append(Items, item)
 		}
 		}
 	}
 	}
-
+	//fmt.Println("Items", len(Items))
 	//如果小于五千条就直接插入,大于五千条就批量插入
 	//如果小于五千条就直接插入,大于五千条就批量插入
 	if len(Items) < 5000 {
 	if len(Items) < 5000 {
 		e = cygx.AddCygxIndustryFllowMulti(Items)
 		e = cygx.AddCygxIndustryFllowMulti(Items)
@@ -118,5 +130,7 @@ func AddUserFllowCompanyLossToTryOut(companyId int) {
 			}
 			}
 		}
 		}
 	}
 	}
+
+	//fmt.Println("AddUserFllowCompanyLossToTryOut end")
 	return
 	return
 }
 }

+ 6 - 4
services/cygx/wx_pay.go

@@ -60,7 +60,7 @@ func RefundsApiService(orderDetail *cygx.CygxOrderResp) (statusCode int, err err
 	}()
 	}()
 	ctx, client, err := getWechatClient()
 	ctx, client, err := getWechatClient()
 	if err != nil {
 	if err != nil {
-		log.Printf("getWechatClientt err:%s", err)
+		//log.Printf("getWechatClientt err:%s", err)
 		return
 		return
 	}
 	}
 
 
@@ -69,7 +69,7 @@ func RefundsApiService(orderDetail *cygx.CygxOrderResp) (statusCode int, err err
 		refunddomestic.CreateRequest{
 		refunddomestic.CreateRequest{
 			//SubMchid:      core.String(Mchid),
 			//SubMchid:      core.String(Mchid),
 			TransactionId: core.String(orderDetail.OutTradeCode),
 			TransactionId: core.String(orderDetail.OutTradeCode),
-			OutTradeNo:    core.String(orderDetail.OrderCode),
+			OutTradeNo:    core.String(orderDetail.OutTradeNo),
 			OutRefundNo:   core.String("RE" + orderDetail.OrderCode),
 			OutRefundNo:   core.String("RE" + orderDetail.OrderCode),
 			Reason:        core.String("退款"),
 			Reason:        core.String("退款"),
 			NotifyUrl:     core.String(utils.Wx_MFYX_Refund_NotifyUrl),
 			NotifyUrl:     core.String(utils.Wx_MFYX_Refund_NotifyUrl),
@@ -85,13 +85,15 @@ func RefundsApiService(orderDetail *cygx.CygxOrderResp) (statusCode int, err err
 			},
 			},
 		},
 		},
 	)
 	)
-	statusCode = result.Response.StatusCode
 	if err != nil {
 	if err != nil {
 		// 处理错误
 		// 处理错误
-		log.Printf("call Create err:%s", err)
+		//log.Printf("call Create err:%s", err)
+		return
 	} else {
 	} else {
 		// 处理返回结果
 		// 处理返回结果
 		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
 		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
 	}
 	}
+	statusCode = result.Response.StatusCode
+
 	return
 	return
 }
 }

+ 6 - 0
utils/constants.go

@@ -423,6 +423,12 @@ const (
 	HONG_GUAN_NAME                          string = "宏观"
 	HONG_GUAN_NAME                          string = "宏观"
 )
 )
 
 
+// 权益cygx_config配置主键以后放这里
+const (
+	YANXUAN_SPECIAL_ARTICLE_BUTTON_MOBILE string = "yanxuan_special_article_button_mobile" //CRM研选专栏模块文章管理可以查看的手机号
+	YANXUAN_SPECIAL_AUTHOR_BUTTON_MOBILE  string = "yanxuan_special_author_button_mobile"  //CRM研选专栏模块作者管理可以查看的手机号
+)
+
 var CYGX_REGISTER_PLATFORM_MAP = map[string]string{
 var CYGX_REGISTER_PLATFORM_MAP = map[string]string{
 	"1": "小程序",
 	"1": "小程序",
 	"2": "网页版",
 	"2": "网页版",