xuzhiheng пре 5 година
родитељ
комит
159785d6cd

+ 4 - 3
core/src/config.json

@@ -55,8 +55,8 @@
         "s_industry": [7,99],
 		"s_avatar": [8,99]
     },
-	"jyWebdomain":"http://192.168.110.101:82",
-	"qmxWebdomain":"http://wxlxl.qmx.top",
+	"jyWebdomain":"http://web-jydev-xzh.jianyu360.cn",
+	"qmxWebdomain":"http://web-jydev-xzh.jianyu360.cn",
 	"jyadd":"http://webws.qmx.top/jyapp/free/message/",
 	"jyopSmtp":{
 		"addr": "smtp.exmail.qq.com",
@@ -84,5 +84,6 @@
 		"passWord": "Topnet123"
 	},
 	"pushSubscribeRpc":"127.0.0.1:1122",
-	"jyRpc":"127.0.0.1:8084"
+	"jyRpc":"127.0.0.1:8084",
+	"invoice_interface_address": "http://192.168.3.14:7080/Invoice/Add"
 }

+ 45 - 44
core/src/qfw/coreconfig/SysConfig.go

@@ -5,50 +5,51 @@ package coreconfig
 
 //系统配置
 type config struct {
-	Webserverport      string                 `json:"webServerPort"` //web服务器端口
-	Redisservers       string                 `json:"redisServers"`  //redis缓存服务器列表
-	Useredis           bool                   `json:"useRedis"`
-	Mongodbservers     string                 `json:"mongodbServers"` //mongodb节点
-	MongodbPoolSize    int                    `json:"mongodbPoolSize"`
-	MongodbName        string                 `json:"mongodbName"`
-	Cassandra          []string               `json:"cassandra"`
-	Cassandrasize      int                    `json:"cassandrasize"`
-	Elasticsearch      string                 `json:"elasticsearch"`
-	JyEscsearch        string                 `json:"jyescsearch"` //content内容
-	Smtp               smtp                   `json:"smtp"`
-	JyopSmtp           smtp                   `json:"jyopSmtp"`
-	Sms                sms                    `json:"sms"`
-	Entrelation        entrelation            `json:"entrelation”`
-	Allownfiletype     string                 `json:"allownfiletype"`
-	Filesize           int                    `json:"filesize"`
-	TemplateCache      bool                   `json:"templateCache"`
-	HttpCache          bool                   `json:"httpCache"`
-	MailFailureTime    int                    `json:"mailFailureTime"`
-	ChatServer         string                 `json:"chatServer"`
-	ChatRpc            string                 `json:"chatRpc"`
-	PushRpc            string                 `json:"pushRpc"`
-	ElasticPoolSize    int                    `json:"elasticPoolSize"`
-	Ocr_uid            string                 `json:"orc_uid"`
-	Ocr_servicekey     string                 `json:"ocr_servicekey"`
-	Ocr_servicecode    string                 `json:"ocr_servicecode"`
-	EntMongodbservers  string                 `json:"entMongodbServers"` //mongodb节点
-	EntMongodbPoolSize int                    `json:"entMongodbPoolSize"`
-	EntMongodbName     string                 `json:"entMongodbName"`
-	EntMongodbAlias    string                 `json:"entMongodbAlias"`
-	FollowEnterprise   int                    `json:"followEnterprise"`
-	AtrrTitle          map[string]interface{} `json:"atrrTitle"`
-	JyWebdomain        string                 `json:"jyWebdomain"`
-	QmxWebdomain       string                 `json:"qmxWebdomain"`
-	ServiceApp         int                    `json:"serviceApp"`
-	Jyadd              string                 `json:"jyadd"`
-	JyopWebdomain      string                 `json:"jyopWebdomain"`
-	UdpHandle          udphandle              `json:"udpHandle"`
-	Per_del_openid     []string               `json:"per_del_openid"`
-	AppPushServiceRpc  string                 `json:"appPushServiceRpc"`
-	Pchelper           Pchelper               `json:"pcHelper"`
-	Mysql              map[string]string      `json:"mysql"`
-	PushSubscribeRpc   string                 `json:"pushSubscribeRpc"`
-	JyRpc              string                 `json:"jyRpc"`
+	Webserverport             string                 `json:"webServerPort"` //web服务器端口
+	Redisservers              string                 `json:"redisServers"`  //redis缓存服务器列表
+	Useredis                  bool                   `json:"useRedis"`
+	Mongodbservers            string                 `json:"mongodbServers"` //mongodb节点
+	MongodbPoolSize           int                    `json:"mongodbPoolSize"`
+	MongodbName               string                 `json:"mongodbName"`
+	Cassandra                 []string               `json:"cassandra"`
+	Cassandrasize             int                    `json:"cassandrasize"`
+	Elasticsearch             string                 `json:"elasticsearch"`
+	JyEscsearch               string                 `json:"jyescsearch"` //content内容
+	Smtp                      smtp                   `json:"smtp"`
+	JyopSmtp                  smtp                   `json:"jyopSmtp"`
+	Sms                       sms                    `json:"sms"`
+	Entrelation               entrelation            `json:"entrelation”`
+	Allownfiletype            string                 `json:"allownfiletype"`
+	Filesize                  int                    `json:"filesize"`
+	TemplateCache             bool                   `json:"templateCache"`
+	HttpCache                 bool                   `json:"httpCache"`
+	MailFailureTime           int                    `json:"mailFailureTime"`
+	ChatServer                string                 `json:"chatServer"`
+	ChatRpc                   string                 `json:"chatRpc"`
+	PushRpc                   string                 `json:"pushRpc"`
+	ElasticPoolSize           int                    `json:"elasticPoolSize"`
+	Ocr_uid                   string                 `json:"orc_uid"`
+	Ocr_servicekey            string                 `json:"ocr_servicekey"`
+	Ocr_servicecode           string                 `json:"ocr_servicecode"`
+	EntMongodbservers         string                 `json:"entMongodbServers"` //mongodb节点
+	EntMongodbPoolSize        int                    `json:"entMongodbPoolSize"`
+	EntMongodbName            string                 `json:"entMongodbName"`
+	EntMongodbAlias           string                 `json:"entMongodbAlias"`
+	FollowEnterprise          int                    `json:"followEnterprise"`
+	AtrrTitle                 map[string]interface{} `json:"atrrTitle"`
+	JyWebdomain               string                 `json:"jyWebdomain"`
+	QmxWebdomain              string                 `json:"qmxWebdomain"`
+	ServiceApp                int                    `json:"serviceApp"`
+	Jyadd                     string                 `json:"jyadd"`
+	JyopWebdomain             string                 `json:"jyopWebdomain"`
+	UdpHandle                 udphandle              `json:"udpHandle"`
+	Per_del_openid            []string               `json:"per_del_openid"`
+	AppPushServiceRpc         string                 `json:"appPushServiceRpc"`
+	Pchelper                  Pchelper               `json:"pcHelper"`
+	Mysql                     map[string]string      `json:"mysql"`
+	PushSubscribeRpc          string                 `json:"pushSubscribeRpc"`
+	JyRpc                     string                 `json:"jyRpc"`
+	Invoice_interface_address string                 `json:"invoice_interface_address"`
 }
 type smtp struct {
 	Addr     string `json:"addr"`

+ 0 - 20
core/src/qfw/manage/dataExport.go

@@ -24,7 +24,6 @@ type DataExport struct {
 	dataDetail       xweb.Mapper `xweb:"/manage/dataExport/dataDetail/(\\w+)"`
 	toOfflinePay     xweb.Mapper `xweb:"/manage/dataExport/toOfflinePayPage/(\\w+)"` //跳转线下支付页面
 	offlinePaySubmit xweb.Mapper `xweb:"/manage/dataExport/offlinePaySubmit"`        //上传线下支付凭证
-	refundInfo       xweb.Mapper `xweb:"/manage/refund/(\\w+)"`                      //退款信息保存
 }
 
 func init() {
@@ -266,22 +265,3 @@ func DataExportOrderChangeCall(req *frpc.DateExportData) string {
 	}
 	return repl
 }
-
-func (d *DataExport) RefundInfo(orderCode string) {
-	apply_refund_name := d.GetString("applyName")
-	apply_refund_time, _ := strconv.ParseInt(d.GetString("applyTime"), 10, 64)
-	apply_refund_reason := d.GetString("applyReason")
-	qMap := map[string]interface{}{}
-	qMap["order_code"] = orderCode
-	ok := cutil.Mysql.Update("dataexport_order", qMap, map[string]interface{}{
-		"order_status":        -2,
-		"apply_refund_name":   apply_refund_name,
-		"apply_refund_time":   apply_refund_time,
-		"apply_refund_reason": apply_refund_reason,
-	})
-	if ok {
-		d.ServeJson(map[string]interface{}{
-			"success": "true",
-		})
-	}
-}

+ 97 - 0
core/src/qfw/manage/refund.go

@@ -0,0 +1,97 @@
+package manage
+
+import (
+	"encoding/json"
+	"log"
+	"qfw/coreconfig"
+	cutil "qfw/coreutil"
+	"qfw/util"
+
+	//"qfw/util/mongodb"
+	"bytes"
+	"io/ioutil"
+	"net/http"
+	"strconv"
+
+	"github.com/go-xweb/xweb"
+)
+
+type Refund struct {
+	*xweb.Action
+	refundInfo xweb.Mapper `xweb:"/manage/refund/(\\w+)"` //退款信息保存
+}
+
+func init() {
+	xweb.AddAction(&Refund{})
+}
+
+func (d *Refund) RefundInfo(orderCode string) {
+	apply_refund_name := d.GetString("applyName")
+	apply_refund_time, _ := strconv.ParseInt(d.GetString("applyTime"), 10, 64)
+	apply_refund_reason := d.GetString("applyReason")
+	qMap := map[string]interface{}{}
+	qMap["order_code"] = orderCode
+	ok := cutil.Mysql.Update("dataexport_order", qMap, map[string]interface{}{
+		"order_status":        -2,
+		"apply_refund_name":   apply_refund_name,
+		"apply_refund_time":   apply_refund_time,
+		"apply_refund_reason": apply_refund_reason,
+	})
+	if ok {
+		data := cutil.Mysql.Find("invoice", qMap, "", "create_time", 0, 0)
+		if *data != nil || len(*data) != 0 {
+			if len(*data) > 1 {
+				// if (*status)[1]["url"] != nil {
+				invoice_serialnum := util.ObjToString((*data)[1]["invoice_serialnum"])
+				RefundInvoice(invoice_serialnum)
+				// }
+			} else {
+				// if (*status)[0]["url"] != nil {
+				invoice_serialnum := util.ObjToString((*data)[0]["invoice_serialnum"])
+				RefundInvoice(invoice_serialnum)
+				// }
+			}
+		}
+		d.ServeJson(map[string]interface{}{
+			"success": "true",
+		})
+	}
+}
+
+//退票 发票流水号
+func RefundInvoice(invoice_serialnum string) {
+	var refund_flag = -1
+	if invoice_serialnum != "" {
+		query := make(map[string]interface{})
+		query["invoice_serialnum"] = invoice_serialnum
+		res := cutil.Mysql.FindOne("invoice", query, "invoice_code,invoice_number", "")
+		if res != nil {
+			req_ := make(map[string]interface{})
+			req_["fpdm"] = (*res)["invoice_code"]
+			req_["fphm"] = (*res)["invoice_number"]
+			b, _ := json.Marshal(req_)
+			buffer := bytes.NewBuffer(b)
+			request, err := http.NewRequest("POST", coreconfig.SysConfig.Invoice_interface_address, buffer)
+			if err == nil {
+				client := &http.Client{}
+				response, _ := client.Do(request)
+				res, _ := ioutil.ReadAll(response.Body)
+				defer response.Body.Close()
+				result := map[string]interface{}{}
+				err := json.Unmarshal(res, &result)
+				if err != nil {
+					log.Println("json序列化错误")
+				} else {
+					if result["code"].(string) == "0" {
+						refund_flag = 0
+					} else if result["code"].(string) == "1" {
+						refund_flag = 1
+					} else {
+						refund_flag = 2
+					}
+				}
+				go cutil.Mysql.Update("invoice", query, map[string]interface{}{"refund_flag": refund_flag})
+			}
+		}
+	}
+}