文件
mashangyoujiu/Application/Distribution/Model/ConfigModel.class.php

64 行
3.4 KiB
PHP
可执行文件

<?php
namespace Distribution\Model;
/**
* 分销设置表
* Class ConfigModel
* @package Distribution\Model
*/
class ConfigModel extends \Common\Model\BaseModel
{
protected $tableName = 'distribution_config';
protected $fields = array(
'id', //int(11) NOT NULL AUTO_INCREMENT,
'merchant_id', //int(11) NOT NULL DEFAULT '0' COMMENT '商户id',
'is_open', //tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否开启分销 0关闭 1开启',
'distribution_level', //tinyint(1) NOT NULL DEFAULT '1' COMMENT '分销层级 1一级分销 2二级分销',
'second_level_rate', //decimal(10,2) DEFAULT '0.00' COMMENT '二级佣金比',
'is_self_buying', //tinyint(1) NOT NULL DEFAULT '0' COMMENT '分销自购 0不可以获得佣金 1可以获得佣金',
'clearing_form', //tinyint(1) NOT NULL DEFAULT '0' COMMENT '结算方式 0自动结算 1手动结算',
'balance_date', //varchar(50) DEFAULT '' COMMENT '分销订单自动结算时间:确认收货后隔'balance_date'天自动结算',
'is_check', //tinyint(1) NOT NULL DEFAULT '0' COMMENT '申请成为分销员是否需要审核 0不需要 1需要',
'is_upgrade', //tinyint(1) NOT NULL DEFAULT '0' COMMENT '分销员自动升级 0自动升级 1不允许自动升级',
'withdrawal_money', //decimal(10,2) DEFAULT '0.00' COMMENT '最低提现金额',
'share_writer', //varchar(50) DEFAULT '' NULL COMMENT '分享文案',
'share_picture', //varchar(50) DEFAULT '' NULL COMMENT '分享图片',
'share_color', //varchar(50) DEFAULT '' NULL COMMENT '分享文案颜色',
'invite_under_color', //varchar(50) DEFAULT '' NULL COMMENT '邀请码底色',
'invite_code_color', //varchar(50) DEFAULT '' NULL COMMENT '邀请码颜色',
'official_writer', //text NULL COMMENT '招募文案',
'official_btn_color', //varchar(50) DEFAULT NULL COMMENT '招募文案申请按钮颜色',
'official_text_color', //varchar(50) DEFAULT NULL COMMENT '招募文案申请按钮文字颜色',
'binding_type', //tinyint(1) DEFAULT '1' COMMENT '客户绑定方式 1购买商品绑定 2点击链接绑定',
'is_customer_protect', //tinyint(1) DEFAULT '1' COMMENT '是否开启客户保护 1关闭 2开启',
'customer_protect_type', //tinyint(1) DEFAULT '1' COMMENT '客户保护方式 1永久保护 2固定时间保护',
'protect_date', //varchar(50) DEFAULT '1' COMMENT '固定保护天数',
);
public function getConfig($merchant_id)
{
$config = $this->getFindTrue(array('merchant_id' => $merchant_id));
return $config;
}
// 获取开启分销插件门店数
public function getPlugMerchant()
{
$where['con.is_open'] = 1;
$where['rm.status'] = 1;
$field = 'con.merchant_id';
// 获取开启插件的门店
$merchant_arr = $this->alias('con')
->join('ls_retail_merchant as rm on rm.id = con.merchant_id', 'LEFT')
->field($field)
->where($where)
->select();
return $merchant_arr ? $merchant_arr : [];
}
}