|
|
@@ -22,4 +22,71 @@ class Sys extends Model
|
|
|
public function saveSys($save) {
|
|
|
$this->where('id',1)->save($save);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 微信配置信息
|
|
|
+ * @param type $data
|
|
|
+ */
|
|
|
+ public function saveWxConfig($data){
|
|
|
+ $save=[
|
|
|
+ "appid" => empty($data["appid"])?"":$data["appid"],
|
|
|
+ "secret" => empty($data["secret"])?"":$data["secret"],
|
|
|
+ "mchid" => empty($data["mchid"])?"":$data["mchid"],
|
|
|
+ "apiv2key" => empty($data["apiv2key"])?"":$data["apiv2key"],
|
|
|
+ "apiclient_key" => empty($data["apiclient_key"])?"":$data["apiclient_key"],
|
|
|
+ "apiclient_cert" => empty($data["apiclient_cert"])?"":$data["apiclient_cert"],
|
|
|
+ "notify_url" => empty($data["notify_url"])?"":$data["notify_url"],
|
|
|
+ ];
|
|
|
+ $this->where("id",1)->update(["wxconfig"=> serialize($save)]);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 分享配置信息
|
|
|
+ * @param type $data
|
|
|
+ */
|
|
|
+ public function saveShareConfig($data){
|
|
|
+ $save=[
|
|
|
+ "img" => empty($data["img"]) ?"":$data["img"],
|
|
|
+ "title" => empty($data["title"])?"":$data["title"],
|
|
|
+ "query" => empty($data["query"])?"":$data["query"],
|
|
|
+ ];
|
|
|
+ $this->where("id",1)->update(["shareconfig"=> serialize($save)]);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取配置详情
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function getDataInfo($code=""){
|
|
|
+ $sys = (new SysModel)->where("id", 1)->find();
|
|
|
+ $data = $sys->toArray();
|
|
|
+ //微信配置
|
|
|
+ if(empty($data["wxconfig"])){
|
|
|
+ $data["wxconfig"]=[
|
|
|
+ "appid"=>"",
|
|
|
+ "secret"=>"",
|
|
|
+ "mchid"=>"",
|
|
|
+ "apiv2key"=>"",
|
|
|
+ "apiclient_key"=>"",
|
|
|
+ "apiclient_cert"=>"",
|
|
|
+ "notify_url"=>""
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $data["wxconfig"] = unserialize($data["wxconfig"]);
|
|
|
+ }
|
|
|
+ //分享配置
|
|
|
+ if(empty($data["shareconfig"])){
|
|
|
+ $data["shareconfig"]=[
|
|
|
+ "img"=>"",
|
|
|
+ "title"=>"",
|
|
|
+ "query"=>"",
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $data["shareconfig"] = unserialize($data["wxconfig"]);
|
|
|
+ }
|
|
|
+ if($code=="weixin"){
|
|
|
+ return $data["wxconfig"];
|
|
|
+ }
|
|
|
+ if($code=="share"){
|
|
|
+ return $data["shareconfig"];
|
|
|
+ }
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
}
|