quanwei
13 hours ago 408c463c5b66bba2aa1c81d8dca23e04c1608e24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
<?php
 
namespace app\common\model\settings;
 
use app\common\enum\settings\SettingEnum;
use think\facade\Cache;
use app\common\enum\settings\DeliveryTypeEnum;
use app\common\model\BaseModel;
use app\common\enum\settings\OperateTypeEnum;
use think\Model;
use app\common\model\supplier\Supplier as SupplierModel;
 
/**
 * 系统设置模型
 */
class Setting extends BaseModel
{
    protected $name = 'setting';
    protected $createTime = false;
 
    /**
     * 获取器: 转义数组格式
     */
    public function getValuesAttr($value)
    {
        return json_decode($value, true);
    }
 
    /**
     * 修改器: 转义成json格式
     */
    public function setValuesAttr($value)
    {
        return json_encode($value);
    }
 
    /**
     * 获取指定项设置
     */
    public static function getItem($key, $app_id = null,$shop_supplier_id=0)
    {
        $data = self::getAll($app_id);
        if (!isset($data[$key])&&strpos($key, 'nav_')!==false){
            if ($shop_supplier_id!=0){
                return [];
            }else{
                $key = 'nav';
            }
 
        }
        $data_key = $data[$key];
        if(isset($data_key)){
            $data_key = $data[$key]['values'];
            jsonRecursive($data_key);
        }else{
            $data_key = [];
        }
        return $data_key;
    }
   /**
     * 获取系统配置
     */
    public static function getSysConfig()
    {
        $model = new static;
        $result = $model->withoutGlobalScope()->where('key', '=', SettingEnum::SYS_CONFIG)->value('values');
        if(!$result){
            $result = $model->defaultData()[SettingEnum::SYS_CONFIG]['values'];
        } else {
            $result = json_decode($result, true);
            $result = array_merge_multiple($model->defaultData()[SettingEnum::SYS_CONFIG]['values'], $result);
        }
        return $result;
    }
     /**
     * 获取指定项设置
     */
    public static function getSupplierItem($key, $shop_supplier_id, $app_id = null)
    {
        $data = self::getAll($app_id, $shop_supplier_id);
        $data_key = $data[$key];
        if(isset($data_key)){
            $data_key = $data[$key]['values'];
            jsonRecursive($data_key);
        }else{
            $data_key = [];
        }
 
        return $data_key;
    }
 
    /**
     * 获取设置项信息
     */
    public static function detail($key,$shop_supplier_id=0)
    {   
        $where = [];
        if($shop_supplier_id){
            $where['shop_supplier_id'] = $shop_supplier_id;
        }
 
        return (new static())->where('key', '=', $key)->where($where)->find();
    }
 
    /**
     * 全局缓存: 系统设置
     */
    public static function getAll($app_id = null, $shop_supplier_id = 0)
    {
        $static = new static;
        is_null($app_id) && $app_id = $static::$app_id;
        if (!$data = Cache::get('setting_' . $app_id . '_' . $shop_supplier_id)) {
            $setting = $static->where(compact('app_id'))->where('shop_supplier_id', $shop_supplier_id)->select();
            $data = empty($setting) ? [] : array_column($static->collection($setting)->toArray(), null, 'key');
            Cache::tag('cache')->set('setting_' . $app_id. '_' .$shop_supplier_id, $data);
        }
        return $static->getMergeData($data);
    }
 
    /**
     * 数组转换为数据集对象
     */
    public function collection($resultSet)
    {
        $item = current($resultSet);
        if ($item instanceof Model) {
            return \think\model\Collection::make($resultSet);
        } else {
            return \think\Collection::make($resultSet);
        }
    }
 
 
    /**
     * 合并用户设置与默认数据
     */
    private function getMergeData($userData)
    {
        $defaultData = $this->defaultData();
        // 商城设置:配送方式
        if (isset($userData['store']['values']['delivery_type'])) {
            unset($defaultData['store']['values']['delivery_type']);
        }
        return array_merge_multiple($defaultData, $userData);
    }
 
