...
|
...
|
@@ -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 |
...
|
...
|
|