| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use app\models\Option;
- use app\constants\OptionSetting;
- /**
- * This is the model class for table "{{%upload_config}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property string $storage_type
- * @property string $aliyun
- * @property string $qcloud
- * @property string $qiniu
- * @property integer $created_at
- * @property integer $is_delete
- */
- class UploadConfig extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%upload_config}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id'], 'required'],
- [['store_id', 'created_at', 'is_delete'], 'integer'],
- [['aliyun', 'qcloud', 'qiniu'], 'string'],
- [['storage_type'], 'string', 'max' => 255],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'storage_type' => '存储类型:留空=本地,aliyun=阿里云oss,qcloud=腾讯云cos,qiniu=七牛云存储',
- 'aliyun' => '阿里云oss配置,json格式',
- 'qcloud' => '腾讯云cos配置,json格式',
- 'qiniu' => '七牛云存储配置,json格式',
- 'created_at' => 'Addtime',
- 'is_delete' => 'Is Delete',
- ];
- }
-
- public static function getConf($store_id) {
- $mho = Option::get(OptionSetting::MCH_HIDE_OSS, 0, 'saas', 0)['value'];
- if($mho){
- $store_id = 0;
- }
- $config = UploadConfig::findOne(['store_id' => $store_id, 'is_delete' => 0]);
- if ($store_id > 0 && empty($config)) {
- $config = UploadConfig::findOne(['store_id' => 0, 'is_delete' => 0]);
- }
- \Yii::error([__METHOD__, $store_id]);
- return $config;
- }
- }
|