Преглед изворни кода

修改报告状态;新增申请

xiexiaoyuan пре 2 година
родитељ
комит
97a0ae7374

+ 11 - 4
controllers/report.go

@@ -85,7 +85,13 @@ func (this *ReportController) Detail() {
 	}
 
 	utils.FileLog.Info("report.detail %d,%d", user.CompanyId, productId)
-	company, err := models.GetCompanyProductById(user.CompanyId, productId)
+	status, checkInfo, company, msg, brMsg, brErrMsg := services.CheckUserReportPermission(user, productId, report, maxPermissionCount)
+	if brMsg != "" {
+		br.Msg = brMsg
+		br.ErrMsg = brErrMsg
+		return
+	}
+	/*company, err := models.GetCompanyProductById(user.CompanyId, productId)
 	if err != nil {
 		if err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取报告详情失败"
@@ -152,7 +158,7 @@ func (this *ReportController) Detail() {
 			}
 			msg = "您还未开通" + tips + "权限,如有需要请联系对口销售"
 		}
-	}
+	}*/
 
 	if report.ClassifyNameFirst == "权益研报" {
 		if report.ClassifyNameSecond == "近期路演精华" {
@@ -164,7 +170,7 @@ func (this *ReportController) Detail() {
 		report.TitleType = "FICC"
 	}
 	//判断大小权限
-	{
+	/*{
 		if status == 2 {
 			if company != nil {
 				permissionCount, err := models.GetCompanyProductPermissionCount(company.CompanyId, productId)
@@ -185,7 +191,7 @@ func (this *ReportController) Detail() {
 	if company != nil && company.IsSuspend > 0 && company.Status == "试用" {
 		status = 2
 		msg = "您还未开通权限,如有需要请联系对口销售"
-	}
+	}*/
 	if status == 2 {
 		report.Content = report.ContentSub
 		report.VideoUrl = ""
@@ -275,6 +281,7 @@ func (this *ReportController) Detail() {
 	}
 
 	resp.Classify = item
+	resp.PermissionCheckInfo = checkInfo
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 63 - 0
controllers/yb_apply.go

@@ -0,0 +1,63 @@
+package controllers
+
+import (
+	"encoding/json"
+	"hongze/hongze_api/models"
+	"hongze/hongze_api/services"
+)
+
+//报告
+type YbApplyController struct {
+	BaseAuthController
+}
+
+// @Title 申请
+// @Description 发起申请接口
+// @Success 200
+// @router /ybApply [post]
+func (this *YbApplyController) YbApply() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	var req models.YbApplyReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	if req.CompanyName == "" {
+		br.Msg = "公司名称不能为空"
+		return
+	}
+
+	if req.RealName == "" {
+		req.RealName = user.RealName
+	}
+	if req.RealName == "" {
+		br.Msg = "姓名不能为空"
+		return
+	}
+
+	_, err = services.AddYbApply(user.UserId, user.CompanyId, user.Mobile, user.Email, req)
+	if err != nil {
+		br.Msg = "申请失败"
+		br.ErrMsg = "申请失败" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+	br.Data = nil
+}
+

+ 53 - 0
models/admin.go

@@ -0,0 +1,53 @@
+package models
+
+import (
+	"github.com/rdlucklib/rdluck_tools/orm"
+	"time"
+)
+
+// Admin [...]
+type Admin struct {
+	AdminID                 int64     `gorm:"primaryKey;column:admin_id;type:bigint(20);not null" json:"-"`
+	AdminName               string    `gorm:"uniqueIndex:un;index:name;index:admin_pass;column:admin_name;type:varchar(60);not null" json:"adminName"`
+	RealName                string    `gorm:"column:real_name;type:varchar(60)" json:"realName"`
+	Password                string    `gorm:"index:password;index:admin_pass;column:password;type:varchar(60);not null" json:"password"`
+	LastUpdatedPasswordTime time.Time `gorm:"column:last_updated_password_time;type:datetime" json:"lastUpdatedPasswordTime"`
+	Enabled                 int8      `gorm:"uniqueIndex:un;column:enabled;type:tinyint(1);not null;default:1" json:"enabled"` // 1:有效,0:禁用
+	Email                   string    `gorm:"column:email;type:varchar(60)" json:"email"`
+	LastLoginTime           time.Time `gorm:"column:last_login_time;type:datetime" json:"lastLoginTime"`                                         // 最近登陆时间
+	CreatedTime             time.Time `gorm:"index:created_time;column:created_time;type:datetime;default:CURRENT_TIMESTAMP" json:"createdTime"` // 创建时间
+	LastUpdatedTime         time.Time `gorm:"index:last_updated_time;column:last_updated_time;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"lastUpdatedTime"`
+	Role                    string    `gorm:"column:role;type:varchar(30);default:saller" json:"role"`               // 用户角色
+	Mobile                  string    `gorm:"column:mobile;type:varchar(20)" json:"mobile"`                          // 手机号
+	RoleType                int8      `gorm:"column:role_type;type:tinyint(4);default:0" json:"roleType"`            // 角色类型:1需要录入指标,0:不需要
+	RoleID                  int       `gorm:"column:role_id;type:int(11);default:0" json:"roleId"`                   // 角色id
+	RoleName                string    `gorm:"column:role_name;type:varchar(100)" json:"roleName"`                    // 角色名称
+	RoleTypeCode            string    `gorm:"column:role_type_code;type:varchar(20);default:''" json:"roleTypeCode"` // 角色编码
+	DepartmentID            int       `gorm:"column:department_id;type:int(11);default:0" json:"departmentId"`       // 部门id
+	DepartmentName          string    `gorm:"column:department_name;type:varchar(100)" json:"departmentName"`        // 部门名称
+	GroupID                 int       `gorm:"column:group_id;type:int(11);default:0" json:"groupId"`                 // 分组id
+	GroupName               string    `gorm:"column:group_name;type:varchar(100)" json:"groupName"`                  // 分组名称
+	Authority               int8      `gorm:"column:authority;type:tinyint(4);default:0" json:"authority"`           // 管理权限,0:无,1:部门负责人,2:小组负责人,3:超级管理员
+	Position                string    `gorm:"column:position;type:varchar(100)" json:"position"`                     // 职位
+}
+
+
+// GetAdminByAdminId 根据admin_id获取系统用户信息
+func GetAdminByAdminId(adminId int) (item *Admin, err error) {
+	// 第二个返回值是错误对象,在这里略过
+	qb, _ := orm.NewQueryBuilder("mysql")
+
+	// 构建查询对象
+	qb.Select("real_name",
+		"mobile").
+		From("admin").
+		Where("admin_id =  ? ")
+
+	// 导出 SQL 语句
+	sql := qb.String()
+
+	// 执行 SQL 语句
+	o := orm.NewOrm()
+	err = o.Raw(sql, adminId).QueryRow(&item)
+	return
+}

+ 2 - 2
models/company.go

@@ -46,7 +46,7 @@ func GetCompanyInfoById(companyId int) (item *Company, err error) {
 
 func GetCompanyById(companyId int) (item []*CompanyProduct, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT a.*,b.status,b.is_suspend,b.product_id FROM company AS a
+	sql := ` SELECT a.*,b.status,b.is_suspend,b.product_id, b.seller_name FROM company AS a
 			INNER JOIN company_product AS b ON a.company_id=b.company_id
 			WHERE a.company_id=? `
 	_, err = o.Raw(sql, companyId).QueryRows(&item)
@@ -55,7 +55,7 @@ func GetCompanyById(companyId int) (item []*CompanyProduct, err error) {
 
 func GetCompanyProductById(companyId, productId int) (item *CompanyProduct, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT a.*,b.status,b.is_suspend FROM company AS a
+	sql := ` SELECT a.*,b.status,b.is_suspend,b.seller_id FROM company AS a
 			INNER JOIN company_product AS b ON a.company_id=b.company_id
 			WHERE a.company_id=? AND b.product_id=? `
 	err = o.Raw(sql, companyId, productId).QueryRow(&item)

+ 1 - 0
models/db.go

@@ -45,5 +45,6 @@ func init() {
 		new(UserAccessRecord),
 		new(WxUserCode),
 		new(UserRecord),
+		new(YbApplyRecord),
 	)
 }

+ 21 - 0
models/report.go

@@ -163,6 +163,27 @@ type ReportDetailResp struct {
 	Status        int                `description:"状态:0:正常展示,1:报告不存在,2:无权限"`
 	Msg           string             `description:"提示信息"`
 	Classify      *ClassifyDetail    `description:"对应专栏"`
+	PermissionCheckInfo PermissionCheckInfoResp `description:"权限相关"`
+}
+
+// PermissionCheckInfo 权限校验完成后的结果
+type PermissionCheckInfoResp struct {
+	Name         string       `description:"销售名称"`
+	Mobile       string       `description:"手机号"`
+	Type         string       `description:"校验失败,没有权限,需要让前端处理的类型,枚举值:apply,contact"`
+	HzPhone      string       `description:"弘则公司电话"`
+	CustomerInfo CustomerInfoResp `description:"客户信息"`
+}
+
+
+// CustomerInfoResp 客户信息
+type CustomerInfoResp struct {
+	CompanyName string `description:"客户(公司)名称"`
+	Name        string `description:"联系人名称"`
+	Mobile      string `description:"手机号"`
+	Status      string `description:"状态"`
+	IsSuspend   int8   `description:"启用与否字段:1:暂停,0:启用"`
+	HasApply    bool   `description:"是否有申请过"`
 }
 
 type ReportRecordReq struct {

+ 10 - 0
models/wx_user.go

@@ -71,6 +71,8 @@ type WxUserItem struct {
 	CreatedTime     time.Time `description:"创建时间"`
 	LastUpdatedTime time.Time `description:"最近一次修改时间"`
 	IsRegister      int       `description:"是否注册:1:已注册,0:未注册"`
+	Note            string    `description:"客户备份信息"`
+	IsNote          int8      `description:"是否备注过信息"`
 }
 
 func GetWxUserItemByUserId(userId int) (item *WxUserItem, err error) {
@@ -467,3 +469,11 @@ func ModifyWxUserRegisterStatus(userId, status, source int, registerTime time.Ti
 	_, err = o.Raw(sql, status, source, registerTime, userId).Exec()
 	return
 }
+
+// ModifyWxUserNameApplyMethod 更新用户名称等信息
+func ModifyWxUserNameApplyMethod(userId int, realName, note string, isNote int8, applyMethod int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE wx_user SET real_name=?,note=?,is_note=?,apply_method=? WHERE user_id = ? `
+	_, err = o.Raw(sql, realName, note, isNote, applyMethod, userId).Exec()
+	return
+}

+ 70 - 0
models/yb_apply_record.go

@@ -0,0 +1,70 @@
+package models
+
+import (
+	"github.com/rdlucklib/rdluck_tools/orm"
+	"time"
+)
+
+// YbApplyRecord 弘则研报客户申请
+type YbApplyRecord struct {
+	ApplyRecordID   int       `orm:"column(apply_record_id);pk"`
+	UserID          int       `orm:"column(user_id)"`
+	BusinessCardURL string    `orm:"column(business_card_url)"` // 名片
+	RealName        string    `orm:"column(real_name)"`                // 姓名
+	CompanyName     string    `orm:"column(company_name)"`          // 客户备注的公司名称
+	Mobile          string    `orm:"column(mobile)"`                      // 手机号
+	Email           string    `orm:"column(email)"`                        // 邮箱
+	Permission      string    `orm:"column(permission)"`             // 申请权限,多个权限用英文,隔开
+	FiccSellerID    uint32    `orm:"column(ficc_seller_id)"`     // ficc销售id,没有开通ficc权限的话,那么所属销售id为0
+	SellerName      string    `orm:"column(seller_name)"`             // 销售姓名,多个产品销售用/隔开
+	Status          string    `orm:"column(status)"`                      // 用户状态,多个产品状态用/隔开
+	CompanyIDPay    int       `orm:"column(company_id_pay)"`                       // 已付费客户公司id
+	CompanyNamePay  string    `orm:"column(company_name_pay)"`   // 已付费客户公司名称
+	OpStatus        int       `orm:"column(op_status)"`                      // 操作状态,0:未处理,1:已处理
+	DealTime        time.Time `orm:"column(deal_time)"`                               // 处理时间
+	SysUserID       int       `orm:"column(sys_user_id)"`                   // 处理人id
+	CreateTime      time.Time `orm:"column(create_time)"`                           // 创建时间
+	IsMove			int		  `orm:"column(is_move)"`						// 是否已移动 0-否 1-是
+	Source			int		  `orm:"column(source)"`						// 申请来源 1-我的 2-活动 3-图库 4-研报
+	SourceAgent     int       `orm:"column(source_agent)"`             // 申请入口来源,1:小程序,2:pc
+	FromPage        string    `orm:"column(from_page)"`                // 申请来源具体页面
+}
+
+type YbApplyReq struct {
+	//BusinessCardUrl string `description:"名片地址" json:"business_card_url"`
+	CompanyName     string `description:"公司名称"`
+	RealName        string `description:"用户真实姓名"`
+	//Permission      string `description:"用户关注品种,多个品种之间用英文,隔开"`
+	//Source			int	   `description:"申请来源:1-我的 2-活动 3-图库"`
+	//SourceAgent     int    `description:"申请入口来源,1:小程序,2:pc,3:弘则研究公众号"`
+	//FromPage        string `description:"申请来源页面"`
+}
+
+
+// GetLastApplyRecordNotOpRecordByUserId 根据用户id获取最近的一条未被操作过的申请记录信息
+func GetLastApplyRecordNotOpRecordByUserId(userId int) (item *YbApplyRecord, err error) {
+	// 第二个返回值是错误对象,在这里略过
+	qb, _ := orm.NewQueryBuilder("mysql")
+
+	// 构建查询对象
+	qb.Select("apply_record_id").
+		From("yb_apply_record").
+		Where("user_id = ? AND op_status = 0")
+
+	// 导出 SQL 语句
+	sql := qb.String()
+
+	// 执行 SQL 语句
+	o := orm.NewOrm()
+	err = o.Raw(sql, userId).QueryRow(&item)
+	return
+}
+
+
+// AddYbApplyRecord 新增FICC申请记录
+func AddYbApplyRecord(item *YbApplyRecord) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+

+ 3 - 0
routers/router.go

@@ -71,6 +71,9 @@ func init() {
 			web.NSInclude(
 				&controllers.UserPcNotAuthController{},
 			),
+			web.NSInclude(
+				&controllers.YbApplyController{},
+			),
 		),
 		web.NSNamespace("/video",
 			web.NSInclude(

+ 148 - 0
services/user_permission.go

@@ -6,6 +6,7 @@ import (
 	"hongze/hongze_api/models"
 	"hongze/hongze_api/utils"
 	"strconv"
+	"strings"
 )
 
 func CheckUserPermission(userId int) (status int, err error) {
@@ -62,3 +63,150 @@ func CheckUserPermission(userId int) (status int, err error) {
 	}
 	return
 }
+
+// CheckUserReportPermission 判断用户查看当前报告时是需要发起申请还是联系销售
+func CheckUserReportPermission(user *models.WxUserItem, productId int, report *models.ReportDetail, maxPermissionCount int) (status int, checkInfo models.PermissionCheckInfoResp, company *models.CompanyProduct, msg, brMsg, brErrMsg string) {
+	reportId := report.Id
+	company, err := models.GetCompanyProductById(user.CompanyId, productId)
+	if err != nil {
+		if err.Error() != utils.ErrNoRow() {
+			brMsg = "获取报告详情失败"
+			brErrMsg = "获取用户管理企业信息失败,Err:" + err.Error()
+			return
+		}
+	}
+	sellerName := ""
+	if company == nil {
+		status = 2
+		msg = "您还未开通权限,立即申请免费试用"
+		checkInfo.Type = "apply"
+	}else if company.CompanyId == 1 {
+		status = 2
+		msg = "您还未开通权限,立即申请免费试用"
+		checkInfo.Type = "apply"
+	}else {
+		checkInfo.Type = "contact"
+		customerInfo := models.CustomerInfoResp{
+			CompanyName: company.CompanyName,
+			Status:      company.Status,
+			Name:        user.RealName,
+			IsSuspend:   int8(company.IsSuspend),
+			Mobile:      user.Mobile,
+		}
+		checkInfo.CustomerInfo = customerInfo
+		// 判断用户状态
+		if company.Status == utils.COMPANY_STATUS_LOSE {
+			status = 2
+			msg = "您还未开通权限,立即申请免费试用"
+			checkInfo.Type = "apply"
+		}else if company.Status == utils.COMPANY_STATUS_FREEZE {
+			status = 2
+			msg = "您还未开通权限,如有需要请联系对口销售"
+		}else if company.IsSuspend > 0 && company.Status == "试用" {  //如果客户产品被禁用了,只有在试用状态下,才不允许查看报告,那么没有权限
+			status = 2
+			msg = "您还未开通权限,如有需要请联系对口销售"
+		}
+		//查找对应客户的销售信息
+		if company.SellerId > 0 {
+			adminInfo, tmpErr := models.GetAdminByAdminId(company.SellerId)
+			if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
+				brMsg = "获取销售信息失败"
+				brErrMsg = "获取销售信息失败,Err:" + tmpErr.Error()
+				return
+			}
+			if adminInfo != nil {
+				sellerName = adminInfo.RealName
+				checkInfo.Name = adminInfo.RealName
+				checkInfo.Mobile = adminInfo.Mobile
+				if status == 2 && checkInfo.Type == "contact" {
+					msg = "您还未开通权限,如有需要请联系对口销售"+sellerName
+				}
+			}
+		}
+	}
+
+	if productId == 1 {
+		reportType := "rddp"
+		reportPermissionList, err := models.GetReportVarietyListByUserIdExt(user.UserId, reportType) //获取客户拥有权限的报告id
+		if err != nil {
+			if err.Error() != utils.ErrNoRow() {
+				brMsg = "获取报告详情失败"
+				brErrMsg = "获取客户信息失败,Err:" + err.Error()
+				return
+			}
+		}
+		if len(reportPermissionList) >= 0 {
+			permissionMap := make(map[int]int)
+			for _, v := range reportPermissionList {
+				if _, ok := permissionMap[v.ReportChapterTypeId]; !ok {
+					permissionMap[v.ReportChapterTypeId] = v.ReportChapterTypeId
+				}
+			}
+
+			if _, ok := permissionMap[reportId]; !ok {
+				tips := ""
+				status = 2
+				classifyNameSecond := report.ClassifyNameSecond
+				if strings.Contains(classifyNameSecond, "宏观商品复盘") ||
+					strings.Contains(classifyNameSecond, "股债日评") ||
+					strings.Contains(classifyNameSecond, "每日经济数据备忘录") {
+					tips = "宏观"
+				} else if strings.Contains(classifyNameSecond, "知白守黑日评") ||
+					strings.Contains(classifyNameSecond, "动力煤数据点评") {
+					tips = "黑色"
+				} else if strings.Contains(classifyNameSecond, "化里化外日评") ||
+					strings.Contains(classifyNameSecond, "EIA原油库存点评") ||
+					strings.Contains(classifyNameSecond, "苯乙烯数据点评") ||
+					strings.Contains(classifyNameSecond, "聚酯数据点评") {
+					tips = "化工"
+				} else if strings.Contains(classifyNameSecond, "有声有色日度闲篇") {
+					tips = "有色"
+				}
+				if checkInfo.Type == "contact" {
+					msg = "您还未开通" + tips + "权限,如有需要请联系对口销售 "+sellerName
+				}
+
+			}
+		}else{
+			status = 2
+			if checkInfo.Type == "contact" {
+				msg = "您还未开通权限,如有需要请联系对口销售 " + sellerName
+			}
+		}
+
+	}
+
+	//判断大小权限
+	{
+		if status == 2 {
+			if company != nil {
+				permissionCount, err := models.GetCompanyProductPermissionCount(company.CompanyId, productId)
+				if err != nil {
+					brMsg = "获取信息失败"
+					brErrMsg = "获取权限信息失败,Err:" + err.Error()
+					return
+				}
+				if permissionCount >= maxPermissionCount {
+					status = 0
+					msg = ""
+					checkInfo.Type = ""
+				}
+			}
+		}
+	}
+
+	if status == 2 {
+		//查询是否有过申请记录
+		record, err := models.GetLastApplyRecordNotOpRecordByUserId(user.UserId)	// 从来源我的/活动申请的记录
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			brMsg = "获取申请记录失败"
+			brErrMsg = "获取申请记录失败,Err:" + err.Error()
+			return
+		}
+		//查询是否有申请过,如果有申请过的话,那么err是nil
+		if record != nil {
+			checkInfo.CustomerInfo.HasApply = true
+		}
+	}
+	return
+}

+ 105 - 0
services/yb_apply.go

@@ -0,0 +1,105 @@
+package services
+
+import (
+	"hongze/hongze_api/models"
+	"hongze/hongze_api/utils"
+	"strings"
+	"time"
+)
+
+// AddYbApply FICC客户申请
+func AddYbApply(userId int, companyId int, mobile, email string, applyInfo models.YbApplyReq) (ybApplyRecord *models.YbApplyRecord, err error) {
+	sellerName := ``
+	status := `潜在用户`
+	companyName := applyInfo.CompanyName
+
+	tmpmYbApplyRecord, err := models.GetLastApplyRecordNotOpRecordByUserId(userId)
+	if err == nil {
+		ybApplyRecord = tmpmYbApplyRecord	// 申请来源每一种只存在一条数据
+		return
+	} else {
+		if err.Error() != utils.ErrNoRow() {
+			return
+		}
+	}
+
+	// 联系人信息
+	wxUserInfo, err := models.GetWxUserItemByUserId(userId)
+	if err != nil {
+		return
+	}
+
+	if companyId > 1 {
+		//客户信息
+		companyInfo, tmpErr := models.GetCompanyInfoById(companyId)
+		if tmpErr != nil {
+			err = tmpErr
+			return
+		}
+		companyName = companyInfo.CompanyName
+
+		//客户产品权限
+		companyProductList, tmpErr := models.GetCompanyById(companyId)
+		if tmpErr != nil {
+			err = tmpErr
+			return
+		}
+		sellerNameList := make([]string, 0)
+		statusList := make([]string, 0)
+		for _, companyProductInfo := range companyProductList {
+			if companyProductInfo.ProductId == 2 && status == "潜在用户" {
+				status = "权益用户"
+			}
+			if companyProductInfo.ProductId == 1 {
+				sellerName = companyProductInfo.SellerName
+				status = companyProductInfo.Status
+				if companyProductInfo.IsSuspend == 1 {
+					status = `试用暂停`
+				}
+			}
+		}
+		if len(sellerNameList) > 0 && len(statusList) > 0 {
+			sellerName = strings.Join(sellerNameList, ",")
+			status = strings.Join(statusList, ",")
+		}
+	}
+	ybApplyRecord = &models.YbApplyRecord{
+		UserID:          userId,
+		//BusinessCardURL: applyInfo.BusinessCardUrl,
+		RealName:        applyInfo.RealName,
+		CompanyName:     applyInfo.CompanyName,
+		Mobile:          mobile,
+		Email:           email,
+		//Permission:      applyInfo.Permission,
+		SellerName:      sellerName,
+		Status:          status,
+		CompanyIDPay:    companyId,
+		CompanyNamePay:  companyName,
+		CreateTime:      time.Now(),
+	//	Source: 		 applyInfo.Source,
+		SourceAgent:     3, //申请入口来源,1:小程序,2:pc,3:弘则研究公众号"
+	//	FromPage:        applyInfo.FromPage,
+	}
+	err = models.AddYbApplyRecord(ybApplyRecord)
+	if err != nil {
+		return
+	}
+
+	// 修改客户信息
+	wxUserInfo.RealName = applyInfo.RealName
+	wxUserInfo.Note = applyInfo.CompanyName
+	wxUserInfo.IsNote = 1
+
+	applyMethod := wxUserInfo.ApplyMethod //0:未申请,1:已付费客户申请试用,2:非客户申请试用
+	applyMethod = 2
+	if sellerName != "" {
+		applyMethod = 1
+	}
+	wxUserInfo.ApplyMethod = applyMethod
+
+	err = models.ModifyWxUserNameApplyMethod(wxUserInfo.UserId, wxUserInfo.RealName, wxUserInfo.Note, wxUserInfo.IsNote, wxUserInfo.ApplyMethod)
+	if err != nil {
+		
+	}
+	return
+}