|
@@ -95,17 +95,6 @@ class OrdersController extends BaseController
|
|
*/
|
|
*/
|
|
public function chargeList(Request $request)
|
|
public function chargeList(Request $request)
|
|
{
|
|
{
|
|
- if (!$this->checkUid()) {
|
|
|
|
- return response()->error('QAPP_NOT_LOGIN');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $device = $request->has('device')?$request->get('device'):'';
|
|
|
|
-
|
|
|
|
- // 苹果先不展示充值
|
|
|
|
- if($device == 'iPhone'){
|
|
|
|
- return response()->success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
$res = ProductService::getChargeProduct();
|
|
$res = ProductService::getChargeProduct();
|
|
if (!$res->isEmpty()) {
|
|
if (!$res->isEmpty()) {
|
|
$data = [];
|
|
$data = [];
|
|
@@ -129,7 +118,7 @@ class OrdersController extends BaseController
|
|
];
|
|
];
|
|
$intro2 = [
|
|
$intro2 = [
|
|
['label' => '多送', 'important' => false],
|
|
['label' => '多送', 'important' => false],
|
|
- ['label' => (int)($v->given / 100), 'important' => true],
|
|
|
|
|
|
+ ['label' => (int) ($v->given / 100), 'important' => true],
|
|
['label' => '元', 'important' => false],
|
|
['label' => '元', 'important' => false],
|
|
];
|
|
];
|
|
$v->vip = 0;
|
|
$v->vip = 0;
|
|
@@ -162,7 +151,7 @@ class OrdersController extends BaseController
|
|
}
|
|
}
|
|
$data[] = [
|
|
$data[] = [
|
|
'product_id' => $v->id,
|
|
'product_id' => $v->id,
|
|
- 'price' => (int)$v->price . '元',
|
|
|
|
|
|
+ 'price' => (int) $v->price . '元',
|
|
'vip' => $v->vip,
|
|
'vip' => $v->vip,
|
|
'intro' => $intro,
|
|
'intro' => $intro,
|
|
'intro2' => $intro2,
|
|
'intro2' => $intro2,
|
|
@@ -218,13 +207,8 @@ class OrdersController extends BaseController
|
|
*/
|
|
*/
|
|
public function bookOrderList(Request $request)
|
|
public function bookOrderList(Request $request)
|
|
{
|
|
{
|
|
- if (!$this->checkUid()) {
|
|
|
|
- return response()->error('QAPP_NOT_LOGIN');
|
|
|
|
- }
|
|
|
|
$page_size = $request->input('page_size', 15);
|
|
$page_size = $request->input('page_size', 15);
|
|
$book_order = BookOrderService::getRecord($this->uid, $page_size);
|
|
$book_order = BookOrderService::getRecord($this->uid, $page_size);
|
|
- //$book_order = BookOrder::where('uid', $this->uid)->select('bid', 'uid', 'book_name', 'created_at', 'fee')->paginate($page_size);
|
|
|
|
-
|
|
|
|
return response()->pagination(new BookOrderTransformer(), $book_order);
|
|
return response()->pagination(new BookOrderTransformer(), $book_order);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -275,9 +259,6 @@ class OrdersController extends BaseController
|
|
*/
|
|
*/
|
|
public function chapterOrderList(Request $request)
|
|
public function chapterOrderList(Request $request)
|
|
{
|
|
{
|
|
- if (!$this->checkUid()) {
|
|
|
|
- return response()->error('QAPP_NOT_LOGIN');
|
|
|
|
- }
|
|
|
|
$chapter_model = new ChapterOrderService();
|
|
$chapter_model = new ChapterOrderService();
|
|
$page_size = $request->input('page_size', 15);
|
|
$page_size = $request->input('page_size', 15);
|
|
$chapter_order = $chapter_model->getByUid($this->uid, $page_size);
|
|
$chapter_order = $chapter_model->getByUid($this->uid, $page_size);
|
|
@@ -328,9 +309,6 @@ class OrdersController extends BaseController
|
|
*/
|
|
*/
|
|
public function chargeRecordLists(Request $request)
|
|
public function chargeRecordLists(Request $request)
|
|
{
|
|
{
|
|
- if (!$this->checkUid()) {
|
|
|
|
- return response()->error('QAPP_NOT_LOGIN');
|
|
|
|
- }
|
|
|
|
$page_size = $request->input('page_size', 15);
|
|
$page_size = $request->input('page_size', 15);
|
|
$res = OrderService::getOrderList($this->uid, $page_size);
|
|
$res = OrderService::getOrderList($this->uid, $page_size);
|
|
return response()->pagination(new ChargeListTransformer(), $res);
|
|
return response()->pagination(new ChargeListTransformer(), $res);
|
|
@@ -379,22 +357,13 @@ class OrdersController extends BaseController
|
|
*/
|
|
*/
|
|
function wxindex(Request $request)
|
|
function wxindex(Request $request)
|
|
{
|
|
{
|
|
- Log::info($request->all());
|
|
|
|
$product_id = $request->has('product_id') ? $request->get('product_id') : '';
|
|
$product_id = $request->has('product_id') ? $request->get('product_id') : '';
|
|
$sign = $request->has('sign') ? $request->get('sign') : '';
|
|
$sign = $request->has('sign') ? $request->get('sign') : '';
|
|
$send_order_id = $request->has('send_order_id') ? $request->get('send_order_id') : 0;
|
|
$send_order_id = $request->has('send_order_id') ? $request->get('send_order_id') : 0;
|
|
|
|
|
|
- if (!$this->checkUid()) {
|
|
|
|
- return response()->error('QAPP_NOT_LOGIN');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (empty($product_id) || empty($sign)) {
|
|
if (empty($product_id) || empty($sign)) {
|
|
return response()->error('QAPP_PARAM_ERROR');
|
|
return response()->error('QAPP_PARAM_ERROR');
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (!$this->checkSign($request->all('_url'))) {
|
|
|
|
- //return response()->error('QAPP_PARAM_ERROR');
|
|
|
|
- }
|
|
|
|
$bid = $request->has('bid') ? $request->get('bid') : 0;
|
|
$bid = $request->has('bid') ? $request->get('bid') : 0;
|
|
$openid = $this->openid;
|
|
$openid = $this->openid;
|
|
//$openid = 'o0bsX0b3-kgWIb4JBdTAk7HVtnrk';
|
|
//$openid = 'o0bsX0b3-kgWIb4JBdTAk7HVtnrk';
|
|
@@ -405,9 +374,7 @@ class OrdersController extends BaseController
|
|
$uid = $this->uid;
|
|
$uid = $this->uid;
|
|
$distribution_channel_id = $this->distribution_channel_id;
|
|
$distribution_channel_id = $this->distribution_channel_id;
|
|
$price = $product_info->price * 100;
|
|
$price = $product_info->price * 100;
|
|
- if ($uid < 32) {
|
|
|
|
- //$price = 1;
|
|
|
|
- }
|
|
|
|
|
|
+ if ($uid < 32) { }
|
|
|
|
|
|
if (in_array($uid, explode(',', env('TEST_UID')))) {
|
|
if (in_array($uid, explode(',', env('TEST_UID')))) {
|
|
$price = 1;
|
|
$price = 1;
|
|
@@ -418,7 +385,6 @@ class OrdersController extends BaseController
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
$bid = 0;
|
|
$bid = 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
//$price = 1;
|
|
//$price = 1;
|
|
if ($product_info->type == 'YEAR_ORDER') {
|
|
if ($product_info->type == 'YEAR_ORDER') {
|
|
@@ -445,7 +411,7 @@ class OrdersController extends BaseController
|
|
'order_type' => $order_type,
|
|
'order_type' => $order_type,
|
|
'from_bid' => $bid,
|
|
'from_bid' => $bid,
|
|
'from_type' => 'QuickApp',
|
|
'from_type' => 'QuickApp',
|
|
- 'activity_id'=>0
|
|
|
|
|
|
+ 'activity_id' => 0
|
|
]);
|
|
]);
|
|
Log::info('order is');
|
|
Log::info('order is');
|
|
Log::info($res);
|
|
Log::info($res);
|
|
@@ -482,7 +448,7 @@ class OrdersController extends BaseController
|
|
'appId' => $result->appid,
|
|
'appId' => $result->appid,
|
|
'package' => 'prepay_id=' . $result->prepay_id,
|
|
'package' => 'prepay_id=' . $result->prepay_id,
|
|
'nonceStr' => $result->nonce_str,
|
|
'nonceStr' => $result->nonce_str,
|
|
- 'timeStamp' => (string)time(),
|
|
|
|
|
|
+ 'timeStamp' => (string) time(),
|
|
'signType' => 'MD5',
|
|
'signType' => 'MD5',
|
|
];
|
|
];
|
|
$data['paySign'] = $this->MakeSign($data);
|
|
$data['paySign'] = $this->MakeSign($data);
|
|
@@ -520,20 +486,21 @@ class OrdersController extends BaseController
|
|
*
|
|
*
|
|
* }
|
|
* }
|
|
*/
|
|
*/
|
|
- public function checkOrder(Request $request){
|
|
|
|
- $order = $request->input('order','');
|
|
|
|
|
|
+ public function checkOrder(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $order = $request->input('order', '');
|
|
$i = 0;
|
|
$i = 0;
|
|
$uid = $this->uid;
|
|
$uid = $this->uid;
|
|
- while ($i <= 10){
|
|
|
|
|
|
+ while ($i <= 10) {
|
|
$order_info = OrderService::getByTradeNo($order);
|
|
$order_info = OrderService::getByTradeNo($order);
|
|
- if(!$order_info){
|
|
|
|
|
|
+ if (!$order_info) {
|
|
return response()->error('QAPP_SYS_ERROR');
|
|
return response()->error('QAPP_SYS_ERROR');
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if (isset($order_info->status) && $order_info->status == 'PAID') {
|
|
if (isset($order_info->status) && $order_info->status == 'PAID') {
|
|
$data['balance'] = 0;
|
|
$data['balance'] = 0;
|
|
$user = UserService::getById($uid);
|
|
$user = UserService::getById($uid);
|
|
- if($user){
|
|
|
|
|
|
+ if ($user) {
|
|
$data['balance'] = $user->balance;
|
|
$data['balance'] = $user->balance;
|
|
}
|
|
}
|
|
return response()->success($data);
|
|
return response()->success($data);
|
|
@@ -542,7 +509,6 @@ class OrdersController extends BaseController
|
|
$i++;
|
|
$i++;
|
|
}
|
|
}
|
|
return response()->error('QAPP_SYS_ERROR');
|
|
return response()->error('QAPP_SYS_ERROR');
|
|
-
|
|
|
|
}
|
|
}
|
|
protected function MakeSign($value)
|
|
protected function MakeSign($value)
|
|
{
|
|
{
|
|
@@ -614,7 +580,6 @@ class OrdersController extends BaseController
|
|
$order->pay_end_at = date('Y-m-d H:i:s');
|
|
$order->pay_end_at = date('Y-m-d H:i:s');
|
|
$order->transaction_id = $transaction_id;
|
|
$order->transaction_id = $transaction_id;
|
|
$order->save();
|
|
$order->save();
|
|
-
|
|
|
|
} elseif ($product->type == 'BOOK_ORDER') {
|
|
} elseif ($product->type == 'BOOK_ORDER') {
|
|
Log::info('BOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDER');
|
|
Log::info('BOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDER');
|
|
$order_type = 'BOOK';
|
|
$order_type = 'BOOK';
|
|
@@ -624,7 +589,6 @@ class OrdersController extends BaseController
|
|
$order->pay_end_at = date('Y-m-d H:i:s');
|
|
$order->pay_end_at = date('Y-m-d H:i:s');
|
|
$order->transaction_id = $transaction_id;
|
|
$order->transaction_id = $transaction_id;
|
|
$order->save();
|
|
$order->save();
|
|
-
|
|
|
|
} elseif ($product->type == 'TICKET_RECHARGE') {
|
|
} elseif ($product->type == 'TICKET_RECHARGE') {
|
|
Log::info('TICKET_RECHARGETICKET_RECHARGETICKET_RECHARGETICKET_RECHARGETICKET_RECHARGE');
|
|
Log::info('TICKET_RECHARGETICKET_RECHARGETICKET_RECHARGETICKET_RECHARGETICKET_RECHARGE');
|
|
$order_type = 'RECHARGE';
|
|
$order_type = 'RECHARGE';
|
|
@@ -634,7 +598,6 @@ class OrdersController extends BaseController
|
|
$order->pay_end_at = date('Y-m-d H:i:s');
|
|
$order->pay_end_at = date('Y-m-d H:i:s');
|
|
$order->transaction_id = $transaction_id;
|
|
$order->transaction_id = $transaction_id;
|
|
$order->save();
|
|
$order->save();
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
DB::rollback();
|
|
DB::rollback();
|
|
return 'Order not exist.';
|
|
return 'Order not exist.';
|
|
@@ -715,5 +678,4 @@ class OrdersController extends BaseController
|
|
$data['pay_end_at'] = '0000-00-00 00:00:00';
|
|
$data['pay_end_at'] = '0000-00-00 00:00:00';
|
|
return OrderService::save_order($data);
|
|
return OrderService::save_order($data);
|
|
}
|
|
}
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+}
|