...
|
...
|
@@ -6,21 +6,12 @@ use think\Db; |
|
|
use think\Exception;
|
|
|
use think\exception\PDOException;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\library\Sms as Smslib;
|
|
|
use app\mobile\controller\Sms;
|
|
|
use app\mobile\model\CompanyUser;
|
|
|
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;
|
|
|
use app\mobile\model\ScoreOrder;
|
|
|
use app\mobile\model\QuestionCollect;
|
|
|
use app\mobile\model\CourseCollect;
|
|
|
use app\mobile\model\QuestionNote;
|
|
|
use app\mobile\model\Message;
|
|
|
use app\mobile\model\Feedback;
|
|
|
use app\mobile\model\Problem;
|
|
|
use app\mobile\model\Package;
|
|
|
use app\mobile\model\PackageOrder;
|
|
|
use addons\epay\library\Service;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -47,7 +38,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (67)
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiTitle (我的密卷)
|
|
|
* @ApiSummary (我的密卷)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -94,7 +85,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (65)
|
|
|
* @ApiWeigh (97)
|
|
|
* @ApiTitle (我的课程)
|
|
|
* @ApiSummary (我的课程)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -147,7 +138,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiWeigh (95)
|
|
|
* @ApiTitle (企业成员管理)
|
|
|
* @ApiSummary (企业成员管理)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -189,7 +180,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiWeigh (93)
|
|
|
* @ApiTitle (企业成员管理-同意加入)
|
|
|
* @ApiSummary (企业成员管理-同意加入)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -215,7 +206,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiWeigh (91)
|
|
|
* @ApiTitle (企业成员管理-拒绝加入)
|
|
|
* @ApiSummary (企业成员管理-拒绝加入)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -241,7 +232,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiWeigh (89)
|
|
|
* @ApiTitle (企业成员管理-移出团队)
|
|
|
* @ApiSummary (企业成员管理-移出团队)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -267,7 +258,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiWeigh (87)
|
|
|
* @ApiTitle (企业成员管理-企业邀请码)
|
|
|
* @ApiSummary (企业成员管理-企业邀请码)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -290,7 +281,7 @@ class Company extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (99)
|
|
|
* @ApiWeigh (85)
|
|
|
* @ApiTitle (企业成员管理-更新企业邀请码)
|
|
|
* @ApiSummary (企业成员管理-更新企业邀请码)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -311,4 +302,83 @@ class Company extends Api |
|
|
$invite_code = (new User)->setInviteCode($this->company_id);
|
|
|
$this->success('更新邀请码成功',compact('invite_code'));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (83)
|
|
|
* @ApiTitle (企业套餐)
|
|
|
* @ApiSummary (企业套餐)
|
|
|
* @ApiMethod (POST)
|
|
|
*
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="is_buy", type="inter", required=false, description="0=未购买,1=已购买")
|
|
|
* @ApiParams (name="order", type="inter", required=false, description="排序方式:0=最新,1=购买最多,2=价格最低,3=优惠最大")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1600167441",
|
|
|
"data": {
|
|
|
"invite_code": 376581, //企业邀请码
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function package()
|
|
|
{
|
|
|
$user_id = $this->auth->id;
|
|
|
$is_buy = $this->request->param('is_buy',0);
|
|
|
$order = $this->request->param('order',0);
|
|
|
switch ($order) {
|
|
|
case 0:
|
|
|
$order = ['p.createtime' => 'desc'];
|
|
|
break;
|
|
|
case 1:
|
|
|
$order = ['buy_num' => 'desc'];
|
|
|
break;
|
|
|
case 2:
|
|
|
$order = ['p.current_price' => 'asc'];
|
|
|
break;
|
|
|
case 3:
|
|
|
$order = ['preferential_price' => 'asc'];
|
|
|
break;
|
|
|
}
|
|
|
$package_order = Db::name('mobile_package_order')
|
|
|
->where('pay_status','1')
|
|
|
->field('id,package_id,people_num')
|
|
|
->order(['is_top'=>'desc','people_num'=>'desc'])
|
|
|
->limit(1)
|
|
|
->buildSql();
|
|
|
$list = Package::alias('p')
|
|
|
->join(['select id,package_id,people_num from mobile_package_order where pay_status = 1 and user_id = '.$user_id.'and pay_status = 1 order by is_top,people_num desc limit 1'=>'po'],'p.id = po.package_id','left')
|
|
|
->join('mobile_package_cart pc','pc.package_id = p.id and pc.user_id='.$user_id,'left')
|
|
|
->field("
|
|
|
p.*,
|
|
|
if(po.id > 0,1,0) is_buy,
|
|
|
if(pc.id > 0,1,0) is_add_cart,
|
|
|
IFNULL((select SUM(current_price) from fa_mobile_secret where id in (p.secret_ids)),0) +
|
|
|
IFNULL((select SUM(current_price) from fa_mobile_course where id in (p.course_ids)),0) original_price,
|
|
|
p.buy_num_virtual + p.buy_num_real buy_num,
|
|
|
IFNULL((select SUM(current_price) from fa_mobile_secret where id in (p.secret_ids)),0) +
|
|
|
IFNULL((select SUM(current_price) from fa_mobile_course where id in (p.course_ids)),0) - p.current_price preferential_price
|
|
|
")
|
|
|
->order($order)
|
|
|
->having("is_buy = {$is_buy}")
|
|
|
->select();
|
|
|
// halt(Package::getLastSql());
|
|
|
foreach ($list as $v) {
|
|
|
$v->visible([
|
|
|
'id',
|
|
|
'title',
|
|
|
'current_price',
|
|
|
])->append([
|
|
|
'is_buy',
|
|
|
'is_add_cart',
|
|
|
'original_price',
|
|
|
'buy_num',
|
|
|
'preferential_price',
|
|
|
'secret_list',
|
|
|
'course_list',
|
|
|
]);
|
|
|
}
|
|
|
$this->success('成功',$list);
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|