Browse Source

no message

xingzai 1 year ago
parent
commit
fe5703bbcd
3 changed files with 33 additions and 39 deletions
  1. 12 1
      controllers/user.go
  2. 20 3
      models/apply_record.go
  3. 1 35
      services/wechat_send_msg.go

+ 12 - 1
controllers/user.go

@@ -1806,7 +1806,7 @@ func (this *UserController) ApplyDetail() {
 		br.Ret = 408
 		return
 	}
-	resp := new(models.CygxApplyRecordResp)
+	resp := new(models.CygxApplyRecordDetialResp)
 	applyRecordId, _ := this.GetInt("ApplyRecordId")
 	detail, err := models.GetCygxApplyRecordById(applyRecordId)
 	if err != nil {
@@ -1814,6 +1814,17 @@ func (this *UserController) ApplyDetail() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
+	switch detail.RegisterPlatform {
+	case 1:
+		detail.ApplicationSource = "小程序"
+	case 2:
+		detail.ApplicationSource = "网页版"
+	}
+
+	switch detail.InviteCompanySource {
+	case 2:
+		detail.ApplicationSource += "(络町)"
+	}
 	resp.Detail = detail
 	br.Msg = "申请成功!"
 	br.Ret = 200

+ 20 - 3
models/apply_record.go

@@ -21,6 +21,23 @@ type CygxApplyRecord struct {
 	InviteCompanySource int       `description:"来源 1小程序,2:网页"`
 }
 
+type CygxApplyRecordResp struct {
+	ApplyRecordId       int       `orm:"column(apply_record_id);pk" description:"申请试用id"`
+	UserId              int       `description:"用户ID"`
+	BusinessCardUrl     string    `description:"名片地址"`
+	RealName            string    `description:"姓名"`
+	CompanyName         string    `description:"公司名称"`
+	CompanyIdPay        int       `description:"已付费客户公司id"`
+	CompanyIdType       int       `description:"用户状态,1:潜在客户 、2:现有客户 、3:FICC客户 、4:现有客户(正式,无对应权限) 、5:现有客户(试用,无对应权限)  、6:现有客户(试用暂停) 、7:现有客户(冻结) 、8:现有客户(流失) "`
+	CompanyNamePay      string    `description:"公司名称"`
+	Mobile              string    `description:"手机号"`
+	CreateTime          time.Time `description:"创建时间"`
+	ApplyMethod         int       `description:"1:已付费客户申请试用,2:非客户申请试用"`
+	RegisterPlatform    int       `description:"来源 1小程序,2:网页"`
+	InviteCompanySource int       `description:"三方来源 ,1:弘则本身,2:络町"`
+	ApplicationSource   string    `description:"申请来源"`
+}
+
 func AddApplyRecordold(item *ApplyTryReq, mobile, companyNamePay string, userId, companyIdPay, CompanyIdType int) (err error) {
 	o, err := orm.NewOrm().Begin()
 	if err != nil {
@@ -96,13 +113,13 @@ func GetCygxApplyRecordByMobile(mobile string) (item *CygxApplyRecord, err error
 }
 
 // 通过ID获取详情
-func GetCygxApplyRecordById(applyRecordId int) (item *CygxApplyRecord, err error) {
+func GetCygxApplyRecordById(applyRecordId int) (item *CygxApplyRecordResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_apply_record  WHERE apply_record_id=?  `
 	err = o.Raw(sql, applyRecordId).QueryRow(&item)
 	return
 }
 
-type CygxApplyRecordResp struct {
-	Detail *CygxApplyRecord
+type CygxApplyRecordDetialResp struct {
+	Detail *CygxApplyRecordResp
 }

+ 1 - 35
services/wechat_send_msg.go

@@ -116,40 +116,6 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod s
 		}
 	}()
 
-	//var accessToken string
-	//accessToken, err = models.GetWxAccessTokenByXzs()
-	//if err != nil {
-	//	msg = "GetWxAccessToken Err:" + err.Error()
-	//	return
-	//}
-	//if accessToken == "" {
-	//	msg = "accessToken is empty"
-	//	return
-	//}
-	//sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken
-	//
-	//sendMap := make(map[string]interface{})
-	//sendData := make(map[string]interface{})
-	//
-	//keyword1 := "权限申请:" + realName + "【" + companyName + "】"
-	//first := "查研观向有一条新的权限申请,请及时处理。"
-	//keyword2 := mobile
-	//keyword3 := time.Now().Format(utils.FormatDateTime)
-	//keyword4 := applyMethod
-	//fontColor := "#D9001B"
-	//sendData["first"] = map[string]interface{}{"value": first, "color": fontColor}
-	//sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": fontColor}
-	//sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": fontColor}
-	//sendData["keyword3"] = map[string]interface{}{"value": keyword3, "color": fontColor}
-	//sendData["keyword4"] = map[string]interface{}{"value": keyword4, "color": fontColor}
-	//if utils.RunMode == "release" {
-	//	sendMap["template_id"] = utils.WxMsgTemplateIdApplyXzs
-	//} else {
-	//	sendMap["template_id"] = utils.WxMsgTemplateIdApply
-	//}
-	//sendMap["data"] = sendData
-	//sendTemplateMsg(sendUrl, sendMap, itemOpenid, mobile, utils.TEMPLATE_MSG_CYGX_APPLY)
-
 	var first string
 	var keyword1 string
 	var keyword2 string
@@ -164,7 +130,7 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod s
 		return
 	}
 	//如果是潜在客户就推送可查看详情的模版消息
-	if detail.ApplyMethod == 2 && utils.RunMode == "release" {
+	if detail.ApplyMethod == 2 {
 		redirectUrl = utils.WX_MSG_PATH_APPLY_DETAIL + strconv.Itoa(detail.ApplyRecordId)
 	}
 	keyword1 = "权限申请:" + realName + "【" + companyName + "】"