ExpertController.php
4.5 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
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
/**
* Created by PhpStorm.
* auther: sgj
* Date: 2019/1/6
* Time: 14:45
*/
namespace app\user\controller;
use app\user\model\InquiryModel;
use app\user\model\TransferModel;
use app\user\model\UserModel;
use cmf\controller\WeChatBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;
class ExpertController extends WeChatBaseController
{
public function inquiryAnswer(){
$where=[];
$userId=cmf_get_current_user_id();
$model=new InquiryModel();
//todo 释放专家ID
//$where['expert_id']=$userId;
$count0=$model->where($where)->where('status',0)->count('id');
$count1=$model->where($where)->where(['status'=>['neq',0]])->count('id');
$this->assign('count0',$count0);
$this->assign('count1',$count1);
$list0=$model->where($where)->where('status',0)->select()->toArray();
$list1=$model->where($where)->where(['status'=>['neq',0]])->select()->toArray();
$this->assign('list0',$list0);
$this->assign('list1',$list1);
return $this->fetch();
}
public function transferAnswer(){
$where=[];
$userId=cmf_get_current_user_id();
$model=new TransferModel();
//todo 释放专家ID
//$where['expert_id']=$userId;
$count0=$model->where($where)->where('status',0)->count('id');
$count1=$model->where($where)->where(['status'=>['neq',0]])->count('id');
$this->assign('count0',$count0);
$this->assign('count1',$count1);
$list0=$model->where($where)->where('status',0)->select()->toArray();
$list1=$model->where($where)->where(['status'=>['neq',0]])->select()->toArray();
$this->assign('list0',$list0);
$this->assign('list1',$list1);
return $this->fetch();
}
/**
* 获取进修提交列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function engageAnswer(){
$user_id=cmf_get_current_user_id();
$map['user_id']=$user_id;
$map['state']='0';
/*未处理信息*/
$undo=db('engage')->where($map)->select()->toArray();
$map['state']=['in','1,2'];
$redo=db('engage')->where($map)->select()->toArray();
$this->assign('undo',$undo);
$this->assign('redo',$redo);
return $this->fetch();
}
/**
* 提交信息细节
*/
public function engageDetail(){
$id=input('id');
$info=db('engage')->where('id',$id)->find();
if (empty($info)){
$this->error('信息错误');
}
$User=new UserModel();
$user=$User->getUser($info['user_id'])->toArray();
$this->assign('user',$user['0']);
$this->assign('info',$info);
return $this->fetch();
}
public function inquiryDetail(){
$config=config('wechat_config');
$Wechat=new Application($config);
$js = $Wechat->js;
$api[]='startRecord';
$api[]='stopRecord';
$api[]='onVoiceRecordEnd';
$api[]='playVoice';
$api[]='pauseVoice';
$api[]='stopVoice';
$api[]='onVoicePlayEnd';
$api[]='uploadVoice';
$api[]='downloadVoice';
$api[]='chooseImage';
$api[]='previewImage';
$api[]='uploadImage';
$api[]='downloadImage';
$api[]='translateVoice';
$sdk=$js->config($api, true);
$this->assign('sdk',$sdk);
$id=$this->request->param('id',0,'intval');
$model=new InquiryModel();
$info=$model->getInfo($id);
$this->assign('info',$info);
return $this->fetch();
}
public function transferDetail(){
$config=config('wechat_config');
$Wechat=new Application($config);
$js = $Wechat->js;
$api[]='startRecord';
$api[]='stopRecord';
$api[]='onVoiceRecordEnd';
$api[]='playVoice';
$api[]='pauseVoice';
$api[]='stopVoice';
$api[]='onVoicePlayEnd';
$api[]='uploadVoice';
$api[]='downloadVoice';
$api[]='chooseImage';
$api[]='previewImage';
$api[]='uploadImage';
$api[]='downloadImage';
$api[]='translateVoice';
$sdk=$js->config($api, true);
$this->assign('sdk',$sdk);
$id=$this->request->param('id',0,'intval');
$model=new TransferModel();
$info=$model->getInfo($id);
$this->assign('info',$info);
return $this->fetch();
}
}