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

测试代码部署

... ... @@ -3,19 +3,19 @@ stages:
- pull
# job 华为测试服务添加自动部署
#job1:
# stage: pull
# tags:
# - huawei8
# script:
# - cd /home/wwwroot/t/enterprise
# - git pull
# job 华为正式服务器添加自动部署 两个job同时存在为同时向两个服务器推送
job2:
job1:
stage: pull
tags:
- huawei9
- huawei8
script:
- cd /home/wwwroot/fast/enterprise
- git pull
\ No newline at end of file
- cd /home/wwwroot/t/enterprise
- git pull
# job 华为正式服务器添加自动部署 两个job同时存在为同时向两个服务器推送
#job2:
# stage: pull
# tags:
# - huawei9
# script:
# - cd /home/wwwroot/fast/enterprise
# - git pull
\ No newline at end of file
... ...
... ... @@ -306,6 +306,24 @@ class Course extends Api
}
/**
* @ApiTitle (套餐说明)
* @ApiSummary (套餐说明)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "套餐说明" //套餐说明内容
})
*/
public function spec_intro()
{
$content = Db::name('mobile_config')->where('id',1)->value('course_spec_intro');
$this->success('成功', $content);
}
/**
* @ApiTitle (购买预览)
* @ApiSummary (购买预览)
* @ApiMethod (POST)
... ...
... ... @@ -138,6 +138,24 @@ class Secret extends Api
}
/**
* @ApiTitle (套餐说明)
* @ApiSummary (套餐说明)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "套餐说明" //套餐说明内容
})
*/
public function spec_intro()
{
$content = Db::name('mobile_config')->where('id',1)->value('secret_spec_intro');
$this->success('成功', $content);
}
/**
* @ApiTitle (购买预览)
* @ApiSummary (购买预览)
* @ApiMethod (POST)
... ...
... ... @@ -14,6 +14,8 @@ use app\mobile\model\Agreement;
use app\mobile\model\Exam;
use app\mobile\model\CourseOrder;
use app\mobile\model\CourseAppraise;
use app\mobile\model\SecretOrder;
use app\mobile\model\ScoreSpec;
/**
* 我的接口
... ... @@ -272,7 +274,7 @@ class User extends Api
public function index()
{
$user = $this->auth->getUser();
$this->success('成功', $content);
$this->success('成功', $user);
}
/**
... ... @@ -543,4 +545,192 @@ class User extends Api
]);
$this->success('评价成功');
}
/**
* @ApiTitle (我的密卷)
* @ApiSummary (我的密卷)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1600081718",
"data": [{
"id": 9, //密卷订单ID
"pay_price": "50.00", //实际支付金额
"secret": { //密卷信息
"title": "测试密卷", //密卷标题
"do_num": "" //做过人数
},
"is_have_qi": 0 //是否有企字:0=否,1=是
}]
})
*/
public function mySecret(){
// 我加入的企业购买的密卷
$company_secret_list = SecretOrder::alias('a')
->join('mobile_company_user b','b.company_id = a.company_id')
->where('b.user_id',$this->auth->id)
->where('b.status','1')
->field('a.id,a.company_id,a.people_num')
->select();
// 查询我是否可以享受企业密卷(按企业审核时间排队,没在队伍里就无法享受企业密卷)
$secret_id_arr = [];
foreach ($company_secret_list as $v) {
$user_id_arr = CompanyUser::where('company_id',$v['company_id'])
->where('status','1')
->order('updatetime asc')
->limit($v['people_num'])
->column('user_id');
if(in_array($this->auth->id,$user_id_arr)){
$secret_id_arr[] = $v['id'];
}
}
// 查找所有密卷
$list = SecretOrder::with(['secret'])
->where(function($query)use($secret_id_arr){
$query->where('user_id', $this->auth->id)->whereor('id', 'in', $secret_id_arr);
})
->where('pay_status','1')
->select();
foreach ($list as $v) {
$v['is_have_qi'] = in_array($v['id'], $secret_id_arr) ? 1 : 0;
$v->visible(['id','pay_price','secret'])->append(['is_have_qi']);
$v->getRelation('secret')->visible(['cover','title']);
}
$this->success('成功',$list);
}
/**
* @ApiTitle (我的积分)
* @ApiSummary (我的积分)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1600135095",
"data": {
"id": 16, //用户ID
"score": 0, //当前积分
"url": "/u/16",
"max_score": 0 //累计积分
}
})
*/
public function myScore(){
$user = $this->auth->getUser();
$user['max_score'] = db('user_score_log')->where('user_id',$user['id'])->max('after');
$user = $user->visible(['id','score'])->append(['max_score'])->toArray();
$this->success('成功',$user);
}
/**
* @ApiTitle (积分说明)
* @ApiSummary (积分说明)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "积分说明" //积分说明内容
})
*/
public function scoreIntro()
{
$content = Db::name('mobile_config')->where('id',1)->value('user_score_intro');
$this->success('成功', $content);
}
/**
* @ApiTitle (积分记录)
* @ApiSummary (积分记录)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "积分说明" //积分说明内容
})
*/
public function scoreLog()
{
$list = \app\common\model\ScoreLog::where('user_id',$this->auth->id)
->order('createtime desc')
->paginate($page_num,false,['page'=>$page])
->each(function($v){
$v['createtime'] = date('Y.m.d H:i',$v['createtime']);
})->toArray();
$this->success('成功', $content);
}
/**
* @ApiTitle (海报分享)
* @ApiSummary (海报分享)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "积分说明" //积分说明内容
})
*/
public function share()
{
$content = Db::name('mobile_config')->where('id',1)->value('user_score_intro');
$this->success('成功', $content);
}
/**
* @ApiTitle (充值积分-套餐)
* @ApiSummary (充值积分-套餐)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "积分说明" //积分说明内容
})
*/
public function scoreSpec()
{
$list = ScoreSpec::select();
$score_recharge_price = Db::name('mobile_config')->where('id',1)->value('score_recharge_price');
$this->success('成功', compact('list','score_recharge_price'));
}
/**
* @ApiTitle (充值积分)
* @ApiSummary (充值积分)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="score_spec_id", type="int", required=false, description="积分套餐ID")
* @ApiParams (name="score", type="int", required=true, description="评价星数")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599017563",
"data": "积分说明" //积分说明内容
})
*/
public function scoreRecharge()
{
$content = Db::name('mobile_config')->where('id',1)->value('user_score_intro');
$this->success('成功', $content);
}
}
\ No newline at end of file
... ...
<?php
namespace app\mobile\model;
use think\Model;
use think\Db;
class ScoreOrder extends Model
{
// 表名
protected $name = 'mobile_score_order';
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
/**
* 新增订单
*/
public function add($user, $order, $pay_type)
{
Db::startTrans();
$save_data = [
'user_id' => $user['id'],
'score_spec_id' => $order['info']['id'],
'order_sn' => get_order_sn(),
'pay_price' => $order['pay_price'],
'pay_type' => $pay_type,
'score' => $order['score']
];
$this->save([
'user_id' => $user['id'],
'score_spec_id' => $order['info']['id'],
'order_sn' => get_order_sn(),
'pay_price' => $order['pay_price'],
'pay_type' => $pay_type,
'score' => $order['score']
]);
// 用掉积分
\app\common\model\User::score($order['score'],$user['id'],'充值积分');
Db::commit();
return true;
}
}
\ No newline at end of file
... ...
<?php
namespace app\mobile\model;
use think\Model;
class ScoreSpec extends Model
{
// 表名
protected $name = 'mobile_score_spec';
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'score'
];
public function getScoreAttr($value,$data){
return $data['spec_score'] + $data['give_score'];
}
}
\ No newline at end of file
... ...
此 diff 太大无法显示。