作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

课程和密卷购买量

@@ -63,7 +63,7 @@ class Secret extends Backend @@ -63,7 +63,7 @@ class Secret extends Backend
63 ->select(); 63 ->select();
64 64
65 foreach ($list as $row) { 65 foreach ($list as $row) {
66 - $row->visible(['id','title','current_price','original_price','do_num_virtual','do_num_real','updatetime','pay_num']); 66 + $row->visible(['id','title','current_price','original_price','do_num_virtual','do_num_real','buy_num_virtual','buy_num_real','updatetime']);
67 67
68 } 68 }
69 $list = collection($list)->toArray(); 69 $list = collection($list)->toArray();
@@ -67,7 +67,7 @@ class Course extends Backend @@ -67,7 +67,7 @@ class Course extends Backend
67 ->select(); 67 ->select();
68 68
69 foreach ($list as $row) { 69 foreach ($list as $row) {
70 - $row->visible(['id','title','cover','current_price','original_price','study_num_rate','study_num_real','teacher_avatar','teacher_name','teacher_desc','is_top','pay_num']); 70 + $row->visible(['id','title','cover','current_price','original_price','study_num_rate','study_num_virtual','study_num_real','teacher_avatar','teacher_name','teacher_desc','is_top']);
71 71
72 } 72 }
73 $list = collection($list)->toArray(); 73 $list = collection($list)->toArray();
@@ -18,6 +18,5 @@ return [ @@ -18,6 +18,5 @@ return [
18 'Is_top 1' => '是', 18 'Is_top 1' => '是',
19 'Top_time' => '置顶时间', 19 'Top_time' => '置顶时间',
20 'Createtime' => '创建时间', 20 'Createtime' => '创建时间',
21 - 'Updatetime' => '修改时间',  
22 - 'Pay_num' => '购买量' 21 + 'Updatetime' => '修改时间'
23 ]; 22 ];
@@ -10,5 +10,6 @@ return [ @@ -10,5 +10,6 @@ return [
10 'Description' => '试卷介绍', 10 'Description' => '试卷介绍',
11 'Createtime' => '创建时间', 11 'Createtime' => '创建时间',
12 'Updatetime' => '修改时间', 12 'Updatetime' => '修改时间',
13 - 'Pay_num' => '购买量' 13 + 'Buy_num_virtual' => '虚拟购买量',
  14 + 'Buy_num_real' => '真实购买量',
14 ]; 15 ];
@@ -45,6 +45,18 @@ @@ -45,6 +45,18 @@
45 </div> 45 </div>
46 </div> 46 </div>
47 <div class="form-group"> 47 <div class="form-group">
  48 + <label class="control-label col-xs-12 col-sm-2">{:__('Study_num_virtual')}:</label>
  49 + <div class="col-xs-12 col-sm-8">
  50 + <input id="c-study_num_virtual" data-rule="required" class="form-control" name="row[study_num_virtual]" type="number" value="0">
  51 + </div>
  52 + </div>
  53 + <div class="form-group">
  54 + <label class="control-label col-xs-12 col-sm-2">{:__('Study_num_real')}:</label>
  55 + <div class="col-xs-12 col-sm-8">
  56 + <input id="c-study_num_real" data-rule="required" class="form-control" name="row[study_num_real]" type="number" value="0" readonly>
  57 + </div>
  58 + </div>
  59 + <div class="form-group">
48 <label class="control-label col-xs-12 col-sm-2">{:__('Teacher_avatar')}:</label> 60 <label class="control-label col-xs-12 col-sm-2">{:__('Teacher_avatar')}:</label>
49 <div class="col-xs-12 col-sm-8"> 61 <div class="col-xs-12 col-sm-8">
50 <div class="input-group"> 62 <div class="input-group">
@@ -45,6 +45,18 @@ @@ -45,6 +45,18 @@
45 </div> 45 </div>
46 </div> 46 </div>
47 <div class="form-group"> 47 <div class="form-group">
  48 + <label class="control-label col-xs-12 col-sm-2">{:__('Study_num_virtual')}:</label>
  49 + <div class="col-xs-12 col-sm-8">
  50 + <input id="c-study_num_virtual" data-rule="required" class="form-control" name="row[study_num_virtual]" type="number" value="{$row.study_num_virtual|htmlentities}">
  51 + </div>
  52 + </div>
  53 + <div class="form-group">
  54 + <label class="control-label col-xs-12 col-sm-2">{:__('Study_num_real')}:</label>
  55 + <div class="col-xs-12 col-sm-8">
  56 + <input id="c-study_num_real" data-rule="required" class="form-control" name="row[study_num_real]" type="number" value="{$row.study_num_real|htmlentities}" readonly>
  57 + </div>
  58 + </div>
  59 + <div class="form-group">
