| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use yii\db\ActiveRecord;
- /**
- * Class Localchanceloption
- * @package app\models
- * @property integer $id
- * @property integer $channel_id
- * @property integer $type
- * @property integer $cat_id
- * @property string $group_name
- * @property string $name
- * @property string $values
- *
- *
- *
- **/
- class Localchanceloption extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%localchanceloption}}';
- }
- public function rules()
- {
- return [
- [['id', 'channel_id','type','cat_id'], 'integer'],
- [["group_name", 'name', 'values'], 'string'],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => "ID",
- 'channel_id' => "渠道ID",
- 'type' => "支付渠道类型",
- ];
- }
- /**
- * 获取配置数据
- * @param $name
- * @param int $channel_id
- * @param int $type
- * @param string $key
- * @param string $value
- * @return array
- */
- public static function get ($name, $channel_id = 0, $type = 0, $key = '', $value = '')
- {
- $query = self::find()->where([
- 'group_name' => $name,
- 'channel_id' => $channel_id,
- 'type' => $type,
- ])->select(['group_name','values','type']);
- if (is_array($name)) {
- $data = $query->asArray()->all();
- } else {
- $data = $query->asArray()->one();
- }
- if (empty($key) && empty($value) && !empty($data)){
- $data = array_column($data, $value,$key);
- }
- return $data;
- }
- }
|