|
@@ -5,6 +5,7 @@ import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
+ "hongze/hongze_cygx/models/order"
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
)
|
|
|
|
|
@@ -41,3 +42,25 @@ func UpdateCygxUserYanxuanPermissionToClose(cont context.Context) (err error) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 判断用户是购买了单场付费活动
|
|
|
+func GetCygxOrderVirtualAssetdCountTotal(userId, activityId int) (total int) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ go utils.SendAlarmMsg(fmt.Sprint("判断用户是购买了单场付费活动失败 GetCygxOrderUserCardTotal userId:", userId, "activityId:", activityId, ",err:", err.Error()), 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` AND user_id = ? AND source = 'activity' AND source_id = ? `
|
|
|
+ pars = append(pars, userId, activityId)
|
|
|
+
|
|
|
+ total, e := order.GetCygxOrderVirtualAssetdCount(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxOrderVirtualAssetdCount, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|