Jelajahi Sumber

'修改文档'

lh 3 tahun lalu
induk
melakukan
47e4bbcba5

+ 256 - 0
src/Controllers/CompanyAuth/AInfoController.php

@@ -0,0 +1,256 @@
+<?php
+
+namespace General\Controllers\CompanyAuth;
+
+
+use App\Http\Controllers\Controller;
+use General\Controllers\CompanyAuth\Transformers\BaiDuAdAccountTransformer;
+use General\Requests\ChargeReport\BaiDuAccountQueryRequest;
+use General\Requests\ChargeReport\BaiDuAccountRequest;
+use General\Requests\ChargeReport\DelBaiDuAccountRequest;
+use General\Services\BaseAuthConfig;
+use General\Services\ChargeReport\BaiDuAccountService;
+
+/**
+ * 
+ */
+class AInfoController extends Controller
+{
+    /**
+     * @apiDefine 对接前必看
+     */
+
+    /**
+     * @api 签名参考
+     * public static function sign($params, $key)
+     *  {
+     *  $data = $params;
+     *  //签名步骤一:按字典序排序参数
+     *  ksort($data);
+     *  $buff = "";
+     *  foreach ($data as $k => $v) {
+     *      if ($v != null && $k !== "sign" && $v !== "" && !is_array($v)) {
+     *          $buff .= $k . "=" . $v . "&";
+     *      }
+     *  }
+     *  $buff = trim($buff, "&");
+     *  //签名步骤二:在string后加入KEY
+     *  $string = $buff . "&key=" . $key;
+     *  //签名步骤三:MD5加密
+     *  $string = md5($string);
+     *  //签名步骤四:所有字符转为大写
+     *  $result = strtoupper($string);
+     *  return $result;
+     *  }
+     */
+
+
+//
+//    use BaseAuthConfig;
+//
+//    private $service;
+//
+//    public function __construct()
+//    {
+//        $this->service = new BaiDuAccountService;
+//    }
+//
+//    /**
+//     * @api {post} company/auth/baiduAdAccount/add 添加百度广告账号
+//     * @apiVersion 1.0.0
+//     * @apiName addBaiDuAdAccount
+//     * @apiGroup BaiDuAdAccount
+//     * @apiParam {String} app_id 分配好的{app_id}
+//     * @apiParam {String} nonce_str 随机字符串
+//     * @apiParam {String} timestamp 时间戳
+//     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
+//     * @apiParam {String} phone 手机号
+//     * @apiParam {String} account_name 百度广告账号名称
+//     * @apiParam {String} token 百度广告账号授权token
+//     * @apiError {int}         code 状态码
+//     * @apiError {String}      msg  信息
+//     * @apiErrorExample {json} Error-Response:
+//     * HTTP/1.1 200 OK
+//     * [
+//     *   {
+//     *        'code' : 10030,
+//     *        'msg' : '未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10031,
+//     *        'msg' : 'IP未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10032,
+//     *        'msg' : '授权时间已过期!'
+//     *   },
+//     *   {
+//     *        'code' : 10033,
+//     *        'msg' : '授权签名错误!'
+//     *   },
+//     *   {
+//     *        'code' : 10034,
+//     *        'msg' : '查询数据为空!'
+//     *   },
+//     *   {
+//     *        'code' : 10035,
+//     *        'msg' : '查询数据时间长度不能超过30天!'
+//     *   },
+//     *   {
+//     *        'code' : 1002,
+//     *        'msg' : '查询参数错误!'
+//     *   },
+//     * ]
+//     * @apiSuccess {int}         code 状态码
+//     * @apiSuccess {String}      msg  信息
+//     * @apiSuccess {Object}      data 结果集
+//     * @apiSuccess {Int}         id 账号ID
+//     * @apiSuccessExample {json} Success-Response:
+//     * HTTP/1.1 200 OK
+//     *   {
+//     *       "code": 0,
+//     *       "msg": "",
+//     *       "data": [
+//     *           {
+//     *               "id": 130,
+//     *           }
+//     *       ]
+//     *   }
+//     */
+//    public function addBaiDuAdAccount(BaiDuAccountRequest $request)
+//    {
+//        $result = $this->service->addBaiduAdAccount($request->all());
+//        return response()->success([
+//            'id' => $result->id,
+//        ]);
+//    }
+//
+//    /**
+//     * @api {post} company/auth/baiduAdAccount/del 删除百度广告账号
+//     * @apiVersion 1.0.0
+//     * @apiName delBaiDuAdAccount
+//     * @apiGroup BaiDuAdAccount
+//     * @apiParam {String} app_id 分配好的{app_id}
+//     * @apiParam {String} nonce_str 随机字符串
+//     * @apiParam {String} timestamp 时间戳
+//     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
+//     * @apiParam {String} phone 手机号
+//     * @apiParam {Int} id 账号ID
+//     * @apiError {int}         code 状态码
+//     * @apiError {String}      msg  信息
+//     * @apiErrorExample {json} Error-Response:
+//     * HTTP/1.1 200 OK
+//     * [
+//     *   {
+//     *        'code' : 10030,
+//     *        'msg' : '未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10031,
+//     *        'msg' : 'IP未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10032,
+//     *        'msg' : '授权时间已过期!'
+//     *   },
+//     *   {
+//     *        'code' : 10033,
+//     *        'msg' : '授权签名错误!'
+//     *   },
+//     *   {
+//     *        'code' : 10034,
+//     *        'msg' : '查询数据为空!'
+//     *   },
+//     *   {
+//     *        'code' : 10035,
+//     *        'msg' : '查询数据时间长度不能超过30天!'
+//     *   },
+//     *   {
+//     *        'code' : 1002,
+//     *        'msg' : '查询参数错误!'
+//     *   },
+//     * ]
+//     * @apiSuccess {int}         code 状态码
+//     * @apiSuccess {String}      msg  信息
+//     * @apiSuccess {Object}      data 结果集
+//     * @apiSuccess {Int}         id 账号ID
+//     * @apiSuccessExample {json} Success-Response:
+//     * HTTP/1.1 200 OK
+//     *   {
+//     *       "code": 0,
+//     *       "msg": "",
+//     *       "data": [
+//     *       ]
+//     *   }
+//     */
+//    public function delBaiDuAdAccount(DelBaiDuAccountRequest $request)
+//    {
+//        $this->service->delBaiduAdAccount($request->all());
+//        return response()->success();
+//    }
+//
+//    /**
+//     * @api {post} company/auth/baiDuAdAccount 获取百度广告账号
+//     * @apiVersion 1.0.0
+//     * @apiName baiDuAdAccount
+//     * @apiGroup BaiDuAdAccount
+//     * @apiParam {String} app_id 分配好的{app_id}
+//     * @apiParam {String} nonce_str 随机字符串
+//     * @apiParam {String} timestamp 时间戳
+//     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
+//     * @apiParam {String} phone 手机号
+//     * @apiError {int}         code 状态码
+//     * @apiError {String}      msg  信息
+//     * @apiErrorExample {json} Error-Response:
+//     * HTTP/1.1 200 OK
+//     * [
+//     *   {
+//     *        'code' : 10030,
+//     *        'msg' : '未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10031,
+//     *        'msg' : 'IP未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10032,
+//     *        'msg' : '授权时间已过期!'
+//     *   },
+//     *   {
+//     *        'code' : 10033,
+//     *        'msg' : '授权签名错误!'
+//     *   },
+//     *   {
+//     *        'code' : 10034,
+//     *        'msg' : '查询数据为空!'
+//     *   },
+//     *   {
+//     *        'code' : 10035,
+//     *        'msg' : '查询数据时间长度不能超过30天!'
+//     *   },
+//     *   {
+//     *        'code' : 1002,
+//     *        'msg' : '查询参数错误!'
+//     *   },
+//     * ]
+//     * @apiSuccess {int}         code 状态码
+//     * @apiSuccess {String}      msg  信息
+//     * @apiSuccess {Object}      data 结果集
+//     * @apiSuccess {Int}         id 账号ID
+//     * @apiSuccess {String} account_name 百度广告账号名称
+//     * @apiSuccess {String} token 百度广告账号授权token
+//     * @apiSuccessExample {json} Success-Response:
+//     * HTTP/1.1 200 OK
+//     *   {
+//     *       "code": 0,
+//     *       "msg": "",
+//     *       "data": [
+//     *       ]
+//     *   }
+//     */
+//    public function baiDuAdAccount(BaiDuAccountQueryRequest $request)
+//    {
+//        $result = $this->service->findBaiduAdAccounts($request->get('phone'));
+//        return response()->success(collectionTransform(new BaiDuAdAccountTransformer, $result));
+//    }
+}