48 <label class="control-label col-xs-12 col-sm-2">{:__('Teacher_avatar')}:</label> 60 <label class="control-label col-xs-12 col-sm-2">{:__('Teacher_avatar')}:</label>
49 <div class="col-xs-12 col-sm-8"> 61 <div class="col-xs-12 col-sm-8">
50 <div class="input-group"> 62 <div class="input-group">
@@ -36,6 +36,18 @@ @@ -36,6 +36,18 @@
36 <textarea id="c-description" class="form-control " rows="5" name="row[description]" cols="50"></textarea> 36 <textarea id="c-description" class="form-control " rows="5" name="row[description]" cols="50"></textarea>
37 </div> 37 </div>
38 </div> 38 </div>
  39 + <div class="form-group">
  40 + <label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_virtual')}:</label>
  41 + <div class="col-xs-12 col-sm-8">
  42 + <input id="c-buy_num_virtual" data-rule="required" class="form-control" name="row[buy_num_virtual]" type="number" value="0">
  43 + </div>
  44 + </div>
  45 + <div class="form-group">
  46 + <label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_real')}:</label>
  47 + <div class="col-xs-12 col-sm-8">
  48 + <input id="c-buy_num_real" data-rule="required" class="form-control" name="row[buy_num_real]" type="number" value="0" readonly>
  49 + </div>
  50 + </div>
39 <div class="form-group layer-footer"> 51 <div class="form-group layer-footer">
40 <label class="control-label col-xs-12 col-sm-2"></label> 52 <label class="control-label col-xs-12 col-sm-2"></label>
41 <div class="col-xs-12 col-sm-8"> 53 <div class="col-xs-12 col-sm-8">
@@ -36,6 +36,18 @@ @@ -36,6 +36,18 @@
36 <textarea id="c-description" class="form-control " rows="5" name="row[description]" cols="50">{$row.description|htmlentities}</textarea> 36 <textarea id="c-description" class="form-control " rows="5" name="row[description]" cols="50">{$row.description|htmlentities}</textarea>
37 </div> 37 </div>
38 </div> 38 </div>
  39 + <div class="form-group">
  40 + <label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_virtual')}:</label>
  41 + <div class="col-xs-12 col-sm-8">
  42 + <input id="c-buy_num_virtual" data-rule="required" class="form-control" name="row[buy_num_virtual]" type="number" value="{$row.buy_num_virtual|htmlentities}">
  43 + </div>
  44 + </div>
  45 + <div class="form-group">
  46 + <label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_real')}:</label>
  47 + <div class="col-xs-12 col-sm-8">
  48 + <input id="c-buy_num_real" data-rule="required" class="form-control" name="row[buy_num_real]" type="number" value="{$row.buy_num_real|htmlentities}" readonly>
  49 + </div>
  50 + </div>
39 <div class="form-group layer-footer"> 51 <div class="form-group layer-footer">
40 <label class="control-label col-xs-12 col-sm-2"></label> 52 <label class="control-label col-xs-12 col-sm-2"></label>
41 <div class="col-xs-12 col-sm-8"> 53 <div class="col-xs-12 col-sm-8">
@@ -44,8 +44,8 @@ class Notify extends Api @@ -44,8 +44,8 @@ class Notify extends Api
44 $order = CourseOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]); 44 $order = CourseOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
45 if($order && $order['pay_status'] != '1'){ 45 if($order && $order['pay_status'] != '1'){
46 $order->save(['pay_status'=>'1','pay_time'=>time()]); 46 $order->save(['pay_status'=>'1','pay_time'=>time()]);
47 - // 购买次数加1  
48 - Db::name('mobile_course')->where('id',$order['course_id'])->setInc('pay_num'); 47 + // 学习人数加1
  48 + Db::name('mobile_course')->where('id',$order['course_id'])->setInc('study_num_real');
49 } 49 }
50 } catch (Exception $e) { 50 } catch (Exception $e) {
51 } 51 }
@@ -72,8 +72,8 @@ class Notify extends Api @@ -72,8 +72,8 @@ class Notify extends Api
72 $order = SecretOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]); 72 $order = SecretOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
73 if($order && $order['pay_status'] != '1'){ 73 if($order && $order['pay_status'] != '1'){
74 $order->save(['pay_status'=>'1','pay_time'=>time()]); 74 $order->save(['pay_status'=>'1','pay_time'=>time()]);
75 - // 购买次数加1  
76 - Db::name('mobile_secret')->where('id',$order['course_id'])->setInc('pay_num'); 75 + // 购买量加1
  76 + Db::name('mobile_secret')->where('id',$order['course_id'])->setInc('buy_num_real');
77 } 77 }
78 } catch (Exception $e) { 78 } catch (Exception $e) {
79 } 79 }
@@ -128,6 +128,10 @@ class Notify extends Api @@ -128,6 +128,10 @@ class Notify extends Api
128 $order = PackageOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]); 128 $order = PackageOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
129 if($order && $order['pay_status'] != '1'){ 129 if($order && $order['pay_status'] != '1'){
130 $order->save(['pay_status'=>'1','pay_time'=>time()]); 130 $order->save(['pay_status'=>'1','pay_time'=>time()]);
  131 + foreach ($order['package'] as $v){
  132 + // 购买量加1
  133 + Db::name('mobile_package')->where('id',$v['package_id'])->setInc('buy_num_real');
  134 + }
131 } 135 }
132 } catch (Exception $e) { 136 } catch (Exception $e) {
133 } 137 }
@@ -934,7 +934,8 @@ class User extends Api @@ -934,7 +934,8 @@ class User extends Api
934 // save it to a file 934 // save it to a file
935 $qrCode->save($user_code); 935 $qrCode->save($user_code);
936 $user_poster = $user_dir.'/poster_'.$user['id'].'.png'; 936 $user_poster = $user_dir.'/poster_'.$user['id'].'.png';
937 - $desc = "我正在“精工筑匠”\n学习“一级建造师资格证考试”\n来和我一起学习吧!"; 937 + $exam_name = Exam::where('id',$user['exam'][0]['exam_id'])->value('name');
  938 + $desc = "我正在“精工筑匠”\n学习“{$exam_name}\n来和我一起学习吧!";
