推荐用户优化和商品新增海报
parent
152fe30a2e
commit
cbf1e1ed72
|
|
@ -125,6 +125,7 @@ class Goods extends Common
|
|||
'common_app_is_online_service' => (int) MyC('common_app_is_online_service'),
|
||||
'common_app_is_limitedtimediscount' => (int) MyC('common_app_is_limitedtimediscount'),
|
||||
'common_app_is_good_thing' => (int) MyC('common_app_is_good_thing'),
|
||||
'common_app_is_poster_share' => (int) MyC('common_app_is_poster_share'),
|
||||
];
|
||||
|
||||
// 秒杀
|
||||
|
|
@ -279,5 +280,22 @@ class Goods extends Common
|
|||
];
|
||||
return DataReturn('success', 0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品海报
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2019-08-17T21:10:41+0800
|
||||
*/
|
||||
public function Poster()
|
||||
{
|
||||
// 是否开启海报功能
|
||||
if(MyC('common_app_is_poster_share') == 1)
|
||||
{
|
||||
return CallPluginsServiceMethod('distribution', 'PosterGoodsService', 'GoodsCreateMiniWechat', $this->data_post);
|
||||
}
|
||||
return DataReturn('海报功能未启用', -100);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -208,7 +208,7 @@ class User extends Common
|
|||
$result['avatar'] = isset($result['avatarUrl']) ? $result['avatarUrl'] : '';
|
||||
$result['gender'] = empty($result['gender']) ? 0 : ($result['gender'] == 2) ? 1 : 2;
|
||||
$result['openid'] = $result['openId'];
|
||||
$result['referrer']= isset($this->data_post['referrer']) ? intval($this->data_post['referrer']) : 0;
|
||||
$result['referrer']= isset($this->data_post['referrer']) ? $this->data_post['referrer'] : 0;
|
||||
return UserService::AuthUserProgram($result, 'weixin_openid');
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -32,73 +32,21 @@ return array (
|
|||
'log_write' =>
|
||||
array (
|
||||
),
|
||||
'plugins_css' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
1 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_js' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
1 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_service_navigation_header_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
1 => 'app\\plugins\\answers\\Hook',
|
||||
2 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_service_goods_handle_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_service_goods_spec_base' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_base_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_view_home_floor_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_service_users_center_left_menu_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
0 => 'app\\plugins\\distribution\\Hook',
|
||||
),
|
||||
'plugins_service_header_navigation_top_right_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_panel_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_view_buy_goods_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_service_buy_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_view_buy_form_inside' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
),
|
||||
'plugins_service_buy_order_insert_success' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
0 => 'app\\plugins\\distribution\\Hook',
|
||||
),
|
||||
'plugins_service_order_status_change_history_success_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
0 => 'app\\plugins\\distribution\\Hook',
|
||||
),
|
||||
'plugins_service_user_register_end' =>
|
||||
'plugins_service_order_aftersale_audit_handle_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\coupon\\Hook',
|
||||
0 => 'app\\plugins\\distribution\\Hook',
|
||||
),
|
||||
);
|
||||
?>
|
||||
|
|
@ -125,27 +125,53 @@ class Wechat
|
|||
*/
|
||||
public function MiniQrCodeCreate($params)
|
||||
{
|
||||
// 参数校验
|
||||
if(empty($params['path']))
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'page',
|
||||
'error_msg' => 'page地址不能为空',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'checked_data' => '1,32',
|
||||
'key_name' => 'scene',
|
||||
'error_msg' => 'scene参数 1~32 个字符之间',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return '页面地址不能为空';
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
$params['width'] = empty($params['width']) ? 1000 : intval($params['width']);
|
||||
|
||||
// 获取access_token
|
||||
$access_token = $this->GetMiniAccessToken();
|
||||
if($access_token === false)
|
||||
{
|
||||
return '';
|
||||
return DataReturn('access_token获取失败', -1);
|
||||
}
|
||||
|
||||
// 网络请求
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token='.$access_token;
|
||||
// 获取二维码
|
||||
$url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token='.$access_token;
|
||||
$data = [
|
||||
'path' => $params['path'],
|
||||
'width' => $params['width'],
|
||||
'page' => $params['page'],
|
||||
'scene' => $params['scene'],
|
||||
'width' => empty($params['width']) ? 1000 : intval($params['width']),
|
||||
];
|
||||
return $this->HttpRequestPost($url, json_encode($data), false);
|
||||
$res = $this->HttpRequestPost($url, json_encode($data), false);
|
||||
if(!empty($res))
|
||||
{
|
||||
if(stripos($res, 'errcode') === false)
|
||||
{
|
||||
return DataReturn('获取成功', 0, $res);
|
||||
}
|
||||
$res = json_decode($res, true);
|
||||
$msg = isset($res['errmsg']) ? $res['errmsg'] : '获取二维码失败';
|
||||
} else {
|
||||
$msg = '获取二维码失败';
|
||||
}
|
||||
return DataReturn($msg, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ App({
|
|||
// 用户地址选择缓存key
|
||||
cache_buy_user_address_select_key: "cache_buy_user_address_select_key",
|
||||
|
||||
// 用户传入信息缓存key
|
||||
// 启动参数缓存key
|
||||
cache_launch_info_key: "cache_shop_launch_info_key",
|
||||
|
||||
// 默认用户头像
|
||||
|
|
@ -61,7 +61,7 @@ App({
|
|||
|
||||
// 请求地址
|
||||
request_url: "{{request_url}}",
|
||||
// request_url: 'http://tp5-dev.com/',
|
||||
request_url: 'http://tp5-dev.com/',
|
||||
// request_url: 'https://test.shopxo.net/',
|
||||
|
||||
// 基础信息
|
||||
|
|
@ -73,60 +73,31 @@ App({
|
|||
* 小程序初始化
|
||||
*/
|
||||
onLaunch(options) {
|
||||
// 启动参数处理
|
||||
options = this.launch_params_handle(options);
|
||||
|
||||
// 设置设备信息
|
||||
this.set_system_info();
|
||||
|
||||
// 启动query参数处理
|
||||
this.startup_query(options);
|
||||
// 缓存启动参数
|
||||
wx.setStorage({
|
||||
key: this.data.cache_launch_info_key,
|
||||
data: options
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 启动query参数处理
|
||||
* 启动参数处理
|
||||
*/
|
||||
startup_query(params) {
|
||||
// 没有启动参数则返回
|
||||
if ((params || null) == null) {
|
||||
return false;
|
||||
launch_params_handle(params) {
|
||||
// 启动参数处理
|
||||
if ((params.query || null) != null) {
|
||||
params = params.query;
|
||||
}
|
||||
|
||||
// 启动处理类型
|
||||
var type = params.type || null;
|
||||
switch (type) {
|
||||
// type=page
|
||||
case "page":
|
||||
// 页面
|
||||
var page = params.page || null;
|
||||
|
||||
// 参数名
|
||||
var params_field = params.params_field || null;
|
||||
|
||||
// 参数值
|
||||
var params_value = params.params_value || null;
|
||||
|
||||
// 页面跳转
|
||||
if (page != null) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/" + page + "/" + page + "?" + params_field + "=" + params_value
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
// type=view
|
||||
case "view":
|
||||
var url = params.url || null;
|
||||
|
||||
// 页面跳转
|
||||
if (url != null) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/web-view/web-view?url=' + url
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
// 默认
|
||||
default:
|
||||
break;
|
||||
if ((params.scene || null) != null) {
|
||||
params = this.url_params_to_json(decodeURIComponent(params.scene));
|
||||
}
|
||||
return params;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -266,8 +237,8 @@ App({
|
|||
get_user_login_info(object, method, openid, auth_data) {
|
||||
// 邀请人参数
|
||||
var params = wx.getStorageSync(this.data.cache_launch_info_key) || null;
|
||||
var referrer = (params == null) ? 0 : (params.data.referrer || 0);
|
||||
|
||||
var referrer = (params == null) ? 0 : (params.referrer || 0);
|
||||
console.log(params)
|
||||
// 远程解密数据
|
||||
var $this = this;
|
||||
wx.request({
|
||||
|
|
@ -518,6 +489,22 @@ App({
|
|||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* url参数转json对象
|
||||
*/
|
||||
url_params_to_json(url_params) {
|
||||
var json = new Object();
|
||||
if ((url_params || null) != null)
|
||||
{
|
||||
var arr = url_params.split('&');
|
||||
for(var i = 0; i<arr.length; i++) {
|
||||
var temp = arr[i].split('=');
|
||||
json[temp[0]] = temp[1]
|
||||
}
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"pages": [
|
||||
"pages": ["pages/goods-detail/goods-detail",
|
||||
"pages/index/index",
|
||||
"pages/goods-category/goods-category",
|
||||
"pages/cart/cart",
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
"pages/login/login",
|
||||
"pages/paytips/paytips",
|
||||
"pages/goods-search/goods-search",
|
||||
"pages/goods-detail/goods-detail",
|
||||
|
||||
"pages/goods-comment/goods-comment",
|
||||
"pages/goods-attribute/goods-attribute",
|
||||
"pages/buy/buy",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view class="item bg-white spacing-mb" wx:if="{{data_list.length > 0}}" wx:for="{{data_list}}">
|
||||
<view class="base">
|
||||
<view class="oh">
|
||||
<image class="avatar fl" src="{{item.avatar}}" mode="widthFix" data-index="{{index}}" onError="user_avatar_error" />
|
||||
<image class="avatar fl" src="{{item.avatar}}" mode="widthFix" data-index="{{index}}" binderror="user_avatar_error" />
|
||||
<view class="desc fr tl">{{item.content}}</view>
|
||||
</view>
|
||||
<view class="cr-888 tr">{{item.add_time}}</view>
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ Page({
|
|||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 启动参数处理
|
||||
params = app.launch_params_handle(params);
|
||||
|
||||
// 参数赋值,初始化
|
||||
//params['goods_id']=2;
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
|
|
@ -730,6 +734,42 @@ Page({
|
|||
}
|
||||
},
|
||||
|
||||
// 商品海报分享
|
||||
poster_event() {
|
||||
var user = app.get_user_cache_info(this, 'poster_event');
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
wx.showLoading({ title: '生成中...' });
|
||||
wx.request({
|
||||
url: app.get_request_url('poster', 'goods'),
|
||||
method: 'POST',
|
||||
data: { "goods_id": this.data.goods.id },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
wx.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
console.log(res.data);
|
||||
wx.previewImage({
|
||||
current: res.data.data,
|
||||
urls: [res.data.data]
|
||||
});
|
||||
} else {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@
|
|||
<text class="cr-888 single-text">一键分享给好友、群聊</text>
|
||||
</button>
|
||||
</view>
|
||||
<view wx:if="{{common_app_is_poster_share == 1}}" class="share-items oh">
|
||||
<view wx:if="{{common_app_is_poster_share == 1}}" class="share-items oh" bindtap="poster_event">
|
||||
<image src="/images/share-friend-icon.png" mode="scaleToFill" />
|
||||
<text class="cr-888 single-text">生成海报,分享到朋友圈、好友及群聊</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!-- 头部 -->
|
||||
<view class="head-box bg-main">
|
||||
<view class="head-item oh tc">
|
||||
<image bindtap="preview_event" onError="user_avatar_error" class="avatar" src="{{avatar}}" mode="widthFix" />
|
||||
<image bindtap="preview_event" binderror="user_avatar_error" class="avatar" src="{{avatar}}" mode="widthFix" />
|
||||
<text class="item-name dis-block cr-fff">{{nickname}}</text>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue