| xqd
@@ -17,6 +17,7 @@ use app\admin\model\study\PlanBuy;
|
|
|
use app\admin\model\study\PlanSteps;
|
|
|
use app\admin\model\study\PlanItems;
|
|
|
use app\wap\model\special\Special as SpecialModel;
|
|
|
+use app\wap\model\special\SpecialWatch as SpecialWatch;
|
|
|
use app\wap\model\store\StoreOrder;
|
|
|
use service\JsonService;
|
|
|
use think\Url;
|
| xqd
@@ -56,7 +57,7 @@ class Studyplan extends AuthController{
|
|
|
$planinfo = Plan::get($id);
|
|
|
if (!$planinfo) $this->failed('参数错误,无法访问', Url::build('index/index'));
|
|
|
$planinfo['introduction'] = htmlspecialchars_decode($planinfo['introduction']);
|
|
|
- $steps = PlanSteps::where('is_del', 0)->where('pid', $id)->select();
|
|
|
+ $steps = PlanSteps::where('is_del', 0)->where('pid', $id)->order('sort asc')->select();
|
|
|
$stepids = [];
|
|
|
$isPay = 0;
|
|
|
$buyinfo = PlanBuy::where('planid', $id)->where('uid', $this->uid)->where('is_del', 0)->find();
|
| xqd
@@ -74,6 +75,7 @@ class Studyplan extends AuthController{
|
|
|
->join($join)
|
|
|
->where('pid', $id)
|
|
|
->where('stepsid', 'in', $stepids)
|
|
|
+ ->order('sort asc')
|
|
|
->select();
|
|
|
foreach ($items as $v) {
|
|
|
$v['count'] = SpecialModel::numberChapters($v['type'], $v['id']);
|
| xqd
@@ -155,4 +157,37 @@ class Studyplan extends AuthController{
|
|
|
return JsonService::fail(StoreOrder::getErrorInfo('订单生成失败!'));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function gotoStudy($id){
|
|
|
+ if (!$id) $this->failed('缺少参数,无法访问', Url::build('index/index'));
|
|
|
+ $planinfo = Plan::get($id);
|
|
|
+ if (!$planinfo) $this->failed('参数错误,无法访问', Url::build('index/index'));
|
|
|
+ $planinfo['introduction'] = htmlspecialchars_decode($planinfo['introduction']);
|
|
|
+ $steps = PlanSteps::where('is_del', 0)->where('pid', $id)->order('sort asc')->select();
|
|
|
+ foreach($steps as $v){
|
|
|
+ $stepids[] = $v['id'];
|
|
|
+ }
|
|
|
+ $join = [
|
|
|
+ ['special s', 's.id = it.cid and s.is_del = 0 and s.status = 1'],
|
|
|
+ ];
|
|
|
+ $items = PlanItems::alias('it')->field('s.*, it.stepsid,it.pid')
|
|
|
+ ->join($join)
|
|
|
+ ->where('pid', $id)
|
|
|
+ ->where('stepsid', 'in', $stepids)
|
|
|
+ ->order('sort asc')
|
|
|
+ ->select();
|
|
|
+ $spids = [];
|
|
|
+ foreach ($items as $v) {
|
|
|
+ $v['count'] = SpecialModel::numberChapters($v['type'], $v['id']);
|
|
|
+ $itemsList[$v['stepsid']][] = $v->toArray();
|
|
|
+ $spids[] = $v['pid'];
|
|
|
+ }
|
|
|
+ $buyinfo = PlanBuy::where('planid', $id)->where('uid', $this->uid)->where('is_del', 0)->find();
|
|
|
+ if (!$buyinfo) {
|
|
|
+ $this->failed('课程尚未购买,非法访问', Url::build('index/index'));
|
|
|
+ }
|
|
|
+ $spids = array_unique($spids);
|
|
|
+ $specialWatchList = SpecialWatch::where('special_id', 'in', $spids)->where('uid', $this->uid)->group('special_id')->order('add_time desc')->select();
|
|
|
+ print_r($specialWatchList);
|
|
|
+ }
|
|
|
}
|