|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705 |
- package svc
-
- import (
- "applet/app/cfg"
- "applet/app/customer/md"
- "applet/app/db"
- "applet/app/db/model"
- "applet/app/utils"
- "encoding/json"
- "errors"
- "time"
- )
-
- func AesDecrypt(args md.CurlAesDecrypt) (error, interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/decrypt/index"
- utils.FilePutContents("AesDecrypt", utils.SerializeStr(map[string]interface{}{
- "data": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return err, nil
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("AesDecrypt", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return err, nil
- }
- if result.Code != 0 {
- if result.Msg != "" {
- return errors.New(result.Msg), nil
- }
- return errors.New("请求智慧餐厅支付 异常/失败"), nil
- }
- return nil, result.Data
- }
-
- func SystemOauthToken(args md.SystemOauthTokenReq) (error, interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/systemOauthToken/index"
- utils.FilePutContents("SystemOauthToken", utils.SerializeStr(map[string]interface{}{
- "data": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return err, nil
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("SystemOauthToken", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return err, nil
- }
- if result.Code != 0 {
- if result.Msg != "" {
- return errors.New(result.Msg), nil
- }
- return errors.New("请求智慧餐厅支付 异常/失败"), nil
- }
- return nil, result.Data
- }
-
- func CurlAlipayTradeCreate(args md.CurlAlipayTradeCreateReq) (err error, resp md.CurlAlipayTradeCreateResp) {
- url := cfg.SmartCanteenPay + "/alipay/pay/tradeCreate"
- utils.FilePutContents("CurlAlipayTradeCreate", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayTradeCreate", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- err = json.Unmarshal(utils.Serialize(result.Data), &resp)
- if err != nil {
- return
- }
- return
- }
-
- func CurlAlipayTradeQuery(args md.CurlAlipayTradeQueryReq) (err error, resp md.CurlAlipayTradeQueryResp) {
- url := cfg.SmartCanteenPay + "/alipay/pay/tradeCommonQuery"
- utils.FilePutContents("CurlAlipayTradeQuery", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayTradeQuery", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- err = json.Unmarshal(utils.Serialize(result.Data), &resp)
- if err != nil {
- return
- }
- return
- }
-
- func CurlAlipayTradeRefund(args md.CurlAlipayTradeRefundReq) (err error, resp interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/pay/tradeRefund"
- utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- return nil, result.Data
- }
-
- func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity *model.UserIdentity, userToken, schoolName string) (err error, resp interface{}) {
- utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
-
- if userToken == "" {
- //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
- url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
- bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
- "config": map[string]string{
- "ali_app_id": args.Config.AliAppId,
- "ali_private_key": args.Config.AliPrivateKey,
- "ali_public_key": args.Config.AliPublicKey,
- },
- "cert_no": args.CertNo,
- "school_std_code": args.SchoolStdCode,
- "student_name": args.StudentName,
- "out_user_id": args.OutUserId,
- "cert_type": "1",
- "sub_code": "SCHOOL_FACE_PASS_QUERY",
- }), nil)
- if err1 != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateSceneTokenCreate", utils.SerializeStr(result))
- err1 = json.Unmarshal(bytes, &result)
- if err1 != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err1 = errors.New(result.Msg)
- return
- }
- err1 = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- resultMap, ok := result.Data.(map[string]interface{})
- if !ok {
- err1 = errors.New("获取 user_token 失败")
- return
- }
- if resultMap["code"].(string) != "10000" {
- return nil, resultMap
- }
- userToken = resultMap["token"].(string)
- }
-
- //2、TODO::查询用户一脸通行开通状态:根据获取到的用户信息token,使用 alipay.commerce.educate.scene.token.query 接口查询用户人脸采集状态
- url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenQuery"
- bytes, err := utils.CurlPost(url, utils.Serialize(map[string]string{
- "user_token": userToken,
- }), nil)
- if err != nil {
- return
- }
-
- var result1 struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(result1))
- err = json.Unmarshal(bytes, &result1)
- if err != nil {
- return
- }
- if result1.Code != 0 {
- if result1.Msg != "" {
- err = errors.New(result1.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- // 更新/新增 `self_support_for_user_facel_info`
- selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
- selfSupportForUserFaceInfoDb.Set(userIdentity.Id)
- info, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
- if err != nil {
- return
- }
-
- now := time.Now().Format("2006-01-02 15:04:05")
- var res map[string]string
- utils.Unserialize([]byte(utils.SerializeStr(result1.Data)), &res)
-
- if info == nil {
- var concentrateSchoolFacePassStatus = 1
- if res["school_face_pass_status"] == "OPEN" {
- concentrateSchoolFacePassStatus = 3
- }
- info = &model.SelfSupportForUserFaceInfo{
- EnterpriseId: userIdentity.EnterpriseId,
- UserIdentityId: userIdentity.Id,
- CollectFaceType: 1,
- SchoolCode: res["school_code"],
- SchoolStdCode: res["school_std_code"],
- ParentUserId: res["parent_user_id"],
- ParentLogonId: res["parent_logon_id"],
- UserId: res["user_id"],
- SchoolFacePassStatus: res["school_face_pass_status"],
- SchoolFacePaymentStatus: res["school_face_payment_status"],
- ConcentrateSchoolFacePassStatus: concentrateSchoolFacePassStatus,
- CreateAt: now,
- UpdateAt: now,
- }
- _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
- if err2 != nil {
- return err2, nil
- }
- } else {
- var concentrateSchoolFacePassStatus = info.ConcentrateSchoolFacePassStatus
- if res["school_face_pass_status"] == "OPEN" {
- concentrateSchoolFacePassStatus = 3
- }
- info.ParentUserId = res["parent_user_id"]
- info.ParentLogonId = res["parent_logon_id"]
- info.UserId = res["user_id"]
- info.SchoolFacePassStatus = res["school_face_pass_status"]
- info.SchoolFacePaymentStatus = res["school_face_payment_status"]
- info.ConcentrateSchoolFacePassStatus = concentrateSchoolFacePassStatus
- info.UpdateAt = now
- _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoUpdate(info, "parent_user_id", "parent_logon_id", "user_id", "school_face_pass_status", "school_face_payment_status", "concentrate_school_face_pass_status", "update_at")
- if err2 != nil {
- return err2, nil
- }
- }
-
- //TODO:: school_face_pass_status && school_face_payment_status 都为 open 状态,则 签约信息同步“alipay.planet.ecocampus.api.roster.signUpInfo” 至 行业云
- CurlAlipayPlanetEcocampusApiRosterSignUpInfo(md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq{
- FaceUid: info.UserId,
- ParentUid: info.ParentUserId,
- ParentLogonId: info.ParentLogonId,
- RosterName: args.StudentName,
- OutRosterCode: args.OutUserId,
- SchoolCode: info.SchoolCode,
- SchoolName: schoolName,
- ScanFacePayStatus: "ON",
- FaceOpenStatus: "ON",
- })
- return nil, result1.Data
-
- }
-
- func CurlEducateSceneKidsClose(args md.CurlEducateSceneKidsCloseReq) (err error, resp interface{}) {
- utils.FilePutContents("CurlEducateSceneKidsClose", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
-
- //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
- url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneKidsClose"
- bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
- "config": map[string]string{
- "ali_app_id": args.Config.AliAppId,
- "ali_private_key": args.Config.AliPrivateKey,
- "ali_public_key": args.Config.AliPublicKey,
- },
- "cert_no": args.CertNo,
- "school_stdcode": args.SchoolStdCode,
- "user_id": args.UserId,
- "parent_uid": args.ParentUid,
- }), nil)
- if err1 != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateSceneKidsClose", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- err = json.Unmarshal(utils.Serialize(result.Data), &resp)
- if err != nil {
- return
- }
- return nil, result.Data
- }
-
- func CurlEducateFacepayClose(args md.CurlEducateFacepayCloseReq) (err error, resp interface{}) {
- utils.FilePutContents("CurlEducateFacepayClose", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
-
- //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
- url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateFacepayClose"
- bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
- "config": map[string]string{
- "ali_app_id": args.Config.AliAppId,
- "ali_private_key": args.Config.AliPrivateKey,
- "ali_public_key": args.Config.AliPublicKey,
- },
- "school_stdcode": args.SchoolStdCode,
- "face_uid": args.FaceUid,
- }), nil)
- if err1 != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateFacepayClose", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- err = json.Unmarshal(utils.Serialize(result.Data), &resp)
- if err != nil {
- return
- }
- return nil, result.Data
- }
-
- func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err error, resp interface{}) {
- utils.FilePutContents("CurlEducateSceneTokenCreateForApplet", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
-
- //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
- url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
- bytes, err := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
- "config": map[string]string{
- "ali_app_id": args.Config.AliAppId,
- "ali_private_key": args.Config.AliPrivateKey,
- "ali_public_key": args.Config.AliPublicKey,
- },
- "cert_no": args.CertNo,
- "school_std_code": args.SchoolStdCode,
- "student_name": args.StudentName,
- "out_user_id": args.OutUserId,
- "cert_type": "1",
- "sub_code": "SCHOOL_FACE_PASS_NAVIGATE",
- }), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateSceneTokenCreateForApplet", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
-
- return nil, result.Data
- }
-
- func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducateSceneTokenReq) (err error, resp interface{}) {
- utils.FilePutContents("CurlEducateSceneTokenCreateForConcentratedCollectApplet", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
-
- //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
- url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
- bytes, err := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
- "config": map[string]string{
- "ali_app_id": args.Config.AliAppId,
- "ali_private_key": args.Config.AliPrivateKey,
- "ali_public_key": args.Config.AliPublicKey,
- },
- "cert_no": args.CertNo,
- "school_std_code": args.SchoolStdCode,
- "student_name": args.StudentName,
- "out_user_id": args.OutUserId,
- "cert_type": "1",
- "sub_code": "SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT",
- "operator_user_id": args.OperatorUserId, //采集人员的支付宝会员标识。(当sub_code为SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT时,当前参数必选)
- }), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateSceneTokenCreateForConcentratedCollectApplet", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
-
- return nil, result.Data
- }
-
- func CurlEducateFacepayApply(args md.CurlEducateFacepayApplyReq) (err error, resp interface{}) {
- utils.FilePutContents("CurlEducateFacepayApply", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
-
- //1、TODO::alipay.commerce.educate.facepay.apply(人脸开通支付申请)
- url := cfg.SmartCanteenPay + "/alipay/faceScanPay/educateFacepayApply"
- bytes, err := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
- "config": map[string]string{
- "ali_app_id": args.Config.AliAppId,
- "ali_private_key": args.Config.AliPrivateKey,
- "ali_public_key": args.Config.AliPublicKey,
- },
- "face_uid": args.FaceUid,
- "school_std_code": args.SchoolStdCode,
- "face_open_id": args.FaceOpenId,
- }), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlEducateFacepayApply", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
-
- return nil, result.Data
- }
-
- func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(args md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq) (err error, resp interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiRosterSignUpInfo"
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterSignUpInfo", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterSignUpInfo", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- return nil, result.Data
- }
-
- func CurlSelfSupportForSchoolOrderDebtRepay(args md.CurlSelfSupportForSchoolOrderDebtRepay) (err error, resp interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiDebtRepay"
- utils.FilePutContents("CurlSelfSupportForSchoolOrderDebtRepay", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- utils.FilePutContents("CurlSelfSupportForSchoolOrderDebtRepay", utils.SerializeStr(result))
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- mMap, ok := result.Data.(map[string]interface{})
- utils.FilePutContents("CurlSelfSupportForSchoolOrderDebtRepay", utils.SerializeStr(mMap))
- if ok {
- if mMap["code"] == "10000" {
- //TODO::更新订单状态
- selfSupportForSchoolOrdDb := db.SelfSupportForSchoolOrd{}
- selfSupportForSchoolOrdDb.Set(args.OutOrderNo)
- ord, err1 := selfSupportForSchoolOrdDb.GetSelfSupportForSchoolOrd()
- if err1 != nil {
- err = err1
- return
- }
- ord.OrderStatus = 2
- selfSupportForSchoolOrdDb.SelfSupportForSchoolOrdUpdate(ord, "order_status")
- }
- }
- return nil, result.Data
- }
-
- func CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo(args md.CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo) (err error, resp interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiDebtPageQueryDebtInfo"
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- return nil, result.Data
- }
-
- func CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList(args md.CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList) (err error, resp interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiRosterPageQueryBlackList"
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- return nil, result.Data
- }
-
- func CurlAlipayPlanetEcocampusApiDebtCancel(args md.CurlAlipayPlanetEcocampusApiDebtCancel) (err error, resp interface{}) {
- url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiDebtCancel"
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtCancel", utils.SerializeStr(map[string]interface{}{
- "args": args,
- }))
- bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
- if err != nil {
- return
- }
- var result struct {
- Code int `json:"code"`
- Msg string `json:"msg"`
- Data interface{} `json:"data"`
- }
- utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtCancel", utils.SerializeStr(result))
- err = json.Unmarshal(bytes, &result)
- if err != nil {
- return
- }
- if result.Code != 0 {
- if result.Msg != "" {
- err = errors.New(result.Msg)
- return
- }
- err = errors.New("请求智慧餐厅支付 异常/失败")
- return
- }
- return nil, result.Data
- }
|