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

课程和密卷购买量

... ... @@ -63,7 +63,7 @@ class Secret extends Backend
->select();
foreach ($list as $row) {
$row->visible(['id','title','current_price','original_price','do_num_virtual','do_num_real','updatetime','pay_num']);
$row->visible(['id','title','current_price','original_price','do_num_virtual','do_num_real','buy_num_virtual','buy_num_real','updatetime']);
}
$list = collection($list)->toArray();
... ...
... ... @@ -67,7 +67,7 @@ class Course extends Backend
->select();
foreach ($list as $row) {
$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']);
$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']);
}
$list = collection($list)->toArray();
... ...
... ... @@ -18,6 +18,5 @@ return [
'Is_top 1' => '是',
'Top_time' => '置顶时间',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Pay_num' => '购买量'
'Updatetime' => '修改时间'
];
... ...
... ... @@ -10,5 +10,6 @@ return [
'Description' => '试卷介绍',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Pay_num' => '购买量'
'Buy_num_virtual' => '虚拟购买量',
'Buy_num_real' => '真实购买量',
];
... ...
... ... @@ -45,6 +45,18 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Study_num_virtual')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-study_num_virtual" data-rule="required" class="form-control" name="row[study_num_virtual]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Study_num_real')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-study_num_real" data-rule="required" class="form-control" name="row[study_num_real]" type="number" value="0" readonly>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Teacher_avatar')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
... ...
... ... @@ -45,6 +45,18 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Study_num_virtual')}:</label>
<div class="col-xs-12 col-sm-8">
<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}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Study_num_real')}:</label>
<div class="col-xs-12 col-sm-8">
<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>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Teacher_avatar')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
... ...
... ... @@ -36,6 +36,18 @@
<textarea id="c-description" class="form-control " rows="5" name="row[description]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_virtual')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-buy_num_virtual" data-rule="required" class="form-control" name="row[buy_num_virtual]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_real')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-buy_num_real" data-rule="required" class="form-control" name="row[buy_num_real]" type="number" value="0" readonly>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -36,6 +36,18 @@
<textarea id="c-description" class="form-control " rows="5" name="row[description]" cols="50">{$row.description|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_virtual')}:</label>
<div class="col-xs-12 col-sm-8">
<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}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Buy_num_real')}:</label>
<div class="col-xs-12 col-sm-8">
<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>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -44,8 +44,8 @@ class Notify extends Api
$order = CourseOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
// 购买次数加1
Db::name('mobile_course')->where('id',$order['course_id'])->setInc('pay_num');
// 学习人数加1
Db::name('mobile_course')->where('id',$order['course_id'])->setInc('study_num_real');
}
} catch (Exception $e) {
}
... ... @@ -72,8 +72,8 @@ class Notify extends Api
$order = SecretOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
// 购买次数加1
Db::name('mobile_secret')->where('id',$order['course_id'])->setInc('pay_num');
// 购买量加1
Db::name('mobile_secret')->where('id',$order['course_id'])->setInc('buy_num_real');
}
} catch (Exception $e) {
}
... ... @@ -128,6 +128,10 @@ class Notify extends Api
$order = PackageOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
foreach ($order['package'] as $v){
// 购买量加1
Db::name('mobile_package')->where('id',$v['package_id'])->setInc('buy_num_real');
}
}
} catch (Exception $e) {
}
... ...
... ... @@ -934,7 +934,8 @@ class User extends Api
// save it to a file
$qrCode->save($user_code);
$user_poster = $user_dir.'/poster_'.$user['id'].'.png';
$desc = "我正在“精工筑匠”\n学习“一级建造师资格证考试”\n来和我一起学习吧!";
$exam_name = Exam::where('id',$user['exam'][0]['exam_id'])->value('name');
$desc = "我正在“精工筑匠”\n学习“{$exam_name}\n来和我一起学习吧!";
$image->text('我的海报',$path_ttf,14,'#ffffff',[150,54])
->water(ROOT_PATH.'public/assets/img/poster_qr_bg2.png',[11,158])
->water(ROOT_PATH.'public/'.$user_code,[73,242])
... ...
... ... @@ -9,4 +9,9 @@ class User extends Model
public function getImageAttr($value){
return !empty($value) ? cdnurl($value,true) : '';
}
// 用户选择的考试
public function exam(){
return $this->hasMany('UserExam');
}
}
\ No newline at end of file
... ...
... ... @@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'current_price', title: __('Current_price'), operate:'BETWEEN'},
{field: 'original_price', title: __('Original_price'), operate:'BETWEEN'},
{field: 'study_num_rate', title: __('Study_num_rate')},
{field: 'study_num_virtual', title: __('Study_num_virtual')},
{field: 'study_num_real', title: __('Study_num_real')},
{field: 'teacher_avatar', title: __('Teacher_avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'teacher_name', title: __('Teacher_name')},
{field: 'teacher_desc', title: __('Teacher_desc')},
// {field: 'is_top', title: __('Is_top'), searchList: {"0":__('Is_top 0'),"1":__('Is_top 1')}, formatter: Table.api.formatter.toggle},
{field: 'pay_num', title: __('Pay_num')},
//操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
{
field: 'operate',
... ...
... ... @@ -30,7 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'original_price', title: __('Original_price'), operate:'BETWEEN'},
{field: 'do_num_virtual', title: __('Do_num_virtual')},
{field: 'do_num_real', title: __('Do_num_real')},
{field: 'pay_num', title: __('Pay_num')},
{field: 'buy_num_virtual', title: __('Buy_num_virtual')},
{field: 'buy_num_real', title: __('Buy_num_real')},
//操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
{
field: 'operate',
... ...