dever 6 years ago
parent
commit
34e92dd78a
1 changed files with 41 additions and 0 deletions
  1. 41 0
      lib/Set.php

+ 41 - 0
lib/Set.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace Pay\Lib;
+
+use Dever;
+
+class Set
+{
+    public function updateStatus_api()
+    {
+    	$send = Dever::preInput('pay_');
+    	$project_id = $send['pay_project_id'];
+    	$info = Dever::db('pay/project')->one($project_id);
+    	if (!$info) {
+    		return 'error';
+    	}
+        $key = md5($info['key']);
+        ksort($send);
+        $send['signature'] = md5($key . '&' . http_build_query($send));
+        $signature = Dever::input('signature');
+        if ($send['signature'] == $signature) {
+        	$tk_pic = $send['pay_tk_pic'];
+            $tk_time = $send['pay_tk_time'];
+            $tk_desc = $send['pay_tk_desc'];
+            $order_id = $send['pay_order_id'];
+            $status = $send['pay_status'];
+            $uid = $send['uid'];
+
+            $order = Dever::db('pay/order')->one(array('order_id' => $order_id, 'uid' => $uid));
+
+            if ($order) {
+            	$update['where_id'] = $order['id'];
+            	$update['status'] = $status;
+            	$update['tk_pic'] = $tk_pic;
+            	$update['tk_time'] = $tk_time;
+            	$update['tk_desc'] = $tk_desc;
+            	Dever::db('pay/order')->update($update);
+            }
+        }
+    }
+}