瀏覽代碼

Merge branch 'dev3.2' of http://192.168.3.207:10080/qmx/jy into dev3.2

TANGSHIZHE 4 年之前
父節點
當前提交
30721c7afd

+ 34 - 2
src/jfw/modules/subscribepay/src/entity/member.go

@@ -1,6 +1,7 @@
 package entity
 
 import (
+	"database/sql"
 	"encoding/json"
 	"log"
 	qutil "qfw/util"
@@ -34,8 +35,9 @@ func (m *memberStruct) PayCallBack(param *CallBackParam) bool {
 		} else {
 			cycle := qutil.IntAll(filter["cycle"])
 			level := qutil.IntAll(filter["level"])
+			istrial := qutil.IntAll(filter["istrial"]) //是否是试用订单
 			enddate := time.Date(now.Year()+cycle, now.Month(), now.Day(), 23, 59, 59, 0, time.Local)
-			normal_member(level, enddate, userId)
+			normal_member(level, enddate, userId, istrial)
 			//
 			update := util.Mysql.Update("dataexport_order", map[string]interface{}{
 				"id": (*orderdata)["id"],
@@ -56,7 +58,11 @@ func (m *memberStruct) PayCallBack(param *CallBackParam) bool {
 }
 
 //
-func normal_member(level int, enddate time.Time, userId string) {
+var forecastwinner_count = 3
+var decision_count = 7
+var bigmember_amount = "bigmember_amount"
+
+func normal_member(level int, enddate time.Time, userId string, istrial int) {
 	set := map[string]interface{}{
 		"i_member_status":    level,
 		"i_member_starttime": time.Now().Unix(),
@@ -65,4 +71,30 @@ func normal_member(level int, enddate time.Time, userId string) {
 	util.MQFW.UpdateById("user", userId, map[string]interface{}{
 		"$set": set,
 	})
+	//初始化大会员部分功能权限
+	if !util.Mysql.ExecTx("初始化大会员部分功能权限", func(tx *sql.Tx) bool {
+		update_b := util.Mysql.UpdateByTx(tx, bigmember_amount, map[string]interface{}{
+			"user_id": userId,
+		}, map[string]interface{}{
+			"is_ing": 0,
+		})
+		insert := map[string]interface{}{
+			"user_type":                 istrial, //1:试用;0:正式
+			"user_id":                   userId,
+			"createtime":                qutil.NowFormat(qutil.Date_Full_Layout),
+			"updatetime":                qutil.NowFormat(qutil.Date_Full_Layout),
+			"forecastwinner_count":      200,
+			"forecastwinner_used_count": 0,
+			"decision_count":            0,
+			"is_ing":                    1,
+		}
+		if istrial == 1 {
+			insert["forecastwinner_count"] = forecastwinner_count
+			insert["decision_count"] = decision_count
+		}
+		bmat := util.Mysql.InsertByTx(tx, bigmember_amount, insert)
+		return bmat > 0 && update_b
+	}) {
+		log.Println("初始化 大会员账户信息 出错:userid:", userId)
+	}
 }

+ 8 - 2
src/jfw/modules/subscribepay/src/service/payCallback.go

@@ -28,7 +28,7 @@ func (this *PayCallBackAction) TestPay() {
 		return
 	}
 	//userid := qutil.ObjToString(this.GetSession("userId"))
-	userid := "5c89fead1c298a4d75fef39e"
+	userid := ""
 	if userid == "" {
 		userid = this.GetString("uid")
 	}
@@ -54,7 +54,13 @@ func (this *PayCallBackAction) TestPay() {
 		"",
 		"",
 	}
-	if typeFlag == "历史数据" { //数据导出
+	if typeFlag == "大会员" { //大会员
+		if !entity.MemberStruct.PayCallBack(thisParam) {
+			log.Printf("大会员更新执行出错 %+v\n", thisParam)
+			this.Write("大会员更新执行出错")
+			return
+		}
+	} else if typeFlag == "历史数据" { //数据导出
 		if !entity.JyDataExportStruct.PayCallBack(thisParam) {
 			log.Printf("数据导出更新执行出错 %+v\n", thisParam)
 			this.Write("数据导出更新执行出错")