65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
namespace addon\aliapp\model;
|
|
use app\model\system\Config as ConfigModel;
|
|
use app\model\system\UniAccount;
|
|
use app\model\BaseModel;
|
|
/**
|
|
* 小程序配置
|
|
*/
|
|
class Config extends BaseModel
|
|
{
|
|
|
|
|
|
/***
|
|
* 设置小程序配置
|
|
* @param $appid
|
|
* @param $data
|
|
* @param int $site_id
|
|
* @param string $app_original
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function setAlipayConfig($appid,$data, $site_id,$app_original='')
|
|
{
|
|
$config = new UniAccount();
|
|
$condition=[
|
|
'site_id'=>$site_id,
|
|
'appid'=>$appid
|
|
];
|
|
$res = $config->setUniConfig($condition,$data,'aliapp','ALIAPP_CONFIG',$app_original);
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* 获取小程序配置信息
|
|
* @return multitype:string mixed
|
|
*/
|
|
public function getAppConfig($site_id,$app_type='aliapp', $config_key = 'ALIAPP_CONFIG')
|
|
{
|
|
$config = new UniAccount();
|
|
$condition=[
|
|
'site_id'=>$site_id,
|
|
'app_type'=>$app_type
|
|
];
|
|
$res = $config->getUniConfig($condition,$config_key);
|
|
return $res;
|
|
}
|
|
/**
|
|
* 根据appid获取配置信息
|
|
* @return multitype:string mixed
|
|
*/
|
|
public function getAppidConfig($appid,$config_key = 'ALIAPP_CONFIG')
|
|
{
|
|
$config = new UniAccount();
|
|
$res = $config->getUniConfig(['appid', '=', $appid],$config_key);
|
|
return $res;
|
|
}
|
|
|
|
public function getOpenConfig(){
|
|
$config = new ConfigModel();
|
|
$res = $config->getConfig([['site_id', '=', 0], ['app_module', '=', 'admin'], ['config_key', '=', 'ALIPAYOPEN_CONFIG']]);
|
|
return $res;
|
|
}
|
|
} |