87 lines
2.7 KiB
PHP
87 lines
2.7 KiB
PHP
<?php
|
|
namespace app\mp\model;
|
|
use app\model\system\Config as ConfigModel;
|
|
use app\model\BaseModel;
|
|
/**
|
|
* 微信公众号配置
|
|
*/
|
|
class Config extends BaseModel
|
|
{
|
|
/**
|
|
* 获取微信公众号配置信息
|
|
* @param int $site_id
|
|
* @return array
|
|
*/
|
|
public function getWechatConfig($site_id=0)
|
|
{
|
|
$config = new ConfigModel();
|
|
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', 'admin'], ['config_key', '=', 'WECHAT_CONFIG']]);
|
|
return $res;
|
|
}
|
|
/***
|
|
* 获取微信小程序配置信息
|
|
* @param int $site_id
|
|
* @param string $app_module
|
|
* @return array
|
|
*/
|
|
public function getWeappConfig($site_id=0,$app_module='admin')
|
|
{
|
|
$config = new ConfigModel();
|
|
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'WEAPP_CONFIG']]);
|
|
return $res;
|
|
}
|
|
/****
|
|
* 小程序参数设置
|
|
* @param $data 设置数组
|
|
* @param $is_use 是否开启
|
|
* @param int $site_id 商家ID
|
|
* @param string $app_module 应用模块
|
|
* @return array
|
|
*/
|
|
public function setWeappConfig($data,$is_use,$site_id=0,$app_module='shop')
|
|
{
|
|
$config = new ConfigModel();
|
|
$res = $config->setConfig($data, '微信小程序设置', $is_use, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'WEAPP_CONFIG']]);
|
|
return $res;
|
|
}
|
|
/**
|
|
* 设置微信公众号配置
|
|
* @param $data
|
|
* @param $is_use
|
|
* @param int $site_id
|
|
* @param string $app_module
|
|
* @return array
|
|
*/
|
|
public function setWechatConfig($data,$is_use,$site_id=0,$app_module='shop')
|
|
{
|
|
$config = new ConfigModel();
|
|
$res = $config->setConfig($data, '微信公众号设置', $is_use, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'WECHAT_CONFIG']]);
|
|
return $res;
|
|
}
|
|
/**
|
|
* 获取微信开放平台配置信息
|
|
* @param int $site_id
|
|
* @param string $app_module
|
|
* @return array
|
|
*/
|
|
public function getOpenWeConfig($site_id=0,$app_module='admin'){
|
|
$config = new ConfigModel();
|
|
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'WEOPEN_CONFIG']]);
|
|
return $res;
|
|
}
|
|
|
|
|
|
/***
|
|
* 获取云市场配置
|
|
* @param $site_id
|
|
* @param $config_key
|
|
* @param string $app_module
|
|
* @return array|mixed
|
|
*/
|
|
public function getCloudConfig($site_id,$config_key,$app_module='shop'){
|
|
$config = new ConfigModel();
|
|
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', $config_key]]);
|
|
return $res;
|
|
}
|
|
|
|
} |