1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201 |
- <?php
- namespace General\Controllers\CompanyAuth;
- use App\Consts\SysConsts;
- use App\Http\Controllers\Controller;
- use General\Controllers\CompanyAuth\Transformers\ActivityTransformer;
- use General\Controllers\CompanyAuth\Transformers\ChannelTransformer;
- use General\Controllers\CompanyAuth\Transformers\CustomSendMsgsTransformers;
- use General\Controllers\CompanyAuth\Transformers\DelaySendMsgsTransformers;
- use General\Controllers\CompanyAuth\Transformers\OfficialAccountTransformer;
- use General\Controllers\CompanyAuth\Transformers\OrderDayStatsTransformer;
- use General\Controllers\CompanyAuth\Transformers\OrderTransformer;
- use General\Controllers\CompanyAuth\Transformers\SendOrderTransformer;
- use General\Helpers\CommonHelper;
- use General\Requests\CompanyAuth\BookQueryRequest;
- use General\Requests\CompanyAuth\CustomSendMsgRequest;
- use General\Requests\CompanyAuth\ChannelQueryRequest;
- use General\Requests\CompanyAuth\SingleSendOrderRequest;
- use General\Services\Activity\ActivityService;
- use General\Services\BaseAuthConfig;
- use General\Services\Book\BookConfigService;
- use General\Services\Channel\ChannelService;
- use General\Services\OfficialAccount\OfficialAccountService;
- use General\Services\Order\OrderService;
- use General\Services\SendOrder\SendOrderService;
- use General\Services\SendOrder\SendOrderStatistic;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Http\Request;
- class AppController extends Controller
- {
- use BaseAuthConfig;
- /**
- * @apiDefine CompanyAuth 第三方授权接口
- */
- /**
- * @api {post} company/auth/channels 授权站点列表
- * @apiVersion 1.0.0
- * @apiName channels
- * @apiGroup CompanyAuth
- * @apiParam {String} is_enabled 状态(0.未启用 1.已启用)
- * @apiParam {String} phone 手机号
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @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} name 渠道名称
- * @apiSuccess {String} created_at 创建时间
- * @apiSuccess {String} site_nick_name 站点昵称
- * @apiSuccess {String} is_enabled 状态(0.未启用 1.已启用)
- * @apiSuccess {String} phone 手机号
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": [
- * {
- * "id": 130,
- * "name": "杭州微点",
- * "created_at": "2018-01-05 09:57:37",
- * "site_nick_name": "2018-01-05 09:57:37",
- * "is_enabled": "1",
- * "phone": "13888888888"
- * }
- * ]
- * }
- */
- public function channels(Request $request)
- {
- $is_enabled = $request->get('is_enabled', '');
- $phone = $request->get('phone', '');
- $service = new ChannelService;
- $channels = $service->getChannelsByChannelUserIds($this->channel_user_ids, $is_enabled, $phone);
- $result = collectionTransform(new ChannelTransformer, $channels);
- return response()->success($result);
- }
- /**
- * @api {post} company/auth/officialAccounts 服务号列表
- * @apiVersion 1.0.0
- * @apiName officials
- * @apiGroup CompanyAuth
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Int} id 渠道ID
- * @apiSuccess {Int} channel_id 站点ID
- * @apiSuccess {String} app_id 服务号APPID
- * @apiSuccess {String} name 渠道名称
- * @apiSuccess {String} created_at 创建时间
- * @apiSuccess {String} sort_no 关注优先级
- * @apiSuccessExample {json} Success-Response:
- * {
- * "code": 0,
- * "msg": "",
- * "data": [
- * {
- * "app_id": '',
- * "channel_id": 130,
- * "name": "半烟溪桥",
- * "created_at": "2018-01-06 10:38:36"
- * }
- * ]
- * }
- */
- public function officialAccounts()
- {
- $service = new OfficialAccountService;
- $result = collectionTransform(new OfficialAccountTransformer, $service->getOfficialAccountsByChannelIds($this->channel_ids));
- return response()->success($result);
- }
- /**
- * @api {post} company/auth/orders 订单
- * @apiVersion 1.0.0
- * @apiName orders
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点id
- * @apiParam {String} status 支付状态 PAID:已支付, UNPAID: 未支付
- * @apiParam {String} begin_date 开始时间(时间区间小于60天,格式yyyy-MM-dd HH:mm:ss)
- * @apiParam {String} end_date 截止时间(时间区间小于60天,格式yyyy-MM-dd HH:mm:ss)
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} uid 用户UID
- * @apiSuccess {Object} price 充值金额
- * @apiSuccess {String} trade_no 订单号
- * @apiSuccess {String} status 支付状态 PAID:已支付, UNPAID: 未支付
- * @apiSuccess {String} created_at 创建时间
- * @apiSuccess {String} pay_end_at 支付时间
- * @apiSuccess {Int} send_order_id 派单ID
- * @apiSuccess {String} send_order_name 派单名称
- * @apiSuccess {String} promotion_url 派单链接
- * @apiSuccess {String} activity_name 活动名称
- * @apiSuccess {String} keyword 关键词
- * @apiSuccess {Int} user_charge_times 充值次数
- * @apiSuccess {String} bid 书号
- * @apiSuccess {String} book_name 书名
- * @apiSuccess {String} register_time 用户注册时间
- * @apiSuccess {String} subscribe_time 关注时间
- * @apiSuccess {String} app_id 关注app_id
- * @apiSuccess {String} opend_id 关注公众号的openid,只有强关了才有(公众号号是渠道授权的,用户得点击系统返回的带openid的参数的链接,访问后才算强关,或者从强关二维码进来的也算)
- * @apiSuccess {String} register_open_id 分销后台订单的openid(是平台系统默认的静默登录的openid)
- * @apiSuccess {String} wechat_name 关注公众号
- * @apiSuccess {String} order_type 订单类型[普通充值、包年、包月、包季]
- * @apiSuccess {String} push_msg_id 推送消息id,标记用[custom_开头是客服消息,template_开头是模板消息,下划线后是id]
- * @apiSuccess {String} ip 订单创建IP地址
- * @apiSuccess {Int} activity_id 活动ID
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "uid": 162261533,
- * "price": 200.5,
- * "trade_no": "343333235sdrf",
- * "status": "PAID",
- * "created_at": "2019-12-24 11:43:58",
- * "pay_end_at": "2019-12-24 11:43:58",
- * "send_order_id": 1,
- * "send_order_name": "1",
- * "activity_name": "",
- * "keyword": "",
- * "user_charge_times": 1,
- * "push_msg_id": "custom_4041988",
- * "ip": "36.18.52.247",
- * "activity_id": 2522,
- * }
- * ],
- * "meta": {
- * "total": 1,
- * "per_page": 100,
- * "current_page": 1,
- * "total": 1,
- * "next_page_url": "",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function orders(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id');
- $status = $request->get('status');
- $begin_date = $request->get('begin_date', date('Y-m-d', strtotime('-7 days')));
- $end_date = $request->get('end_date', date('Y-m-d', strtotime('+1 days')));
- if (strtotime($end_date) - strtotime($begin_date) > SysConsts::ONE_DAY_SECONDS * 60) {
- return response()->error('COMPANY_AUTH_OVER_TIME');
- } else {
- $service = new OrderService;
- $result = $service->companyAuthOrders(compact('channel_id', 'status', 'begin_date', 'end_date'));
- return response()->pagination(new OrderTransformer, $result);
- }
- }
- /**
- * 添加书币
- * @apiVersion 1.0.0
- * @apiName addBookCoin
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点id
- * @apiParam {String} uid 用户ID
- * @apiParam {String} openid 用户openid
- * @apiParam {String} amount 书币
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "success": 1
- * }
- * }
- */
- public function addBookCoin(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id');
- $uid = $request->get('uid');
- $openid = $request->get('openid');
- $amount = (int)$request->get('amount');
- $limit_amount = 2000;
- // 参数判断
- if ((empty($openid) && empty($uid)) || empty($channel_id) || empty($amount) || $amount < 0 || $amount > $limit_amount) {
- return response()->json(['code'=>-1, 'msg'=>'传参有误!']);
- }
- // 获取当前用户信息
- $user_info = '';
- if (!empty($uid)) {
- $user_info = $prev_coin = DB::connection('mysql')->table('users')->where(['id'=>$uid, 'distribution_channel_id'=>$channel_id])
- ->select('id', 'distribution_channel_id', 'balance', 'reward_balance')->first();
- }else if(!empty($openid)) {
- $user_info = $prev_coin = DB::connection('mysql')->table('users')
- ->where(['distribution_channel_id'=>$channel_id, 'openid'=>$openid])
- ->select('id', 'distribution_channel_id', 'balance', 'reward_balance')->first();
- }
- $user_info = (array)$user_info;
- if (!$user_info) return response()->json(['code'=>-1, 'msg'=>'用户不存在!']);
- // 当日该站点该用户获得的总书币
- $sum = DB::connection('mysql')->table('user_coin_logs')->where(['distribution_channel_id'=>$channel_id, 'uid'=>$user_info['id'], 'day'=>date('Y-m-d')])->sum('amount');
- if ($sum + $amount > $limit_amount) {
- return response()->json(['code' => -1, 'msg' => '每个用户每个站点每日加书币的总额不得超过'.$limit_amount.'!']);
- }
- try {
- DB::connection('mysql')->beginTransaction();
- $result = DB::connection('mysql')->table('users')->where(['id'=>$user_info['id']])->update([
- 'balance' => $user_info['balance'] + $amount,
- 'reward_balance' => $user_info['reward_balance'] + $amount,
- ]);
- if (!$result) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>'数据库异常!']);
- }
- $boolen = DB::connection('mysql')->table('user_coin_logs')->insert([
- 'distribution_channel_id' => $user_info['distribution_channel_id'],
- 'uid' => $user_info['id'],
- 'day' => date('Y-m-d'),
- 'before' => $user_info['balance'],
- 'amount' => $amount,
- 'after' => $user_info['balance'] + $amount,
- 'created_at' => date('Y-m-d H:i:s'),
- 'updated_at' => date('Y-m-d H:i:s'),
- ]);
- if (!$boolen) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>'数据库异常!']);
- }
- DB::connection('mysql')->commit();
- }catch(\Exception $e) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>$e->getMessage()]);
- }
- return response()->json(['code'=>1, 'msg'=>'', 'data'=>['success' => 1]]);
- }
- /**
- * 添加书币或会员有效期
- * @apiVersion 1.0.0
- * @apiName addBookCoinV2
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点id
- * @apiParam {String} uid 用户ID
- * @apiParam {String} openid 用户openid
- * @apiParam {String} type 类型(coin: 加书币 day: 加会员有效期,单位: 天)
- * @apiParam {String} [amount] 书币(type类型为coin时必填)
- * @apiParam {String} [day] 书币(type类型为day时必填)
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "success": 1
- * }
- * }
- */
- public function addBookCoinV2(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id');
- $uid = $request->get('uid');
- $openid = $request->get('openid');
- $amount = (int)$request->get('amount');
- $type = $request->get('type');
- $day = $request->get('day');
- $limit_amount = 2000;
- $limit_users = 20;
- // 参数判断
- if ((empty($openid) && empty($uid)) || empty($channel_id) || empty($type) || !in_array($type, ['coin', 'day'])) {
- return response()->json(['code'=>-1, 'msg'=>'传参有误!']);
- }
- if ($type == 'coin' && (empty($amount) || $amount < 0 || $amount > $limit_amount)) return response()->json(['code'=>-1, 'msg'=>'传参有误!']);
- if ($type == 'day' && (empty($day) || $day < 0 || $day > 366)) return response()->json(['code'=>-1, 'msg'=>'传参有误!']);
- // 获取当前用户信息
- $user_info = '';
- if (!empty($uid)) {
- $user_info = $prev_coin = DB::connection('mysql')->table('users')->where(['id'=>$uid, 'distribution_channel_id'=>$channel_id])
- ->select('id', 'distribution_channel_id', 'balance', 'reward_balance')->first();
- }else if(!empty($openid)) {
- $user_info = $prev_coin = DB::connection('mysql')->table('users')
- ->where(['distribution_channel_id'=>$channel_id, 'openid'=>$openid])
- ->select('id', 'distribution_channel_id', 'balance', 'reward_balance')->first();
- }
- $user_info = (array)$user_info;
- if (!$user_info) return response()->json(['code'=>-1, 'msg'=>'用户不存在!']);
- if ($type == 'day') { // 加包时日期
- $year_order = DB::connection('mysql')->table('year_orders')->where(['distribution_channel_id'=>$channel_id, 'uid'=>$user_info['id']])->select('id', 'end_time')->first();
- try {
- DB::connection('mysql')->beginTransaction();
- if ($year_order) {
- $year_order = (array)$year_order;
- $before_end_time = $year_order['end_time'];
- $after_end_time = date('Y-m-d H:i:s', (strtotime($before_end_time) + $day * 86400));
- $result = DB::connection('mysql')->table('year_orders')->where(['id'=>$year_order['id']])->update([
- 'end_time' => $after_end_time,
- 'updated_at' => date('Y-m-d H:i:s')
- ]);
- }else {
- $before_end_time = date('Y-m-d H:i:s');
- $after_end_time = date('Y-m-d H:i:s', (time() + $day * 86400));
- $result = DB::connection('mysql')->table('year_orders')->insert([
- 'uid' => $user_info['id'],
- 'begin_time' => $before_end_time,
- 'end_time' => $after_end_time,
- 'distribution_channel_id' => $channel_id,
- 'send_order_id' => 0,
- 'created_at' => date('Y-m-d H:i:s'),
- 'updated_at' => date('Y-m-d H:i:s'),
- ]);
- }
- if (!$result) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>'数据库异常!']);
- }
- $boolen = DB::connection('mysql')->table('user_coin_logs')->insert([
- 'distribution_channel_id' => $user_info['distribution_channel_id'],
- 'uid' => $user_info['id'],
- 'day' => date('Y-m-d'),
- 'before_end_time' => $before_end_time,
- 'day_num' => $day,
- 'after_end_time' => $after_end_time,
- 'type' => 2,
- 'created_at' => date('Y-m-d H:i:s'),
- 'updated_at' => date('Y-m-d H:i:s'),
- ]);
- if (!$boolen) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>'数据库异常!']);
- }
- DB::connection('mysql')->commit();
- }catch(\Exception $e) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>$e->getMessage()]);
- }
- return response()->json(['code'=>1, 'msg'=>'', 'data'=>['success' => 1]]);
- }else { // 加书币
- // 当日该站点该用户获得的总书币
- $sum = DB::connection('mysql')->table('user_coin_logs')->where(['distribution_channel_id'=>$channel_id, 'uid'=>$user_info['id'], 'day'=>date('Y-m-d')])->sum('amount');
- if ($sum + $amount > $limit_amount) {
- return response()->json(['code' => -1, 'msg' => '每个用户每个站点每日加书币的总额不得超过'.$limit_amount.'!']);
- }
- // 当日该站点加过书币的总用户数
- $today_users = DB::connection('mysql')->table('user_coin_logs')->where(['distribution_channel_id'=>$channel_id, 'day'=>date('Y-m-d')])->groupBy(['uid'])->get()->pluck('uid')->toArray();
- if (count($today_users) > $limit_users) return response()->json(['code' => -1, 'msg' => '每个站点每日加书币的用户数不得超过'.$limit_users.'!']);
- if (count($today_users) == $limit_users && !in_array($uid, $today_users)) return response()->json(['code' => -1, 'msg' => '每个站点每日加书币的用户数不得超过'.$limit_users.'!']);
- try {
- DB::connection('mysql')->beginTransaction();
- $result = DB::connection('mysql')->table('users')->where(['id'=>$user_info['id']])->update([
- 'balance' => $user_info['balance'] + $amount,
- 'reward_balance' => $user_info['reward_balance'] + $amount,
- ]);
- if (!$result) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>'数据库异常!']);
- }
- $boolen = DB::connection('mysql')->table('user_coin_logs')->insert([
- 'distribution_channel_id' => $user_info['distribution_channel_id'],
- 'uid' => $user_info['id'],
- 'day' => date('Y-m-d'),
- 'before' => $user_info['balance'],
- 'amount' => $amount,
- 'after' => $user_info['balance'] + $amount,
- 'created_at' => date('Y-m-d H:i:s'),
- 'updated_at' => date('Y-m-d H:i:s'),
- ]);
- if (!$boolen) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>'数据库异常!']);
- }
- DB::connection('mysql')->commit();
- }catch(\Exception $e) {
- DB::connection('mysql')->rollback();
- return response()->json(['code'=>-1, 'msg'=>$e->getMessage()]);
- }
- return response()->json(['code'=>1, 'msg'=>'', 'data'=>['success' => 1]]);
- }
- }
- /**
- * @api {post} company/auth/sendOrders 派单信息列表
- * @apiVersion 1.0.0
- * @apiName sendOrders
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点id
- * @apiParam {String} begin_date 开始时间(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)
- * @apiParam {String} end_date 截止时间(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} id 派单ID
- * @apiSuccess {Int} channel_id 渠道ID
- * @apiSuccess {String} name 派单名称
- * @apiSuccess {Int} registerNum 注册用户数
- * @apiSuccess {Int} chapter_id 推广章节ID
- * @apiSuccess {String} chapter_name 推广章节
- * @apiSuccess {String} subscribe_chapter_name 强关章节
- * @apiSuccess {Int} totalChargeAmount 充值金额
- * @apiSuccess {Int} fansNum 关注用户数
- * @apiSuccess {Decimal} cost 成本
- * @apiSuccess {Int} payUserNum 付费用户数
- * @apiSuccess {Int} UV UV
- * @apiSuccess {Int} PV PV
- * @apiSuccess {String} promotion_url 推广链接
- * @apiSuccess {String} created_at 创建时间
- * @apiSuccessExample {json} Success-Response:
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "id": 915338,
- * "channel_id": 166,
- * "name": "qqq",
- * "registerNum": 0,
- * "chapter_name": "第二章 断子绝孙",
- * "subscribe_chapter_name": "第一章 出嫁",
- * "totalChargeAmount": 0,
- * "fansNum": 0,
- * "cost": "0.00",
- * "payUserNum": 0,
- * "PV": 0,
- * "UV": 0,
- * "promotion_url": "https://siteJKa6oWBEzR7Y5Dp8.localhost/yun/915338",
- * "created_at":''
- * }
- * ],
- * "meta": {
- * "total": 1,
- * "per_page": 100,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function sendOrders(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id', 0);
- $begin_date = $request->get('begin_date', date('Y-m-d', strtotime('-7 days')));
- $end_date = $request->get('end_date', date('Y-m-d', strtotime('+1 days')));
- if (strtotime($end_date) - strtotime($begin_date) > SysConsts::ONE_DAY_SECONDS * 31) {
- return response()->error('COMPANY_AUTH_OVER_TIME');
- } else {
- $service = new SendOrderService;
- $result = $service->companyAuthSendOrders(compact('channel_id', 'begin_date', 'end_date'));
- $result = (new SendOrderStatistic(collect($result->items())->pluck('id')->all()))->getDataList($result);
- return response()->pagination(new SendOrderTransformer, $result);
- }
- }
- /**
- * @api {post} company/auth/sendOrder 派单明细
- * @apiVersion 1.0.0
- * @apiName sendOrder
- * @apiGroup CompanyAuth
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {Int} send_order_id 派单ID
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiError {int} code 状态码
- * @apiError {String} msg 信息
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {String} send_order_name 渠道名称
- * @apiSuccess {Int} distribution_channel_id 渠道ID
- * @apiSuccess {String} bid 书号
- * @apiSuccess {String} book_name 书名
- * @apiSuccess {Int} cid 章节ID
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "send_order_name": "知音书苑-0315-1-张艳",
- * "distribution_channel_id": 8,
- * "bid": "5pNo6A7wqQmB1WgQygDjkOM9VZn2vXeY",
- * "book_name": "一生只求一个你"
- * }
- * }
- */
- public function findSendOrder(SingleSendOrderRequest $request)
- {
- $send_order_id = $request->get('send_order_id');
- $service = new SendOrderService;
- $send_order = $service->findSendOrderByChannels($send_order_id, $this->channel_ids);
- if ($send_order) {
- return response()->success([
- 'send_order_name' => $send_order->name,
- 'distribution_channel_id' => $send_order->distribution_channel_id,
- 'bid' => book_hash_encode($send_order->book_id),
- 'book_name' => $send_order->book_name,
- 'cid' => $send_order->chapter_id,
- ]);
- } else {
- return response()->error('COMPANY_AUTH_EMPTY');
- }
- }
- /**
- * @api {post} company/auth/dayStatistic 订单日统计数据
- * @apiVersion 1.0.0
- * @apiName dayStatistic
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点id
- * @apiParam {String} begin_date 开始时间(时间区间小于30天,格式yyyy-MM-dd)
- * @apiParam {String} end_date 截止时间(时间区间小于30天,格式yyyy-MM-dd)
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {String} date 日期
- * @apiSuccess {Int} channel_id 渠道ID
- * @apiSuccess {Int} pay_number 总付费用户数
- * @apiSuccess {Int} charge_amount 总充值金额
- * @apiSuccess {Int} first_pay_number 首充用户数
- * @apiSuccess {Int} first_charge_amount 首充充值金额
- * @apiSuccess {Int} read_uv 阅读人数
- * @apiSuccess {Int} register_number 注册用户数
- * @apiSuccess {Int} register_pay_number 当日注册用户首充用户数
- * @apiSuccess {Int} register_charge_amount 当日注册用户首充金额
- * @apiSuccessExample {json} Success-Response:
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "date": "2020-02-26",
- * "channel_id": 5,
- * "pay_number": 283,
- * "charge_amount": "11123.11",
- * "first_pay_number": 233,
- * "first_charge_amount": "8013.20",
- * "read_uv": 3598,
- * "register_number": 1669,
- * "register_pay_number": 201,
- * "register_charge_amount": "6861.00"
- * }
- * ],
- * "meta": {
- * "total": 1,
- * "per_page": 100,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function dayStatistic(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id', 0);
- $begin_date = $request->get('begin_date', date('Y-m-d', strtotime('-7 days')));
- $end_date = $request->get('end_date', date('Y-m-d'));
- $service = new OrderService;
- $result = $service->companyAuthDayStatistic(compact('channel_id', 'begin_date', 'end_date'));
- return response()->pagination(new OrderDayStatsTransformer, $result);
- }
- /**
- * @api {post} company/auth/chapters/free 免费章节列表
- * @apiVersion 1.0.0
- * @apiName freeChapters
- * @apiGroup CompanyAuth
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} bid 书号
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Int} id 章节ID
- * @apiSuccess {Int} next_cid 下一章章节ID
- * @apiSuccess {String} content 章节内容
- * @apiSuccess {String} name 章节名称
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": [
- * {
- * "id": 1,
- * "name": "第1章 初相见",
- * "next_cid": 1253,
- * "content": "",
- * },
- * {
- * "id": 1253,
- * "name": "第2章 姊妹恶",
- * "next_cid": 1252,
- * "content": "",
- * }
- * ]
- * }
- */
- public function findBookFreeChapters(BookQueryRequest $request)
- {
- $hash_bid = $request->get('bid', '');
- $bid = CommonHelper::book_hash_decode($hash_bid);
- $service = new BookConfigService;
- $chapters = $service->findBookFreeChapters($bid);
- return response()->success($chapters);
- }
- /**
- * @api {post} company/auth/customMsg 客服消息列表
- * @apiVersion 1.0.0
- * @apiName customMsg
- * @apiGroup CompanyAuth
- * @apiParam {String} start_time 创建时间:开始(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} end_time 截止时间(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} send_start_time 发送时间:开始(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} send_end_time 截止时间(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} book_name 书名 可选
- * @apiParam {String} name 消息名称 可选
- * @apiParam {String} channel_id 站点
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} id
- * @apiSuccess {String} appid 微信号APPID
- * @apiSuccess {String} name 消息名称
- * @apiSuccess {String} send_time 消息发送时间
- * @apiSuccess {Int} uv
- * @apiSuccess {Int} pv
- * @apiSuccess {Int} user_num 送达人数
- * @apiSuccess {Int} pay_user_num 充值用户
- * @apiSuccess {Decimal} charge_amount 充值金额
- * @apiSuccess {String} book_name 书名
- * @apiSuccess {String} chapter_name 章节名称
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "id": 4852,
- * "appid": null,
- * "name": "女神小说-0430-客服消息",
- * "send_time": "2018-04-30 14:00:00",
- * "uv": 0,
- * "pv": 0,
- * "channel_id": 0,
- * "pay_user_num": 0,
- * "charge_amount": "",
- * "book_name": "",
- * "chapter_name": "",
- * "create_at": "2018-04-30 12:40:22"
- * },
- * {
- * "id": 4776,
- * "appid": null,
- * "name": "女神小说-0429-客服消息",
- * "send_time": "2018-04-29 14:00:00",
- * "uv": 0,
- * "pv": 0,
- * "channel_id": 0,
- * "pay_user_num": 0,
- * "charge_amount": "",
- * "book_name": "",
- * "chapter_name": "",
- * "create_at": "2018-04-29 13:58:01"
- * },
- * ],
- * "meta": {
- * "total": 2,
- * "per_page": 15,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "http://vipchannel.pre.aizhuishu.com/api/company/auth/customMsg?page=2",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function findCustomSendMsg(CustomSendMsgRequest $request)
- {
- $start_time = $request->get('start_time', date('Y-m-d', strtotime('-7 days')));
- $end_time = $request->get('end_time', date('Y-m-d'));
- $send_start_time = $request->get('send_start_time', '');
- $send_end_time = $request->get('send_end_time', '');
- $book_name = $request->get('book_name', '');
- $name = $request->get('name', '');
- $channel_id = $request->get('channel_id', '');
- $params = [
- 'start_time' => $start_time,
- 'end_time' => $end_time,
- 'book_name' => $book_name,
- 'name' => $name,
- 'channel_id' => $channel_id,
- 'send_start_time' => $send_start_time,
- 'send_end_time' => $send_end_time
- ];
- if (strtotime($end_time) - strtotime($start_time) > SysConsts::ONE_DAY_SECONDS * 31) {
- return response()->error('COMPANY_AUTH_OVER_TIME');
- }
- if ($send_start_time && $send_end_time && strtotime($send_start_time) - strtotime($send_end_time) > SysConsts::ONE_DAY_SECONDS * 31) {
- return response()->error('COMPANY_AUTH_OVER_TIME');
- }
- $result = (new OfficialAccountService)->findCustomSendMsgs($params);
- return response()->pagination(new CustomSendMsgsTransformers, $result);
- }
- /**
- * @api {post} company/auth/templateSendMsg 模板消息列表
- * @apiVersion 1.0.0
- * @apiName templateSendMsg
- * @apiGroup CompanyAuth
- * @apiParam {String} start_time 创建时间:开始(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} end_time 截止时间(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} send_start_time 发送时间:开始(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} send_end_time 截止时间(时间区间小于30天,格式yyyy-MM-dd HH:mm:ss)可选
- * @apiParam {String} book_name 书名 可选
- * @apiParam {String} name 消息名称 可选
- * @apiParam {String} channel_id 站点
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} id
- * @apiSuccess {String} appid 微信号APPID
- * @apiSuccess {String} name 消息名称
- * @apiSuccess {String} send_time 消息发送时间
- * @apiSuccess {Int} uv
- * @apiSuccess {Int} pv
- * @apiSuccess {Int} user_num 送达人数
- * @apiSuccess {Int} pay_user_num 充值用户
- * @apiSuccess {Decimal} charge_amount 充值金额
- * @apiSuccess {String} book_name 书名
- * @apiSuccess {String} chapter_name 章节名称
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "id": 4852,
- * "appid": null,
- * "name": "女神小说-0430-客服消息",
- * "send_time": "2018-04-30 14:00:00",
- * "uv": 0,
- * "pv": 0,
- * "channel_id": 0,
- * "pay_user_num": 0,
- * "charge_amount": "",
- * "book_name": "",
- * "chapter_name": "",
- * "create_at": "2018-04-30 12:40:22"
- * },
- * {
- * "id": 4776,
- * "appid": null,
- * "name": "女神小说-0429-客服消息",
- * "send_time": "2018-04-29 14:00:00",
- * "uv": 0,
- * "pv": 0,
- * "channel_id": 0,
- * "pay_user_num": 0,
- * "charge_amount": "",
- * "book_name": "",
- * "chapter_name": "",
- * "create_at": "2018-04-29 13:58:01"
- * },
- * ],
- * "meta": {
- * "total": 2,
- * "per_page": 15,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "http://vipchannel.pre.aizhuishu.com/api/company/auth/customMsg?page=2",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function findTemplateSendMsg(CustomSendMsgRequest $request)
- {
- $start_time = $request->get('start_time', date('Y-m-d', strtotime('-7 days')));
- $end_time = $request->get('end_time', date('Y-m-d'));
- $send_start_time = $request->get('send_start_time', '');
- $send_end_time = $request->get('send_end_time', '');
- $book_name = $request->get('book_name', '');
- $name = $request->get('name', '');
- $channel_id = $request->get('channel_id', '');
- $params = [
- 'start_time' => $start_time,
- 'end_time' => $end_time,
- 'book_name' => $book_name,
- 'name' => $name,
- 'channel_id' => $channel_id,
- 'send_start_time' => $send_start_time,
- 'send_end_time' => $send_end_time
- ];
- if (strtotime($end_time) - strtotime($start_time) > SysConsts::ONE_DAY_SECONDS * 31) {
- return response()->error('COMPANY_AUTH_OVER_TIME');
- }
- if ($send_start_time && $send_end_time && strtotime($send_start_time) - strtotime($send_end_time) > SysConsts::ONE_DAY_SECONDS * 31) {
- return response()->error('COMPANY_AUTH_OVER_TIME');
- }
- $result = (new OfficialAccountService)->findWechatTemplateMsgs($params);
- return response()->pagination(new CustomSendMsgsTransformers, $result);
- }
- /**
- * @api {post} company/auth/delayMsg 延时客服消息
- * @apiVersion 1.0.0
- * @apiName delayMsg
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} id
- * @apiSuccess {String} title 标题
- * @apiSuccess {String} link 链接
- * @apiSuccess {String} desc 描述
- * @apiSuccess {Int} time_delay 延时时间
- * @apiSuccess {String} user_type 用户类型:ALL所有 UNPAID 未付费 PAID 付费用户
- * @apiSuccess {String} chapter_info 章节名
- * @apiSuccess {String} book_info 书名
- * @apiSuccess {String} type 消息类型 page 页面 book 小说
- * @apiSuccess {Int} uv
- * @apiSuccess {Int} pv
- * @apiSuccess {Int} pay_user_num 付费用户数
- * @apiSuccess {Decimal} charge_amount 充值金额
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "id":"",
- * "title":"",
- * "link":"",
- * "desc":"",
- * "time_delay":"",
- * "user_type":"",
- * "chapter_name":"",
- * "book_name":"",
- * "type":"",
- * "uv":"",
- * "pv":"",
- * "pay_user_num": "",
- * "charge_amount": "",
- * }
- * ],
- * "meta": {
- * "total": 1,
- * "per_page": 15,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function delayMsg(CustomSendMsgRequest $request)
- {
- $channel_id = $request->get('channel_id', '');
- $params = [
- 'channel_id' => $channel_id,
- ];
- $result = (new OfficialAccountService)->findWechatDelayMsgs($params);
- return response()->pagination(new DelaySendMsgsTransformers, $result);
- }
- /**
- * @api {post} company/auth/activity 促销活动列表
- * @apiVersion 1.0.0
- * @apiName activity
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} id
- * @apiSuccess {String} name 活动名称
- * @apiSuccess {String} activity_page 活动地址
- * @apiSuccess {String} created_at 创建时间
- * @apiSuccess {String} start_time 开始时间
- * @apiSuccess {String} end_time 结束时间
- * @apiSuccess {Decimal} price 价格
- * @apiSuccess {Int} orderCount 订单数量
- * @apiSuccess {Decimal} totalChargeAmount 充值金额
- * @apiSuccess {Int} successOrderCount 成功订单数
- * @apiSuccess {Int} pageUserNum 访问人数
- * @apiSuccess {Int} is_reader_page_show 是否阅读页展示
- * @apiSuccess {Int} is_sign_message_show 是否签到页展示
- * @apiSuccess {Decimal} successrate 订单成功率
- * @apiSuccess {Int} is_over 是否结束
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "id":"",
- * "name":"",
- * "activity_page":"",
- * "created_at":"",
- * "start_time":"",
- * "end_time":"",
- * "price":"",
- * "orderCount":"",
- * "totalChargeAmount":"",
- * "successOrderCount":"",
- * "pageUserNum":"",
- * "is_reader_page_show": "",
- * "is_sign_message_show": "",
- * "successrate": "",
- * "is_over": ""
- * }
- * ],
- * "meta": {
- * "total": 1,
- * "per_page": 15,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function activity(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id', 0);
- $result = (new ActivityService)->getCommonActivitiesWithStats($channel_id);
- return response()->pagination(new ActivityTransformer, $result);
- }
- /**
- * @api {post} company/auth/selfActivity 自定义活动列表
- * @apiVersion 1.0.0
- * @apiName selfActivity
- * @apiGroup CompanyAuth
- * @apiParam {String} channel_id 站点
- * @apiParam {Int} page 分页页码
- * @apiParam {String} app_id 分配好的{app_id}
- * @apiParam {String} nonce_str 随机字符串
- * @apiParam {String} timestamp 时间戳
- * @apiParam {String} sign 签名 规则同微信支付签名MD5(排序好的请求字符串&key=分配好的{app_secret})
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {Object} data 结果集
- * @apiSuccess {Object} list 数据结果
- * @apiSuccess {Object} meta 分页信息
- * @apiSuccess {Int} total 分页总数
- * @apiSuccess {Int} id
- * @apiSuccess {String} name 活动名称
- * @apiSuccess {String} activity_page 活动地址
- * @apiSuccess {String} created_at 创建时间
- * @apiSuccess {String} start_time 开始时间
- * @apiSuccess {String} end_time 结束时间
- * @apiSuccess {Decimal} price 价格
- * @apiSuccess {Int} orderCount 订单数量
- * @apiSuccess {Decimal} totalChargeAmount 充值金额
- * @apiSuccess {Int} successOrderCount 成功订单数
- * @apiSuccess {Int} pageUserNum 访问人数
- * @apiSuccess {Int} is_reader_page_show 是否阅读页展示
- * @apiSuccess {Int} is_sign_message_show 是否签到页展示
- * @apiSuccess {Decimal} successrate 订单成功率
- * @apiSuccess {Int} is_over 是否结束
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "code": 0,
- * "msg": "",
- * "data": {
- * "list": [
- * {
- * "id":"",
- * "name":"",
- * "activity_page":"",
- * "created_at":"",
- * "start_time":"",
- * "end_time":"",
- * "price":"",
- * "orderCount":"",
- * "totalChargeAmount":"",
- * "successOrderCount":"",
- * "pageUserNum":"",
- * "is_reader_page_show": "",
- * "is_sign_message_show": "",
- * "successrate": "",
- * "is_over": ""
- * }
- * ],
- * "meta": {
- * "total": 1,
- * "per_page": 15,
- * "current_page": 1,
- * "last_page": 1,
- * "next_page_url": "",
- * "prev_page_url": ""
- * }
- * }
- * }
- */
- public function selfActivity(ChannelQueryRequest $request)
- {
- $channel_id = $request->get('channel_id', 0);
- $result = (new ActivityService)->getChannelActivitiesWithStats($channel_id);
- return response()->pagination(new ActivityTransformer, $result);
- }
- }
|