Zory hai 3 días
pai
achega
cc58798af9
Modificáronse 2 ficheiros con 11 adicións e 3 borrados
  1. 8 1
      app/controller/admin/Store.php
  2. 3 2
      app/extra/douyin/Client.php

+ 8 - 1
app/controller/admin/Store.php

@@ -58,6 +58,7 @@ class Store extends Base
         try {
             $param = $this->_valid([
                 "id.require"    => trans("empty.require"),
+                "val.default"   => 2,
                 "type.default"  => 1, // 1 设置path 2 关闭二维码
             ],"post");
             if (!is_array($param)) return error($param);
@@ -70,7 +71,13 @@ class Store extends Base
                 $resp = (new Account)->config($this->getDyConfig())->token()->setWhiteSetting($store['store_id'],1,true);
                 if ($resp['err_no'] <> 0) return error($resp['err_msg']);
             } else {
-                $resp = (new Client)->config($this->getDyConfig())->token()->setBtnText($store['store_id']);
+                if ($store['is_hide'] == 1) {
+                    $store->is_hide = 0;
+                } else {
+                    $store->is_hide = 1;
+                }
+                $store->save();
+                $resp = (new Client)->config($this->getDyConfig())->token()->setBtnText($store['store_id'],$param['val']);
                 if ($resp['err_no'] <> 0) return error($resp['err_msg']);
             }
             return successTrans("success.data");

+ 3 - 2
app/extra/douyin/Client.php

@@ -83,16 +83,17 @@ class Client extends Base
     /**
      * 设置商家配置文案
      * @param string $account
+     * @param int $mode 1 展示线上核销和二维码核销 2 仅展示线上核销
      * @return array
      */
-    public function setBtnText(string $account = ""): array
+    public function setBtnText(string $account = "",int $mode = 2): array
     {
         $param = [
             "account_id"        => $account,
             "bind_biz_type"     => 0,
             "delivery_app_info" => [
                 "button_text_id" => "te7252216917182660619",
-                "display_mode" => 2,
+                "display_mode" => $mode,
                 "guidance_text_id"=>"te7249212519187791884"
             ]
         ];