<view bindtap="get_share_img" class="service-item">
<text class="iconfont icon-pengyouquan service-icon"></text> –>
<view class="cube-text">
<text>海报</text>
</view>
</view>
get_share_img: function() {
if (wx.showLoading(), "" != this.data.shareImgUrl) wx.hideLoading(), this.setData({
hideModal: !1,
is_share_html: !0
}); else {
var t = wx.getStorageSync("token"), a = wx.getStorageSync("community"), e = this.data.goods_id, o = a.communityId;
app.util.request({
url: "entry/wxapp/index",
data: {
controller: "goods.get_user_goods_qrcode",
token: t,
community_id: o,
goods_id: e
},
dataType: "json",
success: function(t) {
if (0 == t.data.code) {
wx.hideLoading();
var a = t.data.image_path;
wx.previewImage({
current: a,
urls: [a]
});
}
}
});
}
}
public function get_user_goods_qrcode()
{
global $_W;
global $_GPC;
$id = $_GPC['goods_id'];
$community_id = $_GPC['community_id'];
$token = $_GPC['token'];
$token_param = array();
$token_param[':uniacid'] = $_W['uniacid'];
$token_param[':token'] = $token;
$weprogram_token = pdo_fetch("select member_id from ".tablename('lionfish_comshop_weprogram_token')." where uniacid=:uniacid and token=:token limit 1", $token_param);
$member_id = $weprogram_token['member_id'];
$goods_share_image = pdo_fetch("select * from ".tablename('lionfish_comshop_goods_share_image')." where uniacid=:uniacid and member_id=:member_id and goods_id=:goods_id ",
array(":uniacid" => $_W['uniacid'], ":member_id" => $member_id, ":goods_id" => $id ));
if( !empty($goods_share_image) && false)
{
$result = array('code' => 0, 'image_path' => $goods_share_image['image_path']);
echo json_encode($result);
die();
}else {
if( !empty($goods_share_image['image_path']) )
{
$goods_share_image['image_path'] = str_replace($_W['attachurl'], '' , $goods_share_image['image_path']);
$goods_share_image['image_path'] = str_replace($_W['attachurl_local'], '' , $goods_share_image['image_path']);
@unlink(ATTACHMENT_ROOT.$goods_share_image['image_path']);
}
$member_info = pdo_fetch("select avatar,username,wepro_qrcode from ".tablename('lionfish_comshop_member')." where member_id =:member_id and uniacid=:uniacid ",
array(':member_id' => $member_id,':uniacid' => $_W['uniacid'] ));
$goods_model = load_model_class('pingoods');
if( !empty($member_info['wepro_qrcode']) && false)
{
$wepro_qrcode = $member_info['wepro_qrcode'];
}else{
$wepro_qrcode = $goods_model->get_user_avatar($member_info['avatar'], $member_id);
}
$goods_description = pdo_fetch("select wepro_qrcode_image from ".tablename('lionfish_comshop_good_common')." where uniacid=:uniacid and goods_id=:goods_id ",array(':uniacid' => $_W['uniacid'], ':goods_id' => $id));
if( empty($goods_description['wepro_qrcode_image']) || true)
{
$goods_model->get_weshare_image($id);
$goods_description = pdo_fetch("select wepro_qrcode_image from ".tablename('lionfish_comshop_good_common')." where uniacid=:uniacid and goods_id=:goods_id ",
array(':uniacid' => $_W['uniacid'], ':goods_id' => $id));
}
$rocede_path = $goods_model->_get_goods_user_wxqrcode($id,$member_id,$community_id);
$res = $goods_model->_get_compare_qrcode_bgimg($goods_description['wepro_qrcode_image'], $rocede_path,$wepro_qrcode,$member_info['username']);
$data = array();
$data['member_id'] = $member_id;
$data['goods_id'] = $id;
$data['uniacid'] = $_W['uniacid'];
$data['image_path'] = $_W['attachurl']. $res['full_path'];
if (!empty($_W['setting']['remote']['type']))
{
$data['image_path'] = $_W['attachurl_local']. $res['full_path'];
}
$data['image_path'] = str_replace('http://','https://', $data['image_path']);
$data['addtime'] = time();
//ims_
pdo_insert('lionfish_comshop_goods_share_image', $data);
$result = array('code' => 0, 'image_path' => $data['image_path'] );
echo json_encode($result);
die();
}
}