Commit c9493749 authored by zazaname's avatar zazaname

增加渠道下单

parent b23fbb57
......@@ -5,20 +5,13 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use App\Jobs\ExampleJob;
class ExampleController
class ExampleController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
public function test(Request $request){
public function test(Request $request){
$this->dispatch(new ExampleJob(11111));
}
}
......@@ -22,7 +22,7 @@ class PayController extends Controller
*/
public function createOrder()
{
$this->checkParam(['app_id','ctype','uid','cp_order_id','role_id','role_name','server_id','money']);
$this->checkParam(['app_id','uid','cp_order_id','role_id','role_name','server_id','money']);
$data = $this->paySv->createOrder($this->requestData);
return json($data);
}
......
......@@ -40,7 +40,7 @@ class PayService
if (!is_numeric($params['money']) || $params['money'] < 1) {
return error("订单金额的格式类型不正确");
}
if (empty($params['app_id']) || empty($params['ctype']) || empty($params['money']) || empty($params['uid'])) {
if (empty($params['app_id']) || empty($params['money']) || empty($params['uid'])) {
return error("提交参数异常!");
}
//获取游戏表配置
......@@ -52,7 +52,7 @@ class PayService
// 获取渠道表配置
$verInfo = DB::table("app_ver_game as avg")
->leftJoin('app_ver as av', 'avg.ver', '=', 'av.ver_class')
->where(['app_id' => $params['app_id'], 'ver_code' => $params['ctype']])->first();
->where(['app_id' => $params['app_id']])->first();
if (is_null($verInfo)) {
return error('该游戏渠道没配置,app_id:' . $params['app_id']);
}
......@@ -65,7 +65,7 @@ class PayService
'order_id' => $orderId,
'cp_order_id' => $params['cp_order_id'],
'veruniqid' => $userInfo->veruniqid,
'ver' => $params['ctype'],
'ver' => $verInfo->ver_code,
'appid' => $params['app_id'],
'server_id' => $params['server_id'],
'server_name' => $params['server_name'],
......@@ -85,7 +85,7 @@ class PayService
if($channel_order_id){
$model->where(['order_id'=>$orderId])->update(['channel_order_id'=>$channel_order_id]);
}
return success('success',['order_id' => $orderId,'channel_order_id'=>$channel_order_id]);
return success('success',['order_id' => $channel_order_id ?: $orderId]);
}
/**
......
......@@ -2,16 +2,21 @@
namespace App\Jobs;
class ExampleJob extends Job
//use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
class ExampleJob extends Job implements ShouldQueue
{
private $cc;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
public function __construct($cc)
{
//
$this->cc = $cc;
}
/**
......@@ -21,6 +26,8 @@ class ExampleJob extends Job
*/
public function handle()
{
//
sleep(5);
echo getmypid().'-'.time();
dump($this->cc);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment