CustomMsgController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Http\Controllers\Wap\OfficialAccount;
  3. use App\Http\Controllers\Wap\BaseController;
  4. use App\Modules\OfficialAccount\Services\CustomMsgService;
  5. use App\Http\Controllers\Wap\OfficialAccount\Transformers\CustomMsgControllerTransformer;
  6. use Illuminate\Http\Request;
  7. use GuzzleHttp\Client;
  8. use App\Libs\OSS;
  9. class CustomMsgController extends BaseController
  10. {
  11. /**
  12. * @apiDefine OfficialAccount 公众号
  13. */
  14. /**
  15. * @apiVersion 1.0.0
  16. * @api {GET} OfficialAccount/customerImgUrlByChannelId 获取渠道下的二维码图片
  17. * @apiGroup OfficialAccount
  18. * @apiName customerImgUrlByChannelId
  19. * @apiParam {String} distribution_channel_id 分销渠道ID.
  20. * @apiSuccess {String} customer_img_url 客服图片.
  21. * @apiSuccessExample {json} Success-Response:
  22. *
  23. * {
  24. * "code": 0,
  25. * "msg": "",
  26. * "data": []
  27. * }
  28. */
  29. function customerImgUrlByChannelId(Request $request) {
  30. $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
  31. if(empty($distribution_channel_id)) {
  32. return response()->error("PARAM_EMPTY");
  33. }
  34. $distributionChannelSetting = CustomMsgService::customerImgUrlByChannelId($distribution_channel_id);
  35. if (!empty($distributionChannelSetting)) {
  36. # code...
  37. return response()->item(new CustomMsgControllerTransformer(), $wechatTemplateMsgService);
  38. }else{
  39. return response()->success();
  40. }
  41. }
  42. }