PersonalcenterController.php
4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
namespace app\portal\controller;
use cmf\controller\WeChatBaseController;
use think\Db;
class PersonalcenterController extends WeChatBaseController{
/**
* 显示个人中心页
*/
public function personal_center(){
$uid = cmf_get_current_user_id();
$my_user_status = Db::name('my_user') -> where('uid',$uid) -> find();
$weixin = Db::name('user') -> where('id',$uid) -> find();
$this -> assign('weixin',$weixin);
if($my_user_status['status'] == 0 || $my_user_status['status'] == 1 || $my_user_status['status'] == 3 || $my_user_status['status'] == 4 || $my_user_status['status'] == 5 || $my_user_status['status'] == 6){
if($my_user_status['status'] == 0){
$this -> assign('status',0);
}
if($my_user_status['status'] == 1 || $my_user_status['status'] == 5 || $my_user_status['status'] == 6){
$this -> assign('status',1);
}
if($my_user_status['status'] == 3){
$this -> assign('status',3);
}
if($my_user_status['status'] == 4){
$this -> assign('status',4);
}
return $this -> fetch();
}
//业务员个人中心页
if($my_user_status['status'] == 2){
$this -> assign('weixin',$weixin);
return $this -> fetch('personalcenter/salesman_center');
}
}
/**
* 完善个人信息页
*/
public function perfect_information(){
$uid = cmf_get_current_user_id();
$my_user_status = Db::name('my_user') -> where('uid',$uid) -> find();
if($my_user_status['status'] == 2){
$this -> redirect('Personalcenter/personal_center');
}else{
if($my_user_status['status'] == 1){
$this -> assign('status',1);
}
if($my_user_status['status'] == 5){
$this -> assign('status',5);
}
if($my_user_status['status'] == 6){
$this -> assign('status',6);
}
$weixin = Db::name('user') -> where('id',$uid) -> find();
$this -> assign('weixin',$weixin);
return $this -> fetch();
}
}
/**
* 我的收藏页
*/
public function personal_collect(){
$uid = cmf_get_current_user_id();
$data = Db::name('collect') -> where("uid =".$uid) -> select();
$data_count = count($data);
if(!empty($data)){
foreach($data as $key => $val){
$data_goods[] = Db::name('goods') -> where("id =".$val['goods_id']) -> find();
}
foreach ($data_goods as $key => $val){
$price = explode('.',$val['price']);
$pricing = explode('.',$val['pricing']);
$data_goods[$key]['price0'] = $price[0];
$data_goods[$key]['price1'] = $price[1];
$data_goods[$key]['pricing0'] = $pricing[0];
$data_goods[$key]['pricing1'] = $pricing[1];
}
}
$this -> assign('data_count',$data_count);
$this -> assign('data_goods',$data_goods);
return $this -> fetch();
}
/**
* 填写个人信息页
*/
public function add_information(){
return $this -> fetch();
}
/**
* 浏览记录
*/
public function browsing_history(){
$uid = cmf_get_current_user_id();
$data = Db::name('browsing_history') -> where("uid =".$uid) -> select();
foreach($data as $key => $val){
$data_goods[] = Db::name('goods') -> where('id',$val['goods_id']) -> find();
}
dump($data_goods);die;
return $this -> fetch();
}
}