|
@@ -8,6 +8,7 @@ import (
|
|
|
"pay"
|
|
|
qutil "qfw/util"
|
|
|
"qfw/util/redis"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
"util"
|
|
@@ -20,6 +21,16 @@ func DisWordRecode(order_id, sale_money int, product_name, disWord string) {
|
|
|
if redisDis != "" {
|
|
|
//分销者id
|
|
|
shareUId := strings.Split(redisDis, "##")[1]
|
|
|
+ /*//查询用户是企业还是个人账户
|
|
|
+ parentList := util.Mysql.SelectBySql("select * from dis_partner where uid=? ", shareUId)
|
|
|
+ parentType := 1
|
|
|
+ if len(*parentList) > 0 {
|
|
|
+ parentTypeInt, _ := strconv.Atoi(fmt.Sprint((*parentList)[0]["type"]))
|
|
|
+ parentType = parentTypeInt
|
|
|
+ }
|
|
|
+ if (parentType == 2) {
|
|
|
+ return
|
|
|
+ }*/
|
|
|
//查询产品信息 获取 rate 佣金比例
|
|
|
var c_rate float64 = 0
|
|
|
if p_data, ok := util.MQFW.Find("dis_product", nil, `{"l_createdate":1}`, nil, false, -1, -1); ok && p_data != nil {
|
|
@@ -50,7 +61,7 @@ func DisWordRecode(order_id, sale_money int, product_name, disWord string) {
|
|
|
//个人账户更新
|
|
|
p_count := util.Mysql.UpdateOrDeleteBySql("UPDATE account a SET a.dis_sales = a.dis_sales+? , a.dis_order = a.dis_order+1 , a.dis_commission=a.dis_commission+? WHERE a.uid = ?", sale_money, c_money_i, shareUId)
|
|
|
|
|
|
- util.MsgRemind.DistributionSuccess(order_id, shareUId,c_money_i,product_name)
|
|
|
+ util.MsgRemind.DistributionSuccess(order_id, shareUId, c_money_i, product_name)
|
|
|
return s_count > 0 && p_count > 0
|
|
|
}) {
|
|
|
log.Println("分销记录和个人账户统计 错误:", shareUId, "-佣金单号:", code)
|
|
@@ -59,9 +70,19 @@ func DisWordRecode(order_id, sale_money int, product_name, disWord string) {
|
|
|
log.Println("保存分销记录出错:", order_id)
|
|
|
}
|
|
|
}
|
|
|
-func OtherDisWordRecode(order_id, sale_money int, product_name, disWord,userId,creatTime string) {
|
|
|
+func OtherDisWordRecode(order_id, sale_money int, product_name, disWord, userId, creatTime string) {
|
|
|
//redis 获取分销者信息
|
|
|
- infoList := util.Mysql.SelectBySql("select * from dis_word where userId=? and password =? ",userId,disWord)
|
|
|
+ //查询用户是企业还是个人账户
|
|
|
+ parentList := util.Mysql.SelectBySql("select * from dis_partner where uid=? ", userId)
|
|
|
+ parentType := 1
|
|
|
+ if len(*parentList) > 0 {
|
|
|
+ parentTypeInt, _ := strconv.Atoi(fmt.Sprint((*parentList)[0]["type"]))
|
|
|
+ parentType = parentTypeInt
|
|
|
+ }
|
|
|
+ if (parentType == 2) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ infoList := util.Mysql.SelectBySql("select * from dis_word where userId=? and password =? ", userId, disWord)
|
|
|
if len(*infoList) != 0 {
|
|
|
//分销者id
|
|
|
shareUId := fmt.Sprint((*infoList)[0]["belong_userid"])
|
|
@@ -85,9 +106,7 @@ func OtherDisWordRecode(order_id, sale_money int, product_name, disWord,userId,c
|
|
|
//个人账户更新
|
|
|
p_count := util.Mysql.UpdateOrDeleteBySql("UPDATE account a SET a.dis_sales = a.dis_sales+? , a.dis_order = a.dis_order+1 , a.dis_commission=a.dis_commission+? WHERE a.uid = ?", sale_money, c_money_i, shareUId)
|
|
|
|
|
|
- util.MsgRemind.DistributionSuccess(order_id, shareUId,c_money_i,product_name)
|
|
|
-
|
|
|
-
|
|
|
+ util.MsgRemind.DistributionSuccess(order_id, shareUId, c_money_i, product_name)
|
|
|
return s_count > 0 && p_count > 0
|
|
|
}) {
|
|
|
log.Println("分销记录和个人账户统计 错误:", shareUId, "-佣金单号:", code)
|