...
|
...
|
@@ -16,6 +16,9 @@ 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 addons\epay\library\Service;
|
|
|
|
|
|
/**
|
|
|
* 我的接口
|
...
|
...
|
@@ -665,13 +668,15 @@ class User extends Api |
|
|
*/
|
|
|
public function scoreLog()
|
|
|
{
|
|
|
$page = $this->request->param('page', 1, 'intval');
|
|
|
$page_num = $this->request->param('page_num', 10, 'intval');
|
|
|
$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);
|
|
|
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -712,13 +717,49 @@ class User extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @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=false, description="自定义积分")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1599046220",
|
|
|
"data": {
|
|
|
"id": 1, //试卷ID
|
|
|
"title": "测试试卷", //试卷标题
|
|
|
"year": 2015, //年费(单位:年)
|
|
|
"time": 100, //答题时间(单位:分)
|
|
|
"pass_score": 80, //合格分数
|
|
|
"description": "这个还行", //试卷描述
|
|
|
"do_num": 10, //回答人数
|
|
|
"full_score": 100 //试卷分数(单位:分)
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function scoreRechargeView()
|
|
|
{
|
|
|
$param = $this->request->param();
|
|
|
$model = new ScoreOrder;
|
|
|
if(!$order = $model->payView($this->auth->getUser(),$param)){
|
|
|
$this->error($model->getError(),null,$this->model->getCode());
|
|
|
}
|
|
|
$this->success(__('成功'),$order);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @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="评价星数")
|
|
|
* @ApiParams (name="score", type="int", required=false, description="自定义积分")
|
|
|
* @ApiParams (name="pay_type", type="string", required=true, description="支付方式:wechat=微信,alipay=支付宝")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
...
|
...
|
@@ -729,8 +770,50 @@ class User extends Api |
|
|
*/
|
|
|
public function scoreRecharge()
|
|
|
{
|
|
|
$param = $this->request->param();
|
|
|
$model = new ScoreOrder;
|
|
|
if(!$order = $model->payView($this->auth->getUser(),$param)){
|
|
|
$this->error($model->getError(),null,$this->model->getCode());
|
|
|
}
|
|
|
if (!$param['pay_type'] || !in_array($param['pay_type'], ['alipay', 'wechat'])) {
|
|
|
$this->error("请选择支付方式");
|
|
|
}
|
|
|
// 创建订单
|
|
|
$model->add($this->auth->getUser(), $order, $param['pay_type']);
|
|
|
//回调链接
|
|
|
$notifyurl = $this->request->root(true) . '/mobile/notify/notifyScore/paytype/' . $param['pay_type'];
|
|
|
$payment = Service::submitOrder($model['pay_price'], $model['order_sn'], $param['pay_type'], '积分', $notifyurl, null, 'app');
|
|
|
$this->success('成功',$payment);
|
|
|
}
|
|
|
|
|
|
$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 collectQuestionList()
|
|
|
{
|
|
|
$page = $this->request->param('page', 1, 'intval');
|
|
|
$page_num = $this->request->param('page_num', 10, 'intval');
|
|
|
$data = QuestionCollect::with(['question'])
|
|
|
->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']);
|
|
|
$v->getRelation('question')->visible(['title','type']);
|
|
|
})->toArray();
|
|
|
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|