|
@@ -3,20 +3,20 @@
|
|
|
namespace Modules\Channel\Http\Controllers;
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
-use Illuminate\Http\Request;
|
|
|
use Catch\Base\CatchController;
|
|
|
-use Modules\Common\Errors\Errors;
|
|
|
+use Illuminate\Http\Request;
|
|
|
+use Modules\Channel\Exceptions\ChannelBusinessException;
|
|
|
use Modules\Channel\Models\PayProduct;
|
|
|
use Modules\Channel\Models\PayTemplate;
|
|
|
use Modules\Channel\Models\PayTemplateItem;
|
|
|
-use Modules\Channel\Exceptions\ChannelBusinessException;
|
|
|
use Modules\Channel\Services\User\UserService;
|
|
|
+use Modules\Common\Errors\Errors;
|
|
|
|
|
|
class PayTemplateController extends CatchController
|
|
|
{
|
|
|
public function __construct(protected readonly PayTemplate $payTemplate,protected readonly PayTemplateItem $payTemplateItem,protected readonly PayProduct $payProduct)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -41,7 +41,7 @@ class PayTemplateController extends CatchController
|
|
|
'uid','=',$uid
|
|
|
]];
|
|
|
if($name){
|
|
|
- $where[] = ['name','like','%'.$name.'%'];
|
|
|
+ $where[] = ['name','like','%'.$name.'%'];
|
|
|
}
|
|
|
return $this->payTemplate->orderBy('id','desc')->where($where)->paginate(20);
|
|
|
}
|
|
@@ -117,7 +117,7 @@ class PayTemplateController extends CatchController
|
|
|
$data[] = [
|
|
|
'pay_template_id'=>$pay_template_info->id,'pay_product_id'=>$product_info->id,
|
|
|
'is_first_pay'=>$option['type'] == 'FIRST_COIN' ?1:0,'is_default'=>$option['price'] == $default_optioin ?1:0,
|
|
|
- 'status'=>1,'sequence'=>$option['sequence'],'created_at'=>Carbon::now(),'updated_at'=>Carbon::now()
|
|
|
+ 'status'=>1,'sequence'=>$option['sequence'],'created_at'=>Carbon::now(),'updated_at'=>Carbon::now()
|
|
|
];
|
|
|
}
|
|
|
|
|
@@ -151,7 +151,7 @@ class PayTemplateController extends CatchController
|
|
|
->get();
|
|
|
$type_list = collect($this->optionTypeList());
|
|
|
foreach($pay_template_item as $item){
|
|
|
-
|
|
|
+
|
|
|
if($item->type == 'COIN' && $item->is_first_pay == 1){
|
|
|
$item->type == 'FIRST_COIN';
|
|
|
}
|
|
@@ -162,7 +162,7 @@ class PayTemplateController extends CatchController
|
|
|
$item->charge_coin = $item->type_name;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
$item->sequence_text = $this->sequence_map[$item->sequence];
|
|
|
$item->default_text = $item->is_default? '默认项':"非默认项";
|
|
|
}
|
|
@@ -247,7 +247,7 @@ class PayTemplateController extends CatchController
|
|
|
$type = 'COIN';
|
|
|
}
|
|
|
$product_info = $this->getPayProduct($option['price'], $type,$option['given']);
|
|
|
-
|
|
|
+
|
|
|
$pay_template_item = $this->payTemplateItem->where('pay_template_id',$id)->where('pay_product_id',$product_info->id)->first();
|
|
|
if($pay_template_item){
|
|
|
$pay_template_item->status = 1;
|
|
@@ -259,7 +259,7 @@ class PayTemplateController extends CatchController
|
|
|
$data = [
|
|
|
'pay_template_id'=>$id,'pay_product_id'=>$product_info->id,
|
|
|
'is_first_pay'=>$option['type'] == 'FIRST_COIN' ?1:0,'is_default'=>$option['price'] == $default_optioin ?1:0,
|
|
|
- 'status'=>1,'sequence'=>$option['sequence'],'created_at'=>Carbon::now(),'updated_at'=>Carbon::now()
|
|
|
+ 'status'=>1,'sequence'=>$option['sequence'],'created_at'=>Carbon::now(),'updated_at'=>Carbon::now()
|
|
|
];
|
|
|
$this->payTemplateItem->insert($data);
|
|
|
}
|
|
@@ -298,7 +298,7 @@ class PayTemplateController extends CatchController
|
|
|
}
|
|
|
$product_info = $this->getPayProduct($price,$type,$given);
|
|
|
if($info->pay_product_id == $product_info->id){
|
|
|
- $info->is_first_pay = $is_first_pay;
|
|
|
+ $info->is_first_pay = $is_first_pay;
|
|
|
$info->is_default = $is_default;
|
|
|
$info->save();
|
|
|
}else{
|
|
@@ -307,7 +307,7 @@ class PayTemplateController extends CatchController
|
|
|
$data = [
|
|
|
'pay_template_id'=>$info->pay_template_id,'pay_product_id'=>$product_info->id,
|
|
|
'is_first_pay'=>$is_first_pay,'is_default'=>$is_default,
|
|
|
- 'status'=>1,'sequence'=>$sequence,'created_at'=>Carbon::now(),'updated_at'=>Carbon::now()
|
|
|
+ 'status'=>1,'sequence'=>$sequence,'created_at'=>Carbon::now(),'updated_at'=>Carbon::now()
|
|
|
];
|
|
|
$this->payTemplateItem->insert($data);
|
|
|
}
|