作者 王晓刚
1 个管道 的构建 通过 耗费 36 秒

分享bug

... ... @@ -430,6 +430,42 @@ class IndexController extends WeChatBaseController
$salesman_id = Db::name('my_user') -> where('id',$teacher_id['pid']) -> find();
$salesman_goods = Db::name('goods') -> where('uid',$salesman_id['uid']) -> where('is_out',1) -> order("sort desc") -> select() -> toArray();
}
$param = $this->request->param();
if(!empty($param['status_id']) && !empty($param['my_user_id'])){
//判断上级权限是否存在
$my_user = Db::name('my_user') -> where('id',$param['my_user_id']) -> find();
if(empty($my_user)){
$this->error('查无此人','','','');
}
if($my_user['status'] != $param['status_id']){
$this->error('分享失效','','','');
}
if($user['status'] == 0){
//判断数据是老师还是业务员
if($param['status_id'] == 2){
//业务员分享 更改用户身份为老师
$my_user_phone = Db::name('my_user') -> where('id',$param['my_user_id']) -> find();
$data_update['status'] = 3;
$data_update['inviter_phone'] = $my_user_phone['phone'];
$data_update['is_pro'] = 1;
$data_update['pid'] = $my_user_phone['id'];
$data_update['bind_time'] = time();
$data_update['bind_status'] = 1;
Db::name('my_user') -> where('uid',$uid) -> update($data_update);
}elseif ($param['status_id'] == 3){
//老师分享 更改用户身份为学生
$my_user_phone = Db::name('my_user') -> where('id',$param['my_user_id']) -> find();
$data_update['status'] = 4;
$data_update['inviter_phone'] = $my_user_phone['phone'];
$data_update['is_pro'] = 0;
$data_update['pid'] = $my_user_phone['id'];
$data_update['bind_time'] = time();
$data_update['bind_status'] = 1;
Db::name('my_user') -> where('uid',$uid) -> update($data_update);
$salesman_id = Db::name('my_user') -> where('id',$my_user_phone['pid']) -> find();
}
}
}
if(!empty($salesman_goods)){
foreach ($salesman_goods as $key => $val){
$price = explode('.',$salesman_goods[$key]['price']);
... ... @@ -447,6 +483,22 @@ class IndexController extends WeChatBaseController
}
}
$this -> assign('goods',$goods);
//分享
$options=config('wechat_config');
$app = new Application($options);
$js = $app->js;
$jssdk=$js->config(array('onMenuShareAppMessage', 'onMenuShareTimeline'), false,false,true);
$this->assign('jssdk',$jssdk);
$arr = [];
if($user['status'] == 3){
$arr['status_id'] = 2;
$arr['my_user_id'] = $user['pid'];
}else if($user['status'] == 4) {
$arr['status_id'] = 3;
$arr['my_user_id'] = $user['pid'];
}
$url = url('portal/index/salesman_goods',$arr,true,true);
$this->assign('url',$url);
return $this -> fetch();
}
... ...
... ... @@ -55,6 +55,41 @@
<!-- 底部更多 -->
<div class="in_what">—— 已经到底了哦 ——</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
wx.config({$jssdk});
wx.ready(function () {
wx.onMenuShareAppMessage({
title: '学考无忧',
desc: "学考无忧",
link: '{$url}',
imgUrl: "http://xkeasy.w.bronet.cn/logo.jpg", // 分享图标
type: 'link', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function (res) {
//分享成功返回信息
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
wx.onMenuShareTimeline({
title: '学考无忧',
desc: "学考无忧",
link: '{$url}',
imgUrl: "http://xkeasy.w.bronet.cn/logo.jpg", // 分享图标
type: 'link', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function (res) {
//分享成功返回信息
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...