123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587 |
- <?php
- namespace App\Http\Controllers\Wechat\OfficialAccount;
- use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
- use App\Modules\OfficialAccount\Services\OfficialAccountService;
- use App\Modules\OfficialAccount\Models\OfficialAccount;
- use App\Modules\OfficialAccount\Models\ForceSubscribeUsers;
- use App\Http\Controllers\Wechat\OfficialAccount\Transformers\OfficialAccountTransformer;
- use Illuminate\Http\Request;
- use GuzzleHttp\Client;
- use App\Libs\OSS;
- class OfficialAccountsController extends ChannelBaseController
- {
- /**
- * @apiDefine OfficialAccount 公众号
- */
- /**
- * @apiVersion 1.0.0
- * @api {GET} OfficialAccount/officialAccountByAppid 通过appid获取公众号
- * @apiGroup OfficialAccount
- * @apiName officialAccountByAppid
- * @apiParam {String} appid 微信appID.
- * @apiSuccess {Number} distribution_channel_id 分销渠道id.
- * @apiSuccess {String} name 公众号原始名称.
- * @apiSuccess {String} nickname 公众号名称.
- * @apiSuccess {String} alias 唯一ID.
- * @apiSuccess {String} qrcode_url 二维码地址.
- * @apiSuccess {String} principal_name 公司名称.
- * @apiSuccess {String} func_info 功能信息.
- * @apiSuccess {String} head_img 头像地址.
- * @apiSuccess {String} appid 微信appID.
- * @apiSuccess {String} appsecret 微信appsecret.
- * @apiSuccess {String} verify_txt 验证文件.
- * @apiSuccess {String} verify_type_info 授权方认证类型.
- * @apiSuccess {String} authorizer_refresh_token 授权的刷新token.
- * @apiSuccess {String} cancel_auth_time 取消授权时间.
- * @apiSuccess {String} official_account_type 第三方平台关注公众号.
- * @apiSuccess {Number} is_auth 是否授权.
- * @apiSuccess {String} service_type_info 服务号类型.
- * @apiSuccess {Number} subscribe_top_num 强制关注总额.
- * @apiSuccess {Number} subscribe_day_maximum 强制关注日限额.
- * @apiSuccess {Number} is_enabled 是否可用.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "name": "gh_0fdfe1e4f56c",
- * "nickname": "丸子书屋",
- * "alias": "wzsw166",
- * "head_img": "http://wx.qlogo.cn/mmopen/BDDBmFtJlKECdQ3ZeFKiaBMjU0ovndaib5tQQ1e7eXIIUCuKHGgnfwnDMdXecbpPmlstnnOicuHsiapvG71JbicBR52bapunZUvuu/0",
- * "appid": "wx6916de1267c67d50",
- * "appsecret": "wx6916de1267c67d501212",
- * "verify_txt": "",
- * "is_auth": "1",
- * "service_type_info": "2",
- * "subscribe_top_num": "10000",
- * "subscribe_day_maximum": "500",
- * "distribution_channel_id": 2147483647,
- * "qrcode_url": "fdhgfds435gsdfg43t",
- * "principal_name": "dfgh435saf2332",
- * "func_info": "ry3t342trwe",
- * "authorizer_refresh_token": "4534dfsgdsgsdgsdg",
- * "cancel_auth_time": null,
- * "official_account_type": "32dfaw234yewf",
- * "verify_type_info": null,
- * "is_enabled": 1
- * }
- * }
- */
- function officialAccountByAppid(Request $request)
- {
- $appid = $request->has('appid') ? $request->input('appid') : '';
- \Log::info('==========================进入officialAccountByAppid方法'.$appid);
- if(empty($appid)) {
- return response()->error("PARAM_EMPTY");
- }
- $officialAccount['appid'] = $appid;
- $officialAccountService = OfficialAccountService::officialAccountByAppid($officialAccount);
- return response()->item(new OfficialAccountTransformer(), $officialAccountService);
- }
- /**
- * @apiVersion 1.0.0
- * @api {GET} OfficialAccount/canUseOfficialAccountByChannelId 获取可分配的公众号
- * @apiGroup OfficialAccount
- * @apiName canUseOfficialAccountByChannelId
- * @apiParam {String} distribution_channel_id 分销渠道id.
- * @apiSuccess {Number} distribution_channel_id 分销渠道id.
- * @apiSuccess {String} name 公众号原始名称.
- * @apiSuccess {String} nickname 公众号名称.
- * @apiSuccess {String} alias 唯一ID.
- * @apiSuccess {String} qrcode_url 二维码地址.
- * @apiSuccess {String} principal_name 公司名称.
- * @apiSuccess {String} func_info 功能信息.
- * @apiSuccess {String} head_img 头像地址.
- * @apiSuccess {String} appid 微信appID.
- * @apiSuccess {String} appsecret 微信appsecret.
- * @apiSuccess {String} verify_txt 验证文件.
- * @apiSuccess {String} verify_type_info 授权方认证类型.
- * @apiSuccess {String} authorizer_refresh_token 授权的刷新token.
- * @apiSuccess {String} cancel_auth_time 取消授权时间.
- * @apiSuccess {String} official_account_type 第三方平台关注公众号.
- * @apiSuccess {Number} is_auth 是否授权.
- * @apiSuccess {String} service_type_info 服务号类型.
- * @apiSuccess {Number} subscribe_top_num 强制关注总额.
- * @apiSuccess {Number} subscribe_day_maximum 强制关注日限额.
- * @apiSuccess {Number} is_enabled 是否可用.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "name": "gh_0fdfe1e4f56c",
- * "nickname": "丸子书屋",
- * "alias": "wzsw166",
- * "head_img": "http://wx.qlogo.cn/mmopen/BDDBmFtJlKECdQ3ZeFKiaBMjU0ovndaib5tQQ1e7eXIIUCuKHGgnfwnDMdXecbpPmlstnnOicuHsiapvG71JbicBR52bapunZUvuu/0",
- * "appid": "wx6916de1267c67d50",
- * "appsecret": "wx6916de1267c67d501212",
- * "verify_txt": "",
- * "is_auth": "1",
- * "service_type_info": "2",
- * "subscribe_top_num": "10000",
- * "subscribe_day_maximum": "500",
- * "distribution_channel_id": 2147483647,
- * "qrcode_url": "fdhgfds435gsdfg43t",
- * "principal_name": "dfgh435saf2332",
- * "func_info": "ry3t342trwe",
- * "authorizer_refresh_token": "4534dfsgdsgsdgsdg",
- * "cancel_auth_time": null,
- * "official_account_type": "32dfaw234yewf",
- * "verify_type_info": null,
- * "is_enabled": 1
- * }
- * }
- */
- function canUseOfficialAccountByChannelId(Request $request)
- {
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
- if(empty($distribution_channel_id)) {
- return response()->error("PARAM_EMPTY");
- }
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $officialAccountService = OfficialAccountService::canUseOfficialAccountByChannelId($officialAccount);
-
- return response()->item(new OfficialAccountTransformer(), $officialAccountService);
- }
-
- /**
- * @apiVersion 1.0.0
- * @api {GET} OfficialAccount/officialAuthAccountBydistributionChannelId 根据分销渠道号获取所有授权的公众号
- * @apiGroup OfficialAccount
- * @apiName officialAuthAccountBydistributionChannelId
- * @apiParam {String} distribution_channel_id 分销渠道Id.
- * @apiSuccess {Number} distribution_channel_id 分销渠道id.
- * @apiSuccess {String} name 公众号原始名称.
- * @apiSuccess {String} nickname 公众号名称.
- * @apiSuccess {String} alias 唯一ID.
- * @apiSuccess {String} qrcode_url 二维码地址.
- * @apiSuccess {String} principal_name 公司名称.
- * @apiSuccess {String} func_info 功能信息.
- * @apiSuccess {String} head_img 头像地址.
- * @apiSuccess {String} appid 微信appID.
- * @apiSuccess {String} appsecret 微信appsecret.
- * @apiSuccess {String} verify_txt 验证文件.
- * @apiSuccess {String} verify_type_info 授权方认证类型.
- * @apiSuccess {String} authorizer_refresh_token 授权的刷新token.
- * @apiSuccess {String} cancel_auth_time 取消授权时间.
- * @apiSuccess {String} official_account_type 第三方平台关注公众号.
- * @apiSuccess {Number} is_auth 是否授权.
- * @apiSuccess {String} service_type_info 服务号类型.
- * @apiSuccess {Number} subscribe_top_num 强制关注总额.
- * @apiSuccess {Number} subscribe_day_maximum 强制关注日限额.
- * @apiSuccess {Number} is_enabled 是否可用.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "name": "gh_0fdfe1e4f56c",
- * "nickname": "丸子书屋",
- * "alias": "wzsw166",
- * "head_img": "http://wx.qlogo.cn/mmopen/BDDBmFtJlKECdQ3ZeFKiaBMjU0ovndaib5tQQ1e7eXIIUCuKHGgnfwnDMdXecbpPmlstnnOicuHsiapvG71JbicBR52bapunZUvuu/0",
- * "appid": "wx6916de1267c67d50",
- * "appsecret": "wx6916de1267c67d501212",
- * "verify_txt": "",
- * "is_auth": "1",
- * "service_type_info": "2",
- * "subscribe_top_num": "10000",
- * "subscribe_day_maximum": "500",
- * "distribution_channel_id": 2147483647,
- * "qrcode_url": "fdhgfds435gsdfg43t",
- * "principal_name": "dfgh435saf2332",
- * "func_info": "ry3t342trwe",
- * "authorizer_refresh_token": "4534dfsgdsgsdgsdg",
- * "cancel_auth_time": null,
- * "official_account_type": "32dfaw234yewf",
- * "verify_type_info": null,
- * "is_enabled": 1
- * }
- * }
- */
- function officialAuthAccountBydistributionChannelId(Request $request)
- {
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
- if(empty($distribution_channel_id)) {
- return response()->error("PARAM_EMPTY");
- }
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $officialAccountService = OfficialAccountService::officialAuthAccountBydistributionChannelId($officialAccount);
- return response()->collection(new OfficialAccountTransformer(), $officialAccountService);
- }
- /**
- * @apiVersion 1.0.0
- * @api {GET} OfficialAccount/allOfficialAccountBydistributionChannelId 根据分销渠道号获取服务号列表
- * @apiGroup OfficialAccount
- * @apiName allOfficialAccountBydistributionChannelId
- * @apiParam {String} distribution_channel_id 分销渠道Id.
- * @apiSuccess {Number} distribution_channel_id 分销渠道id.
- * @apiSuccess {String} name 公众号原始名称.
- * @apiSuccess {String} nickname 公众号名称.
- * @apiSuccess {String} alias 唯一ID.
- * @apiSuccess {String} qrcode_url 二维码地址.
- * @apiSuccess {String} principal_name 公司名称.
- * @apiSuccess {String} func_info 功能信息.
- * @apiSuccess {String} head_img 头像地址.
- * @apiSuccess {String} appid 微信appID.
- * @apiSuccess {String} appsecret 微信appsecret.
- * @apiSuccess {String} verify_txt 验证文件.
- * @apiSuccess {String} verify_type_info 授权方认证类型.
- * @apiSuccess {String} authorizer_refresh_token 授权的刷新token.
- * @apiSuccess {String} cancel_auth_time 取消授权时间.
- * @apiSuccess {String} official_account_type 第三方平台关注公众号.
- * @apiSuccess {Number} is_auth 是否授权.
- * @apiSuccess {String} service_type_info 服务号类型.
- * @apiSuccess {Number} subscribe_top_num 强制关注总额.
- * @apiSuccess {Number} subscribe_day_maximum 强制关注日限额.
- * @apiSuccess {Number} todayForceSubscribeUsers 今日关注总数.
- * @apiSuccess {Number} allForceSubscribeUsers 关注总数.
- * @apiSuccess {Number} is_enabled 是否可用.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * {
- * "name": "测试呵呵",
- * "nickname": "大哥",
- * "alias": "23534dsgdsvdx",
- * "head_img": "www.baidu.com",
- * "appid": "1211",
- * "appsecret": "dsfsdf3452352",
- * "verify_txt": null,
- * "is_auth": 1,
- * "service_type_info": "546dsfwr23r",
- * "subscribe_top_num": null,
- * "subscribe_day_maximum": null,
- * "distribution_channel_id": 1,
- * "qrcode_url": "fdhgfds435gsdfg43t",
- * "principal_name": "dfgh435saf2332",
- * "func_info": "ry3t342trwe",
- * "authorizer_refresh_token": "4534dfsgdsgsdgsdg",
- * "cancel_auth_time": null,
- * "official_account_type": "32dfaw234yewf",
- * "verify_type_info": null,
- * "is_enabled": 1,
- * "todayForceSubscribeUsers": 0,
- * "allForceSubscribeUsers": 0
- * }
- * }
- * }
- */
- function allOfficialAccountBydistributionChannelId(Request $request)
- {
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
- if(empty($distribution_channel_id)) {
- return response()->error("PARAM_EMPTY");
- }
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $officialAccountService = OfficialAccountService::allOfficialAccountBydistributionChannelId($officialAccount);
-
- return response()->collection(new OfficialAccountTransformer(), $officialAccountService);
- }
- /**
- * @apiVersion 1.0.0
- * @api {POST} OfficialAccount/authOfficialAccount 授权公众号信息
- * @apiGroup OfficialAccount
- * @apiName authOfficialAccount
- * @apiParam {String} appid 微信appID.
- * @apiParam {String} name 公众号原始名称.
- * @apiParam {String} nickname 公众号名称.
- * @apiParam {String} alias 唯一ID.
- * @apiParam {String} head_img 头像地址.
- * @apiParam {String} appid 微信appID.
- * @apiParam {String} appsecret 微信appsecret.
- * @apiParam {String} is_auth 是否授权.
- * @apiParam {String} service_type_info 服务号类型.
- * @apiParam {Number} distribution_channel_id 分销渠道id.
- * @apiParam {String} qrcode_url 二维码地址.
- * @apiParam {String} principal_name 公司名称.
- * @apiParam {String} func_info 功能信息.
- * @apiParam {String} authorizer_refresh_token 授权的刷新token.
- * @apiParam {String} official_account_type 第三方平台关注公众号.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": []
- * }
- */
- function authOfficialAccount(Request $request) {
- $appid = $request->has('appid') ? $request->input('appid') : '';
- // $distribution_channel_id = $this->getChannelId();
-
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-
- $appsecret = $request->has('appsecret') ? $request->input('appsecret') : '';
-
- $alias = $request->has('alias') ? $request->input('alias') : '';
-
- $name = $request->has('name') ? $request->input('name') : '';
-
- $nickname = $request->has('nickname') ? $request->input('nickname') : '';
-
- $head_img = $request->has('head_img') ? $request->input('head_img') : '';
-
- $qrcode_url = $request->has('qrcode_url') ? $request->input('qrcode_url') : '';
-
- $principal_name = $request->has('principal_name') ? $request->input('principal_name') : '';
-
- $service_type_info = $request->has('service_type_info') ? $request->input('service_type_info') : '';
-
- $func_info = $request->has('func_info') ? $request->input('func_info') : '';
-
- $authorizer_refresh_token = $request->has('authorizer_refresh_token') ? $request->input('authorizer_refresh_token') : '';
-
- $is_auth = $request->has('is_auth') ? $request->input('is_auth') : '1';
-
- $official_account_type = $request->has('official_account_type') ? $request->input('official_account_type') : '';
-
- $is_enabled = 1;
- $verify_txt = $request->has('verify_txt') ? $request->input('verify_txt') : '';
- $officialAccount['appid'] = $appid;
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $officialAccount['appsecret'] = $appsecret;
- $officialAccount['alias'] = $alias;
- $officialAccount['name'] = $name;
- $officialAccount['nickname'] = $nickname;
- $officialAccount['head_img'] = $head_img;
- $officialAccount['qrcode_url'] = $qrcode_url;
- $officialAccount['principal_name'] = $principal_name;
- $officialAccount['service_type_info'] = $service_type_info;
- $officialAccount['func_info'] = $func_info;
- $officialAccount['authorizer_refresh_token'] = $authorizer_refresh_token;
- $officialAccount['is_auth'] = $is_auth;
- $officialAccount['official_account_type'] = $official_account_type;
- $officialAccount['is_enabled'] = $is_enabled;
- $officialAccount['verify_txt'] = $verify_txt;
- \Log::info($appid.':auth:create:params');
- \Log::info($officialAccount);
- $resultStatus = OfficialAccountService::authOfficialAccount($officialAccount);
- if ($resultStatus == 1) {
- return response()->success();
- }elseif ($resultStatus == 2) {
- return response()->error('OFFICIAL_ACCOUNT_IS_EXIST');
- }elseif ($resultStatus == 0) {
- return response()->error('OFFICIAL_ACCOUNT_FAILED');
- }else{
- return response()->error('OFFICIAL_ACCOUNT_FAILED');
- }
- }
- /**
- * @apiVersion 1.0.0
- * @api {POST} OfficialAccount/updateOfficialAccount 修改公众号信息
- * @apiGroup OfficialAccount
- * @apiName updateOfficialAccount
- * @apiParam {String} appid 微信appID.
- * @apiParam {String} appsecret 微信appsecret.
- * @apiParam {String} distribution_channel_id 分销渠道id.
- * @apiParam {String} subscribe_top_num 总阀值.
- * @apiParam {String} subscribe_day_maximum 日上线.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": []
- * }
- */
- function updateOfficialAccount(Request $request) {
- $appid = $request->has('appid') ? $request->input('appid') : '';
-
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
- // $distribution_channel_id = $this->getChannelId();
-
- $appsecret = $request->has('appsecret') ? $request->input('appsecret') : '';
-
- $alias = $request->has('alias') ? $request->input('alias') : '';
-
- $name = $request->has('name') ? $request->input('name') : '';
-
- $nickname = $request->has('nickname') ? $request->input('nickname') : '';
-
- $head_img = $request->has('head_img') ? $request->input('head_img') : '';
-
- $qrcode_url = $request->has('qrcode_url') ? $request->input('qrcode_url') : '';
-
- $principal_name = $request->has('principal_name') ? $request->input('principal_name') : '';
-
- $service_type_info = $request->has('service_type_info') ? $request->input('service_type_info') : '';
-
- $func_info = $request->has('func_info') ? $request->input('func_info') : '';
-
- $authorizer_refresh_token = $request->has('authorizer_refresh_token') ? $request->input('authorizer_refresh_token') : '';
-
- $is_auth = $request->has('is_auth') ? $request->input('is_auth') : '1';
-
- $official_account_type = $request->has('official_account_type') ? $request->input('official_account_type') : '';
-
- $is_enabled = 1;
- $verify_txt = $request->has('verify_txt') ? $request->input('verify_txt') : '';
- $subscribe_top_num = $request->has('subscribe_top_num') ? $request->input('subscribe_top_num') : '';
- $subscribe_day_maximum = $request->has('subscribe_day_maximum') ? $request->input('subscribe_day_maximum') : '';
- $officialAccount['appid'] = $appid;
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $officialAccount['appsecret'] = $appsecret;
- $officialAccount['alias'] = $alias;
- $officialAccount['name'] = $name;
- $officialAccount['nickname'] = $nickname;
- $officialAccount['head_img'] = $head_img;
- $officialAccount['qrcode_url'] = $qrcode_url;
- $officialAccount['principal_name'] = $principal_name;
- $officialAccount['service_type_info'] = $service_type_info;
- $officialAccount['func_info'] = $func_info;
- $officialAccount['authorizer_refresh_token'] = $authorizer_refresh_token;
- $officialAccount['is_auth'] = $is_auth;
- $officialAccount['official_account_type'] = $official_account_type;
- $officialAccount['is_enabled'] = $is_enabled;
- $officialAccount['verify_txt'] = $verify_txt;
- $officialAccount['subscribe_top_num'] = $subscribe_top_num;
- $officialAccount['subscribe_day_maximum'] = $subscribe_day_maximum;
- $resultStatus = OfficialAccountService::updateOfficialAccount($officialAccount);
- if ($resultStatus == 1) {
- return response()->success();
- }elseif ($resultStatus == 2) {
- return response()->error('OFFICIAL_ACCOUNT_NOT_FOUND');
- }elseif ($resultStatus == 0) {
- return response()->error('UPDATE_OFFICIAL_ACCOUNT_FAILED');
- }else{
- return response()->error('UPDATE_OFFICIAL_ACCOUNT_FAILED');
- }
-
-
- }
- // public function getUserClient(){
- // return new Client(['base_uri' => env('PUBLIC_API_BASE_URI')]);
- // }
- /**
- * @apiVersion 1.0.0
- * @api {GET} OfficialAccount/cancelAuthOfficialAccount 取消公众号授权
- * @apiGroup OfficialAccount
- * @apiName cancelAuthOfficialAccount
- * @apiParam {String} appid 微信appID.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": []
- * }
- */
- function cancelAuthOfficialAccount(Request $request) {
- $appid = $request->has('appid') ? $request->input('appid') : '';
- if(empty($appid)) {
- return response()->error("PARAM_EMPTY");
- }
- // $distribution_channel_id = $this->getChannelId();
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
- $officialAccount['appid'] = $appid;
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $resultStatus = OfficialAccountService::cancelAuthOfficialAccount($officialAccount);
-
- if ($resultStatus == 1) {
- return response()->success();
- }elseif ($resultStatus == 2) {
- return response()->error("CANCEL_OFFICIAL_ACCOUNT_FAILED");
- }elseif ($resultStatus == 0) {
- return response()->error("CANCEL_OFFICIAL_ACCOUNT_FAILED");
- }else{
- return response()->error("CANCEL_OFFICIAL_ACCOUNT_FAILED");
- }
- }
- /**
- * @apiVersion 1.0.0
- * @api {GET} OfficialAccount/officialAccountAuthUrl 获取服务号授权URL
- * @apiGroup OfficialAccount
- * @apiName officialAccountAuthUrl
- * @apiParam {String} distribution_channel_id 分销渠道ID.
- * @apiSuccessExample {json} Success-Response:
- *
- * {
- * "code": 0,
- * "msg": "",
- * "data": []
- * }
- */
- function officialAccountAuthUrl(Request $request) {
- // $distribution_channel_id = $this->getChannelId();
- $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
- // if(empty($distribution_channel_id)) {
- // return response()->error("PARAM_EMPTY");
- // }
- $officialAccount['distribution_channel_id'] = $distribution_channel_id;
- $backurl = OfficialAccountService::officialAccountAuthUrl($officialAccount);
- return response()->success($backurl);
- }
-
- }
|