Wechat.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\inter\controller;
  3. use think\Controller;
  4. use think\Db;
  5. use think\Session;
  6. use app\common\library\UUIDs;
  7. use think\Cache;
  8. use think\Log;
  9. use app\common\library\Verify;
  10. use think\File;
  11. use app\common\library\send_message;
  12. use app\common\library\Message;
  13. class Wechat extends Base {
  14. public function _initialize() {
  15. }
  16. public function wechatCallback() {
  17. // $param = $_REQUEST['param'];
  18. Log::record('微信支付回调');
  19. $res = file_get_contents("php://input");
  20. $xml = simplexml_load_string($res);
  21. Log::record($xml);
  22. $data = json_decode(json_encode($xml),TRUE);
  23. json_decode($data);
  24. Log::record('微信支付回调');
  25. // $order_id = $param['order_id'];
  26. // $remote_order = DB::table('remote_order')->where('id', $order_id)->find();
  27. // if(!$remote_order) {
  28. // return json_encode(['status'=>'fail','code'=>'3001','msg'=> "没有找到该订单"]);
  29. // }
  30. // if($remote_order !== Application::ORDER_STATUS['CREATE']) {
  31. // return json_encode(['status'=>'fail','code'=>'3002','msg'=> "订单状态出错"]);
  32. // }
  33. // DB::table('remote_order')->where('id', $order_id)->update(["status" => Application::ORDER_STATUS['PAYCOMPLTET']]);
  34. // return json_encode(['status'=>'ok','code'=>'0000','msg'=> "支付回调成功"]);
  35. }
  36. }