| xqd
@@ -167,9 +167,9 @@ class PayController extends Controller
|
|
|
$order->save();
|
|
|
|
|
|
//记日志
|
|
|
-// $this->logAccount($tp, $u->id, $u->name,
|
|
|
-// AccountLog::OP_CHARGE, $cType, $master_amount,
|
|
|
-// AccountLog::DIRECTION_INC, $cType == AccountLog::TYPE_BALANCE ? $u->balance : $u->credit, AccountLog::CHANNEL_WECHATPAY);
|
|
|
+ $this->logAccount($tp, $u->id, $u->name,
|
|
|
+ AccountLog::OP_CHARGE, $cType, $master_amount,
|
|
|
+ AccountLog::DIRECTION_INC, $cType == AccountLog::TYPE_BALANCE ? $u->balance : $u->credit, AccountLog::CHANNEL_WECHATPAY);
|
|
|
|
|
|
\Log::info('支付完成');
|
|
|
|
| xqd
@@ -199,7 +199,7 @@ class PayController extends Controller
|
|
|
/**
|
|
|
* @api {post} /api/pay/charge 充值
|
|
|
* @apiDescription 充值(向平台充值)
|
|
|
- * @apiGroup Merchant
|
|
|
+ * @apiGroup User
|
|
|
* @apiPermission Passport
|
|
|
* @apiVersion 0.1.0
|
|
|
* @apiParam {int} [goods=1] 充值商品(1:梦想币)
|
| xqd
@@ -289,4 +289,91 @@ class PayController extends Controller
|
|
|
return $this->api($result);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @api {post} /api/pay/order_status 订单状态查询
|
|
|
+ * @apiDescription 订单状态查询
|
|
|
+ * @apiGroup User
|
|
|
+ * @apiPermission Passport
|
|
|
+ * @apiVersion 0.1.0
|
|
|
+ * @apiParam {int} [goods=1] 充值商品(1:梦想币)
|
|
|
+ * @apiParam {int} number 充值数量,人民币,以分表示
|
|
|
+ * @apiParam {int} type 支付类型(1:支付宝,2:微信支付)
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
+ * {
|
|
|
+ * "state": true,
|
|
|
+ * "code": 0,
|
|
|
+ * "message": "",
|
|
|
+ * "data": {
|
|
|
+ * "id": 2,
|
|
|
+ * "code": "ALIPAY_201610231314145719",
|
|
|
+ * "transaction_id": "201610231314145719",
|
|
|
+ * "user_type": 2,
|
|
|
+ * "user_id": 1,
|
|
|
+ * "goods_type": 1,
|
|
|
+ * "price": 1,
|
|
|
+ * "number": 1,
|
|
|
+ * "amount": 1,
|
|
|
+ * "pay_type": 1,
|
|
|
+ * "status": 0,
|
|
|
+ * "created_at": "2016-10-23 13:14:14",
|
|
|
+ * "updated_at": "2016-10-23 13:14:14",
|
|
|
+ * "orderString": "alipay_sdk=lokielse%2Fomnipay-alipay&app_id=2016091201894867&biz_content=%7B%22subject%22%3A%22%5Cu7532%5Cu8c61%5Cu8054%5Cu5408-%5Cu4f59%5Cu989d%5Cu5145%5Cu503c%22%2C%22out_trade_no%22%3A%22201610231314145719%22%2C%22total_amount%22%3A0.01%2C%22product_code%22%3A1%7D&charset=UTF-8&format=JSON&method=alipay.trade.app.pay¬ify_url=http%3A%2F%2Fweb%2Fapi%2Fpay%2Falipay%2Fnotify&sign_type=RSA×tamp=2016-10-23+13%3A14%3A14&version=1.0&sign=oxKM0qGMHLWDlMrXHIiy9%2Fk2BXJq3rC3RKdmcfFwkBJVRXvtG6cBoAYPll6VxJYOMQWeu78Ibfov%2FxIVCuN9yUfzEiokfQrzBoptc94bCQ5k0pNyJcSdgezOUKHB12P5Zmm3Hd6AAbGRDV9UCaLVz0wYkFJPrCyUv1ZfhrM%2BBqc%3D"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
+ * HTTP/1.1 400 Bad Request
|
|
|
+ * {
|
|
|
+ * "state": false,
|
|
|
+ * "code": 1000,
|
|
|
+ * "message": "传入参数不正确",
|
|
|
+ * "data": null or []
|
|
|
+ * }
|
|
|
+ * 可能出现的错误代码:
|
|
|
+ * 1000 CLIENT_WRONG_PARAMS 传入参数不正确
|
|
|
+ */
|
|
|
+
|
|
|
+ public function orderStatus(Request $request)
|
|
|
+ {
|
|
|
+
|
|
|
+ $validator = Validator::make($data = $request->all(),
|
|
|
+ [
|
|
|
+ 'number' => 'required|integer|min:1',
|
|
|
+ 'type' => 'required|in:' . join(',', $pTypes),
|
|
|
+ 'goods' => 'in:' . join(',', $gTypes),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'number.required' => '请输入梦想币数量',
|
|
|
+ 'number.integer' => '梦想币数量必须为整数',
|
|
|
+ 'number.min' => '充值梦想币数量至少为1',
|
|
|
+ 'type.required' => '支付类型必填',
|
|
|
+ 'type.in' => '支付类型非法',
|
|
|
+ 'goods.in' => '充值商品非法',
|
|
|
+ ]
|
|
|
+ );
|
|
|
+
|
|
|
+ if ($validator->fails()) {
|
|
|
+ return $this->validatorError($validator->messages()->all(), ErrorCode::CLIENT_WRONG_PARAMS);
|
|
|
+ }
|
|
|
+ $order = new OrderInfoModel();
|
|
|
+ $order->code = $data['code'];
|
|
|
+ $order->transaction_id = $data['transaction_id'];
|
|
|
+ $order->user_id = $data['user_id'];
|
|
|
+ $order->goods_id = $data['goods_id'];
|
|
|
+ $order->price = $data['price'];
|
|
|
+ $order->number = $data['number'];
|
|
|
+ $order->amount = $data['amount'];
|
|
|
+ $order->pay_type = $data['pay_type'];
|
|
|
+ if (isset($data['ext_info'])) {
|
|
|
+ $order->ext_info = $data['ext_info'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($order->save()) {
|
|
|
+ return $order->find($order->id);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|