审查视图

api/portal/controller/UserController.php 2.0 KB
1  
潘浩文 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
namespace api\portal\controller;

use cmf\controller\RestBaseController;
use think\Db;
/**
 * @title 我的
 * @description 个人中心相关接口
 */
class UserController extends RestBaseController
{
    /**
     * @title 我的健康档案
     * @description 健康档案页渲染
     * @author panhaowen
     * @url /portal/User/info
     * @method POST
潘浩文 authored
23
     * @header name:XX-Token require:1 default: desc:token
1  
潘浩文 authored
24 25 26 27
     */
    public function info()
    {
        $data=Db::name('user')->where('id',$this->getUserId())->field('age,height,before_weight,last_yuejin_time,pregnant_week,weight_level')->find();
潘浩文 authored
28
        $data['now_weight']=Db::name('user_week_sign')->where('user_id',$this->getUserId())->order('create_time','desc')->find()['weight'];
1  
潘浩文 authored
29 30
        $this->success('我的健康档案',$data);
    }
潘浩文 authored
31 32 33 34
    /**
     * @title 我的积分管理
     * @description 积分记录接口
     * @author panhaowen
潘浩文 authored
35
     * @url /portal/User/scoreLog
潘浩文 authored
36 37 38
     * @method POST
     * @header name:XX-Token require:1 default: desc:token
     */
1  
潘浩文 authored
39
    public function  scoreLog(){
潘浩文 authored
40 41 42
        $data=Db::name('user_score_log')->where('user_id',$this->getUserId())->select();
        Db::name('user_score_log')->insert(['score'=>-1]);
        $this->success('我的健康档案',$data);
1  
潘浩文 authored
43
    }
潘浩文 authored
44 45 46 47 48 49 50 51 52 53 54
    /**
     * @title 注册信息提交
     * @description 注册信息提交接口
     * @author panhaowen
     * @url /portal/User/registerPost
     * @method POST
     * @header name:XX-Token require:1 default: desc:token
     */
    public function  registerPost(){
        $param=$this->request->param();
        $param['status']=1;
潘浩文 authored
55 56
        Db::name('user')->where('id')->update($param);
        $this->success('提交成功');
潘浩文 authored
57
    }
1  
潘浩文 authored
58
}