智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

616 lines
19 KiB

  1. package svc
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/customer/md"
  5. "applet/app/db"
  6. "applet/app/db/model"
  7. "applet/app/utils"
  8. "encoding/json"
  9. "errors"
  10. "time"
  11. )
  12. func AesDecrypt(args md.CurlAesDecrypt) (error, interface{}) {
  13. url := cfg.SmartCanteenPay + "/alipay/decrypt/index"
  14. utils.FilePutContents("AesDecrypt", utils.SerializeStr(map[string]interface{}{
  15. "data": args,
  16. }))
  17. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  18. if err != nil {
  19. return err, nil
  20. }
  21. var result struct {
  22. Code int `json:"code"`
  23. Msg string `json:"msg"`
  24. Data interface{} `json:"data"`
  25. }
  26. utils.FilePutContents("AesDecrypt", utils.SerializeStr(result))
  27. err = json.Unmarshal(bytes, &result)
  28. if err != nil {
  29. return err, nil
  30. }
  31. if result.Code != 0 {
  32. if result.Msg != "" {
  33. return errors.New(result.Msg), nil
  34. }
  35. return errors.New("请求智慧餐厅支付 异常/失败"), nil
  36. }
  37. return nil, result.Data
  38. }
  39. func SystemOauthToken(args md.SystemOauthTokenReq) (error, interface{}) {
  40. url := cfg.SmartCanteenPay + "/alipay/systemOauthToken/index"
  41. utils.FilePutContents("SystemOauthToken", utils.SerializeStr(map[string]interface{}{
  42. "data": args,
  43. }))
  44. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  45. if err != nil {
  46. return err, nil
  47. }
  48. var result struct {
  49. Code int `json:"code"`
  50. Msg string `json:"msg"`
  51. Data interface{} `json:"data"`
  52. }
  53. utils.FilePutContents("SystemOauthToken", utils.SerializeStr(result))
  54. err = json.Unmarshal(bytes, &result)
  55. if err != nil {
  56. return err, nil
  57. }
  58. if result.Code != 0 {
  59. if result.Msg != "" {
  60. return errors.New(result.Msg), nil
  61. }
  62. return errors.New("请求智慧餐厅支付 异常/失败"), nil
  63. }
  64. return nil, result.Data
  65. }
  66. func CurlAlipayTradeCreate(args md.CurlAlipayTradeCreateReq) (err error, resp md.CurlAlipayTradeCreateResp) {
  67. url := cfg.SmartCanteenPay + "/alipay/pay/tradeCreate"
  68. utils.FilePutContents("CurlAlipayTradeCreate", utils.SerializeStr(map[string]interface{}{
  69. "args": args,
  70. }))
  71. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  72. if err != nil {
  73. return
  74. }
  75. var result struct {
  76. Code int `json:"code"`
  77. Msg string `json:"msg"`
  78. Data interface{} `json:"data"`
  79. }
  80. utils.FilePutContents("CurlAlipayTradeCreate", utils.SerializeStr(result))
  81. err = json.Unmarshal(bytes, &result)
  82. if err != nil {
  83. return
  84. }
  85. if result.Code != 0 {
  86. if result.Msg != "" {
  87. err = errors.New(result.Msg)
  88. return
  89. }
  90. err = errors.New("请求智慧餐厅支付 异常/失败")
  91. return
  92. }
  93. err = json.Unmarshal(utils.Serialize(result.Data), &resp)
  94. if err != nil {
  95. return
  96. }
  97. return
  98. }
  99. func CurlAlipayTradeQuery(args md.CurlAlipayTradeQueryReq) (err error, resp md.CurlAlipayTradeQueryResp) {
  100. url := cfg.SmartCanteenPay + "/alipay/pay/tradeCommonQuery"
  101. utils.FilePutContents("CurlAlipayTradeQuery", utils.SerializeStr(map[string]interface{}{
  102. "args": args,
  103. }))
  104. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  105. if err != nil {
  106. return
  107. }
  108. var result struct {
  109. Code int `json:"code"`
  110. Msg string `json:"msg"`
  111. Data interface{} `json:"data"`
  112. }
  113. utils.FilePutContents("CurlAlipayTradeQuery", utils.SerializeStr(result))
  114. err = json.Unmarshal(bytes, &result)
  115. if err != nil {
  116. return
  117. }
  118. if result.Code != 0 {
  119. if result.Msg != "" {
  120. err = errors.New(result.Msg)
  121. return
  122. }
  123. err = errors.New("请求智慧餐厅支付 异常/失败")
  124. return
  125. }
  126. err = json.Unmarshal(utils.Serialize(result.Data), &resp)
  127. if err != nil {
  128. return
  129. }
  130. return
  131. }
  132. func CurlAlipayTradeRefund(args md.CurlAlipayTradeRefundReq) (err error, resp interface{}) {
  133. url := cfg.SmartCanteenPay + "/alipay/pay/tradeRefund"
  134. utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(map[string]interface{}{
  135. "args": args,
  136. }))
  137. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  138. if err != nil {
  139. return
  140. }
  141. var result struct {
  142. Code int `json:"code"`
  143. Msg string `json:"msg"`
  144. Data interface{} `json:"data"`
  145. }
  146. utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(result))
  147. err = json.Unmarshal(bytes, &result)
  148. if err != nil {
  149. return
  150. }
  151. if result.Code != 0 {
  152. if result.Msg != "" {
  153. err = errors.New(result.Msg)
  154. return
  155. }
  156. err = errors.New("请求智慧餐厅支付 异常/失败")
  157. return
  158. }
  159. return nil, result.Data
  160. }
  161. func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity *model.UserIdentity, userToken, schoolName string) (err error, resp interface{}) {
  162. utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(map[string]interface{}{
  163. "args": args,
  164. }))
  165. if userToken == "" {
  166. //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
  167. url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
  168. bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
  169. "config": map[string]string{
  170. "ali_app_id": args.Config.AliAppId,
  171. "ali_private_key": args.Config.AliPrivateKey,
  172. "ali_public_key": args.Config.AliPublicKey,
  173. },
  174. "cert_no": args.CertNo,
  175. "school_std_code": args.SchoolStdCode,
  176. "student_name": args.StudentName,
  177. "out_user_id": args.OutUserId,
  178. "cert_type": "1",
  179. "sub_code": "SCHOOL_FACE_PASS_QUERY",
  180. }), nil)
  181. if err1 != nil {
  182. return
  183. }
  184. var result struct {
  185. Code int `json:"code"`
  186. Msg string `json:"msg"`
  187. Data interface{} `json:"data"`
  188. }
  189. utils.FilePutContents("CurlEducateSceneTokenCreate", utils.SerializeStr(result))
  190. err1 = json.Unmarshal(bytes, &result)
  191. if err1 != nil {
  192. return
  193. }
  194. if result.Code != 0 {
  195. if result.Msg != "" {
  196. err1 = errors.New(result.Msg)
  197. return
  198. }
  199. err1 = errors.New("请求智慧餐厅支付 异常/失败")
  200. return
  201. }
  202. resultMap, ok := result.Data.(map[string]interface{})
  203. if !ok {
  204. err1 = errors.New("获取 user_token 失败")
  205. return
  206. }
  207. if resultMap["code"].(string) != "10000" {
  208. return nil, resultMap
  209. }
  210. userToken = resultMap["token"].(string)
  211. }
  212. //2、TODO::查询用户一脸通行开通状态:根据获取到的用户信息token,使用 alipay.commerce.educate.scene.token.query 接口查询用户人脸采集状态
  213. url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenQuery"
  214. bytes, err := utils.CurlPost(url, utils.Serialize(map[string]string{
  215. "user_token": userToken,
  216. }), nil)
  217. if err != nil {
  218. return
  219. }
  220. var result1 struct {
  221. Code int `json:"code"`
  222. Msg string `json:"msg"`
  223. Data interface{} `json:"data"`
  224. }
  225. utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(result1))
  226. err = json.Unmarshal(bytes, &result1)
  227. if err != nil {
  228. return
  229. }
  230. if result1.Code != 0 {
  231. if result1.Msg != "" {
  232. err = errors.New(result1.Msg)
  233. return
  234. }
  235. err = errors.New("请求智慧餐厅支付 异常/失败")
  236. return
  237. }
  238. // 更新/新增 `self_support_for_user_facel_info`
  239. selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
  240. selfSupportForUserFaceInfoDb.Set(userIdentity.Id)
  241. info, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
  242. if err != nil {
  243. return
  244. }
  245. now := time.Now().Format("2006-01-02 15:04:05")
  246. var res map[string]string
  247. utils.Unserialize([]byte(utils.SerializeStr(result1.Data)), &res)
  248. if info == nil {
  249. var concentrateSchoolFacePassStatus = 1
  250. if res["school_face_pass_status"] == "OPEN" {
  251. concentrateSchoolFacePassStatus = 3
  252. }
  253. info = &model.SelfSupportForUserFaceInfo{
  254. EnterpriseId: userIdentity.EnterpriseId,
  255. UserIdentityId: userIdentity.Id,
  256. CollectFaceType: 1,
  257. SchoolCode: res["school_code"],
  258. SchoolStdCode: res["school_std_code"],
  259. ParentUserId: res["parent_user_id"],
  260. ParentLogonId: res["parent_logon_id"],
  261. UserId: res["user_id"],
  262. SchoolFacePassStatus: res["school_face_pass_status"],
  263. SchoolFacePaymentStatus: res["school_face_payment_status"],
  264. ConcentrateSchoolFacePassStatus: concentrateSchoolFacePassStatus,
  265. CreateAt: now,
  266. UpdateAt: now,
  267. }
  268. _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
  269. if err2 != nil {
  270. return err2, nil
  271. }
  272. } else {
  273. var concentrateSchoolFacePassStatus = info.ConcentrateSchoolFacePassStatus
  274. if res["school_face_pass_status"] == "OPEN" {
  275. concentrateSchoolFacePassStatus = 3
  276. }
  277. info.ParentUserId = res["parent_user_id"]
  278. info.ParentLogonId = res["parent_logon_id"]
  279. info.UserId = res["user_id"]
  280. info.SchoolFacePassStatus = res["school_face_pass_status"]
  281. info.SchoolFacePaymentStatus = res["school_face_payment_status"]
  282. info.ConcentrateSchoolFacePassStatus = concentrateSchoolFacePassStatus
  283. info.UpdateAt = now
  284. _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoUpdate(info, "parent_user_id", "parent_logon_id", "user_id", "school_face_pass_status", "school_face_payment_status", "update_at")
  285. if err2 != nil {
  286. return err2, nil
  287. }
  288. }
  289. //TODO:: school_face_pass_status && school_face_payment_status 都为 open 状态,则 签约信息同步“alipay.planet.ecocampus.api.roster.signUpInfo” 至 行业云
  290. CurlAlipayPlanetEcocampusApiRosterSignUpInfo(md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq{
  291. FaceUid: info.UserId,
  292. ParentUid: info.ParentUserId,
  293. ParentLogonId: info.ParentLogonId,
  294. RosterName: args.StudentName,
  295. OutRosterCode: args.OutUserId,
  296. SchoolCode: info.SchoolCode,
  297. SchoolName: schoolName,
  298. ScanFacePayStatus: "ON",
  299. FaceOpenStatus: "ON",
  300. })
  301. return nil, result1.Data
  302. }
  303. func CurlEducateSceneKidsClose(args md.CurlEducateSceneKidsCloseReq) (err error, resp interface{}) {
  304. utils.FilePutContents("CurlEducateSceneKidsClose", utils.SerializeStr(map[string]interface{}{
  305. "args": args,
  306. }))
  307. //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
  308. url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneKidsClose"
  309. bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
  310. "config": map[string]string{
  311. "ali_app_id": args.Config.AliAppId,
  312. "ali_private_key": args.Config.AliPrivateKey,
  313. "ali_public_key": args.Config.AliPublicKey,
  314. },
  315. "cert_no": args.CertNo,
  316. "school_std_code": args.SchoolStdCode,
  317. "user_id": args.UserId,
  318. "parent_uid": args.ParentUid,
  319. }), nil)
  320. if err1 != nil {
  321. return
  322. }
  323. var result struct {
  324. Code int `json:"code"`
  325. Msg string `json:"msg"`
  326. Data interface{} `json:"data"`
  327. }
  328. utils.FilePutContents("CurlEducateSceneKidsClose", utils.SerializeStr(result))
  329. err = json.Unmarshal(bytes, &result)
  330. if err != nil {
  331. return
  332. }
  333. if result.Code != 0 {
  334. if result.Msg != "" {
  335. err = errors.New(result.Msg)
  336. return
  337. }
  338. err = errors.New("请求智慧餐厅支付 异常/失败")
  339. return
  340. }
  341. err = json.Unmarshal(utils.Serialize(result.Data), &resp)
  342. if err != nil {
  343. return
  344. }
  345. return nil, result.Data
  346. }
  347. func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err error, resp interface{}) {
  348. utils.FilePutContents("CurlEducateSceneTokenCreateForApplet", utils.SerializeStr(map[string]interface{}{
  349. "args": args,
  350. }))
  351. //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
  352. url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
  353. bytes, err := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
  354. "config": map[string]string{
  355. "ali_app_id": args.Config.AliAppId,
  356. "ali_private_key": args.Config.AliPrivateKey,
  357. "ali_public_key": args.Config.AliPublicKey,
  358. },
  359. "cert_no": args.CertNo,
  360. "school_std_code": args.SchoolStdCode,
  361. "student_name": args.StudentName,
  362. "out_user_id": args.OutUserId,
  363. "cert_type": "1",
  364. "sub_code": "SCHOOL_FACE_PASS_NAVIGATE",
  365. }), nil)
  366. if err != nil {
  367. return
  368. }
  369. var result struct {
  370. Code int `json:"code"`
  371. Msg string `json:"msg"`
  372. Data interface{} `json:"data"`
  373. }
  374. utils.FilePutContents("CurlEducateSceneTokenCreateForApplet", utils.SerializeStr(result))
  375. err = json.Unmarshal(bytes, &result)
  376. if err != nil {
  377. return
  378. }
  379. if result.Code != 0 {
  380. if result.Msg != "" {
  381. err = errors.New(result.Msg)
  382. return
  383. }
  384. err = errors.New("请求智慧餐厅支付 异常/失败")
  385. return
  386. }
  387. return nil, result.Data
  388. }
  389. func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducateSceneTokenReq) (err error, resp interface{}) {
  390. utils.FilePutContents("CurlEducateSceneTokenCreateForConcentratedCollectApplet", utils.SerializeStr(map[string]interface{}{
  391. "args": args,
  392. }))
  393. //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
  394. url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
  395. bytes, err := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
  396. "config": map[string]string{
  397. "ali_app_id": args.Config.AliAppId,
  398. "ali_private_key": args.Config.AliPrivateKey,
  399. "ali_public_key": args.Config.AliPublicKey,
  400. },
  401. "cert_no": args.CertNo,
  402. "school_std_code": args.SchoolStdCode,
  403. "student_name": args.StudentName,
  404. "out_user_id": args.OutUserId,
  405. "cert_type": "1",
  406. "sub_code": "SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT",
  407. "operator_user_id": args.OperatorUserId, //采集人员的支付宝会员标识。(当sub_code为SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT时,当前参数必选)
  408. }), nil)
  409. if err != nil {
  410. return
  411. }
  412. var result struct {
  413. Code int `json:"code"`
  414. Msg string `json:"msg"`
  415. Data interface{} `json:"data"`
  416. }
  417. utils.FilePutContents("CurlEducateSceneTokenCreateForConcentratedCollectApplet", utils.SerializeStr(result))
  418. err = json.Unmarshal(bytes, &result)
  419. if err != nil {
  420. return
  421. }
  422. if result.Code != 0 {
  423. if result.Msg != "" {
  424. err = errors.New(result.Msg)
  425. return
  426. }
  427. err = errors.New("请求智慧餐厅支付 异常/失败")
  428. return
  429. }
  430. return nil, result.Data
  431. }
  432. func CurlEducateFacepayApply(args md.CurlEducateFacepayApplyReq) (err error, resp interface{}) {
  433. utils.FilePutContents("CurlEducateFacepayApply", utils.SerializeStr(map[string]interface{}{
  434. "args": args,
  435. }))
  436. //1、TODO::alipay.commerce.educate.facepay.apply(人脸开通支付申请)
  437. url := cfg.SmartCanteenPay + "/alipay/faceScanPay/educateFacepayApply"
  438. bytes, err := utils.CurlPost(url, utils.Serialize(map[string]interface{}{
  439. "config": map[string]string{
  440. "ali_app_id": args.Config.AliAppId,
  441. "ali_private_key": args.Config.AliPrivateKey,
  442. "ali_public_key": args.Config.AliPublicKey,
  443. },
  444. "face_uid": args.FaceUid,
  445. "school_std_code": args.SchoolStdCode,
  446. "face_open_id": args.FaceOpenId,
  447. }), nil)
  448. if err != nil {
  449. return
  450. }
  451. var result struct {
  452. Code int `json:"code"`
  453. Msg string `json:"msg"`
  454. Data interface{} `json:"data"`
  455. }
  456. utils.FilePutContents("CurlEducateFacepayApply", utils.SerializeStr(result))
  457. err = json.Unmarshal(bytes, &result)
  458. if err != nil {
  459. return
  460. }
  461. if result.Code != 0 {
  462. if result.Msg != "" {
  463. err = errors.New(result.Msg)
  464. return
  465. }
  466. err = errors.New("请求智慧餐厅支付 异常/失败")
  467. return
  468. }
  469. return nil, result.Data
  470. }
  471. func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(args md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq) (err error, resp interface{}) {
  472. url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiRosterSignUpInfo"
  473. utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterSignUpInfo", utils.SerializeStr(map[string]interface{}{
  474. "args": args,
  475. }))
  476. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  477. if err != nil {
  478. return
  479. }
  480. var result struct {
  481. Code int `json:"code"`
  482. Msg string `json:"msg"`
  483. Data interface{} `json:"data"`
  484. }
  485. utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterSignUpInfo", utils.SerializeStr(result))
  486. err = json.Unmarshal(bytes, &result)
  487. if err != nil {
  488. return
  489. }
  490. if result.Code != 0 {
  491. if result.Msg != "" {
  492. err = errors.New(result.Msg)
  493. return
  494. }
  495. err = errors.New("请求智慧餐厅支付 异常/失败")
  496. return
  497. }
  498. return nil, result.Data
  499. }
  500. func CurlSelfSupportForSchoolOrderDebtRepay(args md.CurlSelfSupportForSchoolOrderDebtRepay) (err error, resp interface{}) {
  501. url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiDebtRepay"
  502. utils.FilePutContents("CurlSelfSupportForSchoolOrderDebtRepay", utils.SerializeStr(map[string]interface{}{
  503. "args": args,
  504. }))
  505. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  506. if err != nil {
  507. return
  508. }
  509. var result struct {
  510. Code int `json:"code"`
  511. Msg string `json:"msg"`
  512. Data interface{} `json:"data"`
  513. }
  514. utils.FilePutContents("CurlSelfSupportForSchoolOrderDebtRepay", utils.SerializeStr(result))
  515. err = json.Unmarshal(bytes, &result)
  516. if err != nil {
  517. return
  518. }
  519. if result.Code != 0 {
  520. if result.Msg != "" {
  521. err = errors.New(result.Msg)
  522. return
  523. }
  524. err = errors.New("请求智慧餐厅支付 异常/失败")
  525. return
  526. }
  527. return nil, result.Data
  528. }
  529. func CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo(args md.CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo) (err error, resp interface{}) {
  530. url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiDebtPageQueryDebtInfo"
  531. utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo", utils.SerializeStr(map[string]interface{}{
  532. "args": args,
  533. }))
  534. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  535. if err != nil {
  536. return
  537. }
  538. var result struct {
  539. Code int `json:"code"`
  540. Msg string `json:"msg"`
  541. Data interface{} `json:"data"`
  542. }
  543. utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtPageQueryDebtInfo", utils.SerializeStr(result))
  544. err = json.Unmarshal(bytes, &result)
  545. if err != nil {
  546. return
  547. }
  548. if result.Code != 0 {
  549. if result.Msg != "" {
  550. err = errors.New(result.Msg)
  551. return
  552. }
  553. err = errors.New("请求智慧餐厅支付 异常/失败")
  554. return
  555. }
  556. return nil, result.Data
  557. }
  558. func CurlAlipayPlanetEcocampusApiDebtCancel(args md.CurlAlipayPlanetEcocampusApiDebtCancel) (err error, resp interface{}) {
  559. url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiDebtCancel"
  560. utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtCancel", utils.SerializeStr(map[string]interface{}{
  561. "args": args,
  562. }))
  563. bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
  564. if err != nil {
  565. return
  566. }
  567. var result struct {
  568. Code int `json:"code"`
  569. Msg string `json:"msg"`
  570. Data interface{} `json:"data"`
  571. }
  572. utils.FilePutContents("CurlAlipayPlanetEcocampusApiDebtCancel", utils.SerializeStr(result))
  573. err = json.Unmarshal(bytes, &result)
  574. if err != nil {
  575. return
  576. }
  577. if result.Code != 0 {
  578. if result.Msg != "" {
  579. err = errors.New(result.Msg)
  580. return
  581. }
  582. err = errors.New("请求智慧餐厅支付 异常/失败")
  583. return
  584. }
  585. return nil, result.Data
  586. }