作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

个人中心接口

@@ -61,7 +61,7 @@ class GoodsController extends RestBaseController @@ -61,7 +61,7 @@ class GoodsController extends RestBaseController
61 * @param name:address_id type:int require:1 other: desc:收货地址id 61 * @param name:address_id type:int require:1 other: desc:收货地址id
62 * @param name:remark type:text require:0 other: desc:备注 62 * @param name:remark type:text require:0 other: desc:备注
63 * @param name:count type:int require:1 other: desc:商品数量 63 * @param name:count type:int require:1 other: desc:商品数量
64 - * @param name:price type:int require:1 other: desc:商品数量 64 + * @param name:price type:int require:1 other: desc:实付金额
65 */ 65 */
66 public function orderPost() 66 public function orderPost()
67 { 67 {
@@ -82,7 +82,7 @@ class GoodsController extends RestBaseController @@ -82,7 +82,7 @@ class GoodsController extends RestBaseController
82 ]); 82 ]);
83 if ($re) { 83 if ($re) {
84 Db::name('user')->where('id',$this->getUserId())->setDec('score',$param['score']); 84 Db::name('user')->where('id',$this->getUserId())->setDec('score',$param['score']);
85 - Db::name('user_score_log')->insert(['user_id'=>$this->getUserId(),'score'=>$param['score'],'action'=>'消费','now_score'=>$user_score-$param]); 85 + Db::name('user_score_log')->insert(['user_id'=>$this->getUserId(),'score'=>-$param['score'],'action'=>'消费','now_score'=>$user_score-$param]);
86 $this->success('兑换成功',1); 86 $this->success('兑换成功',1);
87 }else{ 87 }else{
88 $this->error('兑换失败',3); 88 $this->error('兑换失败',3);
@@ -11,8 +11,6 @@ use think\Db; @@ -11,8 +11,6 @@ use think\Db;
11 /** 11 /**
12 * @title 我的 12 * @title 我的
13 * @description 个人中心相关接口 13 * @description 个人中心相关接口
14 - * @header name:key require:1 default: desc:秘钥(区别设置)  
15 - * @param name:public type:int require:1 default:1 other: desc:公共参数(区别设置)  
16 */ 14 */
17 class UserController extends RestBaseController 15 class UserController extends RestBaseController
18 { 16 {
@@ -22,7 +20,7 @@ class UserController extends RestBaseController @@ -22,7 +20,7 @@ class UserController extends RestBaseController
22 * @author panhaowen 20 * @author panhaowen
23 * @url /portal/User/info 21 * @url /portal/User/info
24 * @method POST 22 * @method POST
25 - * @param 23 + * @header name:XX-Token require:1 default: desc:token
26 */ 24 */
27 public function info() 25 public function info()
28 { 26 {
@@ -30,8 +28,17 @@ class UserController extends RestBaseController @@ -30,8 +28,17 @@ class UserController extends RestBaseController
30 $data['now_weight']=Db::name('user_week_sign')->where('user_id',$this->getUserId())->order('create_time','desc')->limit(1)['weight']; 28 $data['now_weight']=Db::name('user_week_sign')->where('user_id',$this->getUserId())->order('create_time','desc')->limit(1)['weight'];
31 $this->success('我的健康档案',$data); 29 $this->success('我的健康档案',$data);
32 } 30 }
33 - 31 + /**
  32 + * @title 我的积分管理
  33 + * @description 积分记录接口
  34 + * @author panhaowen
  35 + * @url /portal/User/info
  36 + * @method POST
  37 + * @header name:XX-Token require:1 default: desc:token
  38 + */
34 public function scoreLog(){ 39 public function scoreLog(){
35 - $data=1; 40 + $data=Db::name('user_score_log')->where('user_id',$this->getUserId())->select();
  41 + Db::name('user_score_log')->insert(['score'=>-1]);
  42 + $this->success('我的健康档案',$data);
36 } 43 }
37 } 44 }