|
@@ -37,10 +37,101 @@ class Api extends Core
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
- # 获取分享的链接
|
|
|
+ public function qrcode($url, $content_id)
|
|
|
+ {
|
|
|
+ $file = 'shareDv_' . $this->uid . '_' . $this->id . '_' . $content_id;
|
|
|
+ $file = Dever::load('qrcode/api')->qrcode($url, $file, $this->user['avatar']);
|
|
|
+
|
|
|
+ return $file['url'];
|
|
|
+ }
|
|
|
+
|
|
|
+ # 获取分享的内容
|
|
|
public function getShare()
|
|
|
{
|
|
|
-
|
|
|
+ $url = Dever::input('url');
|
|
|
+ $type = Dever::input('type');
|
|
|
+ $index = Dever::input('index');
|
|
|
+ $content_id = Dever::input('content_id');
|
|
|
+ $data = array();
|
|
|
+ $info = Dever::db('collection/info')->one($this->id);
|
|
|
+ $data['info'] = $data['pic'] = $data['text'] = $data['share'] = array();
|
|
|
+ $data['info']['id'] = $content_id;
|
|
|
+ $data['info']['platform_name'] = $info['name'];
|
|
|
+ $data['info']['qrcode'] = $data['info']['name'] = $data['info']['price'] = $data['info']['s_price'] = '';
|
|
|
+
|
|
|
+ $code = $this->getCode($this->id, $this->parent_page_id, $this->page_id, $index, $this->times, $this->uid);
|
|
|
+ $url .= '?code=' . $code;
|
|
|
+
|
|
|
+ $data['info']['qrcode'] = $this->qrcode($url, $content_id);
|
|
|
+
|
|
|
+ $background = array
|
|
|
+ (
|
|
|
+ '#ffaa00',
|
|
|
+ '#bababa'
|
|
|
+ );
|
|
|
+ if ($type == -1) {
|
|
|
+ $page = Dever::db('collection/page')->one($content_id);
|
|
|
+ $data['info']['name'] = $page['name'];
|
|
|
+ $data['pic'] = explode(',', $page['pic']);
|
|
|
+ $data['text'] = array(
|
|
|
+ array
|
|
|
+ (
|
|
|
+ 'background' => $background[0],
|
|
|
+ 'content' => $page['desc'],
|
|
|
+ )
|
|
|
+ );
|
|
|
+ $data['share'] = array
|
|
|
+ (
|
|
|
+ 'title' => $page['name'],
|
|
|
+ 'content' => $page['desc'],
|
|
|
+ 'pic' => $page['pic'],
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ $content = Dever::db('collection/content')->one($content_id);
|
|
|
+ $data['info']['name'] = $content['share_title'] ? $content['share_title'] : $content['name'];
|
|
|
+ if ($content['share_pic']) {
|
|
|
+ $data['pic'] = explode(',', $content['share_pic']);
|
|
|
+ } else {
|
|
|
+ $data['pic'] = explode(',', $content['pic']);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($content['type'] == 70) {
|
|
|
+ $content['data'] = Dever::db('content/product')->one(array('content_id' => $content['id'], 'info_id' => $content['info_id']));
|
|
|
+
|
|
|
+ if (isset($content['data']['goods_id']) && $content['data']['goods_id'] > 0) {
|
|
|
+ $goods = Dever::load('goods/lib/info')->getInfo($content['data']['goods_id']);
|
|
|
+ if ($goods && isset($goods['price']['min']['price'])) {
|
|
|
+ $data['info']['price'] = '¥' . $goods['price']['min']['price'];
|
|
|
+ $data['info']['s_price'] = '¥' . $goods['price']['min']['s_price'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $text = Dever::array_decode($content['copy_text']);
|
|
|
+ $i = 0;
|
|
|
+ foreach ($text as $k => $v) {
|
|
|
+ if ($v['name']) {
|
|
|
+ $back = $background[1];
|
|
|
+ if ($i == 0) {
|
|
|
+ $back = $background[0];
|
|
|
+ }
|
|
|
+ $data['text'][$i] = array
|
|
|
+ (
|
|
|
+ 'background' => $back,
|
|
|
+ 'content' => $v['name'],
|
|
|
+ );
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data['share'] = array
|
|
|
+ (
|
|
|
+ 'title' => $data['info']['name'],
|
|
|
+ 'content' => $content['share_content'],
|
|
|
+ 'pic' => $data['pic'][0],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
}
|
|
|
|
|
|
# 获取合集内容
|