|
@@ -39,46 +39,56 @@ func (b *integral) PayCallBack(param *CallBackParam) bool {
|
|
|
if qutil.IntAll((*orderdata)["order_status"]) == 0 {
|
|
|
now := time.Now()
|
|
|
nowFormat := qutil.FormatDate(&now, qutil.Date_Full_Layout)
|
|
|
- product_type := qutil.ObjToString((*orderdata)["product_type"])
|
|
|
var filter map[string]interface{}
|
|
|
if err := json.Unmarshal([]byte(qutil.ObjToString((*orderdata)["filter"])), &filter); err != nil {
|
|
|
log.Println("剑鱼币支付解析json.Unmarshal出错", err)
|
|
|
} else {
|
|
|
score := qutil.IntAll(filter["score"])
|
|
|
order_code := qutil.ObjToString((*orderdata)["order_code"])
|
|
|
+ //调用积分接口 给用户增加积分
|
|
|
+ href := config.IntegralConfig.IntegralHarvestHref
|
|
|
+ data := url.Values{
|
|
|
+ "userId": []string{userId},
|
|
|
+ "appId": []string{config.IntegralConfig.Appid}, //剑鱼标识
|
|
|
+ "pointType": []string{strconv.Itoa(1001)}, //1001充值
|
|
|
+ "sourceId": []string{order_code}, //订单号
|
|
|
+ "sourceType": []string{"充值"}, //业务类型
|
|
|
+ "point": []string{strconv.Itoa(score)}, //积分
|
|
|
+ "operationType": []string{"true"}, //积分类型永久:true、时效:false
|
|
|
+ "endDate": []string{""}, //永久为空
|
|
|
+ }
|
|
|
+ //
|
|
|
+ res, err := http.PostForm(href, data)
|
|
|
+ if err != nil {
|
|
|
+ log.Println(err.Error())
|
|
|
+ }
|
|
|
+ defer res.Body.Close()
|
|
|
+ bs, _ := ioutil.ReadAll(res.Body)
|
|
|
+ log.Println("返回内容:" + string(bs))
|
|
|
+ SerialNumber := "" //流水号
|
|
|
+ resMap := map[string]interface{}{}
|
|
|
+ err = json.Unmarshal([]byte(bs), &resMap)
|
|
|
+ if err != nil {
|
|
|
+ log.Println("json.unmarshal err", resMap)
|
|
|
+ } else {
|
|
|
+ if qutil.IntAll(resMap["Code"]) == 1 {
|
|
|
+ SerialNumber = qutil.ObjToString(resMap["SerialNumber"])
|
|
|
+ }
|
|
|
+ }
|
|
|
update := util.Mysql.Update("dataexport_order", map[string]interface{}{
|
|
|
"id": (*orderdata)["id"],
|
|
|
}, map[string]interface{}{
|
|
|
"pay_money": param.CashFee,
|
|
|
"pay_time": nowFormat,
|
|
|
"order_status": 1,
|
|
|
+ "filter_id": SerialNumber, //流水号
|
|
|
})
|
|
|
- log.Println("############", update)
|
|
|
if update {
|
|
|
//取消其他订单
|
|
|
go PayCancel(userId, "剑鱼币", "")
|
|
|
- //调用积分接口 给用户增加积分
|
|
|
- log.Println(product_type, "-----score--:", score, "---", order_code)
|
|
|
- href := config.IntegralConfig.IntegralHarvestHref
|
|
|
- data := url.Values{
|
|
|
- "userId": []string{userId},
|
|
|
- "appId": []string{config.IntegralConfig.Appid}, //剑鱼标识
|
|
|
- "pointType": []string{strconv.Itoa(1001)}, //1001充值
|
|
|
- "sourceId": []string{order_code}, //订单号
|
|
|
- "sourceType": []string{"充值"}, //业务类型
|
|
|
- "point": []string{strconv.Itoa(score)}, //积分
|
|
|
- "operationType": []string{"true"}, //积分类型永久:true、时效:false
|
|
|
- "endDate": []string{""}, //永久为空
|
|
|
- }
|
|
|
- //
|
|
|
- res, err := http.PostForm(href, data)
|
|
|
- if err != nil {
|
|
|
- log.Println(err.Error())
|
|
|
- }
|
|
|
- defer res.Body.Close()
|
|
|
- bs, _ := ioutil.ReadAll(res.Body)
|
|
|
- log.Println("返回内容:" + string(bs))
|
|
|
+
|
|
|
}
|
|
|
+ log.Println("############", update)
|
|
|
}
|
|
|
}
|
|
|
return true
|