作者 何书鹏
1 个管道 的构建 失败 耗费 6 秒

接口获取资源地址修改

@@ -150,9 +150,9 @@ class Common extends Api @@ -150,9 +150,9 @@ class Common extends Api
150 $this->error("上传失败"); 150 $this->error("上传失败");
151 } 151 }
152 152
153 - $qiniu = get_addon_config('qiniu')['cdnurl']; 153 + //$qiniu = get_addon_config('qiniu')['cdnurl'];
154 $url['yuan'] = '/' . $object; 154 $url['yuan'] = '/' . $object;
155 - $url['dai'] = $qiniu.'/' . $object; 155 + $url['dai'] = cdnurl('/' . $object,true);
156 156
157 //上传成功后将存储变更为qiniu 157 //上传成功后将存储变更为qiniu
158 $attachment->storage = 'qiniu'; 158 $attachment->storage = 'qiniu';
@@ -123,7 +123,6 @@ class Exam extends Api @@ -123,7 +123,6 @@ class Exam extends Api
123 public function question() 123 public function question()
124 { 124 {
125 $user_id = $this->auth->id; 125 $user_id = $this->auth->id;
126 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
127 $study_id = $this->request->param('study_id'); 126 $study_id = $this->request->param('study_id');
128 if(empty($study_id)){ 127 if(empty($study_id)){
129 $this->error('缺少必要参数'); 128 $this->error('缺少必要参数');
@@ -227,7 +226,7 @@ class Exam extends Api @@ -227,7 +226,7 @@ class Exam extends Api
227 $v['option'] = json_decode($v['option'],true); 226 $v['option'] = json_decode($v['option'],true);
228 if($v['type'] == 2){ 227 if($v['type'] == 2){
229 foreach ($v['option'] as &$val){ 228 foreach ($v['option'] as &$val){
230 - $val['gender'] = $qiniu.$val['gender']; 229 + $val['gender'] = cdnurl($val['gender'],true);
231 } 230 }
232 } 231 }
233 } 232 }
@@ -252,7 +251,7 @@ class Exam extends Api @@ -252,7 +251,7 @@ class Exam extends Api
252 $v['option'] = json_decode($v['option'],true); 251 $v['option'] = json_decode($v['option'],true);
253 if($v['type'] == 2){ 252 if($v['type'] == 2){
254 foreach ($v['option'] as &$val){ 253 foreach ($v['option'] as &$val){
255 - $val['gender'] = $qiniu.$val['gender']; 254 + $val['gender'] = cdnurl($val['gender'],true);
256 } 255 }
257 } 256 }
258 } 257 }
@@ -31,9 +31,8 @@ class Index extends Api @@ -31,9 +31,8 @@ class Index extends Api
31 */ 31 */
32 public function index() 32 public function index()
33 { 33 {
34 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
35 $data = Db::name('image')->where('id',1)->field('id,image')->find(); 34 $data = Db::name('image')->where('id',1)->field('id,image')->find();
36 - $data['image'] = $qiniu.$data['image']; 35 + $data['image'] = cdnurl($data['image'],true);
37 $this->success('success',$data); 36 $this->success('success',$data);
38 } 37 }
39 38
@@ -57,14 +56,13 @@ class Index extends Api @@ -57,14 +56,13 @@ class Index extends Api
57 */ 56 */
58 public function banner() 57 public function banner()
59 { 58 {
60 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
61 $data = Db::name('banner') 59 $data = Db::name('banner')
62 ->field('id,image,title,url') 60 ->field('id,image,title,url')
63 ->order('id desc') 61 ->order('id desc')
64 ->limit(5) 62 ->limit(5)
65 ->select(); 63 ->select();
66 foreach ($data as &$v){ 64 foreach ($data as &$v){
67 - $v['image'] = $qiniu.$v['image']; 65 + $v['image'] = cdnurl($v['image'],true);
68 } 66 }
69 $this->success('success',$data); 67 $this->success('success',$data);
70 } 68 }
@@ -87,12 +85,11 @@ class Index extends Api @@ -87,12 +85,11 @@ class Index extends Api
87 */ 85 */
88 public function about() 86 public function about()
89 { 87 {
90 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
91 $data = Db::name('about') 88 $data = Db::name('about')
92 ->where('id',1) 89 ->where('id',1)
93 ->field('id,image,content') 90 ->field('id,image,content')
94 ->find(); 91 ->find();
95 - $data['image'] = $qiniu.$data['image']; 92 + $data['image'] = cdnurl($data['image'],true);
96 $this->success('success',$data); 93 $this->success('success',$data);
97 } 94 }
98 95
@@ -119,13 +116,12 @@ class Index extends Api @@ -119,13 +116,12 @@ class Index extends Api
119 */ 116 */
120 public function kefu() 117 public function kefu()
121 { 118 {
122 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
123 $data = Db::name('kefu') 119 $data = Db::name('kefu')
124 ->where('id',1) 120 ->where('id',1)
125 ->field('createtime',true) 121 ->field('createtime',true)
126 ->find(); 122 ->find();
127 - $data['downloadimage'] = $qiniu.$data['downloadimage'];  
128 - $data['image'] = $qiniu.$data['image']; 123 + $data['downloadimage'] = cdnurl($data['downloadimage'],true);
  124 + $data['image'] = cdnurl($data['image'],true);
129 $this->success('success',$data); 125 $this->success('success',$data);
130 } 126 }
131 127
@@ -156,13 +152,12 @@ class Index extends Api @@ -156,13 +152,12 @@ class Index extends Api
156 */ 152 */
157 public function teacher() 153 public function teacher()
158 { 154 {
159 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
160 $data = Db::name('teacher') 155 $data = Db::name('teacher')
161 ->field('updatetime',true) 156 ->field('updatetime',true)
162 ->order('createtime desc') 157 ->order('createtime desc')
163 ->select(); 158 ->select();
164 foreach ($data as &$v){ 159 foreach ($data as &$v){
165 - $v['image'] = $qiniu.$v['image']; 160 + $v['image'] = cdnurl($v['image'],true);
166 $v['age_num'] = $v['age_num'].'年'; 161 $v['age_num'] = $v['age_num'].'年';
167 $v['order_num'] = $v['order_num'].'单'; 162 $v['order_num'] = $v['order_num'].'单';
168 $v['createtime'] = datetime('Y-m-d H:i:s',$v['createtime']); 163 $v['createtime'] = datetime('Y-m-d H:i:s',$v['createtime']);
@@ -197,7 +192,6 @@ class Index extends Api @@ -197,7 +192,6 @@ class Index extends Api
197 */ 192 */
198 public function teacher_detail() 193 public function teacher_detail()
199 { 194 {
200 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
201 $teacher_id = $this->request->param('teacher_id'); 195 $teacher_id = $this->request->param('teacher_id');
202 if(empty($teacher_id)){ 196 if(empty($teacher_id)){
203 $this->error('缺少必要参数'); 197 $this->error('缺少必要参数');
@@ -205,7 +199,7 @@ class Index extends Api @@ -205,7 +199,7 @@ class Index extends Api
205 $data = Db::name('teacher')->field('updatetime',true)->where('id',$teacher_id)->find(); 199 $data = Db::name('teacher')->field('updatetime',true)->where('id',$teacher_id)->find();
206 $data['age_num'] = $data['age_num'].'年'; 200 $data['age_num'] = $data['age_num'].'年';
207 $data['order_num'] = $data['order_num'].'单'; 201 $data['order_num'] = $data['order_num'].'单';
208 - $data['image'] = $qiniu.$data['image']; 202 + $data['image'] = cdnurl($data['image'],true);
209 $data['createtime'] = date('Y-m-d H:i:s',$data['createtime']); 203 $data['createtime'] = date('Y-m-d H:i:s',$data['createtime']);
210 $this->success('success',$data); 204 $this->success('success',$data);
211 } 205 }
@@ -231,13 +225,12 @@ class Index extends Api @@ -231,13 +225,12 @@ class Index extends Api
231 */ 225 */
232 public function center() 226 public function center()
233 { 227 {
234 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
235 $data = Db::name('center') 228 $data = Db::name('center')
236 ->field('updatetime',true) 229 ->field('updatetime',true)
237 ->order('id desc') 230 ->order('id desc')
238 ->select(); 231 ->select();
239 foreach ($data as &$v){ 232 foreach ($data as &$v){
240 - $v['image'] = $qiniu.$v['image']; 233 + $v['image'] = cdnurl($v['image'],true);
241 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); 234 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
242 } 235 }
243 $this->success('success',$data); 236 $this->success('success',$data);
@@ -101,7 +101,6 @@ class Lists extends Api @@ -101,7 +101,6 @@ class Lists extends Api
101 */ 101 */
102 public function sou() 102 public function sou()
103 { 103 {
104 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
105 $user_id = $this->auth->id; 104 $user_id = $this->auth->id;
106 $page = $this->request->param('page', 1, 'intval'); 105 $page = $this->request->param('page', 1, 'intval');
107 $pageNum = $this->request->param('pageNum', 10, 'intval'); 106 $pageNum = $this->request->param('pageNum', 10, 'intval');
@@ -146,7 +145,7 @@ class Lists extends Api @@ -146,7 +145,7 @@ class Lists extends Api
146 $video_avinfo = json_decode(file_get_contents(cdnurl($v['video_file'], true) . '?avinfo'), true); // 获取视频元信息 145 $video_avinfo = json_decode(file_get_contents(cdnurl($v['video_file'], true) . '?avinfo'), true); // 获取视频元信息
147 $duration = ceil($video_avinfo['format']['duration']); 146 $duration = ceil($video_avinfo['format']['duration']);
148 $v['duration'] = gmdate('H:i:s',$duration); 147 $v['duration'] = gmdate('H:i:s',$duration);
149 - $v['image'] = $qiniu.$v['image']; 148 + $v['image'] = cdnurl($v['image'],true);
150 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); 149 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
151 } 150 }
152 $this->success('success',$data); 151 $this->success('success',$data);
@@ -169,7 +168,7 @@ class Lists extends Api @@ -169,7 +168,7 @@ class Lists extends Api
169 ->order('id desc') 168 ->order('id desc')
170 ->select(); 169 ->select();
171 foreach ($data['info'] as &$v){ 170 foreach ($data['info'] as &$v){
172 - $v['video_file'] = $qiniu.$v['video_file']; 171 + $v['video_file'] = cdnurl($v['video_file'],true);
173 $video_info = json_decode(file_get_contents($v['video_file'] . '?avinfo'), true); 172 $video_info = json_decode(file_get_contents($v['video_file'] . '?avinfo'), true);
174 $v['video_image'] = $this->get_video_first_image( $v['video_file'], $video_info); 173 $v['video_image'] = $this->get_video_first_image( $v['video_file'], $video_info);
175 } 174 }
@@ -329,7 +328,6 @@ class Lists extends Api @@ -329,7 +328,6 @@ class Lists extends Api
329 */ 328 */
330 public function index_info() 329 public function index_info()
331 { 330 {
332 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
333 $id = $this->request->param('id'); 331 $id = $this->request->param('id');
334 if(empty($id)){ 332 if(empty($id)){
335 $this->error('缺少必要参数'); 333 $this->error('缺少必要参数');
@@ -358,7 +356,7 @@ class Lists extends Api @@ -358,7 +356,7 @@ class Lists extends Api
358 foreach ($file_list as &$v){ 356 foreach ($file_list as &$v){
359 if(!empty($v['file'])){ 357 if(!empty($v['file'])){
360 $base_url = $v['file']; 358 $base_url = $v['file'];
361 - $qiniu_url = $qiniu.$v['file']; 359 + $qiniu_url = cdnurl($v['file'],true);
362 $a = file_get_contents($qiniu_url); 360 $a = file_get_contents($qiniu_url);
363 $path = './uploads/'.explode('/',$base_url)[2].'/'; 361 $path = './uploads/'.explode('/',$base_url)[2].'/';
364 if(!file_exists($path)) { 362 if(!file_exists($path)) {
@@ -401,7 +399,6 @@ class Lists extends Api @@ -401,7 +399,6 @@ class Lists extends Api
401 */ 399 */
402 public function policy_info() 400 public function policy_info()
403 { 401 {
404 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
405 $id = $this->request->param('id'); 402 $id = $this->request->param('id');
406 if(empty($id)){ 403 if(empty($id)){
407 $this->error('缺少必要参数'); 404 $this->error('缺少必要参数');
@@ -430,7 +427,7 @@ class Lists extends Api @@ -430,7 +427,7 @@ class Lists extends Api
430 foreach ($file_list as &$v){ 427 foreach ($file_list as &$v){
431 if(!empty($v['file'])){ 428 if(!empty($v['file'])){
432 $base_url = $v['file']; 429 $base_url = $v['file'];
433 - $qiniu_url = $qiniu.$v['file']; 430 + $qiniu_url = cdnurl($v['file'],true);
434 $a = file_get_contents($qiniu_url); 431 $a = file_get_contents($qiniu_url);
435 $path = './uploads/'.explode('/',$base_url)[2].'/'; 432 $path = './uploads/'.explode('/',$base_url)[2].'/';
436 if(!file_exists($path)) { 433 if(!file_exists($path)) {
@@ -476,7 +473,6 @@ class Lists extends Api @@ -476,7 +473,6 @@ class Lists extends Api
476 */ 473 */
477 public function download_info() 474 public function download_info()
478 { 475 {
479 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
480 $id = $this->request->param('id'); 476 $id = $this->request->param('id');
481 if(empty($id)){ 477 if(empty($id)){
482 $this->error('缺少必要参数'); 478 $this->error('缺少必要参数');
@@ -492,7 +488,7 @@ class Lists extends Api @@ -492,7 +488,7 @@ class Lists extends Api
492 foreach ($file_list as &$v){ 488 foreach ($file_list as &$v){
493 if(!empty($v['file'])){ 489 if(!empty($v['file'])){
494 $base_url = $v['file']; 490 $base_url = $v['file'];
495 - $qiniu_url = $qiniu.$v['file']; 491 + $qiniu_url = cdnurl($v['file'],true);
496 $a = file_get_contents($qiniu_url); 492 $a = file_get_contents($qiniu_url);
497 $path = './uploads/'.explode('/',$base_url)[2].'/'; 493 $path = './uploads/'.explode('/',$base_url)[2].'/';
498 if(!file_exists($path)) { 494 if(!file_exists($path)) {
@@ -539,7 +535,6 @@ class Lists extends Api @@ -539,7 +535,6 @@ class Lists extends Api
539 { 535 {
540 $page = $this->request->param('page', 1, 'intval'); 536 $page = $this->request->param('page', 1, 'intval');
541 $pageNum = $this->request->param('pageNum', 10, 'intval'); 537 $pageNum = $this->request->param('pageNum', 10, 'intval');
542 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
543 $data['total_num'] = Db::name('optimization') 538 $data['total_num'] = Db::name('optimization')
544 ->count(); 539 ->count();
545 $data['info'] = Db::name('optimization') 540 $data['info'] = Db::name('optimization')
@@ -552,7 +547,7 @@ class Lists extends Api @@ -552,7 +547,7 @@ class Lists extends Api
552 $video_avinfo = json_decode(file_get_contents(cdnurl($v['video_file'], true) . '?avinfo'), true); // 获取视频元信息 547 $video_avinfo = json_decode(file_get_contents(cdnurl($v['video_file'], true) . '?avinfo'), true); // 获取视频元信息
553 $duration = ceil($video_avinfo['format']['duration']); 548 $duration = ceil($video_avinfo['format']['duration']);
554 $v['duration'] = gmdate('H:i:s',$duration); 549 $v['duration'] = gmdate('H:i:s',$duration);
555 - $v['image'] = $qiniu.$v['image']; 550 + $v['image'] = cdnurl($v['image'],true);
556 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); 551 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
557 } 552 }
558 $this->success('success',$data); 553 $this->success('success',$data);
@@ -587,12 +582,11 @@ class Lists extends Api @@ -587,12 +582,11 @@ class Lists extends Api
587 if(empty($id)){ 582 if(empty($id)){
588 $this->error('缺少必要参数'); 583 $this->error('缺少必要参数');
589 } 584 }
590 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
591 $data = Db::name('optimization') 585 $data = Db::name('optimization')
592 ->where('id',$id) 586 ->where('id',$id)
593 ->find(); 587 ->find();
594 - $data['image'] = $qiniu.$data['image'];  
595 - $data['video_file'] = $qiniu.$data['video_file']; 588 + $data['image'] = cdnurl($data['image'],true);
  589 + $data['video_file'] = cdnurl($data['video_file'],true);
596 590
597 // 获取视频时长 591 // 获取视频时长
598 $video_avinfo = json_decode(file_get_contents(cdnurl($data['video_file'], true) . '?avinfo'), true); // 获取视频元信息 592 $video_avinfo = json_decode(file_get_contents(cdnurl($data['video_file'], true) . '?avinfo'), true); // 获取视频元信息
@@ -643,7 +637,6 @@ class Lists extends Api @@ -643,7 +637,6 @@ class Lists extends Api
643 } 637 }
644 $page = $this->request->param('page', 1, 'intval'); 638 $page = $this->request->param('page', 1, 'intval');
645 $pageNum = $this->request->param('pageNum', 10, 'intval'); 639 $pageNum = $this->request->param('pageNum', 10, 'intval');
646 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
647 // $user_id = Session::get('user_id'); 640 // $user_id = Session::get('user_id');
648 $user_id = $this->auth->id; 641 $user_id = $this->auth->id;
649 $where['expirationtime'] = ['>',time()]; 642 $where['expirationtime'] = ['>',time()];
@@ -675,7 +668,7 @@ class Lists extends Api @@ -675,7 +668,7 @@ class Lists extends Api
675 } 668 }
676 669
677 } 670 }
678 - $v['image'] = $qiniu.$v['image']; 671 + $v['image'] = cdnurl($v['image'],true);
679 $v['expirationtime'] = date('Y-m-d H:i:s',$v['expirationtime']); 672 $v['expirationtime'] = date('Y-m-d H:i:s',$v['expirationtime']);
680 } 673 }
681 $this->success('success',$data); 674 $this->success('success',$data);
@@ -726,7 +719,6 @@ class Lists extends Api @@ -726,7 +719,6 @@ class Lists extends Api
726 } 719 }
727 $page = $this->request->param('page', 1, 'intval'); 720 $page = $this->request->param('page', 1, 'intval');
728 $pageNum = $this->request->param('pageNum', 12, 'intval'); 721 $pageNum = $this->request->param('pageNum', 12, 'intval');
729 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
730 // $user_id = Session::get('user_id'); 722 // $user_id = Session::get('user_id');
731 $user_id = $this->auth->id; 723 $user_id = $this->auth->id;
732 $where['expirationtime'] = ['>',time()]; 724 $where['expirationtime'] = ['>',time()];
@@ -762,7 +754,7 @@ class Lists extends Api @@ -762,7 +754,7 @@ class Lists extends Api
762 $third_study = Db::name('third_study')->where('third_id',$user_id)->where('study_id',$v['id'])->field('periodtime')->find(); 754 $third_study = Db::name('third_study')->where('third_id',$user_id)->where('study_id',$v['id'])->field('periodtime')->find();
763 $v['expirationtime'] = !empty($third_study) ? date('Y-m-d H:i:s',$third_study['periodtime']) : date('Y-m-d H:i:s',$v['expirationtime']); 755 $v['expirationtime'] = !empty($third_study) ? date('Y-m-d H:i:s',$third_study['periodtime']) : date('Y-m-d H:i:s',$v['expirationtime']);
764 } 756 }
765 - $v['image'] = $qiniu.$v['image']; 757 + $v['image'] = cdnurl($v['image'],true);
766 } 758 }
767 $this->success('success',$data); 759 $this->success('success',$data);
768 } 760 }
@@ -824,8 +816,6 @@ class Lists extends Api @@ -824,8 +816,6 @@ class Lists extends Api
824 public function password_login(){ 816 public function password_login(){
825 817
826 $type = $this->request->param('type'); 818 $type = $this->request->param('type');
827 -  
828 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
829 $username = $this->request->param('username'); 819 $username = $this->request->param('username');
830 $password = $this->request->param('password'); 820 $password = $this->request->param('password');
831 if(empty($username) || empty($password)){ 821 if(empty($username) || empty($password)){
@@ -843,7 +833,7 @@ class Lists extends Api @@ -843,7 +833,7 @@ class Lists extends Api
843 // $this->error('抱歉,有效期已过'); 833 // $this->error('抱歉,有效期已过');
844 // } 834 // }
845 if(!empty($user['image'])){ 835 if(!empty($user['image'])){
846 - $user['image'] = $qiniu.$user['image']; 836 + $user['image'] = cdnurl($user['image'],true);
847 }else{ 837 }else{
848 $user['image'] = ''; 838 $user['image'] = '';
849 } 839 }
@@ -1094,11 +1084,10 @@ class Lists extends Api @@ -1094,11 +1084,10 @@ class Lists extends Api
1094 { 1084 {
1095 $page = $this->request->param('page', 1, 'intval'); 1085 $page = $this->request->param('page', 1, 'intval');
1096 $pageNum = $this->request->param('pageNum', 10, 'intval'); 1086 $pageNum = $this->request->param('pageNum', 10, 'intval');
1097 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
1098 $data['total_num'] = Db::name('kelist')->count(); 1087 $data['total_num'] = Db::name('kelist')->count();
1099 $data['info'] = Db::name('kelist')->order('id desc')->field('updatetime',true)->page($page,$pageNum)->select(); 1088 $data['info'] = Db::name('kelist')->order('id desc')->field('updatetime',true)->page($page,$pageNum)->select();
1100 foreach ($data['info'] as &$v){ 1089 foreach ($data['info'] as &$v){
1101 - $v['image'] = $qiniu.$v['image']; 1090 + $v['image'] = cdnurl($v['image'],true);
1102 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); 1091 $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
1103 } 1092 }
1104 $this->success('success',$data); 1093 $this->success('success',$data);
@@ -1131,13 +1120,12 @@ class Lists extends Api @@ -1131,13 +1120,12 @@ class Lists extends Api
1131 */ 1120 */
1132 public function ke_list_detail() 1121 public function ke_list_detail()
1133 { 1122 {
1134 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
1135 $id = $this->request->param('id'); 1123 $id = $this->request->param('id');
1136 if(empty($id)){ 1124 if(empty($id)){
1137 $this->error('缺少必要参数'); 1125 $this->error('缺少必要参数');
1138 } 1126 }
1139 $data = Db::name('kelist')->where('id',$id)->find(); 1127 $data = Db::name('kelist')->where('id',$id)->find();
1140 - $data['image'] = $qiniu.$data['image']; 1128 + $data['image'] = cdnurl($data['image'],true);
1141 $this->success('success',$data); 1129 $this->success('success',$data);
1142 } 1130 }
1143 1131
@@ -59,7 +59,6 @@ class User extends Api @@ -59,7 +59,6 @@ class User extends Api
59 */ 59 */
60 public function index() 60 public function index()
61 { 61 {
62 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
63 $user_id = $this->auth->id; 62 $user_id = $this->auth->id;
64 $data = Db::name('user')->where('id',$user_id)->find(); 63 $data = Db::name('user')->where('id',$user_id)->find();
65 if(empty($data['nickname'])){ 64 if(empty($data['nickname'])){
@@ -70,7 +69,7 @@ class User extends Api @@ -70,7 +69,7 @@ class User extends Api
70 $data['yuan_image'] = ''; 69 $data['yuan_image'] = '';
71 }else{ 70 }else{
72 $data['yuan_image'] = $data['image']; 71 $data['yuan_image'] = $data['image'];
73 - $data['image'] = $qiniu.$data['image']; 72 + $data['image'] = cdnurl($data['image'],true);
74 } 73 }
75 if(empty($data['card'])){ 74 if(empty($data['card'])){
76 $data['card'] = ''; 75 $data['card'] = '';
@@ -202,7 +201,6 @@ class User extends Api @@ -202,7 +201,6 @@ class User extends Api
202 $where['is_major'] = 2; 201 $where['is_major'] = 2;
203 } 202 }
204 $where['study_id'] = $id; 203 $where['study_id'] = $id;
205 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
206 $data['total_num'] = Db::name('classes') 204 $data['total_num'] = Db::name('classes')
207 ->where($where) 205 ->where($where)
208 ->count(); 206 ->count();
@@ -213,9 +211,9 @@ class User extends Api @@ -213,9 +211,9 @@ class User extends Api
213 ->order('id desc') 211 ->order('id desc')
214 ->select(); 212 ->select();
215 foreach ($data['info'] as &$v){ 213 foreach ($data['info'] as &$v){
216 - $v['video_file'] = $qiniu.$v['video_file']; 214 + $v['video_file'] = cdnurl($v['video_file'],true);
217 // $video_info = json_decode(file_get_contents($v['video_file'] . '?avinfo'), true); 215 // $video_info = json_decode(file_get_contents($v['video_file'] . '?avinfo'), true);
218 - $v['video_image'] = $qiniu.$v['video_image']; 216 + $v['video_image'] = cdnurl($v['video_image'],true);
219 } 217 }
220 $this->success('success',$data); 218 $this->success('success',$data);
221 } 219 }
@@ -690,7 +688,7 @@ class User extends Api @@ -690,7 +688,7 @@ class User extends Api
690 ->where('id',$id) 688 ->where('id',$id)
691 ->find(); 689 ->find();
692 690
693 - $data['exam']['image'] = $qiniu.$data['exam']['image']; 691 + $data['exam']['image'] = cdnurl($data['exam']['image'],true);
694 692
695 $finish_hour = Db::name('study_class') 693 $finish_hour = Db::name('study_class')
696 ->alias('a') 694 ->alias('a')
@@ -772,7 +770,7 @@ class User extends Api @@ -772,7 +770,7 @@ class User extends Api
772 $v['proportion'] = '100%'; 770 $v['proportion'] = '100%';
773 } 771 }
774 $v['duration'] = ceil($v['duration']/60); 772 $v['duration'] = ceil($v['duration']/60);
775 - $v['video_image'] = $qiniu.$v['video_image']; 773 + $v['video_image'] = cdnurl($v['video_image'],true);
776 } 774 }
777 $data['third'] = $third_exam; 775 $data['third'] = $third_exam;
778 $this->success('success',$data); 776 $this->success('success',$data);
@@ -799,7 +797,6 @@ class User extends Api @@ -799,7 +797,6 @@ class User extends Api
799 }) 797 })
800 */ 798 */
801 public function certificate(){ 799 public function certificate(){
802 - $qiniu = get_addon_config('qiniu')['cdnurl'];  
803 $user_id = $this->auth->id; 800 $user_id = $this->auth->id;
804 $id = $this->request->param('id'); 801 $id = $this->request->param('id');
805 if(empty($id)){ 802 if(empty($id)){
@@ -839,7 +836,7 @@ class User extends Api @@ -839,7 +836,7 @@ class User extends Api
839 if (!file_exists($dir_user)){ 836 if (!file_exists($dir_user)){
840 mkdir($dir_user,0777,true); 837 mkdir($dir_user,0777,true);
841 } 838 }
842 - $qiniu_url = $qiniu.$data['image']; 839 + $qiniu_url = cdnurl($data['image'],true);
843 $image_name = $user_id.'.png'; 840 $image_name = $user_id.'.png';
844 $furl = $dir_user . DS .$image_name; 841 $furl = $dir_user . DS .$image_name;
845 $a = file_get_contents($qiniu_url); 842 $a = file_get_contents($qiniu_url);
@@ -850,7 +847,7 @@ class User extends Api @@ -850,7 +847,7 @@ class User extends Api
850 if (!file_exists($dir_qrcode)){ 847 if (!file_exists($dir_qrcode)){
851 mkdir($dir_qrcode,0777,true); 848 mkdir($dir_qrcode,0777,true);
852 } 849 }
853 - $yinimage = $qiniu.$data['yinimage']; 850 + $yinimage = cdnurl($data['yinimage'],true);
854 $imagename = $data['study_id'].'.png'; 851 $imagename = $data['study_id'].'.png';
855 $yinfurl = $dir_qrcode . DS .$imagename; 852 $yinfurl = $dir_qrcode . DS .$imagename;
856 $b = file_get_contents($yinimage); 853 $b = file_get_contents($yinimage);