+ 211 - 211
src/Controllers/CompanyAuth/BaiDuAccountController.php

@@ -16,215 +16,215 @@ use General\Services\ChargeReport\BaiDuAccountService;
  */
 class BaiDuAccountController extends Controller
 {
-    /**
-     * @apiDefine BaiDuAdAccount 百度广告账号
-     */
-
-    use BaseAuthConfig;
-
-    private $service;
-
-    public function __construct()
-    {
-        $this->service = new BaiDuAccountService;
-    }
-
-    /**
-     * @api {post} company/auth/baiduAdAccount/add 添加百度广告账号
-     * @apiVersion 1.0.0
-     * @apiName addBaiDuAdAccount
-     * @apiGroup BaiDuAdAccount
-     * @apiParam {String} app_id 分配好的{app_id}
-     * @apiParam {String} nonce_str 随机字符串
-     * @apiParam {String} timestamp 时间戳
-     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
-     * @apiParam {String} phone 手机号
-     * @apiParam {String} account_name 百度广告账号名称
-     * @apiParam {String} token 百度广告账号授权token
-     * @apiError {int}         code 状态码
-     * @apiError {String}      msg  信息
-     * @apiErrorExample {json} Error-Response:
-     * HTTP/1.1 200 OK
-     * [
-     *   {
-     *        'code' : 10030,
-     *        'msg' : '未授权!'
-     *   },
-     *   {
-     *        'code' : 10031,
-     *        'msg' : 'IP未授权!'
-     *   },
-     *   {
-     *        'code' : 10032,
-     *        'msg' : '授权时间已过期!'
-     *   },
-     *   {
-     *        'code' : 10033,
-     *        'msg' : '授权签名错误!'
-     *   },
-     *   {
-     *        'code' : 10034,
-     *        'msg' : '查询数据为空!'
-     *   },
-     *   {
-     *        'code' : 10035,
-     *        'msg' : '查询数据时间长度不能超过30天!'
-     *   },
-     *   {
-     *        'code' : 1002,
-     *        'msg' : '查询参数错误!'
-     *   },
-     * ]
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {Object}      data 结果集
-     * @apiSuccess {Int}         id 账号ID
-     * @apiSuccessExample {json} Success-Response:
-     * HTTP/1.1 200 OK
-     *   {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": [
-     *           {
-     *               "id": 130,
-     *           }
-     *       ]
-     *   }
-     */
-    public function addBaiDuAdAccount(BaiDuAccountRequest $request)
-    {
-        $result = $this->service->addBaiduAdAccount($request->all());
-        return response()->success([
-            'id' => $result->id,
-        ]);
-    }
-
-    /**
-     * @api {post} company/auth/baiduAdAccount/del 删除百度广告账号
-     * @apiVersion 1.0.0
-     * @apiName delBaiDuAdAccount
-     * @apiGroup BaiDuAdAccount
-     * @apiParam {String} app_id 分配好的{app_id}
-     * @apiParam {String} nonce_str 随机字符串
-     * @apiParam {String} timestamp 时间戳
-     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
-     * @apiParam {String} phone 手机号
-     * @apiParam {Int} id 账号ID
-     * @apiError {int}         code 状态码
-     * @apiError {String}      msg  信息
-     * @apiErrorExample {json} Error-Response:
-     * HTTP/1.1 200 OK
-     * [
-     *   {
-     *        'code' : 10030,
-     *        'msg' : '未授权!'
-     *   },
-     *   {
-     *        'code' : 10031,
-     *        'msg' : 'IP未授权!'
-     *   },
-     *   {
-     *        'code' : 10032,
-     *        'msg' : '授权时间已过期!'
-     *   },
-     *   {
-     *        'code' : 10033,
-     *        'msg' : '授权签名错误!'
-     *   },
-     *   {
-     *        'code' : 10034,
-     *        'msg' : '查询数据为空!'
-     *   },
-     *   {
-     *        'code' : 10035,
-     *        'msg' : '查询数据时间长度不能超过30天!'
-     *   },
-     *   {
-     *        'code' : 1002,
-     *        'msg' : '查询参数错误!'
-     *   },
-     * ]
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {Object}      data 结果集
-     * @apiSuccess {Int}         id 账号ID
-     * @apiSuccessExample {json} Success-Response:
-     * HTTP/1.1 200 OK
-     *   {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": [
-     *       ]
-     *   }
-     */
-    public function delBaiDuAdAccount(DelBaiDuAccountRequest $request)
-    {
-        $this->service->delBaiduAdAccount($request->all());
-        return response()->success();
-    }
-
-    /**
-     * @api {post} company/auth/baiDuAdAccount 获取百度广告账号
-     * @apiVersion 1.0.0
-     * @apiName baiDuAdAccount
-     * @apiGroup BaiDuAdAccount
-     * @apiParam {String} app_id 分配好的{app_id}
-     * @apiParam {String} nonce_str 随机字符串
-     * @apiParam {String} timestamp 时间戳
-     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
-     * @apiParam {String} phone 手机号
-     * @apiError {int}         code 状态码
-     * @apiError {String}      msg  信息
-     * @apiErrorExample {json} Error-Response:
-     * HTTP/1.1 200 OK
-     * [
-     *   {
-     *        'code' : 10030,
-     *        'msg' : '未授权!'
-     *   },
-     *   {
-     *        'code' : 10031,
-     *        'msg' : 'IP未授权!'
-     *   },
-     *   {
-     *        'code' : 10032,
-     *        'msg' : '授权时间已过期!'
-     *   },
-     *   {
-     *        'code' : 10033,
-     *        'msg' : '授权签名错误!'
-     *   },
-     *   {
-     *        'code' : 10034,
-     *        'msg' : '查询数据为空!'
-     *   },
-     *   {
-     *        'code' : 10035,
-     *        'msg' : '查询数据时间长度不能超过30天!'
-     *   },
-     *   {
-     *        'code' : 1002,
-     *        'msg' : '查询参数错误!'
-     *   },
-     * ]
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {Object}      data 结果集
-     * @apiSuccess {Int}         id 账号ID
-     * @apiSuccess {String} account_name 百度广告账号名称
-     * @apiSuccess {String} token 百度广告账号授权token
-     * @apiSuccessExample {json} Success-Response:
-     * HTTP/1.1 200 OK
-     *   {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": [
-     *       ]
-     *   }
-     */
-    public function baiDuAdAccount(BaiDuAccountQueryRequest $request)
-    {
-        $result = $this->service->findBaiduAdAccounts($request->get('phone'));
-        return response()->success(collectionTransform(new BaiDuAdAccountTransformer, $result));
-    }
+//    /**
+//     * @apiDefine BaiDuAdAccount 百度广告账号
+//     */
+//
+//    use BaseAuthConfig;
+//
+//    private $service;
+//
+//    public function __construct()
+//    {
+//        $this->service = new BaiDuAccountService;
+//    }
+//
+//    /**
+//     * @api {post} company/auth/baiduAdAccount/add 添加百度广告账号
+//     * @apiVersion 1.0.0
+//     * @apiName addBaiDuAdAccount
+//     * @apiGroup BaiDuAdAccount
+//     * @apiParam {String} app_id 分配好的{app_id}
+//     * @apiParam {String} nonce_str 随机字符串
+//     * @apiParam {String} timestamp 时间戳
+//     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
+//     * @apiParam {String} phone 手机号
+//     * @apiParam {String} account_name 百度广告账号名称
+//     * @apiParam {String} token 百度广告账号授权token
+//     * @apiError {int}         code 状态码
+//     * @apiError {String}      msg  信息
+//     * @apiErrorExample {json} Error-Response:
+//     * HTTP/1.1 200 OK
+//     * [
+//     *   {
+//     *        'code' : 10030,
+//     *        'msg' : '未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10031,
+//     *        'msg' : 'IP未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10032,
+//     *        'msg' : '授权时间已过期!'
+//     *   },
+//     *   {
+//     *        'code' : 10033,
+//     *        'msg' : '授权签名错误!'
+//     *   },
+//     *   {
+//     *        'code' : 10034,
+//     *        'msg' : '查询数据为空!'
+//     *   },
+//     *   {
+//     *        'code' : 10035,
+//     *        'msg' : '查询数据时间长度不能超过30天!'
+//     *   },
+//     *   {
+//     *        'code' : 1002,
+//     *        'msg' : '查询参数错误!'
+//     *   },
+//     * ]
+//     * @apiSuccess {int}         code 状态码
+//     * @apiSuccess {String}      msg  信息
+//     * @apiSuccess {Object}      data 结果集
+//     * @apiSuccess {Int}         id 账号ID
+//     * @apiSuccessExample {json} Success-Response:
+//     * HTTP/1.1 200 OK
+//     *   {
+//     *       "code": 0,
+//     *       "msg": "",
+//     *       "data": [
+//     *           {
+//     *               "id": 130,
+//     *           }
+//     *       ]
+//     *   }
+//     */
+//    public function addBaiDuAdAccount(BaiDuAccountRequest $request)
+//    {
+//        $result = $this->service->addBaiduAdAccount($request->all());
+//        return response()->success([
+//            'id' => $result->id,
+//        ]);
+//    }
+//
+//    /**
+//     * @api {post} company/auth/baiduAdAccount/del 删除百度广告账号
+//     * @apiVersion 1.0.0
+//     * @apiName delBaiDuAdAccount
+//     * @apiGroup BaiDuAdAccount
+//     * @apiParam {String} app_id 分配好的{app_id}
+//     * @apiParam {String} nonce_str 随机字符串
+//     * @apiParam {String} timestamp 时间戳
+//     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
+//     * @apiParam {String} phone 手机号
+//     * @apiParam {Int} id 账号ID
+//     * @apiError {int}         code 状态码
+//     * @apiError {String}      msg  信息
+//     * @apiErrorExample {json} Error-Response:
+//     * HTTP/1.1 200 OK
+//     * [
+//     *   {
+//     *        'code' : 10030,
+//     *        'msg' : '未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10031,
+//     *        'msg' : 'IP未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10032,
+//     *        'msg' : '授权时间已过期!'
+//     *   },
+//     *   {
+//     *        'code' : 10033,
+//     *        'msg' : '授权签名错误!'
+//     *   },
+//     *   {
+//     *        'code' : 10034,
+//     *        'msg' : '查询数据为空!'
+//     *   },
+//     *   {
+//     *        'code' : 10035,
+//     *        'msg' : '查询数据时间长度不能超过30天!'
+//     *   },
+//     *   {
+//     *        'code' : 1002,
+//     *        'msg' : '查询参数错误!'
+//     *   },
+//     * ]
+//     * @apiSuccess {int}         code 状态码
+//     * @apiSuccess {String}      msg  信息
+//     * @apiSuccess {Object}      data 结果集
+//     * @apiSuccess {Int}         id 账号ID
+//     * @apiSuccessExample {json} Success-Response:
+//     * HTTP/1.1 200 OK
+//     *   {
+//     *       "code": 0,
+//     *       "msg": "",
+//     *       "data": [
+//     *       ]
+//     *   }
+//     */
+//    public function delBaiDuAdAccount(DelBaiDuAccountRequest $request)
+//    {
+//        $this->service->delBaiduAdAccount($request->all());
+//        return response()->success();
+//    }
+//
+//    /**
+//     * @api {post} company/auth/baiDuAdAccount 获取百度广告账号
+//     * @apiVersion 1.0.0
+//     * @apiName baiDuAdAccount
+//     * @apiGroup BaiDuAdAccount
+//     * @apiParam {String} app_id 分配好的{app_id}
+//     * @apiParam {String} nonce_str 随机字符串
+//     * @apiParam {String} timestamp 时间戳
+//     * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
+//     * @apiParam {String} phone 手机号
+//     * @apiError {int}         code 状态码
+//     * @apiError {String}      msg  信息
+//     * @apiErrorExample {json} Error-Response:
+//     * HTTP/1.1 200 OK
+//     * [
+//     *   {
+//     *        'code' : 10030,
+//     *        'msg' : '未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10031,
+//     *        'msg' : 'IP未授权!'
+//     *   },
+//     *   {
+//     *        'code' : 10032,
+//     *        'msg' : '授权时间已过期!'
+//     *   },
+//     *   {
+//     *        'code' : 10033,
+//     *        'msg' : '授权签名错误!'
+//     *   },
+//     *   {
+//     *        'code' : 10034,
+//     *        'msg' : '查询数据为空!'
+//     *   },
+//     *   {
+//     *        'code' : 10035,
+//     *        'msg' : '查询数据时间长度不能超过30天!'
+//     *   },
+//     *   {
+//     *        'code' : 1002,
+//     *        'msg' : '查询参数错误!'
+//     *   },
+//     * ]
+//     * @apiSuccess {int}         code 状态码
+//     * @apiSuccess {String}      msg  信息
+//     * @apiSuccess {Object}      data 结果集
+//     * @apiSuccess {Int}         id 账号ID
+//     * @apiSuccess {String} account_name 百度广告账号名称
+//     * @apiSuccess {String} token 百度广告账号授权token
+//     * @apiSuccessExample {json} Success-Response:
+//     * HTTP/1.1 200 OK
+//     *   {
+//     *       "code": 0,
+//     *       "msg": "",
+//     *       "data": [
+//     *       ]
+//     *   }
+//     */
+//    public function baiDuAdAccount(BaiDuAccountQueryRequest $request)
+//    {
+//        $result = $this->service->findBaiduAdAccounts($request->get('phone'));
+//        return response()->success(collectionTransform(new BaiDuAdAccountTransformer, $result));
+//    }
 }