Browse Source

fix:页面

super-yimizi 4 days ago
parent
commit
a57329886b

+ 1 - 1
application/admin/lang/zh-cn/shop/shipper.php

@@ -2,7 +2,7 @@
 
 return [
     'Name'              => '快递名称',
-    'Shipper_code'      => '快递公司编码',
+    'Code'              => '快递公司编码',
     'Createtime'        => '创建时间',
     'Updatetime'        => '更新时间'
 ];

+ 3 - 3
application/admin/view/shop/shipper/edit.html

@@ -3,13 +3,13 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
+            <input id="c-name"  data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Shipper_code')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Code')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-shipper_code" class="form-control" name="row[shipper_code]" type="text" value="{$row.shipper_code|htmlentities}">
+            <input id="c-code"  data-rule="required" class="form-control" name="row[code]" type="text" value="{$row.code|htmlentities}">
         </div>
     </div>
     <div class="form-group layer-footer">

+ 2 - 4
application/api/controller/third/Wechat.php

@@ -19,15 +19,13 @@ class Wechat extends Base
     {
         parent::_initialize();
 
-        $this->platform = $this->request->param('platform', '');
+        $this->platform = $this->request->header('platform', '');
 
         if ($this->platform === '') {
             $this->error('参数错误');
         }
 
-        $payloadString = htmlspecialchars_decode($this->request->param('payload', ''));
-
-        $this->payload = json_decode(urldecode($payloadString), true) ?? [];
+        $this->payload = $this->request->post('payload/a', '') ?? [];
 
         $this->wechat = new WechatService($this->platform, $this->payload);
     }

+ 0 - 2
application/common/Service/Order/ShippingInfo/Base.php

@@ -5,8 +5,6 @@ namespace app\common\Service\Order\ShippingInfo;
 use app\common\Enum\PayEnum;
 use app\common\exception\BusinessException;
 use app\common\model\pay\Index as PayModel;
-use think\helper\Str;
-use app\common\Enum\GoodsEnum;
 class Base
 {
     protected $order = null;

+ 0 - 2
application/common/Service/Order/shippingInfo/Base.php

@@ -5,8 +5,6 @@ namespace app\common\Service\Order\ShippingInfo;
 use app\common\Enum\PayEnum;
 use app\common\exception\BusinessException;
 use app\common\model\pay\Index as PayModel;
-use think\helper\Str;
-use app\common\Enum\GoodsEnum;
 class Base
 {
     protected $order = null;

+ 5 - 2
application/common/Service/Third/Wechat/OpenPlatform.php

@@ -23,10 +23,13 @@ class OpenPlatform
     {
         $payload = $this->payload;
         if (empty($payload['code'])) {
-                        ('登陆失败');
+            throw new BusinessException('登陆失败');
         }
         $config = shop_config('shop.platform.App');
-
+        echo "<pre>";
+        print_r($this->wechat);
+        echo "</pre>";
+        exit;
         // 获取accessToken & openid
         $res = Http::get('https://api.weixin.qq.com/sns/oauth2/access_token', [
             'appid' => $config['app_id'],

+ 5 - 2
application/common/Service/Third/Wechat/Wechat.php

@@ -2,6 +2,7 @@
 
 namespace app\common\Service\Third\Wechat;
 
+use app\common\Enum\ChannelEnum;
 use app\common\library\Auth;
 use app\common\model\ThirdOauth;
 use app\common\model\User as UserModel;
@@ -28,7 +29,6 @@ class Wechat
 
     /**
      * 微信登陆
-     *
      * @return array
      */
     public function login()
@@ -183,7 +183,10 @@ class Wechat
             case 'miniProgram':
                 $service = new MiniProgram($payload);
                 break;
-            case 'openPlatform':
+            case ChannelEnum::CHANNEL_IOS_APP:
+                $service = new OpenPlatform($payload);
+                break;
+            case ChannelEnum::CHANNEL_ANDROID_APP:
                 $service = new OpenPlatform($payload);
                 break;
         }

+ 21 - 0
application/common/facade/Wechat.php

@@ -123,6 +123,27 @@ class Wechat extends Base
 
         return $GLOBALS['WECHAT']['OPENPLATFORM'];
     }
+      /**
+     * 开放给小程序的公众号
+     *
+     * @return \EasyWeChat\OpenPlatform\Application
+     */
+    public static function openPlatform()
+    {
+        if (isset($GLOBALS['WECHAT']['OPENPLATFORM'])) {
+            return $GLOBALS['WECHAT']['OPENPLATFORM'];
+        }
+        $defaultConfig = self::defaultConfig();
+        $openPlatform = shop_config('shop.platform.android_app', false);
+        $config = array_merge($defaultConfig, [
+            'app_id'  => $openPlatform['app_id'],
+            'secret'  => $openPlatform['secret'],
+        ]);
+        $app = new \EasyWeChat\OpenPlatform\Application($config);
+        $GLOBALS['WECHAT']['OPENPLATFORM'] = $app;
+
+        return $GLOBALS['WECHAT']['OPENPLATFORM'];
+    }
 
 
     protected static function defaultConfig () {

+ 1 - 1
public/assets/js/backend/shop/shipper.js

@@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'name', title: __('Name'), operate: 'LIKE'},
-                        {field: 'shipper_code', title: __('Shipper_code'), operate: 'LIKE'},
+                        {field: 'code', title: __('Code'), operate: 'LIKE'},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}