938 $image->text('我的海报',$path_ttf,14,'#ffffff',[150,54]) 939 $image->text('我的海报',$path_ttf,14,'#ffffff',[150,54])
939 ->water(ROOT_PATH.'public/assets/img/poster_qr_bg2.png',[11,158]) 940 ->water(ROOT_PATH.'public/assets/img/poster_qr_bg2.png',[11,158])
940 ->water(ROOT_PATH.'public/'.$user_code,[73,242]) 941 ->water(ROOT_PATH.'public/'.$user_code,[73,242])
@@ -9,4 +9,9 @@ class User extends Model @@ -9,4 +9,9 @@ class User extends Model
9 public function getImageAttr($value){ 9 public function getImageAttr($value){
10 return !empty($value) ? cdnurl($value,true) : ''; 10 return !empty($value) ? cdnurl($value,true) : '';
11 } 11 }
  12 +
  13 + // 用户选择的考试
  14 + public function exam(){
  15 + return $this->hasMany('UserExam');
  16 + }
12 } 17 }
@@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
30 {field: 'current_price', title: __('Current_price'), operate:'BETWEEN'}, 30 {field: 'current_price', title: __('Current_price'), operate:'BETWEEN'},
31 {field: 'original_price', title: __('Original_price'), operate:'BETWEEN'}, 31 {field: 'original_price', title: __('Original_price'), operate:'BETWEEN'},
32 {field: 'study_num_rate', title: __('Study_num_rate')}, 32 {field: 'study_num_rate', title: __('Study_num_rate')},
  33 + {field: 'study_num_virtual', title: __('Study_num_virtual')},
33 {field: 'study_num_real', title: __('Study_num_real')}, 34 {field: 'study_num_real', title: __('Study_num_real')},
34 {field: 'teacher_avatar', title: __('Teacher_avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image}, 35 {field: 'teacher_avatar', title: __('Teacher_avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image},
35 {field: 'teacher_name', title: __('Teacher_name')}, 36 {field: 'teacher_name', title: __('Teacher_name')},
36 {field: 'teacher_desc', title: __('Teacher_desc')}, 37 {field: 'teacher_desc', title: __('Teacher_desc')},
37 // {field: 'is_top', title: __('Is_top'), searchList: {"0":__('Is_top 0'),"1":__('Is_top 1')}, formatter: Table.api.formatter.toggle}, 38 // {field: 'is_top', title: __('Is_top'), searchList: {"0":__('Is_top 0'),"1":__('Is_top 1')}, formatter: Table.api.formatter.toggle},
38 - {field: 'pay_num', title: __('Pay_num')},  
39 //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮 39 //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
40 { 40 {
41 field: 'operate', 41 field: 'operate',
@@ -30,7 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -30,7 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
30 {field: 'original_price', title: __('Original_price'), operate:'BETWEEN'}, 30 {field: 'original_price', title: __('Original_price'), operate:'BETWEEN'},
31 {field: 'do_num_virtual', title: __('Do_num_virtual')}, 31 {field: 'do_num_virtual', title: __('Do_num_virtual')},
32 {field: 'do_num_real', title: __('Do_num_real')}, 32 {field: 'do_num_real', title: __('Do_num_real')},
33 - {field: 'pay_num', title: __('Pay_num')}, 33 + {field: 'buy_num_virtual', title: __('Buy_num_virtual')},
  34 + {field: 'buy_num_real', title: __('Buy_num_real')},
34 //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮 35 //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
35 { 36 {
36 field: 'operate', 37 field: 'operate',