|
|
@@ -231,4 +231,45 @@ class Main extends Core
|
|
|
}
|
|
|
return $info;
|
|
|
}
|
|
|
+
|
|
|
+ # 获取分享信息
|
|
|
+ public function share()
|
|
|
+ {
|
|
|
+ $sales_type = Dever::input('sales_type');
|
|
|
+ $sales_id = Dever::input('sales_id');
|
|
|
+ $type = Dever::input('type');
|
|
|
+ if (!$type) {
|
|
|
+ $type = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$sales_type || !$sales_id) {
|
|
|
+ $sales_type = $this->place->info['sales_type'];
|
|
|
+ $sales_id = $this->place->info['sales_id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$this->place->uid) {
|
|
|
+ $this->place->uid = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = Dever::load(\Place\Lib\Info::class)->share($this->place->info['id'], $sales_type, $sales_id, $this->place->uid, false, $type, false);
|
|
|
+ $share['path'] = $result['path'];
|
|
|
+ if ($type > 0) {
|
|
|
+ # 资源信息
|
|
|
+ $source = Dever::db('source/info')->find(['id' => $type]);
|
|
|
+ if (!$source['share_pic'] && $source['pic']) {
|
|
|
+ $source['pic'] = explode(',', $source['pic']);
|
|
|
+ $share['pic'] = $source['pic'][0];
|
|
|
+ } else {
|
|
|
+ $share['pic'] = $source['share_pic'];
|
|
|
+ }
|
|
|
+ $share['name'] = $source['share_name'] ?: $source['name'];
|
|
|
+ $share['desc'] = $source['share_desc'] ?: $source['info'];
|
|
|
+ } else {
|
|
|
+ $share['name'] = $this->place->info['share_name'] ?: $this->place->info['name'];
|
|
|
+ $share['pic'] = $this->place->info['share_pic'] ?: $this->place->info['logo'];
|
|
|
+ $share['desc'] = $this->place->info['share_desc'] ?: $this->place->info['info'];
|
|
|
+ }
|
|
|
+ $data['share'] = $share;
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
}
|