rdluck %!s(int64=4) %!d(string=hai) anos
pai
achega
9564a0c321
Modificáronse 5 ficheiros con 17 adicións e 7 borrados
  1. 1 1
      controllers/article.go
  2. 3 1
      controllers/user.go
  3. 4 4
      models/user.go
  4. 9 0
      models/wx_user.go
  5. 0 1
      utils/config.go

+ 1 - 1
controllers/article.go

@@ -14,7 +14,7 @@ type ArticleController struct {
 }
 
 type ArticleCommonController struct {
-	BaseAuthController
+	BaseCommonController
 }
 
 // @Title 获取报告详情

+ 3 - 1
controllers/user.go

@@ -616,7 +616,9 @@ func (this *UserController) ApplyTryOut() {
 		}
 		sellerMobile = sellerItem.Mobile
 	}
-	err = models.AddApplyRecord(&req, user.Mobile, user.UserId)
+	//models.GetWxUserItemByMobile()
+
+	err = models.AddApplyRecord(&req, user.Mobile,"", user.UserId,0)
 	if err != nil {
 		br.Msg = "申请失败"
 		br.ErrMsg = "申请失败,Err:" + err.Error()

+ 4 - 4
models/user.go

@@ -213,7 +213,7 @@ type CygxApplyRecord struct {
 	ApplyMethod     int       `description:"1:已付费客户申请试用,2:非客户申请试用"`
 }
 
-func AddApplyRecord(item *ApplyTryReq, mobile string, userId int) (err error) {
+func AddApplyRecord(item *ApplyTryReq, mobile,companyNamePay string, userId,companyIdPay int) (err error) {
 	o := orm.NewOrm()
 	o.Begin()
 	defer func() {
@@ -224,9 +224,9 @@ func AddApplyRecord(item *ApplyTryReq, mobile string, userId int) (err error) {
 		}
 	}()
 
-	sql := `INSERT INTO cygx_apply_record (user_id,business_card_url, real_name,company_name, mobile,create_time, apply_method)
-          VALUES(?,?,?,?,?,?,?) `
-	_, err = o.Raw(sql, userId, item.BusinessCardUrl, item.RealName, item.CompanyName, mobile, time.Now(), item.ApplyMethod).Exec()
+	sql := `INSERT INTO cygx_apply_record (user_id,business_card_url, real_name,company_name, mobile,create_time, apply_method,company_id_pay,company_name_pay)
+          VALUES(?,?,?,?,?,?,?,?,?) `
+	_, err = o.Raw(sql, userId, item.BusinessCardUrl, item.RealName, item.CompanyName, mobile, time.Now(), item.ApplyMethod,companyIdPay,companyNamePay).Exec()
 	if err != nil {
 		return
 	}

+ 9 - 0
models/wx_user.go

@@ -171,3 +171,12 @@ type WxGetPhoneNumberResp struct {
 	PurePhoneNumber string `description:"没有区号的手机号"`
 	CountryCode     string `description:"区号"`
 }
+
+
+func GetWxUserItemByMobile(mobile string) (item *WxUserItem, err error) {
+	sql := `SELECT a.*,b.company_name FROM wx_user AS a
+			LEFT JOIN company AS b on a.company_id=b.company_id
+			WHERE a.mobile=? `
+	err = orm.NewOrm().Raw(sql, mobile).QueryRow(&item)
+	return
+}

+ 0 - 1
utils/config.go

@@ -44,7 +44,6 @@ func init() {
 		WxAppId = "wxcc32b61f96720d2f"
 		WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
 		WxId = "gh_a9d3744e1072"
-
 		STATIC_DIR = "/home/static/imgs/"
 	}
 }