作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

11

@@ -248,4 +248,25 @@ class Order extends Api @@ -248,4 +248,25 @@ class Order extends Api
248 if ($order['refund_status'] == 1) return self::setErrorInfo('正在申请退款中!'); 248 if ($order['refund_status'] == 1) return self::setErrorInfo('正在申请退款中!');
249 if ($order['status'] == 1) return self::setErrorInfo('订单当前无法退款!'); 249 if ($order['status'] == 1) return self::setErrorInfo('订单当前无法退款!');
250 } 250 }
  251 +
  252 + /**
  253 + * 我的订单-评价
  254 + * @ApiMethod (POST)
  255 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  256 + * @ApiParams (name="order_id", type="integer", required=true, description="订单ID")
  257 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  258 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  259 + * @ApiReturnParams (name="data", type="object", description="扩展数据返回")
  260 + * @ApiReturn ({
  261 + 'code':'1',
  262 + 'msg':'返回成功'
  263 + })
  264 + */
  265 + public function appraise()
  266 + {
  267 + $post = $this->request->post();
  268 + if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
  269 + $this->error($this->model->getError());
  270 + }
  271 + }
251 } 272 }
@@ -18,11 +18,8 @@ class Test extends Api @@ -18,11 +18,8 @@ class Test extends Api
18 /** 18 /**
19 * 测试方法 19 * 测试方法
20 */ 20 */
21 - public function test(){  
22 - $reason = config('site.refundreason') ?: [];//退款理由  
23 - $reason = str_replace("\r\n", "\n", $reason);//防止不兼容  
24 - $reason = explode("\n", $reason);  
25 - halt($reason); 21 + public function test($user_id,$sup='+'){
  22 + \app\common\model\User::score($sup.$order['score'],$user_id,'测试');
26 } 23 }
27 24
28 25
@@ -22,6 +22,7 @@ class User extends Api @@ -22,6 +22,7 @@ class User extends Api
22 public function _initialize() 22 public function _initialize()
23 { 23 {
24 parent::_initialize(); 24 parent::_initialize();
  25 + $this->model = model('app\common\model\User');
25 $this->user = $this->auth->getUser(); 26 $this->user = $this->auth->getUser();
26 } 27 }
27 28
@@ -40,7 +41,7 @@ class User extends Api @@ -40,7 +41,7 @@ class User extends Api
40 public function index() 41 public function index()
41 { 42 {
42 // 当前用户信息 43 // 当前用户信息
43 - $user = $this->auth->getUser(); 44 + $user = $this->user;
44 $coupon_count = \app\common\model\UserCoupon::alias('uc') 45 $coupon_count = \app\common\model\UserCoupon::alias('uc')
45 ->join('coupon c','c.id = uc.coupon_id') 46 ->join('coupon c','c.id = uc.coupon_id')
46 ->where('uc.user_id',$this->user['id']) 47 ->where('uc.user_id',$this->user['id'])
@@ -73,8 +74,8 @@ class User extends Api @@ -73,8 +74,8 @@ class User extends Api
73 // $session = Wechat::miniProgram()->auth->session($code); 74 // $session = Wechat::miniProgram()->auth->session($code);
74 // // 自动注册用户 75 // // 自动注册用户
75 // $userInfo = json_decode(htmlspecialchars_decode($user_info), true); 76 // $userInfo = json_decode(htmlspecialchars_decode($user_info), true);
76 - // if (!$user = UserModel::get(['openid' => $session['openid']])) {  
77 - // $user = new UserModel; 77 + // if (!$user = $this->model->get(['openid' => $session['openid']])) {
  78 + // $user = $this->model;
78 // $userInfo['openid'] = $session['openid']; 79 // $userInfo['openid'] = $session['openid'];
79 // } 80 // }
80 // $userInfo['nickname'] = preg_replace('/[\xf0-\xf7].{3}/', '', $userInfo['nickname']); 81 // $userInfo['nickname'] = preg_replace('/[\xf0-\xf7].{3}/', '', $userInfo['nickname']);
@@ -84,7 +85,7 @@ class User extends Api @@ -84,7 +85,7 @@ class User extends Api
84 $session = [ 85 $session = [
85 'openid' => $testopenid ?: 'test', 86 'openid' => $testopenid ?: 'test',
86 ]; 87 ];
87 - $user = UserModel::get(['openid' => $session['openid']]); 88 + $user = $this->model->get(['openid' => $session['openid']]);
88 // 生成token (session3rd) 89 // 生成token (session3rd)
89 $guid = guidv4();// 生成一个不会重复的随机字符串 90 $guid = guidv4();// 生成一个不会重复的随机字符串
90 $timeStamp = microtime(true);// 当前时间戳 (精确到毫秒) 91 $timeStamp = microtime(true);// 当前时间戳 (精确到毫秒)
@@ -143,7 +144,7 @@ class User extends Api @@ -143,7 +144,7 @@ class User extends Api
143 if (!Validate::regex($mobile, "^1\d{10}$")) { 144 if (!Validate::regex($mobile, "^1\d{10}$")) {
144 $this->error(__('Mobile is incorrect')); 145 $this->error(__('Mobile is incorrect'));
145 } 146 }
146 - if (UserModel::where('mobile', $mobile)->where('id', '<>', $this->user['id'])->find()) { 147 + if ($this->model->where('mobile', $mobile)->where('id', '<>', $this->user['id'])->find()) {
147 $this->error(__('Mobile already exists')); 148 $this->error(__('Mobile already exists'));
148 } 149 }
149 // $result = Sms::check($mobile, $captcha, 'changemobile'); 150 // $result = Sms::check($mobile, $captcha, 'changemobile');
@@ -176,7 +177,7 @@ class User extends Api @@ -176,7 +177,7 @@ class User extends Api
176 */ 177 */
177 public function scoreLog(){ 178 public function scoreLog(){
178 $page = $this->request->request('page'); 179 $page = $this->request->request('page');
179 - $list = UserModel::scoreLog($this->user['id'],$page); 180 + $list = $this->model->scoreLog($this->user['id'],$page);
180 $this->success(__('成功'),compact('list')); 181 $this->success(__('成功'),compact('list'));
181 } 182 }
182 183
@@ -54,7 +54,7 @@ class User extends Model @@ -54,7 +54,7 @@ class User extends Model
54 /** 54 /**
55 * 积分记录 55 * 积分记录
56 */ 56 */
57 - public static function scoreLog($user_id,$page) 57 + public function scoreLog($user_id,$page)
58 { 58 {
59 return ScoreLog::where('user_id',$user_id) 59 return ScoreLog::where('user_id',$user_id)
60 ->order(['createtime' => 'desc']) 60 ->order(['createtime' => 'desc'])