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

课程购买量

@@ -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_times']); 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']);
71 71
72 } 72 }
73 $list = collection($list)->toArray(); 73 $list = collection($list)->toArray();
@@ -19,5 +19,5 @@ return [ @@ -19,5 +19,5 @@ return [
19 'Top_time' => '置顶时间', 19 'Top_time' => '置顶时间',
20 'Createtime' => '创建时间', 20 'Createtime' => '创建时间',
21 'Updatetime' => '修改时间', 21 'Updatetime' => '修改时间',
22 - 'Pay_times' => '购买次数' 22 + 'Pay_num' => '购买量'
23 ]; 23 ];
@@ -45,7 +45,7 @@ class Notify extends Api @@ -45,7 +45,7 @@ class Notify extends Api
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 47 // 购买次数加1
48 - Db::name('mobile_course')->where('id',$order['course_id'])->setInc('pay_times'); 48 + Db::name('mobile_course')->where('id',$order['course_id'])->setInc('pay_num');
49 } 49 }
50 } catch (Exception $e) { 50 } catch (Exception $e) {
51 } 51 }
@@ -72,6 +72,8 @@ class Notify extends Api @@ -72,6 +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 } 77 }
76 } catch (Exception $e) { 78 } catch (Exception $e) {
77 } 79 }
@@ -35,7 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -35,7 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
35 {field: 'teacher_name', title: __('Teacher_name')}, 35 {field: 'teacher_name', title: __('Teacher_name')},
36 {field: 'teacher_desc', title: __('Teacher_desc')}, 36 {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}, 37 // {field: 'is_top', title: __('Is_top'), searchList: {"0":__('Is_top 0'),"1":__('Is_top 1')}, formatter: Table.api.formatter.toggle},
38 - {field: 'pay_times', title: __('Pay_times')}, 38 + {field: 'pay_num', title: __('Pay_num')},
39 //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮 39 //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
40 { 40 {
41 field: 'operate', 41 field: 'operate',
@@ -47,7 +47,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -47,7 +47,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
47 name: 'top', 47 name: 'top',
48 text: '置顶', 48 text: '置顶',
49 title: '置顶', 49 title: '置顶',
50 - classname: 'btn btn-xs btn-danger btn-ajax', 50 + classname: 'btn btn-xs btn-primary btn-ajax',
51 icon: 'fa fa-long-arrow-up', 51 icon: 'fa fa-long-arrow-up',
52 url: 'mobile/course/course/top?course_id={id}&is_top=1', 52 url: 'mobile/course/course/top?course_id={id}&is_top=1',
53 visible: function (row) { 53 visible: function (row) {
@@ -63,7 +63,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -63,7 +63,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
63 name: 'top', 63 name: 'top',
64 text: '取消置顶', 64 text: '取消置顶',
65 title: '取消置顶', 65 title: '取消置顶',
66 - classname: 'btn btn-xs btn-primary btn-ajax', 66 + classname: 'btn btn-xs btn-danger btn-ajax',
67 icon: 'fa fa-long-arrow-down', 67 icon: 'fa fa-long-arrow-down',
68 url: 'mobile/course/course/top?course_id={id}&is_top=0', 68 url: 'mobile/course/course/top?course_id={id}&is_top=0',
69 visible: function (row) { 69 visible: function (row) {