PayTemplateController.php 945 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Controllers\Channel\Channel;
  3. use App\Modules\Channel\Models\PayTemplate;
  4. use App\Modules\Channel\Services\PayTemplateService;
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Channel\BaseController;
  7. class PayTemplateController extends BaseController
  8. {
  9. public function getPayTemplate(){
  10. $distribution_channel_id = (int)$this->getChannelId();
  11. $template_id = PayTemplateService::getPayTemplate($distribution_channel_id);
  12. return response()->success(['type'=>$template_id]);
  13. }
  14. public function setPayTemplate(Request $request){
  15. $distribution_channel_id = (int)$this->getChannelId();
  16. $type = (int)$request->post('type');
  17. if(empty($type) || !in_array($type,[1,2])){
  18. return response()->error('PARAM_ERROR');
  19. }
  20. $res = PayTemplateService::setPayTemplate($distribution_channel_id,$type);
  21. return response()->success();
  22. }
  23. }