rabin 2 месяцев назад
Родитель
Сommit
72c3d80e37
9 измененных файлов с 33 добавлено и 24 удалено
  1. 5 3
      lib/Account.php
  2. 1 1
      lib/Api.php
  3. 4 4
      lib/Platform.php
  4. 1 1
      lib/Platform/Field.php
  5. 1 1
      lib/Platform/Response.php
  6. 3 0
      lib/Platform/Sign.php
  7. 3 0
      lib/Sku.php
  8. 12 12
      table/format.php
  9. 3 2
      table/platform_sign.php

+ 5 - 3
lib/Account.php

@@ -43,13 +43,15 @@ class Account
         if ($func['type'] == 1) {
             # 仅执行第一个
             $result = Dever::load('api', 'api')->$method($api[0], $param);
-            $result['account_id'] = $account['id'];
-            $result['api_id'] = $api[0]['id'];
+            if (is_array($result)) {
+                $result['account_id'] = $account['id'];
+                $result['api_id'] = $api[0]['id'];
+            }
         } elseif ($func['type'] == 2) {
             # 同步执行
             foreach ($api as $k => $v) {
                 $result = Dever::load('api', 'api')->$method($v, $param);
-                if ($result) {
+                if ($result && is_array($result)) {
                     $param = array_merge($result, $param);
                 }
             }

+ 1 - 1
lib/Api.php

@@ -2,7 +2,7 @@
 use Dever;
 class Api extends Platform
 {
-    protected $type = 'api';
+    public $type = 'api';
 
     # 执行某个接口
     public function run($id, $param = array())

+ 4 - 4
lib/Platform.php

@@ -6,11 +6,11 @@ use Api\Lib\Platform\Request;
 use Api\Lib\Platform\Response;
 class Platform
 {
-    protected $platform;
-    protected $info;
-    protected $field;
+    public $platform;
+    public $info;
+    public $field;
 
-    protected function setting($id, $field = array())
+    public function setting($id, $field = array())
     {
         $this->info($id);
         $this->platform();

+ 1 - 1
lib/Platform/Field.php

@@ -6,11 +6,11 @@ class Field
     public $ssl;
     public function __construct($data)
     {
-        $this->data = $data;
         $this->ssl = new Ssl($this);
         $this->set('time', time());
         $this->set('timestamp', \Dever\Helper\Secure::timestamp());
         $this->set('nonce', \Dever\Helper\Secure::nonce());
+        $this->data = $data;
     }
 
     public function add($index, $value, $key = 'body')

+ 1 - 1
lib/Platform/Response.php

@@ -61,7 +61,7 @@ class Response
         if ($this->config['type'] == 2) {
             $this->body = Dever::json_decode($this->body);
         } elseif ($this->config['type'] == 3) {
-            $this->body = (array) simplexml_load_string($this->body);
+            $this->body = (array) simplexml_load_string($this->body, null, LIBXML_NOCDATA);
         } else {
             if (strstr($this->body, ',')) {
                 $this->body = explode(',', $this->body);

+ 3 - 0
lib/Platform/Sign.php

@@ -52,6 +52,9 @@ class Sign
         $this->create();
         if ($this->config['kv_sort'] == 2) {
             ksort($this->info);
+        } elseif ($this->config['kv_sort'] == 3) {
+            $this->info = array_values($this->info);
+            sort($this->info, SORT_STRING);
         }
         $this->join();
         $this->toString();

+ 3 - 0
lib/Sku.php

@@ -5,9 +5,12 @@ class Sku
     # 获取当前价格
     public function getPrice($where, $spec_type, $app)
     {
+        /*
         $result['price'] = 0;
         $result['id'] = 0;
         $result['name'] = '';
+        */
+        $result = array();
         if ($spec_type == 2) {
             $where['key'] = '-1';
             $sku = Dever::db('sku', $app)->find($where);

+ 12 - 12
table/format.php

@@ -30,19 +30,19 @@ return array
         'field' => 'sort,name,method,cdate',
         'value' => array
         (
-            '1,"字符串","strval({value})",' . DEVER_TIME,
-            '2,"整数","intval({value})",' . DEVER_TIME,
-            '3,"浮点数","floatval({value})",' . DEVER_TIME,
-            '4,"uri编码","urlencode({value})",' . DEVER_TIME,
-            '5,"uri编码-RFC3986规则","rawurlencode({value})",' . DEVER_TIME,
-            '6,"转小写","strtolower({value})",' . DEVER_TIME,
-            '7,"转大写","strtoupper({value})",' . DEVER_TIME,
-            '8,"去空值","trim({value})",' . DEVER_TIME,
+            '1,"字符串","strval(\'{value}\')",' . DEVER_TIME,
+            '2,"整数","intval(\'{value}\')",' . DEVER_TIME,
+            '3,"浮点数","floatval(\'{value}\')",' . DEVER_TIME,
+            '4,"uri编码","urlencode(\'{value}\')",' . DEVER_TIME,
+            '5,"uri编码-RFC3986规则","rawurlencode(\'{value}\')",' . DEVER_TIME,
+            '6,"转小写","strtolower(\'{value}\')",' . DEVER_TIME,
+            '7,"转大写","strtoupper(\'{value}\')",' . DEVER_TIME,
+            '8,"去空值","trim(\'{value}\')",' . DEVER_TIME,
 
-            '10,"时间戳","strtotime({value})",' . DEVER_TIME,
-            '11,"yyyy-MM-dd HH:mm:ss","date(\'Y-m-d H:i:s\', {value})",' . DEVER_TIME,
-            '12,"yyyy-MM-DDTHH:mm:ss+TIMEZONE","date(\'Y-m-d\\\TH:i:sP\', {value})",' . DEVER_TIME,
-            '13,"yyyy-MM-ddTHH:mm:ssZ","date(\'Y-m-d\\\TH:i:sZ\', {value})",' . DEVER_TIME,
+            '10,"时间戳","strtotime(\'{value}\')",' . DEVER_TIME,
+            '11,"yyyy-MM-dd HH:mm:ss","date(\'Y-m-d H:i:s\', \'{value}\')",' . DEVER_TIME,
+            '12,"yyyy-MM-DDTHH:mm:ss+TIMEZONE","date(\'Y-m-d\\\TH:i:sP\', \'{value}\')",' . DEVER_TIME,
+            '13,"yyyy-MM-ddTHH:mm:ssZ","date(\'Y-m-d\\\TH:i:sZ\', \'{value}\')",' . DEVER_TIME,
         ),
         'num' => 1,
     ),

+ 3 - 2
table/platform_sign.php

@@ -61,8 +61,9 @@ return array
             'default'   => '1',
             'value'     => array
             (
-                1 => '按照签名参数填写的键名顺序排序',
-                2 => '按照签名参数键名字符顺序升序排序',
+                1 => '按照【签名参数键名】填写顺序排序',
+                2 => '按照【签名参数键名】字符顺序升序排序',
+                3 => '按照【签名参数键值】字符顺序升序排序',
             ),
         ),