    /**
     * 店铺是否开启
     */
    public static function getStoreOpen()
    {
        $data = (new static())->getItem(SettingEnum::STORE);
        return $data['store_open'] == 1;
    }
 
    /**
     * 商户独立收款是否开启 by yj 2024.3.12
     */
    public static function getIndependentOpen()
    {
        $data = (new static())->getItem(SettingEnum::STORE);
        return empty($data['is_independent']) ? 0 : $data['is_independent'];
    }
 
    /**
     * 产品下划线价格是否显示
     */
    public static function getUnderlinePriceShow()
    {
        $data = (new static())->getItem(SettingEnum::STORE);
        if(empty($data['underline_price_show']) || $data['underline_price_show'] == 0){
            return true;
        }
        return false;
    }
 
    /**
     * 默认配置
     */
    public function defaultData($storeName = null)
    {  
        $url = base_url();
        return [
            'store' => [
                'key' => 'store',
                'describe' => '商城设置',
                'values' => [
                    // 商城名称
                    'name' => $storeName ?: '未命名商城',
                    'index_open_city' => 0,
                    // 配送方式
                    'delivery_type' => array_keys(DeliveryTypeEnum::data()),
                    // 快递100
                    'kuaidi100' => [
                        'customer' => '',
                        'key' => '',
                    ],
                    // 押金
                    'supplier_cash' => '0',
                    // 抽成比例
                    'commission_rate' => '5',
                    // 模式类型,B2B B2B2C
                    'operate_type' => OperateTypeEnum::B2B,
                    // 新商品是否需要审核
                    'add_audit' => '1',
                    // 审核通过后再修改是否需要审核
                    'edit_audit' => '1',
                    // 供应商入驻图片
                    'supplier_image' => self::$base_url . 'image/supplier/apply.png',
                    // 是否开启短信
                    'sms_open' => '1',
                    // 是否记录日志
                    'is_get_log' => true,
                    // 政策隐私
                    'policy' => [
                        'service' => self::$base_url .'service.html',
                        'privacy' => self::$base_url .'privacy.html',
                    ],
                    'store_open' => '1',//是否显示店铺0不显示
                    'coupon_card_user' => '0', // 是否仅会员卡会员可领取优惠券
                ],
            ],
            'mp_service' => [
                'key' => 'mp_service',
                'describe' => '公众号客服设置',
                'values' => [
                    // qq
                    'qq' => '',
                    // 微信
                    'wechat' => '',
                    // 微信公众号图片
                    'mp_image' => '',
                ],
            ],
            'trade' => [
                'key' => 'trade',
                'describe' => '交易设置',
                'values' => [
                    'order' => [
                        'close_days' => '3',
                        'receive_days' => '10',
                        'refund_days' => '7'
                    ],
                    'freight_rule' => '10',
                ]
            ],
            'takeout' => [
                'key' => 'takeout',
                'describe' => '外卖设置',
                'values' => [
                    'commission_type' => '0',
                    'order_commission' =>'0',
                ]
            ],
            'storage' => [
                'key' => 'storage',
                'describe' => '上传设置',
                'values' => [
                    'default' => 'local',
                    'max_image' => '2',
                    'max_video' => '20',
                    'max_width' => '800', // 图片最大宽度 by lyzflash
                    'engine' => [
                        'local' => [],
                        'qiniu' => [
                            'bucket' => '',
                            'access_key' => '',
                            'secret_key' => '',
                            'domain' => 'http://'
                        ],
                        'aliyun' => [
                            'bucket' => '',
                            'access_key_id' => '',
                            'access_key_secret' => '',
                            'domain' => 'http://'
                        ],
                        'qcloud' => [
                            'bucket' => '',
                            'region' => '',
                            'secret_id' => '',
                            'secret_key' => '',
                            'domain' => 'http://'
                        ],
                    ]
                ],
            ],
            'sms' => [
                'key' => 'sms',
                'describe' => '短信通知',
                'values' => [
                    'default' => 'aliyun',
                    'engine' => [
                        'aliyun' => [
                            'AccessKeyId' => '',
                            'AccessKeySecret' => '',
                            'sign' => '三勾商城',
                            'login_template' => '',
                            'apply_template' => '',
                            'supplier_reject_code' => '',
                            'supplier_pass_code' => ''
                        ],
                    ],
                ],
            ],
            'tplMsg' => [
                'key' => 'tplMsg',
                'describe' => '模板消息',
                'values' => [
                    'payment' => [
                        'is_enable' => '0',
                        'template_id' => '',
                    ],
                    'delivery' => [
                        'is_enable' => '0',
                        'template_id' => '',
                    ],
                    'refund' => [
                        'is_enable' => '0',
                        'template_id' => '',
                    ],
                ],
            ],
            'printer' => [
                'key' => 'printer',
                'describe' => '小票打印机设置',
                'values' => [
                    'is_open' => '0',   // 是否开启打印
                    'printer_id' => '', // 打印机id
                    'order_status' => [], // 订单类型 10下单打印 20付款打印 30确认收货打印
                ],
            ],
            'full_free' => [
                'key' => 'full_free',
                'describe' => '满额包邮设置',
                'values' => [
                    'is_open' => '0',   // 是否开启满额包邮
                    'money' => '',      // 单笔订单额度
                ],
            ],
            'recharge' => [
                'key' => 'recharge',
                'describe' => '用户充值设置',
                'values' => [
                    'is_entrance' => '1',   // 是否允许用户充值
                    'is_custom' => '1',   // 是否允许自定义金额
                    'is_match_plan' => '1',   // 自定义金额是否自动匹配合适的套餐
                    'describe' => "1. 账户充值仅限微信在线方式支付,充值金额实时到账;\n" .
                        "2. 账户充值套餐赠送的金额即时到账;\n" .
                        "3. 账户余额有效期:自充值日起至用完即止;\n" .
                        "4. 若有其它疑问,可拨打客服电话400-000-1234",     // 充值说明
                ],
            ],
            'points' => [
                'key' => 'points',
                'describe' => '积分设置',
                'values' => [
                    'points_name' => '积分',         // 积分名称自定义
                    'is_shopping_gift' => '0',      // 是否开启购物送积分
                    'gift_ratio' => '100',            // 是否开启购物送积分
                    'is_shopping_discount' => '0',    // 是否允许下单使用积分抵扣
                    'is_trans_balance' => '0',    // 是否允许转换余额
                    'discount' => [     // 积分抵扣
                        'discount_ratio' => '0.01',       // 积分抵扣比例
                        'full_order_price' => '100.00',       // 订单满[?]元
                        'max_money_ratio' => '10',             // 最高可抵扣订单额百分比
                    ],
                    // 充值说明
                    'describe' => "a) 积分不可兑现、不可转让,仅可在本平台使用;\n" .
                        "b) 您在本平台参加特定活动也可使用积分,详细使用规则以具体活动时的规则为准;\n" .
                        "c) 积分的数值精确到个位(小数点后全部舍弃,不进行四舍五入)\n" .
                        "d) 买家在完成该笔交易(订单状态为“已签收”)后才能得到此笔交易的相应积分,如购买商品参加店铺其他优惠,则优惠的金额部分不享受积分获取;",
                ],
            ],
            'consumption' => [
                'key' => 'consumption',
                'describe' => '消费券设置',
                'values' => [
                    'consumption_name' => '消费券',         // 消费券名称自定义
                    'is_shopping_gift' => '0',      // 是否开启购物送消费券
                    'gift_ratio' => '100',            // 是否开启购物送消费券
                    'is_shopping_discount' => '0',    // 是否允许下单使用消费券抵扣
                    'give_away'=> 0,//直推赠送
                    'is_trans_balance' => '0',    // 是否允许转换余额
                    'discount' => [     // 消费券抵扣
                        'discount_ratio' => '0.01',       // 消费券抵扣比例
                        'full_order_price' => '100.00',       // 订单满[?]元
                        'max_money_ratio' => '10',             // 最高可抵扣订单额百分比
                    ],
                    // 消费券说明
                    'describe' => "a) 消费券不可兑现、不可转让,仅可在本平台使用;\n" .
                        "b) 您在本平台参加特定活动也可使用消费券,详细使用规则以具体活动时的规则为准;\n" .
                        "c) 消费券的数值精确到个位(小数点后全部舍弃,不进行四舍五入)\n" .
                        "d) 买家在完成该笔交易(订单状态为“已签收”)后才能得到此笔交易的相应消费券,如购买商品参加店铺其他优惠,则优惠的金额部分不享受消费券获取;",
                ],
            ],
            'officia' => [
                'key' => 'officia',
                'describe' => '公众号关注',
                'values' => [
                    'status' => 0
                ],
            ],
            'collection' => [
                'key' => 'collection',
                'describe' => '引导收藏',
                'values' => [
                    'status' => 0
                ],
            ],
            'recommend' => [
                'key' => 'recommend',
                'describe' => '商品推荐',
                'values' => [
                    'is_recommend' => '0',
                    'location' => [],
                    'choice' => '0',
                    'type' => '10',
                    'num' => '20',
                    'product' => []
                ],
            ],
            'basic' => [
                'key' => 'basic',
                'describe' => '好物圈',
                'values' => [
                    // 是否开启
                    'status' => 0,
                    // 是否同步购物车 (商品收藏)
                    'is_shopping' => '0',
                    // 是否同步订单
                    'is_order' => '0',
                ]
            ],
            'homepush' => [
                'key' => 'homepush',
                'describe' => '首页推送',
                'values' => [
                    // 是否开启
                    'is_open' => 0,
                ]
            ],
            'pointsmall' => [
                'key' => 'pointsmall',
                'describe' => '积分商城',
                'values' => [
                    // 是否开启
                    'is_open' => false,
                    // 是否使用优惠券
                    'is_coupon' => false,
                    // 是否分销
                    'is_agent' => false,
                ]
            ],
            'bargain' => [
                'key' => 'bargain',
                'describe' => '限时砍价',
                'values' => [
                    // 是否使用优惠券
                    'is_coupon' => false,
                    // 是否分销
                    'is_agent' => false,
                    // 是否开启积分
                    'is_point' => false,
                    // 规则
                    'bargain_rules' => ''
                ]
            ],
            'sign' => [
                'key' => 'sign',
                'describe' => '签到有礼',
                'values' => [
                    // 是否开启
                    'is_open' => false
                ]
            ],
            'seckill' => [
                'key' => 'seckill',
                'describe' => '限时秒杀',
                'values' => [
                    // 是否开启积分
                    'is_point' => false,
                    // 是否开启分销
                    'is_agent' => false,
                    //未付款订单自动关闭时间,分钟
                    'order_close' => 10,
                    // 是否使用优惠券
                    'is_coupon' => false,
                ]
            ],
            'assemble' => [
                'key' => 'assemble',
                'describe' => '限时拼团',
                'values' => [
                    // 是否开启
                    'is_open' => false,
                    // 是否开启积分
                    'is_point' => false,
                    // 是否开启分销
                    'is_agent' => false,
                    // 是否使用优惠券
                    'is_coupon' => false,
                ]
            ],
            'getPhone' => [
                'key' => 'getPhone',
                'describe' => '获取手机号设置',
                'values' => [
                    // 显示区域
                    'area_type' => [],
                    // 不再提示天数
                   'send_day' => 7
                ],
            ],
            'live' => [
                'key' => 'live',
                'describe' => '直播设置',
                'values' => [
                    // 是否开启直播
                    'is_open' => '0',
                    //是否开启审核
                    'is_audit' => '1',
                    //礼物名称
                    'gift_name'=>'玖币',
                    // appid
                    'sdkappid' => '',
                    // key
                    'key' => '',
                    // 是否开启录制
                    'is_record' => '0',
                    // 存储设置
                    'vendor' => '',
                    'region' => '',
                    'bucket' => '',
                    'accessKey' => '',
                    'secretKey' => '',
                    'username' => '',
                    'password' => '',
                    'domain' => ''
                ]
            ],
            'appshare' => [
                'key' => 'appshare',
                'describe' => 'app分享',
                'values' => [
                    // 分享类型 1公众号/h5 2小程序 3下载页
                    'type' => '1',
                    // 公众号、h5地址
                    'open_site' => '',
                    // 小程序原始id
                    'gh_id' => '',
                    // 跳转网页
                    'web_url' => '',
                    // 下载页
                    'down_url' => '',
                    // 绑定类型
                    'bind_type' => '1'
                ]
            ],
            'sys_config' => [
                'key' => 'sys_config',
                'describe' => '系统设置',
                'values' => [
                    'shop_name' => '商城管理系统',
                    'shop_bg_img' => '',
                    'supplier_name' => '商城供应商管理系统',
                    'supplier_bg_img' => '',
                    'branch_name' => '连盟管理系统',
                    'branch_bg_img' => '',
                    'url' => 'wss://',
                    'service_open' => 0,
                    // 微信服务商支付
                    'weixin_service' => [
                        'is_open' => 0,
                        'app_id' => '',
                        'mch_id' => '',
                        'apikey' => '',
                        'cert_pem' => '',
                        'key_pem' => ''
                    ],
                ]
            ],
            'balance' => [
                'key' => 'balance',
                'describe' => '充值设置',
                'values' => [
                    // 是否开启
                    'is_open' => 0,
                    // 是否可以自定义
                    'is_plan' => 1,
                    // 最低充值金额
                    'min_money' => 1,
                    // 充值说明
                    'describe' => "a) 账户充值仅限在线方式支付,充值金额实时到账;\n" .
                        "b) 有问题请联系客服;\n" ,
                ]
            ],
            'h5Alipay' => [
                'key' => 'h5Alipay',
                'describe' => 'h5支付宝支付',
                'values' => [
                    // 是否开启
                    'is_open' => false,
                    // 支付宝app_id
                    'app_id' => '',
                    // 支付宝公钥
                    'publicKey' => '',
                    // 应用私钥
                    'privateKey' => ''
                ]
            ],
            'nav' => [
                'key' => 'nav',
                'describe' => '底部导航',
                'values' => [
                    'data' => [
                        'is_auto' => "0",
                        "type" => "0",
                        "backgroundColor" => "#FFFFFF",
                        "textColor" => "#000000",
                        "textHoverColor" => "#E2231A",
                        "bulge" => "true",
                        // 菜单
                        'list' => [
                            [
                                'text' => '首页',
                                'iconPath' => self::$base_url . 'image/tabbar/home.png',
                                'selectedIconPath' => self::$base_url . 'image/tabbar/home_active.png',
                                "link_url" => "/pages/index/index"
                            ],
                            [
                                'text' => '分类',
                                'iconPath' => self::$base_url . 'image/tabbar/category.png',
                                'selectedIconPath' => self::$base_url . 'image/tabbar/category_active.png',
                                "link_url" => "/pages/product/category"
                            ],
                            [
                                'text' => '店铺',
                                'iconPath' => self::$base_url . 'image/tabbar/shop.png',
                                'selectedIconPath' => self::$base_url . 'image/tabbar/shop_active.png',
                                "link_url" => "/pages/shop/shop_list"
                            ],
                            [
                                'text' => '购物车',
                                'iconPath' => self::$base_url . 'image/tabbar/cart.png',
                                'selectedIconPath' => self::$base_url . 'image/tabbar/cart_active.png',
                                "link_url" => "/pages/cart/cart"
                            ],
                            [
                                'text' => '我的',
                                'iconPath' => self::$base_url . 'image/tabbar/user.png',
                                'selectedIconPath' => self::$base_url . 'image/tabbar/user_active.png',
                                "link_url" => "/pages/user/index/index"
                            ],
//                        [
//                            'text' => '订单',
//                            'iconPath' => self::$base_url . 'image/tabbar/order.png',
//                            'selectedIconPath' => self::$base_url . 'image/tabbar/order_active.png',
//                            "link_url" => "/pages/order/myorder"
//                        ],
                        ]
                    ]
                ]
            ],
        SettingEnum::THEME => [
                'key' => 'theme',
                'describe' => '主题设置',
                'values' => [
                    'theme' => '0',//主题设置
                ],
            ],
        SettingEnum::ADVANCE => [
                'key' => 'advance',
                'describe' => '预售设置',
                'values' => [
                    // banner图
                    'image' => [],
                    // 预售未付款关闭订单时间
                    'end_time' => '10',//分钟
                    // 支付定金预售结束后未付款结束时间
                    'pay_time' => '24',//小时
                    // 未支付尾款是否退定金
                    'money_return' => '0',//0否1是
                    // 是否开启分销
                    'is_agent' => '0',//0否1是
                ],
            ],
            SettingEnum::BALANCE_CASH => [
                'key' => 'balance_cash',
                'describe' => '余额提现设置',
                'values' => [
                    // 是否开启
                    'is_open' => '0',
                    // 最低提现金额
                    'min_money' => 1,
                    // 提现比例
                    'cash_ratio' => 100,
                    // 微信方式0、提现到零钱 1,转账到零钱
                    'wechat_type' => '0',
                ]
            ],
        SettingEnum::TASK => [
                'key' => 'task',
                'describe' => '任务中心',
                'values' => [
                    //任务背景图
                    'back_image' => base_url() . 'image/task/task.png',
                    //成长任务
                    'grow_task' => [
                        [
                            'name' => '上传头像',
                            'image' => base_url() . 'image/task/image.png',
                            'is_open' => '1',
                            'task_type' => 'image',
                            'rule' => '首次修改头像奖励5积分',
                            'points' => 5,
                            'status' => 0
                        ],
                        [
                            'name' => '完善基本资料',
                            'image' => base_url() . 'image/task/base.png',
                            'is_open' => '1',
                            'task_type' => 'base',
                            'rule' => '首次修改昵称奖励5积分',
                            'points' => 5,
                            'status' => 0
                        ],
                    ],
                    //日常任务
                    'day_task' => [
                        [
                            'name' => '分享商品',
                            'image' => base_url() . 'image/task/product.png',
                            'is_open' => '1',
                            'task_type' => 'product',
                            'rule' => '当日分享商品给好友奖励5积分',
                            'points' => 5,
                            'status' => 0
                        ],
                        [
                            'name' => '分享文章',
                            'image' => base_url() . 'image/task/article.png',
                            'is_open' => '1',
                            'task_type' => 'article',
                            'rule' => '当日分享文章给好友奖励5积分',
                            'points' => 5,
                            'status' => 0
                        ],
                    ],
                ]
            ],
            'message' => [
                'key' => 'message',
                'describe' => '消息通知设置',
                'values' => [
                    'order__user_ids' => [],  // 新订单通知
                ],
            ],
            'card' => [
                'key' => 'card',
                'describe' => '会员卡设置',
                'values' => [
                    'is_open' => '0',   // 是否启用会员卡
                    // 提现方式
                    'pay_type' => [],   // 参数值:10微信支付 20支付宝支付 30银行卡支付
                    'is_license' => 0, // 是否显示协议
                    'license' => [
                        'title' => '会员卡开通协议',
                        'content' => ''
                    ], // 协议
                ],
            ],
        ];
    }
 
    /**
     * 获取商户的抽成比例 by yj 2023.12.21
     */
    public static function getSupplierCommissionRate($shop_supplier_id ='')
    {
        $data = (new static())->getItem(SettingEnum::STORE);
        if(!empty($shop_supplier_id)){
            //获取商户的信息
            $supplier = SupplierModel::detail($shop_supplier_id);
            //判断商户独立抽成是否开启
            if(!empty($supplier) && !empty($supplier["is_alone_commission_rate"]) && $supplier["is_alone_commission_rate"] == 1){
                $data["commission_rate"] = empty($supplier["commission_rate"]) ? 0 : $supplier["commission_rate"];
            }
        }
        return $data;
    }
 
}