|
@@ -2,6 +2,10 @@
|
|
|
|
|
|
namespace App\Http\Controllers\Wap\Pay;
|
|
|
|
|
|
+use App\Client\Pay\BookOrderPaySuccess;
|
|
|
+use App\Client\Pay\ForeverOrderPaySuccess;
|
|
|
+use App\Client\Pay\RechargeOrderPaySuccess;
|
|
|
+use App\Client\Pay\YearOrderPaySuccess;
|
|
|
use App\Modules\Book\Services\BookGiftsService;
|
|
|
use App\Modules\Book\Services\ChapterService;
|
|
|
use App\Modules\OfficialAccount\Services\OfficialAccountService;
|
|
@@ -36,6 +40,7 @@ use App\Libs\AliSMS;
|
|
|
use App\Libs\Pay\Merchants\UnionPay;
|
|
|
use App\Modules\Activity\Services\ActivityService;
|
|
|
use App\Modules\SendOrder\Services\SendOrderService;
|
|
|
+use App\Modules\Subscribe\Models\Order;
|
|
|
use GuzzleHttp\Client;
|
|
|
|
|
|
class OrdersController extends Controller
|
|
@@ -1127,88 +1132,34 @@ class OrdersController extends Controller
|
|
|
}
|
|
|
DB::beginTransaction();
|
|
|
try {
|
|
|
+
|
|
|
$uid = $order->uid;
|
|
|
$distribution_channel_id = $order->distribution_channel_id;
|
|
|
$product_id = $order->product_id;
|
|
|
$product = ProductService::getProductSingle($product_id);
|
|
|
- $send_order_id = $order->send_order_id;
|
|
|
- $create_ip = $order->create_ip;
|
|
|
+ switch ($product->type) {
|
|
|
+ case 'YEAR_ORDER':
|
|
|
+ $instance = new YearOrderPaySuccess($order);
|
|
|
+ break;
|
|
|
+ case 'BOOK_ORDER':
|
|
|
+ $instance = new BookOrderPaySuccess($order);
|
|
|
+ break;
|
|
|
+ case 'TICKET_RECHARGE':
|
|
|
+ $instance = new RechargeOrderPaySuccess($order);
|
|
|
+ break;
|
|
|
+ case 'FOREVER':
|
|
|
+ $instance = new ForeverOrderPaySuccess($order);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $instance->success();
|
|
|
$price = $product->price;
|
|
|
- $bid = $order->from_bid;
|
|
|
- //$this->updateOrderTotal($trade_no,$transaction_id);
|
|
|
$prize_fee = (int) (($product->price * 100) * 0.1);
|
|
|
$this->substituteOrderPrice($order->id, $prize_fee);
|
|
|
$this->smartPushTestBookPaidUv($order->from_bid, $order->uid, $order->price);
|
|
|
- //获取用户充值次数
|
|
|
- $order->pay_type = $this->getChargeTimes($order->uid);
|
|
|
- // 更新其他定制Order表
|
|
|
- if ($product->type == 'YEAR_ORDER') {
|
|
|
- Log::info('YEAR_ORDERYEAR_ORDERYEAR_ORDERYEAR_ORDERYEAR_ORDERYEAR_ORDERYEAR_ORDERYEAR_ORDER');
|
|
|
- $order_type = 'YEAR';
|
|
|
- $this->yearOrder($uid, $distribution_channel_id, $price, $send_order_id);
|
|
|
- $order->order_type = $order_type;
|
|
|
- $order->status = 'PAID';
|
|
|
- $order->pay_end_at = date('Y-m-d H:i:s');
|
|
|
- $order->save();
|
|
|
- //$price = $price/100;
|
|
|
- /*
|
|
|
- $this->createOrder(
|
|
|
- compact(
|
|
|
- 'uid','distribution_channel_id','product_id','price','trade_no','send_order_id','order_type','pay_merchant_source',
|
|
|
- 'pay_merchant_id','create_ip','bid','transaction_id'
|
|
|
- )
|
|
|
- );*/
|
|
|
- } elseif ($product->type == 'BOOK_ORDER') {
|
|
|
- Log::info('BOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDERBOOK_ORDER');
|
|
|
- $order_type = 'BOOK';
|
|
|
- $this->bookOrder($product_id, $uid, $send_order_id, $price, $distribution_channel_id);
|
|
|
- $order->order_type = $order_type;
|
|
|
- $order->status = 'PAID';
|
|
|
- $order->pay_end_at = date('Y-m-d H:i:s');
|
|
|
- $order->save();
|
|
|
- //$price = $price/100;
|
|
|
- /*
|
|
|
- $this->createOrder(
|
|
|
- compact(
|
|
|
- 'uid','distribution_channel_id','product_id','price','trade_no','send_order_id','order_type','pay_merchant_source',
|
|
|
- 'pay_merchant_id','create_ip','bid','transaction_id'
|
|
|
- )
|
|
|
- );*/
|
|
|
- } elseif ($product->type == 'TICKET_RECHARGE') {
|
|
|
- Log::info('TICKET_RECHARGETICKET_RECHARGETICKET_RECHARGETICKET_RECHARGETICKET_RECHARGE');
|
|
|
- $order_type = 'RECHARGE';
|
|
|
- $this->userCharge($product, $uid);
|
|
|
- $order->order_type = $order_type;
|
|
|
- $order->status = 'PAID';
|
|
|
- $order->pay_end_at = date('Y-m-d H:i:s');
|
|
|
- $order->save();
|
|
|
- //$price = $price/100;
|
|
|
- /*
|
|
|
- $this->createOrder(
|
|
|
- compact(
|
|
|
- 'uid','distribution_channel_id','product_id','price','trade_no','send_order_id','order_type','pay_merchant_source',
|
|
|
- 'pay_merchant_id','create_ip','bid','transaction_id'
|
|
|
- ));*/
|
|
|
- } elseif ($product->type == 'FOREVER') {
|
|
|
- Log::info('FOREVER------------------------FOREVER');
|
|
|
- $order_type = 'FOREVER';
|
|
|
- $this->foreverFreeOrder($uid, $distribution_channel_id, $price, $send_order_id);
|
|
|
- $order->order_type = $order_type;
|
|
|
- $order->status = 'PAID';
|
|
|
- $order->pay_end_at = date('Y-m-d H:i:s');
|
|
|
-
|
|
|
- $order->save();
|
|
|
- } else {
|
|
|
- DB::rollback();
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
$this->successPayPushMsg($uid, $product, $order->id);
|
|
|
$this->orderStatistical($order);
|
|
|
$key = 'leyuee:to_send_not_pay_uid:distribution_channel_id:' . $distribution_channel_id;
|
|
|
Redis::hdel($key, $uid);
|
|
|
- DB::commit();
|
|
|
- //$this->huaweiActivity($order->activity_id,$uid,$product_id);
|
|
|
// 注册动作-》回调订单
|
|
|
$action_type = 'CallBackOrder';
|
|
|
$param = [
|
|
@@ -1222,7 +1173,6 @@ class OrdersController extends Controller
|
|
|
$this->exchangeUpdateAndCreated($order->id);
|
|
|
return true;
|
|
|
} catch (\Exception $e) {
|
|
|
- DB::rollback();
|
|
|
return false;
|
|
|
}
|
|
|
}
|