|
@@ -14,6 +14,8 @@ use app\mobile\model\Agreement; |
|
@@ -14,6 +14,8 @@ use app\mobile\model\Agreement; |
14
|
use app\mobile\model\Exam;
|
14
|
use app\mobile\model\Exam;
|
15
|
use app\mobile\model\CourseOrder;
|
15
|
use app\mobile\model\CourseOrder;
|
16
|
use app\mobile\model\CourseAppraise;
|
16
|
use app\mobile\model\CourseAppraise;
|
|
|
17
|
+use app\mobile\model\SecretOrder;
|
|
|
18
|
+use app\mobile\model\ScoreSpec;
|
17
|
|
19
|
|
18
|
/**
|
20
|
/**
|
19
|
* 我的接口
|
21
|
* 我的接口
|
|
@@ -272,7 +274,7 @@ class User extends Api |
|
@@ -272,7 +274,7 @@ class User extends Api |
272
|
public function index()
|
274
|
public function index()
|
273
|
{
|
275
|
{
|
274
|
$user = $this->auth->getUser();
|
276
|
$user = $this->auth->getUser();
|
275
|
- $this->success('成功', $content);
|
277
|
+ $this->success('成功', $user);
|
276
|
}
|
278
|
}
|
277
|
|
279
|
|
278
|
/**
|
280
|
/**
|
|
@@ -543,4 +545,192 @@ class User extends Api |
|
@@ -543,4 +545,192 @@ class User extends Api |
543
|
]);
|
545
|
]);
|
544
|
$this->success('评价成功');
|
546
|
$this->success('评价成功');
|
545
|
}
|
547
|
}
|
|
|
548
|
+
|
|
|
549
|
+ /**
|
|
|
550
|
+ * @ApiTitle (我的密卷)
|
|
|
551
|
+ * @ApiSummary (我的密卷)
|
|
|
552
|
+ * @ApiMethod (POST)
|
|
|
553
|
+ *
|
|
|
554
|
+ * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
555
|
+ *
|
|
|
556
|
+ * @ApiReturn({
|
|
|
557
|
+ "code": 1,
|
|
|
558
|
+ "msg": "成功",
|
|
|
559
|
+ "time": "1600081718",
|
|
|
560
|
+ "data": [{
|
|
|
561
|
+ "id": 9, //密卷订单ID
|
|
|
562
|
+ "pay_price": "50.00", //实际支付金额
|
|
|
563
|
+ "secret": { //密卷信息
|
|
|
564
|
+ "title": "测试密卷", //密卷标题
|
|
|
565
|
+ "do_num": "" //做过人数
|
|
|
566
|
+ },
|
|
|
567
|
+ "is_have_qi": 0 //是否有企字:0=否,1=是
|
|
|
568
|
+ }]
|
|
|
569
|
+ })
|
|
|
570
|
+ */
|
|
|
571
|
+ public function mySecret(){
|
|
|
572
|
+ // 我加入的企业购买的密卷
|
|
|
573
|
+ $company_secret_list = SecretOrder::alias('a')
|
|
|
574
|
+ ->join('mobile_company_user b','b.company_id = a.company_id')
|
|
|
575
|
+ ->where('b.user_id',$this->auth->id)
|
|
|
576
|
+ ->where('b.status','1')
|
|
|
577
|
+ ->field('a.id,a.company_id,a.people_num')
|
|
|
578
|
+ ->select();
|
|
|
579
|
+ // 查询我是否可以享受企业密卷(按企业审核时间排队,没在队伍里就无法享受企业密卷)
|
|
|
580
|
+ $secret_id_arr = [];
|
|
|
581
|
+ foreach ($company_secret_list as $v) {
|
|
|
582
|
+ $user_id_arr = CompanyUser::where('company_id',$v['company_id'])
|
|
|
583
|
+ ->where('status','1')
|
|
|
584
|
+ ->order('updatetime asc')
|
|
|
585
|
+ ->limit($v['people_num'])
|
|
|
586
|
+ ->column('user_id');
|
|
|
587
|
+ if(in_array($this->auth->id,$user_id_arr)){
|
|
|
588
|
+ $secret_id_arr[] = $v['id'];
|
|
|
589
|
+ }
|
|
|
590
|
+ }
|
|
|
591
|
+ // 查找所有密卷
|
|
|
592
|
+ $list = SecretOrder::with(['secret'])
|
|
|
593
|
+ ->where(function($query)use($secret_id_arr){
|
|
|
594
|
+ $query->where('user_id', $this->auth->id)->whereor('id', 'in', $secret_id_arr);
|
|
|
595
|
+ })
|
|
|
596
|
+ ->where('pay_status','1')
|
|
|
597
|
+ ->select();
|
|
|
598
|
+ foreach ($list as $v) {
|
|
|
599
|
+ $v['is_have_qi'] = in_array($v['id'], $secret_id_arr) ? 1 : 0;
|
|
|
600
|
+ $v->visible(['id','pay_price','secret'])->append(['is_have_qi']);
|
|
|
601
|
+ $v->getRelation('secret')->visible(['cover','title']);
|
|
|
602
|
+ }
|
|
|
603
|
+ $this->success('成功',$list);
|
|
|
604
|
+ }
|
|
|
605
|
+
|
|
|
606
|
+ /**
|
|
|
607
|
+ * @ApiTitle (我的积分)
|
|
|
608
|
+ * @ApiSummary (我的积分)
|
|
|
609
|
+ * @ApiMethod (POST)
|
|
|
610
|
+ *
|
|
|
611
|
+ * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
612
|
+ *
|
|
|
613
|
+ * @ApiReturn({
|
|
|
614
|
+ "code": 1,
|
|
|
615
|
+ "msg": "成功",
|
|
|
616
|
+ "time": "1600135095",
|
|
|
617
|
+ "data": {
|
|
|
618
|
+ "id": 16, //用户ID
|
|
|
619
|
+ "score": 0, //当前积分
|
|
|
620
|
+ "url": "/u/16",
|
|
|
621
|
+ "max_score": 0 //累计积分
|
|
|
622
|
+ }
|
|
|
623
|
+ })
|
|
|
624
|
+ */
|
|
|
625
|
+ public function myScore(){
|
|
|
626
|
+ $user = $this->auth->getUser();
|
|
|
627
|
+ $user['max_score'] = db('user_score_log')->where('user_id',$user['id'])->max('after');
|
|
|
628
|
+ $user = $user->visible(['id','score'])->append(['max_score'])->toArray();
|
|
|
629
|
+ $this->success('成功',$user);
|
|
|
630
|
+ }
|
|
|
631
|
+
|
|
|
632
|
+ /**
|
|
|
633
|
+ * @ApiTitle (积分说明)
|
|
|
634
|
+ * @ApiSummary (积分说明)
|
|
|
635
|
+ * @ApiMethod (POST)
|
|
|
636
|
+ *
|
|
|
637
|
+ * @ApiReturn({
|
|
|
638
|
+ "code": 1,
|
|
|
639
|
+ "msg": "成功",
|
|
|
640
|
+ "time": "1599017563",
|
|
|
641
|
+ "data": "积分说明" //积分说明内容
|
|
|
642
|
+ })
|
|
|
643
|
+ */
|
|
|
644
|
+ public function scoreIntro()
|
|
|
645
|
+ {
|
|
|
646
|
+ $content = Db::name('mobile_config')->where('id',1)->value('user_score_intro');
|
|
|
647
|
+ $this->success('成功', $content);
|
|
|
648
|
+ }
|
|
|
649
|
+
|
|
|
650
|
+ /**
|
|
|
651
|
+ * @ApiTitle (积分记录)
|
|
|
652
|
+ * @ApiSummary (积分记录)
|
|
|
653
|
+ * @ApiMethod (POST)
|
|
|
654
|
+ *
|
|
|
655
|
+ * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
656
|
+ * @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
|
|
|
657
|
+ * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
|
|
|
658
|
+ *
|
|
|
659
|
+ * @ApiReturn({
|
|
|
660
|
+ "code": 1,
|
|
|
661
|
+ "msg": "成功",
|
|
|
662
|
+ "time": "1599017563",
|
|
|
663
|
+ "data": "积分说明" //积分说明内容
|
|
|
664
|
+ })
|
|
|
665
|
+ */
|
|
|
666
|
+ public function scoreLog()
|
|
|
667
|
+ {
|
|
|
668
|
+ $list = \app\common\model\ScoreLog::where('user_id',$this->auth->id)
|
|
|
669
|
+ ->order('createtime desc')
|
|
|
670
|
+ ->paginate($page_num,false,['page'=>$page])
|
|
|
671
|
+ ->each(function($v){
|
|
|
672
|
+ $v['createtime'] = date('Y.m.d H:i',$v['createtime']);
|
|
|
673
|
+ })->toArray();
|
|
|
674
|
+ $this->success('成功', $content);
|
|
|
675
|
+ }
|
|
|
676
|
+
|
|
|
677
|
+ /**
|
|
|
678
|
+ * @ApiTitle (海报分享)
|
|
|
679
|
+ * @ApiSummary (海报分享)
|
|
|
680
|
+ * @ApiMethod (POST)
|
|
|
681
|
+ *
|
|
|
682
|
+ * @ApiReturn({
|
|
|
683
|
+ "code": 1,
|
|
|
684
|
+ "msg": "成功",
|
|
|
685
|
+ "time": "1599017563",
|
|
|
686
|
+ "data": "积分说明" //积分说明内容
|
|
|
687
|
+ })
|
|
|
688
|
+ */
|
|
|
689
|
+ public function share()
|
|
|
690
|
+ {
|
|
|
691
|
+ $content = Db::name('mobile_config')->where('id',1)->value('user_score_intro');
|
|
|
692
|
+ $this->success('成功', $content);
|
|
|
693
|
+ }
|
|
|
694
|
+
|
|
|
695
|
+ /**
|
|
|
696
|
+ * @ApiTitle (充值积分-套餐)
|
|
|
697
|
+ * @ApiSummary (充值积分-套餐)
|
|
|
698
|
+ * @ApiMethod (POST)
|
|
|
699
|
+ *
|
|
|
700
|
+ * @ApiReturn({
|
|
|
701
|
+ "code": 1,
|
|
|
702
|
+ "msg": "成功",
|
|
|
703
|
+ "time": "1599017563",
|
|
|
704
|
+ "data": "积分说明" //积分说明内容
|
|
|
705
|
+ })
|
|
|
706
|
+ */
|
|
|
707
|
+ public function scoreSpec()
|
|
|
708
|
+ {
|
|
|
709
|
+ $list = ScoreSpec::select();
|
|
|
710
|
+ $score_recharge_price = Db::name('mobile_config')->where('id',1)->value('score_recharge_price');
|
|
|
711
|
+ $this->success('成功', compact('list','score_recharge_price'));
|
|
|
712
|
+ }
|
|
|
713
|
+
|
|
|
714
|
+ /**
|
|
|
715
|
+ * @ApiTitle (充值积分)
|
|
|
716
|
+ * @ApiSummary (充值积分)
|
|
|
717
|
+ * @ApiMethod (POST)
|
|
|
718
|
+ *
|
|
|
719
|
+ * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
720
|
+ * @ApiParams (name="score_spec_id", type="int", required=false, description="积分套餐ID")
|
|
|
721
|
+ * @ApiParams (name="score", type="int", required=true, description="评价星数")
|
|
|
722
|
+ *
|
|
|
723
|
+ * @ApiReturn({
|
|
|
724
|
+ "code": 1,
|
|
|
725
|
+ "msg": "成功",
|
|
|
726
|
+ "time": "1599017563",
|
|
|
727
|
+ "data": "积分说明" //积分说明内容
|
|
|
728
|
+ })
|
|
|
729
|
+ */
|
|
|
730
|
+ public function scoreRecharge()
|
|
|
731
|
+ {
|
|
|
732
|
+
|
|
|
733
|
+ $content = Db::name('mobile_config')->where('id',1)->value('user_score_intro');
|
|
|
734
|
+ $this->success('成功', $content);
|
|
|
735
|
+ }
|
546
|
} |
736
|
} |