Selaa lähdekoodia

book combination

zz 4 vuotta sitten
vanhempi
commit
d8d78aa656
100 muutettua tiedostoa jossa 0 lisäystä ja 12129 poistoa
  1. 0 423
      app/Http/Controllers/Channel/Activity/ActivityController.php
  2. 0 63
      app/Http/Controllers/Channel/Activity/ActivitySwitchController.php
  3. 0 25
      app/Http/Controllers/Channel/Activity/Transformers/ActivityChargeInfoTransformer.php
  4. 0 32
      app/Http/Controllers/Channel/Activity/Transformers/ActivityTransformer.php
  5. 0 208
      app/Http/Controllers/Channel/Ali/AliSendOrderController.php
  6. 0 43
      app/Http/Controllers/Channel/Ali/AliSendOrderStatController.php
  7. 0 32
      app/Http/Controllers/Channel/Ali/Transformers/AliSendOrderTransformer.php
  8. 0 46
      app/Http/Controllers/Channel/BaseController.php
  9. 0 64
      app/Http/Controllers/Channel/Behavior/BehaviorController.php
  10. 0 55
      app/Http/Controllers/Channel/Book/BookChannelScoreController.php
  11. 0 83
      app/Http/Controllers/Channel/Book/BookSubScribleChapterController.php
  12. 0 907
      app/Http/Controllers/Channel/Book/BooksController.php
  13. 0 127
      app/Http/Controllers/Channel/Book/ChapterController.php
  14. 0 107
      app/Http/Controllers/Channel/Book/ChapterImageController.php
  15. 0 47
      app/Http/Controllers/Channel/Book/Transformers/BookTransformer.php
  16. 0 56
      app/Http/Controllers/Channel/Book/Transformers/BookV2Transformer.php
  17. 0 14
      app/Http/Controllers/Channel/Book/Transformers/ChapterImageTransformer.php
  18. 0 29
      app/Http/Controllers/Channel/Book/Transformers/ChapterListTransformer.php
  19. 0 23
      app/Http/Controllers/Channel/Book/Transformers/ChapterTransformer.php
  20. 0 16
      app/Http/Controllers/Channel/Book/Transformers/ProductTransformer.php
  21. 0 337
      app/Http/Controllers/Channel/Channel/AuthController.php
  22. 0 170
      app/Http/Controllers/Channel/Channel/ChannelController.php
  23. 0 90
      app/Http/Controllers/Channel/Channel/ChannelQuestionNaireController.php
  24. 0 90
      app/Http/Controllers/Channel/Channel/ChannelSubscribeSettingController.php
  25. 0 38
      app/Http/Controllers/Channel/Channel/ChannelSwitchController.php
  26. 0 28
      app/Http/Controllers/Channel/Channel/PayTemplateController.php
  27. 0 22
      app/Http/Controllers/Channel/Channel/Transformers/ChannelSubscribeTransformer.php
  28. 0 15
      app/Http/Controllers/Channel/Channel/Transformers/ChannelTransformer.php
  29. 0 60
      app/Http/Controllers/Channel/Finance/BankController.php
  30. 0 55
      app/Http/Controllers/Channel/Finance/BaseController.php
  31. 0 126
      app/Http/Controllers/Channel/Finance/BillsController.php
  32. 0 255
      app/Http/Controllers/Channel/Finance/CashAccountsController.php
  33. 0 84
      app/Http/Controllers/Channel/Finance/CommissionRateController.php
  34. 0 46
      app/Http/Controllers/Channel/Finance/FinanceController.php
  35. 0 99
      app/Http/Controllers/Channel/Finance/FinancialConfigController.php
  36. 0 268
      app/Http/Controllers/Channel/Finance/FinancialStatController.php
  37. 0 124
      app/Http/Controllers/Channel/Finance/OfficialAccountBills.php
  38. 0 166
      app/Http/Controllers/Channel/Finance/PaymentController.php
  39. 0 21
      app/Http/Controllers/Channel/Finance/Transformers/BankTransformer.php
  40. 0 24
      app/Http/Controllers/Channel/Finance/Transformers/BillTransformer.php
  41. 0 30
      app/Http/Controllers/Channel/Finance/Transformers/CashAccountTransformer.php
  42. 0 21
      app/Http/Controllers/Channel/Finance/Transformers/CommissionRateTransformer.php
  43. 0 20
      app/Http/Controllers/Channel/Finance/Transformers/FinancialConfigTransformer.php
  44. 0 35
      app/Http/Controllers/Channel/Finance/Transformers/FinancialStatDetailTransformer.php
  45. 0 25
      app/Http/Controllers/Channel/Finance/Transformers/FinancialStatTransformer.php
  46. 0 28
      app/Http/Controllers/Channel/Finance/Transformers/OfficialAccountBillsTransformer.php
  47. 0 42
      app/Http/Controllers/Channel/Finance/Transformers/PaymentDetailTransformer.php
  48. 0 24
      app/Http/Controllers/Channel/Finance/Transformers/PaymentTransformer.php
  49. 0 40
      app/Http/Controllers/Channel/Finance/Transformers/WithdrawCashFinancialTransformer.php
  50. 0 31
      app/Http/Controllers/Channel/Finance/Transformers/WithdrawCashTransformer.php
  51. 0 495
      app/Http/Controllers/Channel/Finance/WithdrawCashController.php
  52. 0 45
      app/Http/Controllers/Channel/Notice/NoticeTypesController.php
  53. 0 152
      app/Http/Controllers/Channel/Notice/NoticesController.php
  54. 0 19
      app/Http/Controllers/Channel/Notice/Transformers/NoticeTransformer.php
  55. 0 13
      app/Http/Controllers/Channel/Notice/Transformers/NoticeTypeTransformer.php
  56. 0 18
      app/Http/Controllers/Channel/Notice/Transformers/SimpleNoticeTransformer.php
  57. 0 1318
      app/Http/Controllers/Channel/OfficialAccount/CustomMsgController.php
  58. 0 191
      app/Http/Controllers/Channel/OfficialAccount/CustomSendStatsController.php
  59. 0 165
      app/Http/Controllers/Channel/OfficialAccount/DistributionSelfDefineContentsController.php
  60. 0 284
      app/Http/Controllers/Channel/OfficialAccount/OfficialAccountsController.php
  61. 0 270
      app/Http/Controllers/Channel/OfficialAccount/SmartPushsController.php
  62. 0 14
      app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomMsgControllerTransformer.php
  63. 0 20
      app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomMsgSwitchMultyTransformer.php
  64. 0 17
      app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomMsgSwitchTransformer.php
  65. 0 36
      app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomSendMsgsTransformers.php
  66. 0 21
      app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomSendStatsTransformers.php
  67. 0 41
      app/Http/Controllers/Channel/OfficialAccount/Transformers/OfficialAccountTransformer.php
  68. 0 28
      app/Http/Controllers/Channel/OfficialAccount/Transformers/OfficialImgtextUrlsTransformer.php
  69. 0 25
      app/Http/Controllers/Channel/OfficialAccount/Transformers/SmartPushMsgTransformer.php
  70. 0 26
      app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatKeyWordsMsgTransformer.php
  71. 0 18
      app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatPublicTemplatesTransformer.php
  72. 0 43
      app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatTemplatesMsgTransformer.php
  73. 0 22
      app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatTemplatesTransformer.php
  74. 0 323
      app/Http/Controllers/Channel/OfficialAccount/WechatKeywordsController.php
  75. 0 89
      app/Http/Controllers/Channel/OfficialAccount/WechatPublicTemplatesController.php
  76. 0 1016
      app/Http/Controllers/Channel/OfficialAccount/WechatTemplatesController.php
  77. 0 203
      app/Http/Controllers/Channel/Order/OrdersController.php
  78. 0 19
      app/Http/Controllers/Channel/Order/Transformers/BookOrderTransformer.php
  79. 0 30
      app/Http/Controllers/Channel/Order/Transformers/ChapterOrderTransformer.php
  80. 0 18
      app/Http/Controllers/Channel/Order/Transformers/ChargeListTransformer.php
  81. 0 19
      app/Http/Controllers/Channel/Order/Transformers/OrderTransformer.php
  82. 0 63
      app/Http/Controllers/Channel/Promotion/BgImagesController.php
  83. 0 52
      app/Http/Controllers/Channel/Promotion/BodyTemplatesController.php
  84. 0 54
      app/Http/Controllers/Channel/Promotion/DocumentCoversController.php
  85. 0 60
      app/Http/Controllers/Channel/Promotion/HeadlineController.php
  86. 0 54
      app/Http/Controllers/Channel/Promotion/OriginalGuidesController.php
  87. 0 58
      app/Http/Controllers/Channel/Promotion/PromotionPagesController.php
  88. 0 53
      app/Http/Controllers/Channel/Promotion/QrCodeController.php
  89. 0 27
      app/Http/Controllers/Channel/Promotion/Transformers/BgInagesTransformer.php
  90. 0 25
      app/Http/Controllers/Channel/Promotion/Transformers/BodyTemplatesTransformer.php
  91. 0 25
      app/Http/Controllers/Channel/Promotion/Transformers/DocumentCoversTransformer.php
  92. 0 18
      app/Http/Controllers/Channel/Promotion/Transformers/HeadlinelTransformer.php
  93. 0 25
      app/Http/Controllers/Channel/Promotion/Transformers/OriginalGuidesTransformer.php
  94. 0 28
      app/Http/Controllers/Channel/Promotion/Transformers/PromotionPagesTransformer.php
  95. 0 24
      app/Http/Controllers/Channel/Promotion/Transformers/QrCodeTransformer.php
  96. 0 198
      app/Http/Controllers/Channel/SendOrder/SendOrderBatchHandleController.php
  97. 0 167
      app/Http/Controllers/Channel/SendOrder/SendOrderBreakevenStatsController.php
  98. 0 1351
      app/Http/Controllers/Channel/SendOrder/SendOrderController.php
  99. 0 35
      app/Http/Controllers/Channel/SendOrder/SendOrderStatisticsController.php
  100. 0 0
      app/Http/Controllers/Channel/SendOrder/Transformers/SendOrderBreakevenStatsTransformer.php

+ 0 - 423
app/Http/Controllers/Channel/Activity/ActivityController.php

@@ -1,423 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Activity;
-
-use App\Http\Controllers\Channel\Activity\Transformers\ActivityChargeInfoTransformer;
-use App\Http\Controllers\Channel\Activity\Transformers\ActivityTransformer;
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Activity\Services\ActivityService;
-use App\Modules\Activity\Services\ActivitySwitchService;
-use App\Modules\Trade\Models\Order;
-use App\Modules\Trade\Services\OrderService;
-use DB;
-use Hashids;
-use Illuminate\Http\Request;
-use Log;
-use Storage;
-
-/**
- * 活动
- * Class ActivityController
- * @package App\Http\Controllers\Channel\Activity
- */
-class ActivityController extends BaseController
-{
-
-    /**
-     * @apiDefine Activity 活动模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/getActivities 获取活动信息
-     * @apiGroup Activity
-     * @apiName getActivities
-     * @apiParam   {Number}  [activity_id] 活动ID
-     * @apiParam   {String}  [begin_time] 开始时间
-     * @apiParam   {String}  [end_time] 结束时间
-     * @apiSuccess {Number}  id 活动ID.
-     * @apiSuccess {String}  name 活动名称
-     * @apiSuccess {String}  activity_page 活动页面
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccess {String}  start_time 开始时间
-     * @apiSuccess {String}  end_time 结束时间
-     * @apiSuccess {Number}  price 活动单价
-     * @apiSuccess {Number}  totalChargeAmount 活动的总充值额
-     * @apiSuccess {Number}  orderCount 订单数
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *            {
-     *              "id": 2,
-     *              "name": "活动1222",
-     *              "activity_page": "http://www.baidu.com",
-     *              "created_at": "2017-12-01 10:20:04",
-     *              "start_time": "2017-12-01 10:20:04",
-     *              "end_time": "2017-12-01 10:20:04",
-     *              "price": 30,
-     *              "totalChargeAmount": 1000,
-     *              "orderCount": 50
-     *            }
-     *        ]
-     *     }
-     */
-    function getActivities(Request $request)
-    {
-        $params = [];
-        $request->has('end_time') && $request->input('end_time') && $params['end_time'] = trim($request->input('end_time'));
-        $request->has('begin_time') && $request->input('begin_time') && $params['begin_time'] = $request->input('begin_time');
-        $request->has('activity_id') && $request->input('activity_id') && $params['activity_id'] = $request->input('activity_id');
-
-        $params['distribution_channel_id'] = [0];
-        //\Log::info('achor:start_query_activity_info:'.time());
-        $activities = ActivityService::search($params);
-        //\Log::info('achor:end_query_activity_info:'.time());
-        $channel_id = $this->getChannelId();
-        //\Log::info('channel_id:'.$channel_id);
-        foreach ($activities as $item) {
-            $url = $item->activity_page;
-            $item->activity_page = env('PROTOCOL') . '://site' . encodeDistributionChannelId($channel_id) . '.' . env('CUSTOM_HOST') . '.com' . $url;
-            //select premium
-            /*$item->totalChargeAmount = OrderService::getAmount(['activity_id' => $item->id, 'distribution_channel_id' => $channel_id]);
-            $item->orderCount = OrderService::getActivityOrderNum(['activity_id' => $item->id, 'status' => 'PAID', 'distribution_channel_id' => $channel_id]);*/
-            //\Log::info('achor:start_query_order_info:'.($item->id).':'.time());
-            $order_info = Order::select(DB::raw('count(*) as order_count,sum(price) as total_charge_amount'))
-                ->where([
-                    ['activity_id' ,'=', $item->id],
-                    ['status','=', 'PAID'],
-                    ['distribution_channel_id','=',$channel_id]
-                ])->first();
-            //\Log::info('achor:end_query_order_info:'.($item->id).':'.time());
-            $item->totalChargeAmount = $order_info?$order_info->total_charge_amount:0;
-            $item->orderCount = $order_info?$order_info->order_count:0;
-            if ($item->id == 3) {
-                $item->price = '50元/108元';
-            }
-            if ($item->id == 860) {
-                $item->price = '17元/30元/58元';
-            }
-            if($item->id == 1224){
-                $item->price = '11元/17元/58元';
-            }
-            $is_over = 0;
-            if($item->end_time < date('Y-m-d H:i:s')){
-                $is_over = 1;
-            }
-            $item->is_over = $is_over;
-            //\Log::info('achor:start_query_ActivitySwitch:'.($item->id).':'.time());
-            $item->is_reader_page_show = ActivitySwitchService::isShowInPage($item->id, $channel_id, 'reader');
-            $item->is_sign_message_show = ActivitySwitchService::isShowInPage($item->id, $channel_id, 'sign');
-            //\Log::info('achor:end_query_ActivitySwitch:'.($item->id).':'.time());
-        }
-        return response()->pagination(new ActivityTransformer(), $activities);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/getActivityRechargeInfo 获取活动的充值明细
-     * @apiGroup Activity
-     * @apiName getActivityRechargeInfo
-     * @apiParam   {Number}  [activity_id] 活动ID
-     * @apiSuccess {Number}  uid 用户id.
-     * @apiSuccess {Number}  price 充值金额.
-     * @apiSuccess {String}  trade_no 平台交易ID.
-     * @apiSuccess {String}  pay_end_at 支付完成时间.
-     * @apiSuccess {String}  activity_id 活动ID
-     * @apiSuccess {Number}  send_order_id 派单id
-     * @apiSuccess {String}  send_order_name 派单名称
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *            {
-     *              "uid": 1,
-     *              "price": "1.00",
-     *              "trade_no": "201711301125401585459852216605",
-     *              "pay_end_at": "2017-12-01 10:20:04",
-     *              "activity_id": 1,
-     *              "send_order_id": 0,
-     *              "send_order_name": "",
-     *              "created_at": 1512094804,
-     *            }
-     *        ]
-     *     }
-     */
-    function getActivityRechargeInfo(Request $request)
-    {
-        $activity_id = $request->has('activity_id') ? $request->input('activity_id') : '';
-        if (empty($activity_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        if (!is_numeric($activity_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $activitiesRechargeInfo = ActivityService::getActivityRechargeInfo(['activity_id' => $activity_id, 'status' => 'PAID']);
-        return response()->pagination(new ActivityChargeInfoTransformer(), $activitiesRechargeInfo);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/pushinfo 快速创建客服消息
-     * @apiGroup Activity
-     * @apiName getActivityCustomerPushInfo
-     * @apiParam   {Number}  activity_id 活动ID
-     * @apiSuccess {Number}  data.name 活动名称.
-     * @apiSuccess {Number}  data.redirect_url 跳转地址.
-     * @apiSuccess {String}  data.pic 图片地址
-     * @apiSuccess {String}  data.title 标题
-     * @apiSuccessExample {json} Success-Response:
-     *    {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *           id: 3,
-     *           name: "春节活动",
-     *           created_at: "2018-02-07 19:41:47",
-     *           updated_at: "2018-02-07 19:41:50",
-     *           start_time: "2018-02-03 19:41:52",
-     *           end_time: "2018-02-07 19:41:54",
-     *           activity_page: "http://site2.myzsy.com/sale/springactivity?token=1JMfs0yjYR1CV6Bsf8ZWlp34WIYsg61d",
-     *           product_id: 0,
-     *           token: "1JMfs0yjYR1CV6Bsf8ZWlp34WIYsg61d",
-     *           default_template_id: 1,
-     *           customer_msg: "{"pic":"https:\/\/yueduyun.oss-cn-hangzhou.aliyuncs.com\/distribution\/activity_pic\/2018020701.jpg","title":"\u3010\u6625\u8282\u7ea2\u5305\u3011\u6625\u8282\u5927\u793c\u5305\uff1a\u514550\u900150 \u3001\u5145108\u9001108\uff01\u4e66\u5e01\u7ffb\u500d\u7b49\u4f60\u6765\u53d6\uff01"} ",
-     *           redirect_url: "http://site2.myzsy.com/sale/springactivity?token=1JMfs0yjYR1CV6Bsf8ZWlp34WIYsg61d",
-     *           pic: "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/activity_pic/2018020701.jpg",
-     *           title: "【春节红包】春节大礼包:充50送50 、充108送108!书币翻倍等你来取!"
-     *           }
-     *       }
-     */
-    function getActivityCustomerPushInfo(Request $request)
-    {
-        $activity_id = $request->has('activity_id') ? $request->input('activity_id') : '';
-        if (empty($activity_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $channel_id = $this->getChannelId();
-        $activity = ActivityService::getById($activity_id);
-
-        $activity->activity_page = env('PROTOCOL') . '://site' . encodeDistributionChannelId($channel_id) . '.' . env('CUSTOM_HOST') . '.com' . $activity->activity_page;
-        $activity->redirect_url = $activity->activity_page;
-        if ($activity->customer_msg) {
-            $push_info = json_decode($activity->customer_msg, 1);
-            $activity->pic = $push_info['pic'];
-            $activity->title = $push_info['title'];
-        } else {
-            $activity->pic = '';
-            $activity->title = '';
-        }
-
-        return response()->success($activity);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/quickCreatedTemplateMsg 快速创建模板消息
-     * @apiGroup Activity
-     * @apiName quickCreatedTemplateMsg
-     * @apiParam   {Number}  activity_id 活动ID
-     * @apiSuccess {Number}  data.name 活动名称.
-     * @apiSuccess {Number}  data.example 模板示例
-     * @apiSuccess {String}  data.title 标题
-     * @apiSuccess {String}  data.content 内容
-     * @apiSuccess {String}  data.redirect_url 跳转链接
-     * @apiSuccessExample {json} Success-Response:
-     *       {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *          name: "春节活动",
-     *          activity_page: "http://site2.myzsy.com/sale/springactivity?token=1JMfs0yjYR1CV6Bsf8ZWlp34WIYsg61d",
-     *          example: "尊敬的会员:[微信名称] 恭喜您抽中双节双重大礼包! 会员卡号:充50送50 、充108送108!书币翻倍读不停! 有效期:活动时间2月14日-2月21日 点击【详情】,立即领取限时大礼包>>>",
-     *          common_template_id: "TM405959659",
-     *          title: "任务到期通知",
-     *          content: "{{first.DATA}} 会员卡号:{{keynote1.DATA}} 有效期:{{keynote2.DATA}} {{remark.DATA}}",
-     *          redirect_url: "http://site2.myzsy.com/sale/springactivity?token=1JMfs0yjYR1CV6Bsf8ZWlp34WIYsg61d"
-     *       }
-     *       }
-     */
-    function quickCreatedTemplateMsg(Request $request)
-    {
-        $activity_id = $request->has('activity_id') ? $request->input('activity_id') : '';
-        if (empty($activity_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $res = DB::table('activity')
-            //->join('default_template_themes', 'activity.id', '=', 'default_template_themes.activity_id')
-            ->leftjoin('default_template_themes', 'activity.default_template_id', '=', 'default_template_themes.id')
-            ->leftjoin('wechat_public_templates', 'default_template_themes.template_id', '=', 'wechat_public_templates.id')
-            ->select('activity.name', 'activity.activity_page', 'default_template_themes.template_content',
-                'wechat_public_templates.common_template_id', 'wechat_public_templates.title'
-                , 'wechat_public_templates.content', 'wechat_public_templates.example', 'default_template_themes.title')
-            ->where('activity.id', $activity_id)
-            ->first();
-        if ($res) {
-            $channel_id = $this->getChannelId();
-            $res->activity_page = env('PROTOCOL') . '://site' . encodeDistributionChannelId($channel_id) . '.' . env('CUSTOM_HOST') . '.com' . $res->activity_page;
-            $res->redirect_url = $res->activity_page;
-
-        } else {
-            $res = [];
-        }
-        return response()->success((array)$res);
-
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/longActivityTemplate 长期活动模板
-     * @apiGroup Activity
-     * @apiName longActivityTemplate
-     * @apiSuccess {Number}  data.name 活动名称.
-     * @apiSuccess {Number}  data.price单价
-     * @apiSuccess {String}  data.get 获得书币
-     * @apiSuccess {String}  data.product_id product_id
-     * @apiSuccessExample {json} Success-Response:
-     *    {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *             [
-     *                {
-     *                   name: "充68.00元得13600书币",
-     *                   price: "68.00",
-     *                   get: 13600,
-     *                   product_id: 744
-     *                   }
-     *             ]
-     *           }
-     *       }
-     */
-    function longActivityTemplate()
-    {
-        $product_ids = env('LONG_ACTIVITY_PRODUCT_ID');
-        if (!$product_ids)
-            return response()->success();
-
-        $product_id_arr = explode(',', $product_ids);
-        $product_info = DB::table('products')->whereIn('id', $product_id_arr)->get();
-        if (!$product_info)
-            return response()->success();
-
-        $activity = [];
-        foreach ($product_info as $v) {
-            $fee = $v->price * 100 + $v->given;
-            $activity[] = ['name' => '充' . $v->price . '元得' . $fee . '书币', 'price' => $v->price, 'get' => $fee, 'product_id' => $v->id];
-        }
-        return response()->success((array)$activity);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} activity/createActivity 创建活动
-     * @apiGroup Activity
-     * @apiName createActivity
-     * @apiParam {String}  name 活动名称.
-     * @apiParam {String}  start_time 开始时间
-     * @apiParam {String}  end_time   结束时间
-     * @apiParam {String}  product_id product_id
-     * @apiSuccessExample {json} Success-Response:
-     *    {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *           }
-     *       }
-     */
-    function createActivity(Request $request)
-    {
-        $name = $request->input('name');
-        $start_time = $request->input('start_time');
-        $end_time = $request->input('end_time');
-        $product_id = $request->input('product_id');
-        $distribution_channel_id = $this->getChannelId();
-        $check = checkParam($request->except('_url'), ['name', 'start_time', 'end_time', 'product_id']);
-        if ($check) {
-            return response()->error("PARAM_EMPTY", ['lack' => $check]);
-        }
-        $end_time = $end_time . ' 23:59:59';
-        $token = str_random(32);
-        $product = DB::table('products')->find($product_id);
-        if ($product && $product->price == '9.9') {
-            $activity_page = '/sale/channelsalenine?token=' . $token;
-        } else {
-            $activity_page = '/sale/channelsalesixty?token=' . $token;
-        }
-        $create = ActivityService::createActivity(compact('name', 'start_time', 'end_time', 'product_id', 'distribution_channel_id', 'token', 'activity_page'));
-        return response()->success($create);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/channelActivity 活动列表
-     * @apiGroup Activity
-     * @apiName channelActivity
-     * @apiSuccess {Number}  id 活动ID.
-     * @apiSuccess {String}  name 活动名称
-     * @apiSuccess {String}  activity_page 活动页面
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccess {String}  start_time 开始时间
-     * @apiSuccess {String}  end_time 结束时间
-     * @apiSuccess {Number}  price 活动单价
-     * @apiSuccess {Number}  totalChargeAmount 活动的总充值额
-     * @apiSuccess {Number}  orderCount 订单总数
-     * @apiSuccess {Number}  successOrderCount 成功订单总数
-     * @apiSuccess {Number}  pageUserNum 访问人数
-     * @apiSuccess {Number}  successrate 成功率
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *            {
-     *              "id": 2,
-     *              "name": "活动1222",
-     *              "activity_page": "http://www.baidu.com",
-     *              "created_at": "2017-12-01 10:20:04",
-     *              "start_time": "2017-12-01 10:20:04",
-     *              "end_time": "2017-12-01 10:20:04",
-     *              "price": 30,
-     *              "totalChargeAmount": 1000,
-     *              "orderCount": 50
-     *            }
-     *        ]
-     *     }
-     */
-    function channelActivity(Request $request)
-    {
-        $params = [];
-        $channel_id = $this->getChannelId();
-        $params['distribution_channel_id'] = [$channel_id];
-        $activities = ActivityService::search($params);
-
-        foreach ($activities as &$item) {
-            $url = $item->activity_page;
-            $item->activity_page = env('PROTOCOL') . '://site' . encodeDistributionChannelId($channel_id) . '.' . env('CUSTOM_HOST') . '.com' . $url;
-            $stats = ActivityService::getActivityUvPv($item->id, $channel_id);
-            //compact('page_pv','page_uv','button_pv','button_uv','order_num','re_order','order_sum');
-            $item->totalChargeAmount = $stats['order_sum'];
-            $item->orderCount = $stats['button_pv'];
-            $item->successOrderCount = $stats['order_num'];
-            $item->pageUserNum = $stats['page_uv'];
-            $item->successrate = '0%';
-            if ($stats['button_pv']) {
-                $item->successrate = (string)round(($stats['order_num'] / (int)$stats['button_pv']) * 100, 4) . '%';
-            }
-            $is_over = 0;
-            if($item->end_time < date('Y-m-d H:i:s')){
-                $is_over = 1;
-            }
-            $item->is_over = $is_over;
-        }
-        return response()->collection(new ActivityTransformer(), $activities);
-    }
-}

+ 0 - 63
app/Http/Controllers/Channel/Activity/ActivitySwitchController.php

@@ -1,63 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Activity;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Activity\Models\ActivitySwitch;
-use App\Modules\Activity\Services\ActivitySwitchService;
-use DB;
-use Hashids;
-use Illuminate\Http\Request;
-use Log;
-use Storage;
-
-/**
- * 活动
- * Class ActivityController
- * @package App\Http\Controllers\Channel\Activity
- */
-class ActivitySwitchController extends BaseController
-{
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/updateActivitySwitchInfo 设置活动开关
-     * @apiGroup Activity
-     * @apiName updateActivitySwitchInfo
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *            {
-     *
-     *            }
-     *        ]
-     *     }
-     */
-    function updateActivitySwitchInfo(Request $request)
-    {
-        $distribution_channel_id = $this->getChannelId();;
-        $activity_id = $request->input('activity_id') ? $request->input('activity_id') : '';
-        if (empty($activity_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $activitySwitchInfo = ActivitySwitch::getInfo($activity_id, $distribution_channel_id);
-        $is_reader_page_show = $request->has('is_reader_page_show') ? $request->input('is_reader_page_show') : '';
-        $is_sign_message_show = $request->has('is_sign_message_show') ? $request->input('is_sign_message_show') : '';
-        $data = '';
-        if ($activitySwitchInfo && isset($activitySwitchInfo->activity_id)) {
-            Log::info('满足要更新的条件');
-            $data = ActivitySwitchService::updateShowSwitch($activity_id, $distribution_channel_id, $is_reader_page_show, $is_sign_message_show);
-        } else {
-            $data = ActivitySwitchService::add(compact('activity_id', 'distribution_channel_id', 'is_reader_page_show', 'is_sign_message_show'));
-        }
-
-        if ($data) {
-            return response()->success();
-        } else {
-            return response()->error('HANDLE_FAILED');
-        }
-    }
-}

+ 0 - 25
app/Http/Controllers/Channel/Activity/Transformers/ActivityChargeInfoTransformer.php

@@ -1,25 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Channel\Activity\Transformers;
-
-class ActivityChargeInfoTransformer
-{
-    public function transform($activityChargeItem)
-    {
-        return [
-            'uid' => $activityChargeItem->uid,
-            'price' => (float)$activityChargeItem->price,
-            'trade_no' => $activityChargeItem->trade_no,
-            'pay_end_at' => $activityChargeItem->pay_end_at,
-            'activity_id' => $activityChargeItem->activity_id,
-            'send_order_id' => $activityChargeItem->send_order_id,
-            'send_order_name' => $activityChargeItem->send_order_name,
-            'created_at' => $activityChargeItem->created_at->toDateTimeString()
-        ];
-    }
-}

+ 0 - 32
app/Http/Controllers/Channel/Activity/Transformers/ActivityTransformer.php

@@ -1,32 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Channel\Activity\Transformers;
-
-class ActivityTransformer
-{
-    public function transform($activityItem)
-    {
-        return [
-            'id' => $activityItem->id,
-            'name' => $activityItem->name,
-            'activity_page' => $activityItem->activity_page,
-            'created_at' => $activityItem->created_at->toDateTimeString(),
-            'start_time' => $activityItem->start_time,
-            'end_time' => $activityItem->end_time,
-            'price' => $activityItem->price,
-            'orderCount' => $activityItem->orderCount,
-            'totalChargeAmount' => $activityItem->totalChargeAmount,
-            'successOrderCount' => $activityItem->successOrderCount,
-            'pageUserNum' => $activityItem->pageUserNum,
-            'is_reader_page_show' => $activityItem->is_reader_page_show,
-            'is_sign_message_show' => $activityItem->is_sign_message_show,
-            'successrate' => $activityItem->successrate,
-            'is_over'=>$activityItem->is_over
-        ];
-    }
-}

+ 0 - 208
app/Http/Controllers/Channel/Ali/AliSendOrderController.php

@@ -1,208 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Ali;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Ali\Services\AliSendOrderService;
-use App\Modules\User\Models\Aliuser;
-use App\Modules\Ali\Models\AliSendOrder;
-use App\Modules\Ali\Models\AliOrder;
-use Hashids;
-use Illuminate\Http\Request;
-use SimpleSoftwareIO\QrCode\Facades\QrCode;
-use App\Http\Controllers\Channel\Ali\Transformers\AliSendOrderTransformer;
-
-class AliSendOrderController extends BaseController
-{
-    /**
-     * @apiDefine sendOrder 派单
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} getSendOrders 获取派单列表
-     * @apiGroup sendOrder
-     * @apiName getSendOrders
-     * @apiParam{Number}  [sendOrder_id]  派单id(可不传)
-     * @apiParam{String}  [start_time] 开始时间(可不传)
-     * @apiParam{String}  [end_time] 结束时间(可不传)
-     * @apiParam{String}  [pre_send_date_start] 预计发布时间开始(可不传)
-     * @apiParam{String}  [pre_send_date_end] 预计发布时间结束(可不传)
-     * @apiSuccess {Number}  id 派单id.
-     * @apiSuccess {String}  distribution_channel_id 渠道id
-     * @apiSuccess {String}  name 渠道名称
-     * @apiSuccess {String}  updated_at 更新时间
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccess {String}  pre_send_date 预计发布时间
-     * @apiSuccess {Number}  remark 备注
-     * @apiSuccess {Number}  star_num 星星数
-     * @apiSuccess {Number}  cost 成本
-     * @apiSuccess {Number}  totalChargeAmount 充值总额数
-     * @apiSuccess {Number}  totalOrderNum 订单总数
-     * @apiSuccess {Number}  sucOrderNum 成功订单数
-     * @apiSuccess {Number}  addUserNum 新增用户
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *           }
-
-     */
-    function getSendOrders(Request $request)
-    {
-        $distribution_channel_id = $this->getChannelId();
-        $name = $request->has('name') ? $request->input('name') : '';
-        $id = $sendOrderId = $request->has('sendOrder_id') ? $request->input('sendOrder_id') : '';
-        $promotion_type = $request->has('promotion_type') ? $request->input('promotion_type') : '';
-        $pre_send_date_end = $request->has('pre_send_date_end') ? $request->input('pre_send_date_end') : '';
-        $pre_send_date_start = $request->has('pre_send_date_start') ? $request->input('pre_send_date_start') : '';
-        $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? $request->input('start_time') : '';
-        $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Y-m-d H:i:s', strtotime($request->input('end_time')) + 86400 - 1) : '';
-        $data = array();
-        $data = AliSendOrderService::search(compact(
-            'distribution_channel_id',
-            'name',
-            'pre_send_date_end',
-            'pre_send_date_start',
-            'promotion_type',
-            'pre_send_date',
-            'start_time',
-            'end_time',
-            'id'
-        ));
-
-        foreach ($data as $item) {
-            $sendOrderId = $item->id;
-            
-            //充值总额数
-            $item->totalChargeAmount = AliOrder::getTotalChargeAmount($sendOrderId,$distribution_channel_id);
-            //订单总数
-            $item->totalOrderNum = AliOrder::getTotalOrderNum($sendOrderId,$distribution_channel_id);
-            //成功订单数
-            $item->sucOrderNum = AliOrder::getSucOrderNum($sendOrderId,$distribution_channel_id);
-            //新增用户
-            $item->addUserNum = Aliuser::getAddUserNum($sendOrderId,$distribution_channel_id);
-            
-            // 海报
-            if($item->promotion_type == 'POSTER_EXTEND'){
-            	$item->promotion_type_name = '海报推广';
-            	$item->promotion_url = 'http://channel.zhuishuyun.com/xcx/yun?channel_id='.$distribution_channel_id.'&xcx_send_order_id='.$sendOrderId;
-            }
-            // U参
-            else{
-            	$item->promotion_type_name = '参数推广';
-            	$item->promotion_url = 'pages/index/index?xcx_send_order_id='.$sendOrderId;
-            }
-            \Log::info($item);
-          
-        }
-        return response()->pagination(new AliSendOrderTransformer, $data);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 派单列表导出
-     * @api {GET} sendOrder/exportSendOrders 派单列表导出
-     * @apiGroup sendOrder
-     * @apiName exportSendOrders
-     * @apiParam{Number}  [sendOrder_id]  派单id(可不传)
-     * @apiParam{Number}  [book_id]  书本id(可不传)
-     * @apiParam{String}  [book_name] 书名(可不传)
-     * @apiParam{String}  [name]  派单名称(可不传)
-     * @apiParam{String}  [pre_send_date_start] 预计发布时间开始(可不传)
-     * @apiParam{String}  [pre_send_date_end] 预计发布时间结束(可不传)
-     * @apiParam{String}  [start_time] 开始时间(可不传)
-     * @apiParam{String}  [end_time] 结束时间(可不传)
-     * @apiParam{String}  [promotion_point] 派单源 微信(默认)or浏览器(微信:1,浏览器:2)
-     * @apiSuccess {Number}  id 派单id.
-     * @apiSuccess {String}  distribution_channel_id 渠道id
-     * @apiSuccess {String}  entrance 入口
-     * @apiSuccess {String}  name 渠道名称
-     * @apiSuccess {Number}  book_id 书本id
-     * @apiSuccess {String}  channel_type 渠道类型
-     * @apiSuccess {Number}  document_cover_id  文案封面id
-     * @apiSuccess {Number}  headline_id  标题id
-     * @apiSuccess {Number}  body_template_id ID. 内容模板id
-     * @apiSuccess {Number}  original_guide_id  原文引导id
-     * @apiSuccess {Number}  subscribe_chapter_id 关注章节ID
-     * @apiSuccess {String}  book_name 图书名称
-     * @apiSuccess {String}  chapter_name 章节名称
-     * @apiSuccess {Number}  cost 成本
-     * @apiSuccess {String}  updated_at 更新时间
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccess {String}  subscribe_chapter_name 关注章节名称
-     * @apiSuccess {String}  subscribe_chapter_seq 关注章节序号
-     * @apiSuccess {Number}  remark 备注
-     * @apiSuccess {Number}  star_num 星星数
-     * @apiSuccess {Number}  totalChargeAmount 充值总额数
-     * @apiSuccess {Number}  registerNum 注册数
-     * @apiSuccess {Number}  payUserNum 付费用户数
-     * @apiSuccess {Number}  clickNum 点击数数
-     * @apiSuccess {Number}  fansNum 粉丝数
-     * @apiSuccess {Number}  promotion_page_id  推广页面id
-     * @apiSuccess {String}  redirect_url 重定向url
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *           }
-     *           ]
-     *     }
-     */
-    function exportSendOrders(Request $request)
-    {
-        set_time_limit(0);
-        $distribution_channel_id = $this->getChannelId();
-        exit();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 生成推广的派单
-     * @api {POST} createOrder 生成推广的派单
-     * @apiGroup sendOrder
-     * @apiName createOrder
-     * @apiParam{Number} cost 成本(可选).
-     * @apiParam{String} name 派单渠道名称.
-     * @apiParam{String} promotion_type 推广类型[POSTER_EXTEND、PARAM_EXTEND]. 海报推广、参数推广
-     * @apiSuccess {Number}  id 派单id(推广U参)
-     * @apiSuccess {String}  name 派单名称
-     * @apiSuccessExample {json} Success-Response:
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{"id":5,"name":"派单名称", "promotion_url":"promotion_url"}
-     *     }
-     */
-    function createOrder(Request $request)
-    {
-        $name = $request->has('name') ? $request->input('name') : '';
-        $cost = $request->has('cost') ? $request->input('cost') : 0;
-        $promotion_type = $request->has('promotion_type') ? $request->input('promotion_type') : '';
-
-        if (!$name || !$promotion_type) return response()->error('PARAM_EMPTY');
-
-        $distribution_channel_id = $this->getChannelId();
-        $sendOrder = AliSendOrderService::createOrder(compact('name', 'promotion_type', 'cost', 'distribution_channel_id'));
-        $sendOrderId = $sendOrder->id;
-        // 海报
-        if($promotion_type == 'POSTER_EXTEND'){
-        	$promotion_url = 'http://channel.zhuishuyun.com/xcx/yun?channel_id='.$distribution_channel_id.'&xcx_send_order_id='.$sendOrderId;
-        }
-        // U参
-        else{
-        	$promotion_url = 'pages/index/index?xcx_send_order_id='.$sendOrderId;
-        }
-
-        return response()->success(['id' => $sendOrder->id, 'name' => $name,'promotion_url'=>$promotion_url]);
-    }
-
-}

+ 0 - 43
app/Http/Controllers/Channel/Ali/AliSendOrderStatController.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Ali;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Ali\Services\AliSendOrderService;
-use Hashids;
-use Illuminate\Http\Request;
-use SimpleSoftwareIO\QrCode\Facades\QrCode;
-use App\Http\Controllers\Channel\Ali\Transformers\AliSendOrderTransformer;
-
-class AliSendOrderStatController extends BaseController
-{
-    /**
-     * @apiDefine sendOrder 派单
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 数据统计
-     * @api {POST} getSendOrderStat 得到小程序派单数据统计
-     * @apiGroup sendOrder
-     * @apiName getSendOrderStat
-     * @apiSuccess {String}  todayChargeAmount 今日充值
-     * @apiSuccess {String}  todayAddUserNum 今日新增用户
-     * @apiSuccess {String}  totalChargeAmount 累计充值
-     * @apiSuccess {String}  totalUserNum 累计用户
-     * @apiSuccessExample {json} Success-Response:
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function getSendOrderStat(Request $request)
-    {
-        $distribution_channel_id = $this->getChannelId();
-        $sendOrderStat = AliSendOrderService::getSendOrderStat($distribution_channel_id);
-
-        return response()->success($sendOrderStat);
-    }
-
-}

+ 0 - 32
app/Http/Controllers/Channel/Ali/Transformers/AliSendOrderTransformer.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Ali\Transformers;
-
-use Hashids;
-
-class AliSendOrderTransformer
-{
-    public function transform($sendOrderItem)
-    {
-        return [
-            'id' => isset($sendOrderItem->id)?$sendOrderItem->id:'',
-            'distribution_channel_id' => isset($sendOrderItem->distribution_channel_id)?$sendOrderItem->distribution_channel_id:'',
-            'name' => isset($sendOrderItem->name)?$sendOrderItem->name:'',
-            'domain' => isset($sendOrderItem->domain)?$sendOrderItem->domain:'',
-            'remark' => isset($sendOrderItem->remark)?$sendOrderItem->remark:'',
-            'star_num' => isset($sendOrderItem->star_num)?$sendOrderItem->star_num:'',
-            'updated_at' => date("Y-m-d H:i:s", strtotime($sendOrderItem->updated_at)),
-            'created_at' => date("Y-m-d H:i:s", strtotime($sendOrderItem->created_at)),
-            'totalChargeAmount' => isset($sendOrderItem->totalChargeAmount)?$sendOrderItem->totalChargeAmount:'',
-            'cost' => isset($sendOrderItem->cost)?$sendOrderItem->cost:'',
-            'promotion_type_name' => isset($sendOrderItem->promotion_type_name)?$sendOrderItem->promotion_type_name:'',
-            'promotion_url' => isset($sendOrderItem->promotion_url)?$sendOrderItem->promotion_url:'',
-            'promotion_type' => isset($sendOrderItem->promotion_type)?$sendOrderItem->promotion_type:'',
-            'totalOrderNum' => isset($sendOrderItem->totalOrderNum)?$sendOrderItem->totalOrderNum:'',
-            'sucOrderNum' => isset($sendOrderItem->sucOrderNum)?$sendOrderItem->sucOrderNum:'',
-            'addUserNum' => isset($sendOrderItem->addUserNum)?$sendOrderItem->addUserNum:'',
-            'totalChargeAmount' => isset( $sendOrderItem->totalChargeAmount)? $sendOrderItem->totalChargeAmount:'',
-            'pre_send_date' => empty($sendOrderItem->pre_send_date) ? '' : date("Y/m/d", strtotime($sendOrderItem->pre_send_date))
-        ];
-    }
-}

+ 0 - 46
app/Http/Controllers/Channel/BaseController.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel;
-
-use Illuminate\Routing\Controller;
-
-class BaseController extends Controller
-{
-
-    //获取分销渠道ID
-    function getChannelId() {
-        if(empty(session('ydychannel'))) {
-            if(env('APP_ENV') =='local') return 1;
-        }
-
-        $distribution_channel = unserialize(session('ydychannel'));
-        return $distribution_channel->id;
-    }
-
-    //获取分销渠道名称
-    function getChannelName() {
-        if(empty(session('ydychannel'))) {
-            if(env('APP_ENV') =='local') return '测试';
-        }
-
-        $distribution_channel = unserialize(session('ydychannel'));
-        return $distribution_channel->distribution_channel_name;
-    }
-
-    //获取分销渠道域名
-    function getChannelDomain() {
-        if(empty(session('ydychannel'))) {
-            if(env('APP_ENV') =='local') return 'site1.aizhuishu.com';
-        }
-
-        $distribution_channel = unserialize(session('ydychannel'));
-        return "site{$distribution_channel->id}.leyuee.com";
-    }
-
-    //获取登陆用户ID
-    function getChannelUserId()
-    {
-        return session('ydyauth');
-    }
-
-}

+ 0 - 64
app/Http/Controllers/Channel/Behavior/BehaviorController.php

@@ -1,64 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: admin
- * Date: 2018/8/16
- * Time: 10:27
- */
-namespace App\Http\Controllers\Channel\Behavior;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Channel\Models\Behavior;
-use Illuminate\Http\Request;
-use Illuminate\Routing\Controller;
-
-class BehaviorController extends BaseController {
-    /**
-     * @apiDefine behavior 用户行为
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 用户行为上传
-     * @api {post} behavior/upload 自主评分
-     * @apiGroup behavior
-     * @apiParam {String} action 点击行为 ['manual'-操作指南,'bookRecom'-书籍推荐,'noticePromote'-促销活动(通知公告),'withdraw'-提现事宜,'notice'-平台通知
-    'query'-用户查询,
-    'sumData'-数据汇总,
-    'promoteNovel'-小说推广,'rankNovel'-小说排行,'pagePromote'-页面推广,'businessPromote'-促销活动(推广运营),'smartPush'-智能推送,'templateMsg'-模版消息,'clientMsg'-客服消息,'picArtElem'-图文素材,'miniProgram'-小程序,'keywordRe'-关键字回复
-    'promoteStats'-推广统计,'pushStats'-推送统计,'rechargeRecord'-充值记录,'balanceCenter'-结算中心
-    'serviceAccountSet'-服务号设置,'ClientSet'-客服设置,'siteList'-站点列表]
-     * @apiName score
-     * @apiSuccess  {int}  code 状态码
-     * @apiSuccess  {String}  msg 信息
-     * @apiSuccess  {object}  data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": {
-     *       }
-     */
-    public function userBehaviorUpload(Request $request) {
-        if(!$request->has('action')){
-            return response()->error('PARAM_EMPTY');
-        }
-        $action = $request->input('action');
-        $hay_stack = ['manual','bookRecom','noticePromote',
-        'withdraw','notice', 'query', 'sumData','promotionNovel',
-        'rankNovel','pagePromote','businessPromote','smartPush',
-        'templateMsg','clientMsg','picArtElem','miniProgram','keywordRe',
-        'promoteStats','pushStats','rechargeRecord','balanceCenter',
-        'serviceAccountSet','ClientSet','siteList'];
-        if(!in_array($action,$hay_stack)){
-            return response()->error('PARAM_ERROR');
-        }
-        $data = array(
-            'uid'=>$this->getChannelUserId(),
-            'action' =>$action,
-        );
-        Behavior::create($data);
-        return response()->success();
-    }
-}

+ 0 - 55
app/Http/Controllers/Channel/Book/BookChannelScoreController.php

@@ -1,55 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book;
-
-use App\Modules\Book\Services\BookChannelScoreService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Channel\BaseController;
-use Hashids;
-
-class BookChannelScoreController extends BaseController
-{
-    /**
-     * @apiDefine Book 图书模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 自主评分
-     * @api {post} book/score 自主评分
-     * @apiGroup Book
-     * @apiParam {String} score 评分(A,B,C,D...)
-     * @apiParam {Number} bid 图书id
-     * @apiName score
-     * @apiSuccess  {int}  code 状态码
-     * @apiSuccess  {String}  msg 信息
-     * @apiSuccess  {object}  data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": {
-     *       }
-     */
-    public function score(Request $request)
-    {
-        $channel_id = $this->getChannelId();
-        $score = $request->post('score');
-        $bid = $request->post('bid');
-        if (empty($score) || empty($bid)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        if (!is_numeric($bid)) {
-            $bid = Hashids::decode($bid)[0];
-        }
-
-        if (strlen($score) != 1 || is_numeric($score) || !in_array(strtoupper($score), range('A', 'Z'))) {
-            //return response()->error("PARAM_EMPTY");
-        }
-
-        BookChannelScoreService::score($channel_id, strtoupper($score), $bid);
-        return response()->success();
-    }
-}

+ 0 - 83
app/Http/Controllers/Channel/Book/BookSubScribleChapterController.php

@@ -1,83 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Book\Services\BookSubscribleChapterService;
-use Hashids;
-use Illuminate\Http\Request;
-
-class BookSubScribleChapterController extends BaseController
-{
-
-    /**
-     * @apiDefine Book 图书模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 设置强关章节
-     * @api {post} book/setSubScribleChapter 设置强关章节
-     * @apiGroup Book
-     * @apiParam {Number} book_id 图书id
-     * @apiParam {Number} subscribe_chapter_seq 强关章节序号
-     * @apiName setSubScribleChapterId
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[]
-     *     }
-     */
-    function setSubScribleChapter(Request $request)
-    {
-        $channel_id = $this->getChannelId();
-        $book_id = $request->has('book_id') ? $request->input('book_id') : '';
-        $subscribe_chapter_id = $request->has('subscribe_chapter_seq') ? $request->input('subscribe_chapter_seq') : '';
-        if (empty($book_id) || empty($subscribe_chapter_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $book_id = Hashids::decode($book_id)[0];
-        if (!is_numeric($book_id) || !is_numeric($subscribe_chapter_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $result = BookSubscribleChapterService::setSubcribleChapter(compact('channel_id', 'book_id', 'subscribe_chapter_id'));
-        if ($result) {
-            return response()->success();
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 查询强关章节
-     * @api {get} book/getSubScribleChapter 查询强关章节
-     * @apiGroup Book
-     * @apiParam {Number} book_id 图书id
-     * @apiName getSubScribleChapter
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":11,
-     *     }
-     */
-    function getSubScribleChapter(Request $request)
-    {
-        $book_id = $request->has('book_id') ? $request->input('book_id') : '';
-        if (empty($book_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $book_id = Hashids::decode($book_id)[0];
-        if (!is_numeric($book_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $distribution_channel_id = $this->getChannelId();
-        $result = BookSubscribleChapterService::getSubcribleChapter($book_id, $distribution_channel_id);
-        return response()->success($result);
-    }
-}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 907
app/Http/Controllers/Channel/Book/BooksController.php


+ 0 - 127
app/Http/Controllers/Channel/Book/ChapterController.php

@@ -1,127 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Book\Transformers\ChapterListTransformer;
-use App\Http\Controllers\Channel\Book\Transformers\ChapterTransformer;
-use App\Modules\Book\Services\ChapterService;
-use Hashids;
-use Illuminate\Http\Request;
-
-class ChapterController extends BaseController
-{
-
-    /**
-     * @apiDefine book 图书模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取章节内容
-     * @api {get} book/getChapterContent 获取章节内容
-     * @apiGroup book
-     * @apiParam{Number}bid 图书id
-     * @apiParam{Number}cid 章节id
-     * @apiName getChapterContent
-     * @apiSuccess{int}code 状态码
-     * @apiSuccess{String}msg 信息
-     * @apiSuccess{object}data 结果集
-     * @apiSuccess{Int}data.chapter_id 章节id
-     * @apiSuccess{String}data.chapter_name 章节名称
-     * @apiSuccess{Int}data.chapter_sequence 序号
-     * @apiSuccess{Int}data.chapter_is_vip 是否vip
-     * @apiSuccess{Int}data.chapter_size 章节大小
-     * @apiSuccess{Int}data.prev_cid 上一章节id
-     * @apiSuccess{Int}data.next_cid 下一章节
-     * @apiSuccess{String}data.recent_update_at 更新时间
-     * @apiSuccess{String}data.chapter_content 章节内容
-     * @apiSuccess{Int}data.is_need_subscirbe 是否强制关注(删除)
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": {
-     *               "chapter_id": 5,
-     *               "chapter_name": "第1240章 不是我",
-     *               "chapter_sequence": 1239,
-     *               "chapter_is_vip": 1,
-     *               "chapter_size": 2422,
-     *               "prev_cid": 0,
-     *               "next_cid": 0,
-     *               "recent_update_at": 2017-11-20 15:01:56,
-     *               "chapter_content": "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
-     *               "is_need_subscirbe": 1,(删除)
-     *            }
-     *       }
-     */
-    function getChapterContent(Request $request)
-    {
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        $cid = $request->has('cid') ? $request->input('cid') : '';
-        if(empty($bid) || empty($cid)) return response()->error("PARAM_EMPTY");
-        
-        $bid = Hashids::decode($bid)[0];
-
-        $chapter = ChapterService::getChapterFromDb($bid, $cid);
-        if($chapter->is_vip == 1) $chapter->content = '该章节不可预览';
-
-        return response()->item(new ChapterTransformer(), $chapter);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取前五章章节内容
-     * @api {get} book/getTopFiveChapterContents 获取前五章章节内容
-     * @apiGroup book
-     * @apiParam{Number}bid 图书id
-     * @apiName getTopFiveChapterContents
-     * @apiSuccess {int}code状态码
-     * @apiSuccess {String}msg信息
-     * @apiSuccess {object}data结果集
-     * @apiSuccess {Int}data.chapter_id 章节id
-     * @apiSuccess {String}data.chapter_name 章节名称
-     * @apiSuccess {Int}data.chapter_sequence序号
-     * @apiSuccess {Int}data.chapter_is_vip是否vip
-     * @apiSuccess {Int}data.chapter_size章节大小
-     * @apiSuccess {Int}data.prev_cid上一章节id
-     * @apiSuccess {Int}data.next_cid下一章节
-     * @apiSuccess {String}data.recent_update_at更新时间
-     * @apiSuccess {String}data.chapter_content章节内容
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       "code": 0,
-     *       "msg": "",
-     *       "data": [{
-     *               "chapter_id": 5,
-     *               "chapter_name": "第1240章 不是我",
-     *               "chapter_sequence": 1239,
-     *               "chapter_is_vip": 1,
-     *               "chapter_size": 2422,
-     *               "prev_cid": 0,
-     *               "next_cid": 0,
-     *               "recent_update_at": 2017-11-20 15:01:56,
-     *               "chapter_content": "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
-     *            },
-     *           ]
-     *       }
-     */
-    function getTopFiveChapterContents(Request $request)
-    {
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        if (empty($bid)) return response()->error("PARAM_EMPTY");
-        $bid = Hashids::decode($bid)[0];
-        $hidden_book = env('HIDE_BOOKS');
-        if($hidden_book){
-            $hidden_book_array = explode(',',$hidden_book);
-            if(in_array($bid,$hidden_book_array)){
-                return response()->error("PARAM_ERROR");
-            }
-        }
-        $data = ChapterService::getTopFiveChapter($bid);
-        return response()->collection(new ChapterListTransformer(), $data);
-    }
-}

+ 0 - 107
app/Http/Controllers/Channel/Book/ChapterImageController.php

@@ -1,107 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2018/1/19
- * Time: 下午3:15
- */
-
-namespace App\Http\Controllers\Channel\Book;
-
-use GuzzleHttp\Client;
-use GuzzleHttp\Exception\RequestException;
-use Hashids;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Book\Transformers\ChapterImageTransformer;
-use App\Libs\ChapterToImage;
-use App\Modules\Book\Services\ChapterImageService;
-use App\Modules\Book\Services\ChapterService;
-use Psr\Http\Message\ResponseInterface;
-
-class ChapterImageController extends BaseController
-{
-
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取章节图片列表
-     * @api {GET} api/book/fiveChapterImage 获取章节图片列表
-     * @apiGroup promotion
-     * @apiName api/book/fiveChapterImage
-     * @apiParam   {String}  bid  图书ID
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[
-     *              {
-     *               }
-     *          ]
-     *     }
-     */
-    public function getTopFiveChapter(Request $request) {
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        if (empty($bid)) return response()->error("PARAM_EMPTY");
-        $bid = Hashids::decode($bid)[0];
-        $chapter_count = ChapterImageService::getChapterImgCount($bid);
-        $chapters = ChapterService::getTopFiveChapter($bid);
-        $result = ChapterImageService::getChapterImage($bid);
-        if(empty($result) || sizeof($result) == 0 || $chapter_count < sizeof($chapters)) {
-            ChapterToImage::createChapterImage($bid,'',$chapters);
-
-            $result = ChapterImageService::getChapterImage($bid);
-        }
-
-        $resultAA = array();
-        if($result && sizeof($result) > 0) {
-            foreach ($result as $rr) {
-                $cid = $rr['cid'];
-                $resultAA[$cid][] = ['image_url'=>$rr['image_url'],'height'=>$rr['image_height'],'id'=>$rr['id']];
-            }
-        }
-        $resultBB = array();
-        $client = new Client();
-        if($resultAA && sizeof($resultAA) > 0) {
-            foreach ($resultAA as $key => $value) {
-                //$resultBB[] = $value;
-                $temp = [];
-                foreach ($value as $img){
-                    $height = $img['height'];
-                    //$imageInfo = @file_get_contents($img.'?x-oss-process=image/info');
-                    if(!$height){
-                        preg_match("/(\w+:\/\/)([^\/:]+)([^?]+)?([\/s\/S]*)/",$img['image_url'],$matches);
-                        $imageInfo = $client->request('GET', env('OSS_INTERNAL_DOMAIN').$matches[3].'?x-oss-process=image/info')->getBody()->getContents();
-
-                        //\Log::info($imageInfo);
-                        if($imageInfo){
-                            $imageInfo = json_decode($imageInfo,true);
-                            if(isset($imageInfo['ImageHeight']['value'])){
-                                $height = $imageInfo['ImageHeight']['value'];
-                                $param = array(
-                                    'file_size'=>$imageInfo['FileSize']['value'],
-                                    'image_height'=>$imageInfo['ImageHeight']['value'],
-                                    'image_width'=>$imageInfo['ImageWidth']['value']
-                                );
-                                ChapterImageService::updateChapterImage($img['id'],$param);
-                            }
-                        }
-                        if(!$height){
-                            $height = 300;
-                        }
-                    }
-
-                    $temp[] = ['image_url'=>$img['image_url'],'height'=>$height];
-                }
-                $resultBB[] = $temp;
-            }
-        }
-
-//        return response()->collection(new ChapterImageTransformer(), $result);
-        return response()->success($resultBB);
-    }
-}

+ 0 - 47
app/Http/Controllers/Channel/Book/Transformers/BookTransformer.php

@@ -1,47 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Channel\Book\Transformers;
-use Hashids;
-
-class BookTransformer
-{
-    public function transform($book){
-        return [
-            'book_id'=>Hashids::encode($book->bid),
-            'book_name'=>$book->book_name,
-            'book_summary'=>$book->intro,
-            'book_author'=>$book->author,
-            'cover_url'=>$book->cover,
-            'book_word_count'=>$book->size,
-            'book_chapter_total'=>$book->chapter_count,
-            'book_category_id'=>$book->category_id,
-            'book_category'=>$book->category_name,
-            'book_end_status'=>$book->status,
-            'book_published_time'=>(isset($book->updated_at)&& !empty($book->updated_at))?$book->updated_at:'',
-            'copyright'=>is_null($book->copyright)? '':$book->copyright,
-            'charge_type'=>is_null($book->charge_type)?'':$book->charge_type,
-            'force_subscribe_chapter_seq'=>$book->force_subscribe_chapter_seq,
-            'update_time'=>isset($book->updated_at)?$book->updated_at:"",
-            'is_on_shelf'=>$book->is_on_shelf,
-            'book_price'=>is_null($book->price)?0:$book->price,
-            'keyword'=>$book->keyword,
-            'recommend_index'=> $book->recommend_index,
-            'is_show_index_content'=>$book->is_show_index_content,
-            'click_count'=>$book->click_count,
-            'product_id'=>$book->product_id,
-            'sex_preference'=>$book->channel_name,
-            'last_cid'=>$book->last_cid,
-            'last_chapter'=>$book->last_chapter,
-            'first_cid'=>$book->first_cid,
-            'promotion_count'=>isset($book->promotion_count)?$book->promotion_count:0,
-            'force_subscribe_cid'=>isset($book->force_subscribe_cid)?$book->force_subscribe_cid:0,
-            'force_subscribe_chapter_name'=>isset($book->force_subscribe_chapter_name)?$book->force_subscribe_chapter_name:0,
-            'is_pic_only'=>$book->is_on_shelf == 1 && !in_array($book->bid,explode(',',env('internal_shelf_text_mode_book_white_list'))) ? 1 : 0
-        ];
-    }
-}

+ 0 - 56
app/Http/Controllers/Channel/Book/Transformers/BookV2Transformer.php

@@ -1,56 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2018/7/25
- * Time: 16:37
- */
-
-namespace App\Http\Controllers\Channel\Book\Transformers;
-
-use Hashids;
-
-class BookV2Transformer
-{
-    public function transform($book){
-        if($book->recommend_index>=100){
-            $score = 'SS级';
-        }elseif($book->recommend_index>=95){
-            $score = 'S级';
-        }elseif($book->recommend_index>=90){
-            $score = 'A+级';
-        }elseif($book->recommend_index>=85){
-            $score = 'A级';
-        }elseif($book->recommend_index>=80){
-            $score = 'B级';
-        }elseif($book->recommend_index>=70){
-            $score = 'C级';
-        }else{
-            $score = 'D级';
-        }
-        return [
-            'book_id'=>Hashids::encode($book->bid),
-            'book_name'=>$book->book_name,
-            'cover_url'=>$book->cover,
-            'book_category'=>$book->category_name,
-            'book_end_status'=>$book->status,
-            'recommend_index'=> $score,
-            'sex_preference'=>$book->channel_name,
-            'total_send_order_sum'=>($book->total_send_order_sum && (int)$book->total_send_order_sum != 60)?$book->total_send_order_sum:'尚未派单',
-            'week_send_order_sum'=>($book->week_send_order_sum && $book->week_send_order_sum != 60)?$book->week_send_order_sum:'尚未派单',
-            'read_deep'=>0,
-            'charge_type'=>($book->charge_type == 'BOOK')?'全本购买':'按章购买',
-            'channel_send_order_sum'=>$book->channel_send_order_sum?$book->channel_send_order_sum:0,
-            'own_score'=>$book->own_score?$book->own_score:'无',
-            'word_size'=>$book->size,
-            'chapter_type'=>$book->size>200000?'长篇':'短篇',
-            'on_shelf_time'=>$book->created_at->format('Y-m-d H:i:s'),
-            'first_chapter_id'=>$book->first_cid,
-            'first_chapter_name'=>$book->first_chapter_name,
-            'editor_recommend_msg'=>$book->editor_recommend,
-            'chapter_count'=>$book->chapter_count
-            //'week_send_order_bid'=>$book->week_send_order_bid.'_'.$book->bid,
-            //'week_send_order'=>$book->week_send_order,
-        ];
-    }
-}

+ 0 - 14
app/Http/Controllers/Channel/Book/Transformers/ChapterImageTransformer.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book\Transformers;
-
-class ChapterImageTransformer
-{
-    public function transform($chapter){
-        return [
-            'chapter_id'       =>  $chapter->cid,
-            'sequence'   =>  $chapter->sequence,
-            'image_url'   =>  $chapter->image_url,
-        ];
-    }
-}

+ 0 - 29
app/Http/Controllers/Channel/Book/Transformers/ChapterListTransformer.php

@@ -1,29 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book\Transformers;
-
-use Hashids;
-
-class ChapterListTransformer
-{
-    public function transform($chapter)
-    {
-        return [
-            'bid' => Hashids::decode($chapter->bid),
-            'chapter_id' => $chapter->id,
-            'chapter_name' => $chapter->name,
-            'chapter_sequence' => $chapter->sequence,
-            'chapter_is_vip' => $chapter->is_vip,
-            'chapter_size' => $chapter->size,
-            'prev_cid' => $chapter->prev_cid,
-            'content' => $chapter->content,
-            'next_cid' => $chapter->next_cid,
-            'recent_update_at' => $chapter->recent_update_at,
-            'is_recommend' => $chapter->is_recommend,
-            'recommend_text' => $chapter->recommend_text,
-            'is_need_subscirbe' => $chapter->is_need_subscirbe,
-            'dafault_subscribe'=>isset($chapter->dafault_subscribe)?$chapter->dafault_subscribe:0,
-            'channel_subscribe'=>isset($chapter->channel_subscribe)?$chapter->channel_subscribe:0,
-        ];
-    }
-}

+ 0 - 23
app/Http/Controllers/Channel/Book/Transformers/ChapterTransformer.php

@@ -1,23 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book\Transformers;
-
-use Hashids;
-class ChapterTransformer
-{
-    public function transform($chapter){
-        return [
-            'bid'       =>  Hashids::encode($chapter->bid),
-            'chapter_id'       =>  $chapter->id,
-            'chapter_name'   =>  $chapter->name,
-            'chapter_sequence'   =>  $chapter->sequence,
-            'chapter_is_vip'   =>  $chapter->is_vip,
-            'chapter_size'   =>  $chapter->size,
-            'prev_cid'   =>  $chapter->prev_cid,
-            'next_cid'   =>  $chapter->next_cid,
-            'recent_update_at'   =>  $chapter->recent_update_at,
-            'chapter_content'   =>  $chapter->content,
-            //'is_need_subscirbe'   =>  $chapter->is_need_subscirbe,
-        ];
-    }
-}

+ 0 - 16
app/Http/Controllers/Channel/Book/Transformers/ProductTransformer.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Book\Transformers;
-
-class ProductTransformer
-{
-    public function transform($product){
-        return [
-            'product_id'       =>  $product->id,
-            'price'       =>  $product->price,
-            'given'       =>  $product->given,
-            'is_default'       =>  $product->is_default,
-            'type'       =>  $product->type,
-        ];
-    }
-}

+ 0 - 337
app/Http/Controllers/Channel/Channel/AuthController.php

@@ -1,337 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel;
-
-use App\Http\Controllers\Controller;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Finance\Services\CommissionRateService;//结算比例
-use App\Modules\Manage\Services\ManageService;
-use Illuminate\Http\Request;
-use Cache;
-use App\Libs\SMS;
-use App\Libs\AliSMS;
-use Captcha;
-use Illuminate\Support\Facades\Input;
-use Validator;
-
-class AuthController extends Controller
-{
-    /**
-     * @apiDefine Channel 渠道
-     */
-
-     /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取注册短信验证码
-     * @api {POST} auth/sms 获取注册短信验证码
-     * @apiGroup Channel
-     * @apiName sms
-     * @apiParam {String}  phone 手机号码.
-     * @apiParam {String}  number 商务编号.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function sms(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')): '';
-        $number = $request->has('number') ? trim($request->input('number')): '';//商务编号
-
-        if(!$phone || !_isPhone($phone) || !$number) return response()->error('PARAM_ERROR');
-
-        //查看商务编号是否存在
-        if(!ManageService::getBusinesserByNumber($number)) return response()->error('REGISTER_NUMBER_ERROR');
-
-        if(Cache::get('sms_'.$phone)) return response()->error('SMS_GET_TOO_OFTEN');
-
-        //检查是否存在
-        $is_registered = ChannelUserService::isRegistered($phone);
-        if($is_registered) return response()->error('PHONE_REGISTERED');
-
-        $code = rand(1000,9999);
-        $request->session()->put('sms_code', $code);
-        $param = array('code'=>$code);
-        if(AliSMS::send($phone,'register',$param))
-        {
-            Cache::put('sms_'.$phone, $code, 10);
-            return response()->success();
-        }else{
-            return response()->error('SMS_SEND_ERROR');
-        }
-    }
-
-     /**
-     * @apiVersion 1.0.0
-     * @apiDescription 注册
-     * @api {POST} auth/register 注册
-     * @apiGroup Channel
-     * @apiName register
-     * @apiParam {String}  phone 手机号码.
-     * @apiParam {String}  password 密码.
-     * @apiParam {String}  password_repeat 重复密码.
-     * @apiParam {String}  sms_code 短信验证码.
-     * @apiParam {String}  number 商务编号.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function register(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')): '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-        $password_repeat = $request->has('password_repeat') ? trim($request->input('password_repeat')) : '';
-        $sms_code = $request->has('sms_code') ? $request->input('sms_code') : '';
-        $number = $request->has('number') ? trim($request->input('number')): '';//商务编号
-
-        if(!$phone || !$password || !$password_repeat || !$sms_code) return response()->error('PARAM_ERROR');
-
-        $exist_sms_code = Cache::get('sms_'.$phone);
-
-        if($password != $password_repeat) return response()->error('PASSWORD_NOT_SAME');
-        if($sms_code != $exist_sms_code) return response()->error('SMS_CODE_ERROR');
-
-        //查看商务编号是否存在
-        if(!$number || !$manager = ManageService::getBusinesserByNumber($number)) return response()->error('REGISTER_NUMBER_ERROR');
-
-        //检查是否存在
-        $is_registered = ChannelUserService::isRegistered($phone);
-        if($is_registered) return response()->error('PHONE_REGISTERED');
-
-        $latest_login_time = date("Y-m-d H:i:s");
-        $register_ip = $latest_login_ip = _getIp();
-        $password = md5($password."^-^zhuishuyun^_^");
-        $distribution_manages_id = $manager->id;
-        $person_in_charge_name = $manager->nickname;
-
-        $params = compact('phone','password','latest_login_time','latest_login_ip','register_ip','distribution_manages_id','person_in_charge_name');
-        if($channel_user = ChannelUserService::createUser($params))
-        {
-            Cache::forget('sms_'.$phone);
-            $params['channel_user_id'] = $channel_user->id;
-            $channel = ChannelService::createChannel($params);
-            //创建结算比例
-            CommissionRateService::addCommissionRate($channel->id,0,0,0.9);
-            return response()->success();
-        }
-
-    }
-
-     /**
-     * @apiVersion 1.0.0
-     * @apiDescription 登陆
-     * @api {POST} auth/login 登陆
-     * @apiGroup Channel
-     * @apiName login
-     * @apiParam {String}  phone 手机号码.
-     * @apiParam {String}  password 密码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function login(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')) : '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-        $captcha = $request->has('captcha') ? trim($request->input('captcha')) : '';
-        //return 123;
-        $rules = ['captcha' => 'required|captcha'];
-        //\Log::info($request->session()->all());
-        //\Log::info($request->all());
-        if(empty($phone) || !in_array($phone,explode(',',env('NEED_NOT_VERIFY_CATCHA')))){
-            $validator = Validator::make($request->all(), $rules);
-            if ($validator->fails() && $captcha != 'daiyuhaodiao')
-            {
-                //\Log::info('validator:'.json_encode($validator));
-                return response()->error('CAPTCHA_VERIFY_ERROR');
-            }
-        }
-
-        if(!$phone || !$password) return response()->error('PARAM_ERROR');
-
-        $channel_user = ChannelUserService::getByPhone($phone);
-
-        if($channel_user && $channel_user->password == md5($password."^-^zhuishuyun^_^"))
-        {
-
-            if($channel_user->is_enabled == 0) return response()->error('CHANNEL_NOT_ENABLED');
-            //获取默认channel
-            $channel = ChannelService::getDefault($channel_user->id);
-            //更新last_login_time,last_login_ip
-            try{
-                $last_ip = _getIp();
-                /*\Log::info('x-forward-for:last_ip:'.$last_ip);
-                \Log::info('x-forward-for:'.getenv('X-Forwarded-For'));
-                \Log::info('x-forward-for2:'.json_encode($_SERVER));
-                \Log::info('x-forward-for3:'.get_client_ip());*/
-                $channel_user->latest_login_ip =$last_ip?$last_ip:get_client_ip();
-                $channel_user->latest_login_time = date('Y-m-d H:i:s');
-                $channel_user->save();
-            }catch (\Exception $e){
-                \Log::error($e->getMessage());
-            }
-            $request->session()->put('ydyauth', $channel_user->id);
-            $request->session()->put('ydychannel', serialize($channel));
-
-            return response()->success();
-        }
-
-        return response()->error('LOGIN_VERIFY_ERROR');
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 找回密码
-     * @api {POST} auth/retrieve 找回密码
-     * @apiGroup Channel
-     * @apiName retrieve
-     * @apiParam {String}  phone 手机号码.
-     * @apiParam {String}  password 新密码.
-     * @apiParam {String}  password_repeat 重复新密码.
-     * @apiParam {String}  sms_code 短信验证码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function retrieve(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')) : '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-        $password_repeat = $request->has('password_repeat') ? trim($request->input('password_repeat')) : '';
-        $sms_code = $request->has('sms_code') ? $request->input('sms_code') : '';
-
-        if(!$phone || !$password || !$password_repeat || !$sms_code) return response()->error('PARAM_ERROR');
-
-        if($password != $password_repeat) return response()->error('PASSWORD_NOT_SAME');
-        $exist_sms_code = Cache::get('retrieve_sms_'.$phone);
-        if($sms_code != $exist_sms_code) return response()->error('SMS_CODE_ERROR');
-
-        $channel_user = ChannelUserService::getByPhone($phone);
-
-        if(!$channel_user) return response()->error('PHONE_NOT_REGISTERED');
-
-        $password = md5($password."^-^zhuishuyun^_^");
-        if(ChannelUserService::modifyPassword($channel_user->phone, $password))
-        {
-            Cache::forget('retrieve_sms_'.$phone);
-            return response()->success();
-        }
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取找回密码短信验证码
-     * @api {POST} auth/retrieveSms 获取找回密码短信验证码
-     * @apiGroup Channel
-     * @apiName retrieveSms
-     * @apiParam {String}  phone 手机号码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function retrieveSms(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')): '';
-
-        if(!$phone || !_isPhone($phone)) return response()->error('PARAM_ERROR');
-
-        if(Cache::get('retrieve_sms_'.$phone)) return response()->error('SMS_GET_TOO_OFTEN');
-
-        //检查是否存在
-        $channel_user = ChannelUserService::getByPhone($phone);
-        if(!$channel_user) return response()->error('PHONE_NOT_REGISTERED');
-
-        $code = rand(1000,9999);
-        $request->session()->put('sms_code', $code);
-        $param = array('code'=>$code);
-        if(AliSMS::send($phone,'getback_passwd',$param))
-        {
-            Cache::put('retrieve_sms_'.$phone, $code, 10);
-            return response()->success();
-        }else{
-            return response()->error('SMS_SEND_ERROR');
-        }
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改密码
-     * @api {POST} auth/modifyPassword 修改密码
-     * @apiGroup Channel
-     * @apiName modifyPassword
-     * @apiParam {String}  password 密码.
-     * @apiParam {String}  new_password 新密码.
-     * @apiParam {String}  new_password_repeat 重复新密码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function modifyPassword(Request $request)
-    {
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-        $new_password = $request->has('new_password') ? trim($request->input('new_password')) : '';
-        $new_password_repeat = $request->has('new_password_repeat') ? trim($request->input('new_password_repeat')) : '';
-
-        if(!$password || !$new_password || !$new_password_repeat) return response()->error('PARAM_ERROR');
-
-        if($new_password != $new_password_repeat) return response()->error('PASSWORD_NOT_SAME');
-
-        $channel_user_id = session('ydyauth');
-
-        $channel_user = ChannelUserService::getById($channel_user_id);
-
-        if($channel_user->password != md5($password."^-^zhuishuyun^_^")) return response()->error('PASSWORD_WRONG');
-
-        if($channel_user->phone)
-        {
-            $password = md5($new_password."^-^zhuishuyun^_^");
-            if(ChannelUserService::modifyPassword($channel_user->phone, $password))
-            {
-                return response()->success();
-            }
-        }
-    }
-
-    public function getCaptcha(Request $request) {
-        //return 1;
-        return Captcha::create();
-    }
-    public function test2(Request $request) {
-        //return 1;
-        $rules = ['captcha' => 'required|captcha'];
-        //\Log::info($request->session()->all());
-        //\Log::info($request->all());
-        $validator = Validator::make($request->all(), $rules);
-        if ($validator->fails())
-        {
-            //\Log::info('validator:'.json_encode($validator));
-            return response()->error('CAPTCHA_VERIFY_ERROR');
-        }
-        var_dump($request->session()->all());
-        //return Captcha::create();
-    }
-}

+ 0 - 170
app/Http/Controllers/Channel/Channel/ChannelController.php

@@ -1,170 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel;
-
-use App\Modules\OfficialAccount\Models\OfficialAccount;
-use App\Modules\Finance\Services\FinancialStatService;
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Channel\Services\ChannelService;
-use App\Http\Controllers\Channel\Channel\Transformers\ChannelTransformer;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Finance\Services\CommissionRateService;//结算比例
-use App\Modules\OfficialAccount\Services\PaySubstituteSwitchService;
-use http\Url;
-use Illuminate\Http\Request;
-
-class ChannelController extends BaseController
-{
-
-    /**
-     * @apiDefine Channel 渠道
-     */
-    //设置当前操作渠道
-    public function setCurrent(Request $request)
-    {
-        $channel_user_id = $this->getChannelUserId();
-        $distribution_channel_id = $request->has('distribution_channel_id') ? (int)$request->input('distribution_channel_id') : '';
-        //获取该账号下渠道
-        if (!$channel_user_id || !$distribution_channel_id || !$channel = ChannelService::getUserChannel($distribution_channel_id, $channel_user_id)) return response()->error('PARAM_ERROR');
-
-        $request->session()->put('ydychannel', serialize($channel));
-        return response()->success();
-    }
-
-    //创建渠道
-    public function createChannel(Request $request)
-    {
-        $channel_user_id = $this->getChannelUserId();
-        $channel_user = ChannelUserService::getById($channel_user_id);
-        $distribution_manages_id = $channel_user->distribution_manages_id;
-        $phone = $channel_user->phone;
-        $person_in_charge_name = $channel_user->person_in_charge_name;
-        $nickname = $channel_user->nickname;
-        if ($channel = ChannelService::createChannel(compact('channel_user_id', 'distribution_manages_id', 'phone', 'person_in_charge_name', 'nickname'))) {
-            //创建结算比例
-            CommissionRateService::addCommissionRate($channel->id, 0, 0, 0.9);
-            return response()->success();
-        }
-    }
-
-    //当前账号下渠道列表
-    public function channelList(Request $request)
-    {
-        $channel_user_id = $this->getChannelUserId();
-        $channels = ChannelService::getByChannelUserId($channel_user_id);
-        foreach ($channels as $value) {
-            $pay_substitute = PaySubstituteSwitchService::getChannelSwitch($value->id);
-            $value->paySubstituteSwitch =(bool)((int)$pay_substitute);
-        }
-        return response()->collection(new ChannelTransformer(), $channels);
-    }
-    
-    // 删除站点
-    public function deleteChannel(Request $request)
-    {
-    	$channel_user_id = $this->getChannelUserId();
-    	$distribution_channel_id = $request->has('distribution_channel_id') ? (int)$request->input('distribution_channel_id') : '';
-    	if (empty($distribution_channel_id)) {
-    		return response()->error('PARAM_EMPTY');
-    	}
-    	
-    	\Log::info('deleteChannel_start:'.$distribution_channel_id);
-    	
-    	// 检测未解绑公众号
-    	$exist_official_account = OfficialAccount::getOneOfficialAuthAccounts($distribution_channel_id,1,1);
-    	if(!empty($exist_official_account)){
-    		return response()->error('UNABLE_DEL_EXIST_GZH');
-    	}
-    	
-    	// 检测账户余额
-    	$finance_stat = FinancialStatService::getFinancialStatSingle($distribution_channel_id);
-    	$enable_withdrawal_amount = $finance_stat ? (float)$finance_stat->enable_withdrawal_amount : 0;
-    	\Log::info('deleteChannel_start:'.$distribution_channel_id.' $enable_withdrawal_amount:'.$enable_withdrawal_amount);
-    	 
-    	if($enable_withdrawal_amount > 0){
-    		return response()->error('UNABLE_DEL_EXIST_WITHDRAWL_AMOUNT');
-    	}
-    	\Log::info('deleteChannel_after_check:'.$distribution_channel_id.' channel_user_id:'.$channel_user_id);
-    	 
-    	ChannelService::deleteChannel($distribution_channel_id, $channel_user_id);
-    	return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 设置站点别名
-     * @api {POST} channels/setsitename 设置站点别名
-     * @apiGroup Channel
-     * @apiName setSiteNickName
-     * @apiParam   {Number}  distribution_channel_id  渠道id
-     * @apiParam   {String}  site_name  名称
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *         }
-     *     }
-     */
-    public function setSiteNickName(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? (int)$request->input('distribution_channel_id') : '';
-        $site_name = $request->has('site_name') ? $request->input('site_name') : '';
-        if (empty($distribution_channel_id) || empty($site_name)) {
-            return response()->error('PARAM_EMPTY');
-        }
-
-        ChannelService::setChannelSiteNickName($distribution_channel_id, $site_name);
-        return response()->success();
-    }
-
-    public function updateDistributionOuterSiteSwitch(Request $request)
-    {
-        $status = $request->has('status') ? $request->input('status') : '0';
-        $distribution_channel_id = $this->getChannelId();
-        \Log::info('updateDistributionOuterSiteSwitch:$distribution_channel_id:' . $distribution_channel_id . ' $status:' . $status);
-        ChannelService::updateDistributionOuterSiteSwitch($distribution_channel_id, $status);
-        return response()->success();
-    }
-
-    public function updateDistributionOldUserSiteSwitch(Request $request)
-    {
-        $status = $request->has('status') ? $request->input('status') : '0';
-        $distribution_channel_id = $this->getChannelId();
-        \Log::info('updateDistributionOldUserSiteSwitch:$distribution_channel_id:' . $distribution_channel_id . ' $status:' . $status);
-        ChannelService::updateDistributionOldUserSiteSwitch($distribution_channel_id, $status);
-        return response()->success();
-    }
-
-    public function getDistributionChannel(Request $request)
-    {
-        $distribution_channel_id = $this->getChannelId();
-        $channel = ChannelService::getDistributionChannel($distribution_channel_id);
-        return response()->success($channel);
-    }
-    
-    public function getDistributionChannelSwitchByCategory(Request $request)
-    {
-    	$category = $request->has('category') ? $request->input('category') : '';
-    	if (empty($category)) {
-    		return response()->error('PARAM_EMPTY');
-    	}
-    	$distribution_channel_id = $this->getChannelId();
-    	$channel = ChannelService::getDistributionChannelSwitchByCategory($distribution_channel_id,$category);
-    	$is_show = 0;
-    	if(!empty($channel)){
-    		$is_show = 1;
-    	}
-    	
-    	// 开放全部:周报、图片素材上传
-    	if(in_array($category,array('weekly_report','create_img_chapter'))){
-    		$is_show = 1;
-    	}
-    	
-    	return response()->success($is_show);
-    }
-
-}

+ 0 - 90
app/Http/Controllers/Channel/Channel/ChannelQuestionNaireController.php

@@ -1,90 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Channel\Models\ChannelQuestionNaire;
-use App\Modules\Channel\Services\ChannelQuestionNaireService;
-use App\Modules\Channel\Services\ChannelUserService;
-use Illuminate\Http\Request;
-
-//结算比例
-
-/**
- * 渠道问卷调查
- * Class ChannelSwitchController
- * @package App\Http\Controllers\Channel\Channel
- */
-class ChannelQuestionNaireController extends BaseController
-{
-    /**
-     * 添加问卷调查
-     * @param Request $request
-     * @return mixed
-     */
-    public function add_question_naire(Request $request)
-    {
-        $id = $request->input('id', '');
-        $reply_grade = $request->input('reply_grade', '');
-        $business_name = ChannelQuestionNaireService::getNickName($this->getChannelUserId());
-
-        if (!$id || !$reply_grade) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $result = ChannelQuestionNaireService::updateInfo($id, $reply_grade, $business_name);
-        if ($result) {
-            return response()->success();
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-    /**
-     * 获取渠道的问卷调查是否显示或者提交过
-     * @param Request $request
-     */
-    function checkQuestionNaireShow(Request $request)
-    {
-        $isShow = 0;
-        $isReply = 0;
-        $channel_user_id = $this->getChannelUserId();
-        $channel_user = ChannelUserService::getById($channel_user_id);
-        if ($channel_user) {
-            $isShow = ChannelQuestionNaire::checkQuestionNaire($channel_user->company_id, false);
-            $isReply = ChannelQuestionNaire::checkQuestionNaire($channel_user->company_id, true);
-        }
-
-        $isShow = ($isShow > 0) ? true : false;
-        $isReply = ($isReply > 0) ? true : false;
-        $business_name = ChannelQuestionNaireService::getNickName($channel_user_id);
-        return response()->success(['isShow' => $isShow, 'nickName' => $business_name, 'isReply' => $isReply]);
-    }
-
-    /**
-     * 设置问卷调查的显示状态
-     * @param Request $request
-     * @return mixed
-     */
-    function setQuestionNaireShowed(Request $request)
-    {
-        $channel_user_id = $this->getChannelUserId();
-        $business_name = ChannelQuestionNaireService::getNickName($channel_user_id);
-        //查询这个channel_user_id本月是否已经显示过
-
-        $channel_user = ChannelUserService::getById($channel_user_id);
-        $company_id = $channel_user->company_id;
-        $distribution_manages_id = $channel_user->distribution_manages_id;
-
-        $result = ChannelQuestionNaire::geFirstQuestionNaire($company_id);
-        if (!$result) {
-            $result = ChannelQuestionNaireService::addQuestionNaire(compact('channel_user_id', 'business_name', 'distribution_manages_id', 'company_id'));
-        }
-
-        if ($result) {
-            return response()->success(['id' => $result->id]);
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-}

+ 0 - 90
app/Http/Controllers/Channel/Channel/ChannelSubscribeSettingController.php

@@ -1,90 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel;
-
-use Illuminate\Http\Request;
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Channel\Services\ChannelSubscribeSettingService;
-use App\Http\Controllers\Channel\Channel\Transformers\ChannelSubscribeTransformer;
-class ChannelSubscribeSettingController extends BaseController
-{
-
-    /**
-     * @apiDefine ChannelSubscribe 渠道强关
-     */
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取强关配置
-     * @api {GET} channels/getSubscribeSetting 获取强关配置
-     * @apiGroup ChannelSubscribe
-     * @apiName getSubscribeSetting
-     * @apiParam     {String}  appid  appid
-     * @apiSuccess   {Number}  force_subscribe_type  强关类型
-     * @apiSuccess   {String}  resource_url  跳转地址
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *               id:123,
-     *               force_subscribe_type:2,
-     *               resource_url:12222
-     *         }
-     *     }
-     */
-    public  function getSubscribeSetting(Request $request){
-        $channel_id = $this->getChannelId();
-        $appid = $request->input('appid');
-        $setting = ChannelSubscribeSettingService::getSubscribeTypeByAppId($appid);
-        if($setting){
-            $setting->id = $channel_id;
-            return response()->item(new ChannelSubscribeTransformer,$setting);
-        }
-        return response()->success();
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 设置强关类型
-     * @api {POST} channels/setSubscribeType 设置强关类型
-     * @apiGroup ChannelSubscribe
-     * @apiName setSubscribeType
-     * @apiParam   {Number}  force_subscribe_type  强关类型
-     * @apiParam   {String}  resource_url  跳转地址
-     * @apiParam   {String}  appid  appid
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *               id:123,
-     *               force_subscribe_type:2,
-     *               resource_url:12222
-     *         }
-     *     }
-     */
-    public function setSubscribeType(Request $request){
-        $force_subscribe_type = $request->input('force_subscribe_type');
-        $resource_url = $request->input('resource_url');
-        $distribution_channel_id = $this->getChannelId();
-        $appid = $request->input('appid');
-        if(empty($force_subscribe_type) || empty($appid)){
-            return response()->error('PARAM_EMPTY');
-        }
-        ChannelSubscribeSettingService::updateOrSettingForceSubScribe(compact('force_subscribe_type','resource_url','distribution_channel_id','appid'));
-        $setting = ChannelSubscribeSettingService::getSubscribeTypeByAppId($appid);
-        $setting->force_subscribe_type_text = str_replace(['1','2','3'],['强制关注','弱关注','强制链接关注'],$setting->force_subscribe_type);
-        $setting->force_subscribe_type = explode(',',$setting->force_subscribe_type);
-        return response()->success($setting);
-    }
-
-}

+ 0 - 38
app/Http/Controllers/Channel/Channel/ChannelSwitchController.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\Channel\Services\ChannelService;
-use App\Http\Controllers\Channel\Channel\Transformers\ChannelTransformer;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Finance\Services\CommissionRateService;//结算比例
-use App\Modules\OfficialAccount\Services\PaySubstituteSwitchService;
-use Illuminate\Http\Request;
-
-class ChannelSwitchController extends BaseController
-{
-    public function getChannelPaySubstituteSwitch(Request $request) {
-        $distribution_channel_id = $request->input('distribution_channel_id','');
-        if(empty($distribution_channel_id)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $switch = PaySubstituteSwitchService::getChannelSwitch($distribution_channel_id);
-        $switch->status = (int)$switch->status;
-        return response()->success($switch);
-    }
-
-    public function setChannelPaySubstituteSwitch(Request $request) {
-        $distribution_channel_id = $request->input('distribution_channel_id','');
-        $switch = $request->input('switch','');
-        if(empty($distribution_channel_id)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!in_array($switch,['1','0',1,0])){
-            return response()->error('PARAM_ERROR');
-        }
-        $switch = PaySubstituteSwitchService::setChannelSwitch($distribution_channel_id,$switch);
-        $switch->status = (int)$switch->status;
-        return response()->success($switch);
-    }
-}

+ 0 - 28
app/Http/Controllers/Channel/Channel/PayTemplateController.php

@@ -1,28 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel;
-
-use App\Modules\Channel\Models\PayTemplate;
-use App\Modules\Channel\Services\PayTemplateService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Channel\BaseController;
-
-class PayTemplateController extends BaseController
-{
-    public function getPayTemplate(){
-        $distribution_channel_id = (int)$this->getChannelId();
-        $template_id = PayTemplateService::getPayTemplate($distribution_channel_id);
-        return response()->success(['type'=>$template_id]);
-    }
-
-
-    public function setPayTemplate(Request $request){
-        $distribution_channel_id = (int)$this->getChannelId();
-        $type = (int)$request->post('type');
-        if(empty($type) || !in_array($type,[1,2])){
-            return response()->error('PARAM_ERROR');
-        }
-        $res = PayTemplateService::setPayTemplate($distribution_channel_id,$type);
-        return response()->success();
-    }
-}

+ 0 - 22
app/Http/Controllers/Channel/Channel/Transformers/ChannelSubscribeTransformer.php

@@ -1,22 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2018/3/13
- * Time: 14:32
- */
-
-namespace App\Http\Controllers\Channel\Channel\Transformers;
-
-
-class ChannelSubscribeTransformer
-{
-    public function transform($channel)
-    {
-        return [
-            'id' => $channel->id,
-            'force_subscribe_type' =>$channel->force_subscribe_type,
-            'resource_url'=>$channel->resource_url
-        ];
-    }
-}

+ 0 - 15
app/Http/Controllers/Channel/Channel/Transformers/ChannelTransformer.php

@@ -1,15 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Channel\Transformers;
-
-class ChannelTransformer
-{
-    public function transform($channel)
-    {
-        return [
-            'id' => $channel->id,
-            'nickname' =>empty($channel->site_nick_name)? '站点'.$channel->id:$channel->site_nick_name,
-            'paySubstituteSwitch'=>isset($channel->paySubstituteSwitch)?$channel->paySubstituteSwitch:1
-        ];
-    }
-}

+ 0 - 60
app/Http/Controllers/Channel/Finance/BankController.php

@@ -1,60 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/6
- * Time: 下午7:13
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Http\Controllers\Channel\Finance\Transformers\BankTransformer;
-use App\Modules\Finance\Services\BankService;
-use Illuminate\Http\Request;
-
-class BankController extends BaseController
-{
-
-
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取银行列表
-     * @api {GET} banks 获取银行列表
-     * @apiGroup Finance
-     * @apiName banks
-     * @apiSuccess   {Number}  id 姓名.
-     * @apiSuccess   {String}  name 银行名称.
-     * @apiSuccess   {String}  code 银行编号.
-     * @apiSuccess   {String}  source 渠道支付来源.通联支付,连连支付
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[
-     *              {
-     *                   "id": 1,
-     *                   "name": "中国邮政储蓄银行",
-     *                   "code": "100",
-     *                   "source": "通连支付"
-     *               }
-     *          ]
-     *     }
-     */
-    function getBankList(Request $request)
-    {
-        //$channel_id = $this->getChannelId();
-        //$channel_name = $this->getChannelName();
-        //$banks = BankService::getBankList(ChannelService::getChannelBankSourceById($channel_id));
-        $banks = BankService::getBankList(config('common.lianlianpay'));
-
-        return response()->collection(new BankTransformer(), $banks);
-    }
-
-}

+ 0 - 55
app/Http/Controllers/Channel/Finance/BaseController.php

@@ -1,55 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Finance;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-use Illuminate\Http\Request;
-
-class BaseController extends ChannelBaseController
-{
-    /**
-     * 检测参数有没有为空的
-     * @param Request $request
-     * @param $params
-     * @return bool
-     */
-    public static function checkParamValueEmpty(Request $request, $params) {
-        $isCheck = false;
-        foreach ($params as $keyName) {
-            $value = $request->has($keyName) ? $request->input($keyName) : '';
-            if(empty($value)) {
-                $isCheck = true;
-            }
-        }
-        return $isCheck;
-    }
-
-    /**
-     * 检测参数有没有不是数字的
-     * @param Request $request
-     * @param $params
-     * @return bool
-     */
-    public static function checkParamValueNumber(Request $request, $params) {
-        $isCheck = false;
-        foreach ($params as $keyName) {
-            $value = $request->has($keyName) ? $request->input($keyName) : '';
-            if(!is_numeric($value)) {
-                $isCheck = true;
-            }
-        }
-        return $isCheck;
-    }
-
-    /**
-     * 获取今天最大时间
-     * @param string $dayTime
-     * @return mixed
-     */
-    public static function getMaxDay($dayTime = '') {
-        if(!empty($dayTime) && (strlen(trim($dayTime)) == 8 || strlen(trim($dayTime)) == 10)) {
-            $dayTime = $dayTime." 23:59:59";
-        }
-        return $dayTime;
-    }
-}

+ 0 - 126
app/Http/Controllers/Channel/Finance/BillsController.php

@@ -1,126 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Http\Controllers\Channel\Finance\Transformers\BillTransformer;
-use App\Modules\Finance\Services\BillService;
-use Illuminate\Http\Request;
-
-
-class BillsController extends BaseController
-{
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取结算列表
-     * @api {GET} bills 获取结算列表
-     * @apiGroup Finance
-     * @apiName bills
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间2017-01-01.(可不传)
-     * @apiParam   {String}  [end_time] 结束时间2017-02-01.(可不传)
-     * @apiSuccess   {String}  date 日期.
-     * @apiSuccess   {Number}  recharge_amount 充值金额.
-     * @apiSuccess   {Number}  settlement_price 结算金额.
-     * @apiSuccess   {Number}  tallage 扣税金额.
-     * @apiSuccess   {String}  rate 比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *              {
-     *                  "list":[
-     *                             {
-     *                               "date": "2017-11-18",
-     *                               "recharge_amount": 1100,
-     *                               "settlement_price": 440,
-     *                               "tallage": 0,
-     *                               "rate": "0.40%"
-     *                               }
-     *                          ]
-     *                   "meta":{
-     *                      "total": 4,
-     *                       "per_page": 15,
-     *                       "current_page": 1,
-     *                       "last_page": 1,
-     *                       "next_page_url": "",
-     *                       "prev_page_url": ""
-     *                          }
-     *               }
-     *     }
-     */
-	function get_list(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
-        $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
-        $end_time = self::getMaxDay($end_time);
-
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        $params = [
-            'channel_id'=>$distribution_channel_id,
-            'channel_name'=>$distribution_channel_name,
-            'search_name'=>$search_name,
-            'start_date'=>$start_time,
-            'end_date'=>$end_time,
-        ];
-        $bills = BillService::getBillList($params);
-        return response()->pagination(new BillTransformer(), $bills);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取结算导出
-     * @api {GET} exportBills 获取结算导出
-     * @apiGroup Finance
-     * @apiName exportBills
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间2017-01-01.(可不传)
-     * @apiParam   {String}  [end_time] 结束时间2017-02-01.(可不传)
-     */
-    function export(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $start_time = $request->has('start_time') ? date('Ymd',strtotime($request->input('start_time'))) : '';
-        $end_time = $request->has('end_time') ? date('Ymd',strtotime($request->input('end_time'))) : '';
-        $end_time = self::getMaxDay($end_time);
-
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        $params = [
-            'channel_id'=>$distribution_channel_id,
-            'channel_name'=>$distribution_channel_name,
-            'search_name'=>$search_name,
-            'start_date'=>$start_time,
-            'end_date'=>$end_time,
-        ];
-        $bills = BillService::getBillList($params, true);
-
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "结算" . date("YmdHis") . ".csv");
-        echo iconv("UTF-8","GBK","\"结算日期\",\"充值金额\",\"佣金比例\",\"扣税金额\",\"结算金额\"\r\n");
-        if($bills)
-        {
-            foreach($bills as $bill)
-            {
-                echo("\"" . iconv("UTF-8","GBK",date('Y-m-d',strtotime($bill->date))) .  "\",");
-                echo("\"" . (float)$bill->recharge_amount .  "\",");
-                echo("\"" . ($bill->rate).'%' .  "\",");
-                echo("\"" . (float)$bill->tallage .  "\",");
-                echo("\"" . (float)$bill->settlement_price.  "\"\r\n");
-            }
-        }
-        exit();
-    }
-}

+ 0 - 255
app/Http/Controllers/Channel/Finance/CashAccountsController.php

@@ -1,255 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 上午11:36
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Http\Controllers\Channel\Finance\Transformers\CashAccountTransformer;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Finance\Services\BankService;
-use App\Modules\Finance\Services\CashAccountService;
-use Illuminate\Http\Request;
-use Cache;
-use Redis;
-use App\Libs\SMS;
-use Log;
-use App\Libs\AliSMS;
-
-class CashAccountsController extends BaseController
-{
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取银行账号
-     * @api {GET} getCashAccount 获取银行账号
-     * @apiGroup Finance
-     * @apiName getCashAccount
-     * @apiSuccess   {String}  account_name 姓名.
-     * @apiSuccess   {String}  identity_card 身份证号码.
-     * @apiSuccess   {String}  card_number 银行卡号码.
-     * @apiSuccess   {String}  account_bank 开户支行名称.
-     * @apiSuccess   {Number}  bank_id 银行ID.
-     * @apiSuccess   {String}  bank 交易银行.
-     * @apiSuccess   {String}  phone 电话号码.
-     * @apiSuccess   {String}  province 省份.
-     * @apiSuccess   {Number}  status 省份.状态; -1:禁止编辑; 0:默认可编辑
-     * @apiSuccess   {Number}  is_company 0:对私账户; 1:对公账户
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *              {
-     *                   "account_bank": "钱江支行",
-     *                   "account_name": "宋晓",
-     *                   "bank_id": 1,
-     *                   "bank": "杭州银行",
-     *                   "card_number": "6222520177654916",
-     *                   "identity_card": "33038119930901821X",
-     *                   "province": "北京市",
-     *                   "status": -1,
-     *                   "phone": "13688998899",
-     *                   "is_company": 0,
-     *                   "updated_time": "2017-11-20 14:54:50"
-     *               }
-     *     }
-     */
-    function get_cashAccount(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-
-        $cashAccount = CashAccountService::getCashAccountSingle($distribution_channel_id);
-        return response()->item(new CashAccountTransformer(), $cashAccount);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加更新银行账号
-     * @api {POST} addCashAccount 添加银行账号
-     * @apiGroup Finance
-     * @apiName addCashAccount
-     * @apiParam   {Number}  [is_company] 0:对私账户; 1:对公账户
-     * @apiParam   {Number}  bank_id 银行ID.
-     * @apiParam   {String}  account_bank 开户支行名称.
-     * @apiParam   {String}  account_name 对私账户:开户人名称;  对公账户:持卡人名称
-     * @apiParam   {String}  card_number 银行卡号码.
-     * @apiParam   {String}  [phone] 电话号码.
-     * @apiParam   {String}  [identity_card] 对私账户:开户人身份证号码;   对公账户:持卡人身份证号码
-     * @apiParam   {String}  [province] 省份.
-     * @apiParam   {String}  [sms_code] 验证码,修改的时候必传.
-     *
-     * @apiSuccess   {String}  account_name 姓名.
-     * @apiSuccess   {String}  identity_card 身份证号码.
-     * @apiSuccess   {String}  card_number 银行卡号码.
-     * @apiSuccess   {String}  account_bank 开户支行名称.
-     * @apiSuccess   {Number}  bank_id 银行ID.
-     * @apiSuccess   {String}  bank 交易银行.
-     * @apiSuccess   {String}  phone 电话号码.
-     * @apiSuccess   {String}  province 省份.
-     * @apiSuccess   {Number}  status 省份.状态; -1:禁止编辑; 0:默认可编辑
-     * @apiSuccess   {Number}  is_company 0:对私账户; 1:对公账户
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *              {
-     *                   "account_bank": "钱江支行",
-     *                   "account_name": "宋晓",
-     *                   "bank_id": 1,
-     *                   "bank": "杭州银行",
-     *                   "card_number": "6222520177654916",
-     *                   "identity_card": "33038119930901821X",
-     *                   "province": "北京市",
-     *                   "status": -1,
-     *                   "phone": "13688998899",
-     *                   "is_company": 0,
-     *                   "updated_time": "2017-11-20 14:54:50"
-     *               }
-     *     }
-     */
-    function add_cashAccount(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $channel_id = $distribution_channel_id;
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $account_name = $request->has('account_name') ? $request->input('account_name') : '';
-        if(empty($account_name)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $identity_card = $request->has('identity_card') ? $request->input('identity_card') : '';
-//        if(empty($identity_card)) {
-//            return response()->error("PARAM_EMPTY");
-//        }
-        $card_number = $request->has('card_number') ? $request->input('card_number') : '';
-        if(empty($card_number)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $account_bank = $request->has('account_bank') ? $request->input('account_bank') : '';
-//        if(empty($account_bank)) {
-//            return response()->error("PARAM_EMPTY");
-//        }
-        $bank_id = $request->has('bank_id') ? $request->input('bank_id') : '';
-        if(!is_numeric($bank_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        $bankModel = BankService::getBankSingle($bank_id);
-        if(empty($bankModel)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $bank = $request->has('bank') ? $request->input('bank') : '';
-        if(empty($bank)) {
-            $bank = $bankModel['name'];
-        }
-
-        $province = $request->has('province') ? $request->input('province') : '';
-        $phone = $request->has('phone') ? $request->input('phone') : '';
-
-        $cashAccount = CashAccountService::getCashAccountSingle($distribution_channel_id);
-
-        if(empty($cashAccount)) {
-            $cashAccount = CashAccountService::addCashAccount($distribution_channel_id, $account_name, $identity_card, $card_number, $account_bank, $bank_id, $bank, $province, $is_company, $phone);
-        } else {
-            $channel = ChannelService::getById($distribution_channel_id);
-            if(!$channel) {
-                return response()->error('PARAM_ERROR');
-            }
-            $channelUser = ChannelUserService::getById($channel->channel_user_id);
-            if(!$channelUser) {
-                return response()->error('PARAM_ERROR');
-            }
-            $phoneCodeNumber = $channelUser->phone;
-
-            $phoneCode = Redis::get('sms_'.$channel_id."_".$phoneCodeNumber);
-            if(!$phoneCode) {
-                $phoneCode = Cache::get('sms_'.$channel_id."_".$phoneCodeNumber);
-            }
-            $exist_sms_code = $phoneCode;
-            $sms_code = $request->has('sms_code') ? $request->input('sms_code') : '';
-
-            Log::info("======修改渠道提现信息验证码=====[".'sms_'.$channel_id."_".$phoneCodeNumber."_".$exist_sms_code."]======输入验证码 [ ".$sms_code ." =====".date("y-m-d H:i:s"."\n"));
-
-            if(empty($exist_sms_code) || empty($sms_code)) {
-                return response()->error('PHONE_CODE_ERROR');
-            }
-
-            if($sms_code != $exist_sms_code) {
-                return response()->error('VERIFY_CODE_ERROR');
-            }
-
-            $cashAccount = CashAccountService::updateCashAccount($distribution_channel_id, $account_name, $identity_card, $card_number, $account_bank, $bank_id, $bank, $province, $is_company, $phone);
-            Cache::forget('sms_'.$channel_id."_".$phoneCodeNumber);
-            Redis::del('sms_'.$channel_id."_".$phoneCodeNumber);
-
-//            if(CashAccountService::isEditCashAccount($distribution_channel_id)) {
-//                //-1 禁止修改
-//                return response()->error("FORBID_CHANGE");
-//            } else {
-//            }
-        }
-        return response()->item(new CashAccountTransformer(), $cashAccount);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取修改银行账号信息验证码
-     * @api {GET} getCashAccountSms 获取修改银行账号信息验证码
-     * @apiGroup Finance
-     * @apiName getCashAccountSms
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[]
-     *     }
-     */
-    function getCashAccountSms(Request $request) {
-        $channel_id = $this->getChannelId();
-        $userId = $this->getChannelUserId();
-        if($userId) {
-            $user = ChannelUserService::getById($userId);
-            if($user) {
-                $phone = $user->phone;
-                if(Cache::get('sms_'.$channel_id."_".$phone)) {
-                    return response()->error('SMS_GET_TOO_OFTEN');
-                }
-                $code = rand(1000,9999);
-                $request->session()->put('sms_code', $code);
-                Cache::put('sms_'.$channel_id."_".$phone, $code, 10);
-                Log::info("======修改渠道提现信息验证码=====[".'sms_'.$channel_id."_".$phone."_".$code."]===========".date("y-m-d H:i:s"."\n"));
-                Redis::setex('sms_'.$channel_id."_".$phone, 10 * 60, $code);
-                $param = array('code'=>$code);
-                if(AliSMS::send($phone,'update_withdraw_cash',$param)){
-                    return response()->success();
-                }else{
-                    return response()->error('SMS_SEND_ERROR');
-                }
-            }
-        }
-        return response()->error('SMS_SEND_ERROR');
-    }
-
-}

+ 0 - 84
app/Http/Controllers/Channel/Finance/CommissionRateController.php

@@ -1,84 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午4:23
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-use App\Http\Controllers\Manage\Channel\Transformers\CommissionRateTransformer;
-use App\Modules\Finance\Services\CommissionRateService;
-use Illuminate\Http\Request;
-
-class CommissionRateController extends BaseController
-{
-
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取佣金结算比例列表
-     * @api {GET} commissionRates 佣金结算比例列表
-     * @apiGroup Finance
-     * @apiName commissionRates
-     * @apiSuccess   {Number}  begin_amount 起始金额.
-     * @apiSuccess   {Number}  end_amount 结束金额.
-     * @apiSuccess   {Number}  rate 比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *             [
-     *              {
-     *                  "begin_amount": 0,
-     *                  "end_amount": 1000,
-     *                  "rate": "0.10"
-     *               }
-     *              ]
-     *     }
-     */
-    function get_list(Request $request) {
-        if(self::checkParamValueNumber($request, ['channel_id'])) {
-            return response()->error("PARAM_ERROR");
-        }
-        $distribution_channel_id = $request->has('channel_id') ? $request->input('channel_id') : '';
-
-        $result = CommissionRateService::getCommissionRateList($distribution_channel_id);
-
-        return response()->collection(new CommissionRateTransformer(), $result);
-
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取当前渠道当前佣金比例
-     * @api {GET} getCommissionRate 获取当前渠道当前佣金比例
-     * @apiGroup Finance
-     * @apiName getCommissionRate
-     * @apiSuccess {Number}  rate 当前佣金比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *             "rate": "0.60"
-     *         }
-     *     }
-     */
-    function get_commissionRate(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $rate = CommissionRateService::getRateCommissionRate($distribution_channel_id);
-        return response()->success(compact('rate'));
-    }
-}

+ 0 - 46
app/Http/Controllers/Channel/Finance/FinanceController.php

@@ -1,46 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午8:30
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Modules\Finance\Services\WithdrawCashService;
-use Illuminate\Http\Request;
-
-class FinanceController extends BaseController
-{
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取状态列表
-     * @api {POST} getWithdrawCashStatus 获取状态列表
-     * @apiGroup Finance
-     * @apiName getWithdrawCashStatus
-     * @apiSuccess   {Number}  code 状态码
-     * @apiSuccess   {String}  name 状态名称.
-     * @apiSuccess   {Number}  show 是否显示 0:隐藏; 1:显示
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[
-     *                  {
-     *                      "code": 0,
-     *                      "name": "待审核",
-     *                      "show": 1
-     *                  }
-     *              ]
-     *     }
-     */
-    public function getWithdrawCashStatus(Request $request) {
-        $result = WithdrawCashService::getWithdrawCashStatusList(10);
-        return response()->success($result);
-    }
-
-}

+ 0 - 99
app/Http/Controllers/Channel/Finance/FinancialConfigController.php

@@ -1,99 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午3:12
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Http\Controllers\Channel\Finance\Transformers\FinancialConfigTransformer;
-use App\Modules\Finance\Services\FinancialConfigService;
-use Illuminate\Http\Request;
-
-class FinancialConfigController extends BaseController
-{
-
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 账号冻结,与解冻
-     * @api {GET} getFinancialConfig 账号冻结,与解冻
-     * @apiGroup Finance
-     * @apiName getFinancialConfig
-     * @apiSuccess   {Number}  frozen 0:解冻; -1:冻结状态.
-     * @apiSuccess   {String}  remark 渠道备注.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                 frozen : 0
-     *                 remark : ''
-     *              }
-     *     }
-     */
-    function get_frozen(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $financialConfig = FinancialConfigService::getFinancialConfigSingle($distribution_channel_id);
-        if(empty($financialConfig)) {
-            $financialConfig = new FinancialConfig();
-            $financialConfig['is_frozen'] = 0;
-            return response()->item(new FinancialConfigTransformer(), $financialConfig);
-        }
-        return response()->item(new FinancialConfigTransformer(), $financialConfig);
-    }
-
-    /**
-     * @apiignore
-     * @apiVersion 1.0.0
-     * @apiDescription 变更账号冻结,与解冻
-     * @api {POST} changeFinancialConfig 变更账号冻结,与解冻
-     * @apiGroup Finance
-     * @apiName changeFinancialConfig
-     * @apiParam   {Number}  frozen 0:解冻; -1:冻结状态.
-     * @apiParam    {String}  remark 渠道备注.
-     * @apiSuccess   {Number}  frozen 0:解冻; -1:冻结状态.
-     * @apiSuccess   {String}  remark 渠道备注.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                 frozen : 0
-     *                 remark : ''
-     *              }
-     *     }
-     */
-    function change_frozen(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $frozen = $request->input('frozen');
-        if(empty($frozen)) {
-            $frozen = 0;
-        }
-        if($frozen == -1 || $frozen == 0) {
-        } else {
-            $frozen = 0;
-        }
-
-        FinancialConfigService::updateFrozenDistributionChannel($distribution_channel_id, $frozen, $remark);
-        return response()->success(compact('frozen', 'remark'));
-    }
-}

+ 0 - 268
app/Http/Controllers/Channel/Finance/FinancialStatController.php

@@ -1,268 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 上午10:14
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Http\Controllers\Channel\Finance\Transformers\FinancialStatDetailTransformer;
-use App\Http\Controllers\Channel\Finance\Transformers\FinancialStatTransformer;
-use App\Modules\Finance\Services\FinancialStatService;
-use Illuminate\Http\Request;
-
-class FinancialStatController extends BaseController
-{
-
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取提现汇总信息
-     * @api {GET} getFinancialStat 获取提现汇总信息
-     * @apiGroup Finance
-     * @apiName getFinancialStat
-     * @apiSuccess   {Number}  accumulative_amount 累计提现金额.
-     * @apiSuccess   {Number}  enable_amount 可提现金额.
-     * @apiSuccess   {Number}  latest_amount 最近提现金额.
-     * @apiSuccess   {Number}  pending_amount 提现中金额.
-     * @apiSuccess   {String}  latest_time 最后提现时间.
-     * @apiSuccess   {String}  rate 当前佣金比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                   "accumulative_amount": "0.00",
-     *                   "enable_amount": "2170.00",
-     *                   "latest_amount": "0.00",
-     *                   "latest_time": "",
-     *                   "pending_amount": "0.00",
-     *                   "rate": "0.60%"
-     *              }
-     *     }
-     */
-    function get_FinancialStatInfo(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $result = FinancialStatService::getFinancialStatSingle($distribution_channel_id);
-
-        return response()->item(new FinancialStatTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取账号信息列表
-     * @api {GET} financialStats 获取账号信息列表
-     * @apiGroup Finance
-     * @apiName financialStats
-     * @apiParam   {String}  [person_in_charge_name] 渠道负责人名称.
-     * @apiParam   {String}  [search_name] 搜索名称.
-     * @apiParam   {Number}  [is_frozen] 0:解冻; -1:冻结状态.
-     * @apiParam   {String}  [ac_start_time] 账号创建开始时间2017-01-01
-     * @apiParam   {String}  [ac_end_time] 账号创建结束时间2017-02-01
-     * @apiParam   {String}  [frozen_start_time] 账号冻结开始时间2017-01-01
-     * @apiParam   {String}  [frozen_end_time] 账号冻结结束时间2017-02-01
-     * @apiSuccess   {Number}  accumulative_amount 累计提现金额.
-     * @apiSuccess   {Number}  enable_amount 可提现金额.
-     * @apiSuccess   {Number}  latest_amount 最近提现金额.
-     * @apiSuccess   {Number}  pending_amount 提现中金额.
-     * @apiSuccess   {String}  latest_time 最后提现时间.
-     * @apiSuccess   {String}  rate 当前佣金比例.
-     * @apiSuccess   {String}  phone 电话号码.
-     * @apiSuccess   {String}  name 渠道名称.
-     * @apiSuccess   {String}  pay_merchant 支付方式.
-     * @apiSuccess   {String}  nickname 渠道昵称.
-     * @apiSuccess   {String}  channel_remark 渠道备注.
-     * @apiSuccess   {String}  channel_created_time 渠道创建时间.
-     * @apiSuccess   {String}  fc_remark 冻结备注.
-     * @apiSuccess   {String}  person_in_charge_name 渠道负责人
-     * @apiSuccess   {String}  frozen_time 渠道冻结解冻时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                   "list": [
-     *                       {
-     *                           "accumulative_amount": "1000.00",
-     *                           "enable_amount": "11170.00",
-     *                           "latest_amount": "0.00",
-     *                           "latest_time": "2017-11-28 15:43:39",
-     *                           "pending_amount": "1600.00",
-     *                           "rate": "0.60%",
-     *                           "phone": "",
-     *                           "name": "sfsd",
-     *                           "pay_merchant": "34",
-     *                           "nickname": "",
-     *                           "channel_remark": ""
-     *                           "channel_created_time": "2017-11-28 15:43:39",
-     *                           "frozen_time": "2017-11-28 15:43:39",
-     *                           "person_in_charge_name": "",
-     *                           "fc_remark": ""
-     *                       }
-     *                      "meta": {
-     *                       ],
-     *                           "total": 2,
-     *                           "per_page": 15,
-     *                           "current_page": 1,
-     *                           "last_page": 1,
-     *                           "next_page_url": "",
-     *                           "prev_page_url": ""
-     *                       }
-     *              }
-     *     }
-     */
-    function get_FinancialStatListDetail(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-
-        $person_in_charge_name = $request->has('person_in_charge_name') ? $request->input('person_in_charge_name') : '';
-        $isFrozen = $request->has('is_frozen') ? $request->input('is_frozen') : '';
-        $is_frozen = '';
-        if(is_numeric($isFrozen) && ($isFrozen == -1 || $isFrozen == 0)) {
-            $is_frozen = $isFrozen;
-        }
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        $ac_start_time = $request->has('ac_start_time') && !empty($request->input('ac_start_time')) ? date('Ymd',strtotime($request->input('ac_start_time'))) : '';
-        $ac_end_time = $request->has('ac_end_time') && !empty($request->input('ac_end_time')) ? date('Ymd',strtotime($request->input('ac_end_time'))) : '';
-        $ac_end_time = self::getMaxDay($ac_end_time);
-
-        $frozen_start_time = $request->has('frozen_start_time') && !empty($request->input('frozen_start_time')) ? date('Ymd',strtotime($request->input('frozen_start_time'))) : '';
-        $frozen_end_time = $request->has('frozen_end_time') && !empty($request->input('frozen_end_time')) ? date('Ymd',strtotime($request->input('frozen_end_time'))) : '';
-        $frozen_end_time = self::getMaxDay($frozen_end_time);
-
-        $params = [
-            'channel_id'=>$distribution_channel_id,
-            'channel_name'=>$distribution_channel_name,
-            'person_in_charge_name'=>$person_in_charge_name,
-            'search_name'=>$search_name,
-            'ac_start_time'=>$ac_start_time,
-            'ac_end_time'=>$ac_end_time,
-            'is_frozen'=>$is_frozen,
-            'frozen_start_time'=>$frozen_start_time,
-            'frozen_end_time'=>$frozen_end_time,
-        ];
-        $result = FinancialStatService::getFrozenFinancialStatListParam($params);
-
-        return response()->pagination(new FinancialStatDetailTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 结算明细
-     * @api {GET} financialStatSettlementPriceDetail 结算明细
-     * @apiGroup Finance
-     * @apiName financialStatSettlementPriceDetail
-     * @apiParam   {String}  [person_in_charge_name] 渠道负责人名称.
-     * @apiParam   {String}  [search_name] 搜索名称.
-     * @apiParam   {Number}  [is_frozen] 0:解冻; -1:冻结状态.
-     * @apiParam   {String}  [ac_start_time] 账号创建开始时间2017-01-01
-     * @apiParam   {String}  [ac_end_time] 账号创建结束时间2017-02-01
-     * @apiParam   {String}  [frozen_start_time] 账号冻结开始时间2017-01-01
-     * @apiParam   {String}  [frozen_end_time] 账号冻结结束时间2017-02-01
-     * @apiSuccess   {Number}  accumulative_amount 累计提现金额.
-     * @apiSuccess   {Number}  enable_amount 可提现金额.
-     * @apiSuccess   {Number}  latest_amount 最近提现金额.
-     * @apiSuccess   {Number}  pending_amount 提现中金额.
-     * @apiSuccess   {String}  latest_time 最后提现时间.
-     * @apiSuccess   {String}  rate 当前佣金比例.
-     * @apiSuccess   {String}  phone 电话号码.
-     * @apiSuccess   {String}  name 渠道名称.
-     * @apiSuccess   {String}  pay_merchant 支付方式.
-     * @apiSuccess   {String}  nickname 渠道昵称.
-     * @apiSuccess   {String}  channel_remark 渠道备注.
-     * @apiSuccess   {String}  channel_created_time 渠道创建时间
-     * @apiSuccess   {String}  person_in_charge_name 渠道负责人
-     * @apiSuccess   {String}  frozen_time 渠道冻结解冻时间
-     * @apiSuccess   {String}  fc_remark 冻结备注.
-     * @apiSuccess   {Number}  recharge_amount_count 总充值金额.
-     * @apiSuccess   {Number}  tallage 手续费
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                   "list": [
-     *                       {
-     *                           "accumulative_amount": "1000.00",
-     *                           "enable_amount": "11170.00",
-     *                           "latest_amount": "0.00",
-     *                           "latest_time": "2017-11-28 15:43:39",
-     *                           "pending_amount": "1600.00",
-     *                           "rate": "0.60%",
-     *                           "phone": "",
-     *                           "name": "sfsd",
-     *                           "pay_merchant": "34",
-     *                           "nickname": "",
-     *                           "channel_remark": "",
-     *                           "channel_created_time": "2017-11-28 15:43:39",
-     *                           "frozen_time": "2017-11-28 15:43:39",
-     *                           "person_in_charge_name": "",
-     *                           "fc_remark": "",
-     *                           "recharge_amount_count": "6300.00",
-     *                           "tallage": 0
-     *                       }
-     *                      "meta": {
-     *                       ],
-     *                           "total": 2,
-     *                           "per_page": 15,
-     *                           "current_page": 1,
-     *                           "last_page": 1,
-     *                           "next_page_url": "",
-     *                           "prev_page_url": ""
-     *                       }
-     *              }
-     *     }
-     */
-    function settlement_price_detail(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-
-        $person_in_charge_name = $request->has('person_in_charge_name') ? $request->input('person_in_charge_name') : '';
-        $isFrozen = $request->has('is_frozen') ? $request->input('is_frozen') : '';
-        $is_frozen = '';
-        if(is_numeric($isFrozen) && ($isFrozen == -1 || $isFrozen == 0)) {
-            $is_frozen = $isFrozen;
-        }
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        $ac_start_time = $request->has('ac_start_time') && !empty($request->input('ac_start_time')) ? date('Ymd',strtotime($request->input('ac_start_time'))) : '';
-        $ac_end_time = $request->has('ac_end_time') && !empty($request->input('ac_end_time')) ? date('Ymd',strtotime($request->input('ac_end_time'))) : '';
-        $ac_end_time = self::getMaxDay($ac_end_time);
-
-        $frozen_start_time = $request->has('frozen_start_time') && !empty($request->input('frozen_start_time')) ? date('Ymd',strtotime($request->input('frozen_start_time'))) : '';
-        $frozen_end_time = $request->has('frozen_end_time') && !empty($request->input('frozen_end_time')) ? date('Ymd',strtotime($request->input('frozen_end_time'))) : '';
-        $frozen_end_time = self::getMaxDay($frozen_end_time);
-
-        $params = [
-            'channel_id'=>$distribution_channel_id,
-            'channel_name'=>$distribution_channel_name,
-            'person_in_charge_name'=>$person_in_charge_name,
-            'search_name'=>$search_name,
-            'ac_start_time'=>$ac_start_time,
-            'ac_end_time'=>$ac_end_time,
-            'is_frozen'=>$is_frozen,
-            'frozen_start_time'=>$frozen_start_time,
-            'frozen_end_time'=>$frozen_end_time,
-        ];
-
-        $result = FinancialStatService::getFrozenFinancialStatPriceListDetail($params);
-        return response()->pagination(new FinancialStatDetailTransformer(), $result);
-    }
-}

+ 0 - 124
app/Http/Controllers/Channel/Finance/OfficialAccountBills.php

@@ -1,124 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Finance;
-
-use App\Http\Controllers\Channel\Finance\Transformers\OfficialAccountBillsTransformer;
-use App\Modules\Finance\Services\OfficialAccountBillsService;
-use DB;
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Storage;
-
-class OfficialAccountBills extends BaseController
-{
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 服务号结算详情
-     * @api {GET} OfficialAccountBills/getList 服务号结算详情
-     * @apiGroup Finance
-     * @apiName OfficialAccountBills-getList
-     * @apiParam     {String}  start_time 开始时间.
-     * @apiParam     {String}  end_time 结束时间.
-     * @apiParam     {String}  export  导出(值给1就行export=1)
-     * @apiSuccess   {String}  data.list.recharge_amount 充值金额.
-     * @apiSuccess   {String}  data.list.date 日期.
-     * @apiSuccess   {String}  data.list.nickname  服务号
-     * @apiSuccess   {String}  data.meta.channel_recharge_amount total  渠道累计充值
-     * @apiSuccess   {String}  data.meta.recharge_amount_in_30_days 30日内充值
-     * @apiSuccess   {String}  data.meta.recharge_amount_in_60_days 60日内充值
-     * @apiSuccess   {String}  data.meta.recharge_amount_in_90_days 90日内充值
-     * @apiSuccess   {String}  data.meta.new_fans_num 新关粉丝数
-     * @apiSuccess   {String}  data.meta.per_page per_page
-     * @apiSuccess   {String}  data.meta.current_page current_page
-     * @apiSuccess   {String}  data.meta.last_page last_page
-     * @apiSuccess   {String}  data.meta.next_page_url next_page_url
-     * @apiSuccess   {String}  data.meta.prev_page_url prev_page_url
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              list:[
-     *                  {
-     *                       recharge_amount: "3145.00",
-     *                       date: "2018-04-13",
-     *                       appid: "wx1d6855c00d8e6500",
-     *                       nickname: "南梦繁花",
-     *                       channel_recharge_amount: "27680.00",
-     *                       recharge_amount_in_30_days: 111,
-     *                       recharge_amount_in_60_days: 111,
-     *                       recharge_amount_in_90_days: 111,
-     *                       new_fans_num: 40
-     *                    },...
-     *                ]
-     *             meta:{}
-     *             }
-     *
-     */
-    public function getList(Request $request)
-    {
-        $start_time = $request->input('start_time', date('Y-m-d'));
-        $end_time = $request->input('end_time', date('Y-m-d', time() + 86400));
-        $distribution_channel_id = $this->getChannelId();
-        $official = $this->getOfficialAccount($distribution_channel_id);
-        if (!$official)
-            return response()->success();
-        if ($request->input('export')) {
-            $data = OfficialAccountBillsService::getBillsByOfficialAcount($distribution_channel_id, $start_time, $end_time, true);
-//            $data = OrderService::OfficialAccountOrderStat($distribution_channel_id,$start_time,$end_time,500);
-        } else {
-//            $data = OrderService::OfficialAccountOrderStat($distribution_channel_id,$start_time,$end_time);
-            $data = OfficialAccountBillsService::getBillsByOfficialAcount($distribution_channel_id, $start_time, $end_time, false);
-        }
-
-//        if ($data) {
-//            foreach ($data as &$v) {
-//                $v->nickname = isset($official[$v->appid]) ? $official[$v->appid] : '未知';
-//                $amount = OrderService::OfficialAccountOrderSum($distribution_channel_id, $start_time, $end_time, $v->appid);
-//                $v->total_amount = $amount;
-//            }
-//        }
-
-        if ($request->input('export')) {
-            $filename = date('YmdHis') . '.csv';
-
-            Storage::append($filename, mb_convert_encoding("日期,服务号,充值金额,总额,新关粉丝数,30天内充值,60天内充值,90天内充值", 'gbk'));
-            $str = '';
-            if ($data) {
-                foreach ($data as $val) {
-                    $val->new_fans_num = $val->new_fans_num ? $val->new_fans_num : 0;
-                    $val->recharge_amount_in_30_days = $val->recharge_amount_in_30_days ? $val->recharge_amount_in_30_days : 0;
-                    $val->recharge_amount_in_60_days = $val->recharge_amount_in_60_days ? $val->recharge_amount_in_60_days : 0;
-                    $val->recharge_amount_in_90_days = $val->recharge_amount_in_90_days ? $val->recharge_amount_in_90_days : 0;
-
-                    $str .= "{$val->date},{$val->nickname},{$val->recharge_amount},{$val->channel_recharge_amount},{$val->new_fans_num},{$val->recharge_amount_in_30_days},{$val->recharge_amount_in_60_days},{$val->recharge_amount_in_90_days}\r\n";
-                }
-            }
-
-            Storage::append($filename, mb_convert_encoding($str, 'gbk'));
-            return response()->download(storage_path('app/' . $filename))->deleteFileAfterSend(true);
-        }
-
-        return response()->pagination(new OfficialAccountBillsTransformer(), $data);
-    }
-
-
-    private function getOfficialAccount($distribution_channel_id)
-    {
-        if (empty($distribution_channel_id)) return [];
-        $res = DB::table('official_accounts')->select('nickname', 'appid')->where('distribution_channel_id', $distribution_channel_id)->get();
-        if ($res) {
-            $data = [];
-            foreach ($res as $v) {
-                $data[$v->appid] = $v->nickname;
-            }
-            return $data;
-        }
-        return [];
-    }
-}

+ 0 - 166
app/Http/Controllers/Channel/Finance/PaymentController.php

@@ -1,166 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 下午3:23
- */
-
-namespace App\Http\Controllers\Channel\Finance;
-
-
-use App\Http\Controllers\Channel\Finance\Transformers\PaymentDetailTransformer;
-use App\Http\Controllers\Channel\Finance\Transformers\PaymentTransformer;
-use App\Modules\Finance\Services\FinancialConfigService;
-use App\Modules\Finance\Services\PaymentService;
-use App\Modules\Finance\Services\WithdrawCashService;
-use Illuminate\Http\Request;
-use DB;
-
-class PaymentController extends BaseController
-{
-
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 打款列表
-     * @api {GET} payments 打款列表
-     * @apiGroup Finance
-     * @apiName payments
-     * @apiParam   {Number}  withdraw_cash_id 提现id.
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiSuccess {Number}  id 打款 id.
-     * @apiSuccess {Number}  withdraw_cash_id 提现 id.
-     * @apiSuccess {Number}  amount 打款金额.
-     * @apiSuccess {String}  remark 备注
-     * @apiSuccess {String}  pay_time 打款时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              "list": [
-     *                      {
-     *                          "id": 1,
-     *                          "withdraw_cash_id": 1,
-     *                          "amount": "1000.0000",
-     *                          "remark": "dfsdfssd",
-     *                          "pay_time": "2017-11-20 14:28:28"
-     *                      }
-     *                   ],
-     *                     "meta": {
-     *                           "total": 1,
-     *                           "per_page": 15,
-     *                           "current_page": 1,
-     *                          "last_page": 1,
-     *                          "next_page_url": "",
-     *                          "prev_page_url": ""
-     *                   }
-     *              }
-     *     }
-     */
-    function get_list(Request $request) {
-        $withdraw_cash_id = $request->has('withdraw_cash_id') ? $request->input('withdraw_cash_id') : '';
-        $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
-        $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
-        $end_time = self::getMaxDay($end_time);
-
-        $payments = PaymentService::getPaymentList($withdraw_cash_id, $start_time, $end_time);
-
-        return response()->pagination(new PaymentTransformer(), $payments);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 打款列表详情
-     * @api {GET} listPayments 打款列表详情
-     * @apiGroup Finance
-     * @apiName listPayments
-     * @apiParam   {Number}  withdraw_cash_id 提现 id.
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {String}  [account_name] 账户名称
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     *
-     * @apiSuccess {Number}  id 打款 id.
-     * @apiSuccess {Number}  withdraw_cash_id 提现 id.
-     * @apiSuccess {Number}  amount 打款金额.
-     * @apiSuccess {String}  remark 备注
-     * @apiSuccess {String}  pay_time 打款时间
-     * @apiSuccess {String}  status 打款状态
-     * @apiSuccess {Number}  check_user_id 审核人ID
-     * @apiSuccess {String}  check_user_name 审核人名称
-     * @apiSuccess {String}  account_name 银行卡户主名称
-     * @apiSuccess {String}  identity_card 银行卡户主身份证
-     * @apiSuccess {String}  card_number 银行卡账号
-     * @apiSuccess {String}  account_bank 银行支行
-     * @apiSuccess {String}  bank 银行名称
-     * @apiSuccess {String}  province 银行地址
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              "list": [
-     *                      {
-     *                           "id": 1,
-     *                           "withdraw_cash_id": 1,
-     *                           "amount": "1000.0000",
-     *                           "pay_time": "2017-11-20 14:28:28",
-     *                           "status": "已打款",
-     *                           "remark": "哈哈哈,有钱",
-     *                           "check_user_id": 1,
-     *                           "check_user_name": "张大妈",
-     *                           "account_name": "宋晓",
-     *                           "identity_card": "33038119930901821X",
-     *                           "card_number": "6222520177654916",
-     *                           "account_bank": "钱江支行",
-     *                           "bank": "杭州银行",
-     *                           "province": "北京市"
-     *                      }
-     *                   ],
-     *                     "meta": {
-     *                           "total": 1,
-     *                           "per_page": 15,
-     *                           "current_page": 1,
-     *                          "last_page": 1,
-     *                          "next_page_url": "",
-     *                          "prev_page_url": ""
-     *                   }
-     *              }
-     *     }
-     */
-    function get_listDetail(Request $request) {
-        $distribution_channel_id = $this->getChannelId();
-        $distribution_channel_name = $this->getChannelName();
-        $distribution_channel_name = '';
-
-        $withdraw_cash_id = $request->has('withdraw_cash_id') ? $request->input('withdraw_cash_id') : '';
-        $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
-        $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
-
-        $account_name = $request->has('account_name') ? $request->input('account_name') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-        $status = $request->has('status') ? $request->input('status') : '';
-
-        $params = [
-            'withdraw_cash_id'=>$withdraw_cash_id,
-            'channel_id'=>$distribution_channel_id,
-            'channel_name'=>$distribution_channel_name,
-            'start_date'=>$start_time,
-            'end_date'=>$end_time,
-            'account_name'=>$account_name,
-            'search_name'=>$search_name,
-        ];
-        $payments = PaymentService::getPaymentDetailList($params, $status);
-
-        return response()->pagination(new PaymentDetailTransformer(), $payments);
-    }
-}

+ 0 - 21
app/Http/Controllers/Channel/Finance/Transformers/BankTransformer.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:26
- */
-
-class BankTransformer
-{
-    public function transform($bank){
-        return [
-            'id'       =>  isset($bank->id) ? $bank->id : 0,
-            'name'       =>  isset($bank->name) ? $bank->name : "",
-            'code'   =>  isset($bank->code) ? $bank->code : "",
-            'source'   =>  isset($bank->source) ? $bank->source : "",
-        ];
-    }
-}

+ 0 - 24
app/Http/Controllers/Channel/Finance/Transformers/BillTransformer.php

@@ -1,24 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:26
- */
-
-class BillTransformer
-{
-    public function transform($bill){
-        return [
-//            'channel_id'       =>  $bill->distribution_channel_id,
-//            'channel_name'       =>  $bill->distribution_channel_name,
-            'date'       =>  date('Y-m-d',strtotime($bill->date)),
-            'recharge_amount'       =>  (float)($bill->recharge_amount),
-            'settlement_price'   =>  (float)($bill->settlement_price),
-            'tallage'   =>  (float)(isset($bill->tallage) ? ($bill->tallage) : 0),
-            'rate'   =>  (100 * (float)($bill->rate))."%",
-        ];
-    }
-}

+ 0 - 30
app/Http/Controllers/Channel/Finance/Transformers/CashAccountTransformer.php

@@ -1,30 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class CashAccountTransformer
-{
-    public function transform($cashAccount){
-        return [
-            'account_name'       =>  isset($cashAccount->account_name) ? $cashAccount->account_name : "",
-            'identity_card'       =>  isset($cashAccount->identity_card) ? $cashAccount->identity_card : "",
-            'card_number'   =>  isset($cashAccount->card_number) ? $cashAccount->card_number : "",
-            'account_bank'   => isset($cashAccount->account_bank) ? $cashAccount->account_bank : "",
-            'bank_id'   =>  (float)(isset($cashAccount->bank_id) ? $cashAccount->bank_id : 0),
-            'is_company'   =>  (float)(isset($cashAccount->is_company) ? $cashAccount->is_company : 0),
-            'bank'   =>  isset($cashAccount->bank) ? $cashAccount->bank : "",
-            'phone'   =>  isset($cashAccount->phone) ? $cashAccount->phone : "",
-            'status'   =>  isset($cashAccount->status) ? $cashAccount->status : "",
-            'province'   =>  isset($cashAccount->province) ? $cashAccount->province : "",
-            'updated_time'   =>  isset($cashAccount->updated_at) ? date("Y-m-d H:i:s",strtotime($cashAccount->updated_at)) : "",
-        ];
-    }
-
-}

+ 0 - 21
app/Http/Controllers/Channel/Finance/Transformers/CommissionRateTransformer.php

@@ -1,21 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class CommissionRateTransformer
-{
-    public function transform($commissionRate){
-        return [
-            'begin_amount'       =>  (float)$commissionRate->begin_amount,
-            'end_amount'       =>  (float)$commissionRate->end_amount,
-            'rate'   =>  (float)($commissionRate->rate)
-        ];
-    }
-}

+ 0 - 20
app/Http/Controllers/Channel/Finance/Transformers/FinancialConfigTransformer.php

@@ -1,20 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午3:23
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class FinancialConfigTransformer
-{
-    public function transform($financialConfig){
-        return [
-            'frozen'       =>  $financialConfig->is_frozen,
-            'remark'       =>  $financialConfig->remark,
-        ];
-    }
-}

+ 0 - 35
app/Http/Controllers/Channel/Finance/Transformers/FinancialStatDetailTransformer.php

@@ -1,35 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 上午10:41
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-class FinancialStatDetailTransformer
-{
-    public function transform($financialStat){
-        return [
-//            'channel_id'       =>  isset($financialStat->id) ? $financialStat->id : "",
-            'accumulative_amount'       =>  (float)(isset($financialStat->accumulative_withdrawal_amount) ? $financialStat->accumulative_withdrawal_amount : 0),
-            'enable_amount'       =>  (float)(isset($financialStat->enable_withdrawal_amount) ? $financialStat->enable_withdrawal_amount : 0),
-            'latest_amount'       =>  (float)(isset($financialStat->latest_withdrawal_amount) ? $financialStat->latest_withdrawal_amount : 0),
-            'latest_time'       =>  isset($financialStat->latest_withdraw_time) ? ($financialStat->latest_withdraw_time ? date('Y-m-d H:i:s', strtotime($financialStat->latest_withdraw_time)) : "") : "",
-            'pending_amount'       =>  (float)(isset($financialStat->withdraw_pending_amount) ? $financialStat->withdraw_pending_amount : 0),
-            'rate'       =>  (float)(isset($financialStat->commission_rate) ? ($financialStat->commission_rate) : 0),
-            'phone'       =>  isset($financialStat->phone) ? ($financialStat->phone) : "",
-            'name'       =>  isset($financialStat->name) ? ($financialStat->name) : "",
-            'person_in_charge_name'       =>  isset($financialStat->person_in_charge_name) ? ($financialStat->person_in_charge_name) : "",
-            'frozen_time'       =>  isset($financialStat->frozen_time) ? ($financialStat->frozen_time ? date('Y-m-d H:i:s', strtotime($financialStat->frozen_time)) : "") : "",
-            'pay_merchant'       =>  isset($financialStat->pay_merchant) ? ($financialStat->pay_merchant) : "",
-            'nickname'       =>  isset($financialStat->nickname) ? ($financialStat->nickname) : "",
-            'channel_remark'       =>  isset($financialStat->channel_remark) ? ($financialStat->channel_remark) : "",
-            'channel_created_time'       =>  isset($financialStat->channel_created_at) ? ($financialStat->channel_created_at ? date('Y-m-d H:i:s', strtotime($financialStat->channel_created_at)) : "") : "",
-            'fc_remark'       =>  isset($financialStat->fc_remark) ? ($financialStat->fc_remark) : "",
-            'recharge_amount_count'       =>  (float)(isset($financialStat->recharge_amount_count) ? ($financialStat->recharge_amount_count) : 0),
-            'tallage'  => (float)isset($financialStat->tallage) ? ($financialStat->tallage) : 0,
-        ];
-    }
-}

+ 0 - 25
app/Http/Controllers/Channel/Finance/Transformers/FinancialStatTransformer.php

@@ -1,25 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 上午10:41
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class FinancialStatTransformer
-{
-    public function transform($financialStat){
-        return [
-//            'channel_id'       =>  isset($financialStat->distribution_channel_id) ? $financialStat->distribution_channel_id : "",
-            'accumulative_amount'       =>  (float) (isset($financialStat->accumulative_withdrawal_amount) ? $financialStat->accumulative_withdrawal_amount : 0),
-            'enable_amount'       =>  (float)(isset($financialStat->enable_withdrawal_amount) ? $financialStat->enable_withdrawal_amount : 0),
-            'latest_amount'       =>  (float)(isset($financialStat->latest_withdrawal_amount) ? $financialStat->latest_withdrawal_amount : 0),
-            'latest_time'       =>  isset($financialStat->latest_withdraw_time) ? ($financialStat->latest_withdraw_time ? date('Y-m-d H:i:s', strtotime($financialStat->latest_withdraw_time)) : "") : "",
-            'pending_amount'       =>  (float)(isset($financialStat->withdraw_pending_amount) ? $financialStat->withdraw_pending_amount : 0),
-            'rate'       =>  ((float)(isset($financialStat->commission_rate) ? ($financialStat->commission_rate): 0)),
-        ];
-    }
-}

+ 0 - 28
app/Http/Controllers/Channel/Finance/Transformers/OfficialAccountBillsTransformer.php

@@ -1,28 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class OfficialAccountBillsTransformer
-{
-    public function transform($item)
-    {
-        return [
-            "amount" => $item->recharge_amount,
-            "date" => $item->date,
-            "appid" => $item->appid,
-            "nickname" => $item->nickname,
-            "total" => $item->channel_recharge_amount,
-            'recharge_amount_in_30_days' => $item->recharge_amount_in_30_days ? $item->recharge_amount_in_30_days : 0,
-            'recharge_amount_in_60_days' => $item->recharge_amount_in_60_days ? $item->recharge_amount_in_60_days : 0,
-            'recharge_amount_in_90_days' => $item->recharge_amount_in_90_days ? $item->recharge_amount_in_90_days : 0,
-            'new_fans_num' => $item->new_fans_num ? $item->new_fans_num : 0
-        ];
-    }
-}

+ 0 - 42
app/Http/Controllers/Channel/Finance/Transformers/PaymentDetailTransformer.php

@@ -1,42 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class PaymentDetailTransformer
-{
-    public function transform($payment){
-        return [
-            'id'=>$payment->id,
-            'withdraw_cash_id' => $payment->cash_id,
-            'amount' => (float)$payment->amount,
-            'withdraw_cashes_amount' => (float)($payment->withdraw_cashes_amount),
-            'withdraw_cashes_tallage' => (float)($payment->withdraw_cashes_tallage),
-            'pay_time'   =>  date('Y-m-d H:i:s',strtotime($payment->pay_time)),
-            'trade_no' => $payment->trade_no,
-            'pay_merchant_source' => $payment->pay_merchant_source,
-            'status' => $payment->payments_status,
-//            'is_company' => (float) $payment->is_company,
-            'pay_merchant_source_msg' => $payment->pay_merchant_source_msg,
-            'pay_merchant_source_result' => $payment->pay_merchant_source_result,
-//            'channel_id' => $payment->channel_id,
-//            'channel_name' => $payment->channel_name,
-            'status' => $payment->wc_status,
-            'remark' => $payment->remark,
-            'check_user_id' => $payment->check_user_id,
-            'check_user_name' => $payment->check_user_name,
-            'account_name' => $payment->account_name,
-            'identity_card' => $payment->identity_card,
-            'card_number' => $payment->card_number,
-            'account_bank' => $payment->account_bank,
-            'bank' => $payment->bank,
-            'province' => $payment->province
-        ];
-    }
-}

+ 0 - 24
app/Http/Controllers/Channel/Finance/Transformers/PaymentTransformer.php

@@ -1,24 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class PaymentTransformer
-{
-    public function transform($payment){
-        return [
-            'withdraw_cash_id' => $payment->withdraw_cash_id,
-            'amount' =>(float) ($payment->amount),
-            'remark' => $payment->remark,
-            'pay_time'   =>  date('Y-m-d H:i:s',strtotime($payment->pay_time)),
-            'status' => $payment->status,
-//            'is_company' => (float) $payment->is_company,
-        ];
-    }
-}

+ 0 - 40
app/Http/Controllers/Channel/Finance/Transformers/WithdrawCashFinancialTransformer.php

@@ -1,40 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class WithdrawCashFinancialTransformer
-{
-    public function transform($withdrawCash){
-        return [
-            'id' => $withdrawCash->id,
-//            'channel_id' => $withdrawCash->channel_id,
-//            'channel_name' => $withdrawCash->channel_name,
-            'amount' => (float)($withdrawCash->amount),
-            'pay_amount' => (float)($withdrawCash->amount - $withdrawCash->tallage),
-            'status'   =>  $withdrawCash->wc_status,
-            'remark'   =>  $withdrawCash->remark,
-//            'serial_number'   =>  $withdrawCash->serial_number,
-//            'is_company'   =>  (float)$withdrawCash->is_company,
-            'check_user_id'   =>  $withdrawCash->check_user_id,
-            'check_user_name'   =>  $withdrawCash->check_user_name,
-            'account_name' => $withdrawCash->account_name,
-            'identity_card' => $withdrawCash->identity_card,
-            'card_number' => $withdrawCash->card_number,
-            'account_bank' => $withdrawCash->account_bank,
-            'bank' => $withdrawCash->bank,
-            'province' => $withdrawCash->province,
-            'created_time'   =>  date('Y-m-d H:i:s',strtotime($withdrawCash->created_at)),
-            'updated_time'   =>  date('Y-m-d H:i:s',strtotime($withdrawCash->updated_at)),
-            'tallage' => (float)($withdrawCash->tallage),
-            'is_frozen' => $withdrawCash->is_frozen,
-            'fc_remark' => $withdrawCash->fc_remark
-        ];
-    }
-}

+ 0 - 31
app/Http/Controllers/Channel/Finance/Transformers/WithdrawCashTransformer.php

@@ -1,31 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Channel\Finance\Transformers;
-
-
-class WithdrawCashTransformer
-{
-    public function transform($withdrawCash){
-        return [
-//            'channel_id' => $withdrawCash->distribution_channel_id,
-//            'channel_name' => $withdrawCash->distribution_channel_name,
-            'amount' => (float)($withdrawCash->amount),
-            'pay_amount' => (float)($withdrawCash->amount - $withdrawCash->tallage),
-            'tallage' => (float)($withdrawCash->tallage),
-            'status'   =>  $withdrawCash->status,
-            'remark'   =>  $withdrawCash->remark,
-//            'serial_number'   =>  $withdrawCash->serial_number,
-//            'is_company'   =>  (float)$withdrawCash->is_company,
-            'check_user_id'   =>  $withdrawCash->check_user_id,
-            'check_user_name'   =>  $withdrawCash->check_user_name,
-            'created_time'   =>  date('Y-m-d H:i:s',strtotime($withdrawCash->created_at)),
-            'updated_time'   =>  date('Y-m-d H:i:s',strtotime($withdrawCash->updated_at)),
-        ];
-    }
-}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 495
app/Http/Controllers/Channel/Finance/WithdrawCashController.php


+ 0 - 45
app/Http/Controllers/Channel/Notice/NoticeTypesController.php

@@ -1,45 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Notice;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Notice\Transformers\NoticeTypeTransformer;
-use App\Modules\Notice\Services\NoticeService;
-use Illuminate\Http\Request;
-
-class NoticeTypesController extends BaseController
-{
-    /**
-     * @apiDefine Notice 公告
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取公告分类列表
-     * @api {GET} noticeTypes 获取公告分类列表
-     * @apiGroup Notice
-     * @apiName noticeTypes
-     * @apiSuccess {Number}  id 公告分类id.
-     * @apiSuccess {String}  name 分类名称.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         [
-     *             {
-     *                 "id": 121,
-     *                 "name": "教程",
-     *             }
-     *         ]
-     *     }
-     */
-    function get_list(Request $request)
-    {
-        $notic_types = NoticeService::getAllNoticeTypeList();
-
-        return response()->collection(new NoticeTypeTransformer(),$notic_types);
-    }
-    
-}

+ 0 - 152
app/Http/Controllers/Channel/Notice/NoticesController.php

@@ -1,152 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Notice;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Notice\Transformers\NoticeTransformer;
-use App\Http\Controllers\Channel\Notice\Transformers\SimpleNoticeTransformer;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Notice\Services\fansLimitNoticeService;
-use App\Modules\Notice\Services\NoticeService;
-use Illuminate\Http\Request;
-
-class NoticesController extends BaseController
-{
-
-    /**
-     * @apiDefine Notice 公告
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取公告列表
-     * @api {GET} notices 获取公告列表
-     * @apiGroup Notice
-     * @apiName notices
-     * @apiParam   {Number}  [notice_type_id] 公告分类id.(可不传,不传获取所有分类公告)
-     * @apiParam   {Number}  [status] 状态.0:正常状态; -1:删除   (可不传,不传获取所有分类公告)
-     * @apiSuccess {Number}  id 公告ID.
-     * @apiSuccess {String}  is_popup 是否弹出. 0:普通;1:弹框;
-     * @apiSuccess {String}  title 标题.
-     * @apiSuccess {String}  content 内容.
-     * @apiSuccess {status}  status 状态.0:正常状态; -1:删除
-     * @apiSuccess {String}  updated_time 更新时间.
-     * @apiSuccess {String}  type_name 类型名称
-     * @apiSuccess {Number}  type_id 类型ID
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *             "list":[
-     *                 {
-     *                     "id": "121",
-     *                     "is_popup": "1",
-     *                     "title": "1212-12-12-12",
-     *                     "content": "对不起,我爱你",
-     *                     "status": 0,
-     *                     "updated_time": "2017-12-12 12:12:12"
-     *                     "type_name": "测试类型",
-     *                     "type_id": 1
-     *                 }
-     *             ],
-     *             "meta":{
-     *                 "total"=>224,
-     *                 "per_page"=>15,
-     *                 "current_page"=>1,
-     *                 "last_page"=>15,
-     *                 "next_page_url"=>"",
-     *                 "prev_page_url"=>""
-     *             }
-     *         }
-     *     }
-     */
-    function get_list(Request $request)
-    {
-        $notice_type_id = $request->has('notice_type_id') && $request->input('notice_type_id') ? $request->input('notice_type_id') : null;
-        $status = $request->has('status') && $request->input('status') ? $request->input('status') : null;
-        $status = 0;
-
-        $notices = NoticeService::getAllNoticeList($notice_type_id, $status);
-        return response()->pagination(new NoticeTransformer(), $notices);
-    }
-
-    //获取简易的通知列表
-    function get_simple_list(Request $request)
-    {
-        $notice_type_id = $request->has('notice_type_id') && $request->input('notice_type_id') ? $request->input('notice_type_id') : null;
-        $status = $request->has('status') && $request->input('status') ? $request->input('status') : null;
-        $status = 0;
-
-        $notices = NoticeService::getSimpleNoticeList($notice_type_id, $status);
-        return response()->pagination(new SimpleNoticeTransformer(), $notices);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取一个公告
-     * @api {get} getNotice 获取一个公告
-     * @apiGroup Notice
-     * @apiName getNotice
-     * @apiParam   {Number}  id 公告ID.
-     * @apiSuccess {String}  is_popup 是否弹出. 0:普通;1:弹框;
-     * @apiSuccess {String}  title 标题.
-     * @apiSuccess {String}  content 内容.
-     * @apiSuccess {status}  status 状态.0:正常状态; -1:删除
-     * @apiSuccess {String}  updated_time 更新时间.
-     * @apiSuccess {String}  type_name 类型名称
-     * @apiSuccess {Number}  type_id 类型ID
-     * @apiSuccessExample {json} Success-Response:
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                     "id": "121",
-     *                     "is_popup": "1",
-     *                     "title": "1212-12-12-12",
-     *                     "content": "对不起,我爱你",
-     *                     "status": 0,
-     *                     "updated_time": "2017-12-12 12:12:12"
-     *                     "type_name": "测试类型",
-     *                     "type_id": 1
-     *                 }
-     *     }
-     */
-    function get_notice(Request $request) {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if(!is_numeric($id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $notice = NoticeService::getNotice($id);
-        if(empty($notice)) {
-            return response()->error("PARAM_ERROR");
-        }
-        return response()->item(new NoticeTransformer(), $notice);
-    }
-
-    public function getfansLimitNotice(){
-        $channel_user_id = $this->getChannelUserId();
-        if(!$channel_user_id) return response()->error('PARAM_ERROR');
-        $distribution_channel_ids = ChannelService::getUserChannelIds($channel_user_id);
-        $notice = fansLimitNoticeService::getAllOfficialAccountsLimit($distribution_channel_ids);
-        $data=[];
-        if(!$notice->isEmpty()){
-            $official_accounts = [];
-            foreach ($notice as $item){
-                $official_accounts[] = $item->account_nickname;
-                $item->is_read=1;
-                $item->save();
-            }
-            $official_accounts = implode(',',$official_accounts);
-            $data = [
-                'title'=>'阈值提醒',
-                'contents'=>"站点服务号{$official_accounts}今日增粉阈值0,请关注服务号解封情况!
-解封后请前往系统设置-服务号设置-编辑,调高日关注上限!"
-            ];
-            return response()->success($data);
-        }
-        return response()->success($data);
-    }
-}

+ 0 - 19
app/Http/Controllers/Channel/Notice/Transformers/NoticeTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Notice\Transformers;
-
-class NoticeTransformer
-{
-    public function transform($notice){
-        return [
-            'id'   =>  $notice->id,
-            'title'   =>  $notice->title,
-            'content'   =>  $notice->content,
-            'is_popup'   =>  $notice->is_popup,
-            'status'   =>  $notice->status,
-            'updated_time'   => date("Y-m-d H:i:s",strtotime($notice->updated_at)),
-            'type_name'   =>  $notice->type_name,
-            'type_id'   =>  $notice->type_id
-        ];
-    }
-}

+ 0 - 13
app/Http/Controllers/Channel/Notice/Transformers/NoticeTypeTransformer.php

@@ -1,13 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Notice\Transformers;
-
-class NoticeTypeTransformer
-{
-    public function transform($noticeType){
-        return [
-            'id'       =>  $noticeType->id,
-            'name'   =>  $noticeType->name,
-        ];
-    }
-}

+ 0 - 18
app/Http/Controllers/Channel/Notice/Transformers/SimpleNoticeTransformer.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Notice\Transformers;
-
-class SimpleNoticeTransformer
-{
-    public function transform($notice){
-        return [
-            'id'   =>  $notice->id,
-            'title'   =>  $notice->title,
-            'is_popup'   =>  $notice->is_popup,
-            'status'   =>  $notice->status,
-            'updated_time'   => date("Y-m-d H:i:s",strtotime($notice->updated_at)),
-            'type_name'   =>  $notice->type_name,
-            'type_id'   =>  $notice->type_id
-        ];
-    }
-}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1318
app/Http/Controllers/Channel/OfficialAccount/CustomMsgController.php


+ 0 - 191
app/Http/Controllers/Channel/OfficialAccount/CustomSendStatsController.php

@@ -1,191 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount;
-
-use App\Modules\OfficialAccount\Models\CustomMsgSwitchs;
-
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-use App\Modules\OfficialAccount\Services\CustomSendStatsService;
-use App\Http\Controllers\Channel\OfficialAccount\Transformers\CustomSendStatsTransformers;
-use Illuminate\Http\Request;
-
-class CustomSendStatsController extends ChannelBaseController
-{
-
-     /**
-     * @apiDefine OfficialAccount 公众号
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/customSendDayStatsByChannelAndFrom 获取每日智能推送分析数据
-     * @apiGroup OfficialAccount
-     * @apiName customSendDayStatsByChannelAndFrom
-     * @apiParam   {String}  from 智能分析类型  not_pay未支付提醒   recovery_push三天回本   hot_push热门推送   point_push书籍推荐.
-     * @apiSuccess {String}  distribution_channel_id 渠道号.
-     * @apiSuccess {String}  date 日期.
-     * @apiSuccess {String}  push_user_num 推送次数.
-     * @apiSuccess {String}  click_num 点击次数.
-     * @apiSuccess {String}  amount 充值金额.
-     * @apiSuccess {String}  success_pay_num 充值笔数.
-     * @apiSuccess {String}  success_pay_rate 充值率.
-     * @apiSuccess {String}  click_rate 点击率.
-     * @apiSuccess {String}  from 智能分析类型  not_pay未支付提醒   recovery_push三天回本   hot_push热门推送   point_push书籍推荐..
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *      {
-     *          "code": 0,
-     *          "msg": "",
-     *          "data": {
-     *              "list": [
-     *                  {
-     *                      "id": 1,
-     *                      "distribution_channel_id": 2,
-     *                      "date": "2018-01-17",
-     *                      "push_user_num": 1211,
-     *                      "click_num": 211,
-     *                      "click_rate": 0.000,
-     *                      "amount": "2312.00",
-     *                      "success_pay_num": 123,
-     *                      "success_pay_rate": "0.5100",
-     *                      "from": "not_pay"
-     *                  },
-     *                  {
-     *                      "id": 2,
-     *                      "distribution_channel_id": 2,
-     *                      "date": "2018-01-16",
-     *                      "push_user_num": 1312,
-     *                      "click_num": 421,
-     *                      "click_rate": 0.000,
-     *                      "amount": "16421.00",
-     *                      "success_pay_num": 3212,
-     *                      "success_pay_rate": "0.2100",
-     *                      "from": "not_pay"
-     *                  }
-     *              ],
-     *              "meta": {
-     *                  "total": 2,
-     *                  "per_page": 15,
-     *                  "current_page": 1,
-     *                  "last_page": 1,
-     *                  "next_page_url": "",
-     *                  "prev_page_url": ""
-     *              }
-     *          }
-     *      }   
-     */
-    function  customSendDayStatsByChannelAndFrom(Request $request) {
-
-
-        $distribution_channel_id = $this->getChannelId();
-
-        $from = $request->has('from') ? $request->input('from') : '';
-        if(empty($from)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        \Log::info('日推送智能分析 渠道ID:'.$distribution_channel_id);
-        \Log::info('日推送智能分析 类型:'.$from);
-
-        $customMsgService = CustomSendStatsService::customSendDayStatsByChannelAndFrom($distribution_channel_id,$from);
-
-        if (!empty($customMsgService)) {
-            
-            return response()->pagination(new CustomSendStatsTransformers(), $customMsgService);
-        }else{
-
-            $customMsgService['distribution_channel_id'] = $distribution_channel_id;
-            $customMsgService['date'] = date("Y-m-d");
-            $customMsgService['push_user_num'] = 0;
-            $customMsgService['click_num'] = 0;
-            $customMsgService['amount'] = 0;
-            $customMsgService['success_pay_num'] = 0;
-            $customMsgService['success_pay_rate'] = 0;
-            $customMsgService['click_rate'] = 0;
-            $customMsgService['from'] = $from;
-            return response()->item(new CustomSendStatsTransformers(), $customMsgService);
-        }
-        
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/customSendStatsByChannelAndFrom 获取智能推送分析总数据
-     * @apiGroup OfficialAccount
-     * @apiName customSendStatsByChannelAndFrom
-     * @apiParam   {String}  from 智能分析类型  not_pay未支付提醒   recovery_push三天回本   hot_push热门推送   point_push书籍推荐.
-     * @apiSuccess {String}  distribution_channel_id 渠道号.
-     * @apiSuccess {String}  date 日期.
-     * @apiSuccess {String}  push_user_num 推送次数.
-     * @apiSuccess {String}  click_num 点击次数.
-     * @apiSuccess {String}  amount 充值金额.
-     * @apiSuccess {String}  success_pay_num 充值笔数.
-     * @apiSuccess {String}  success_pay_rate 充值率.
-     * @apiSuccess {String}  click_rate 点击率.
-     * @apiSuccess {String}  from 智能分析类型  not_pay未支付提醒   recovery_push三天回本   hot_push热门推送   point_push书籍推荐..
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *      {
-     *          "code": 0,
-     *          "msg": "",
-     *          "data": {
-     *              "id": 1,
-     *              "distribution_channel_id": 2,
-     *              "date": "2018-01-18",
-     *              "push_user_num": 4123,
-     *              "click_num": 543,
-     *              "amount": "123141.00",
-     *              "success_pay_num": 2132,
-     *              "success_pay_rate": "0.3100",
-     *              "click_rate": "0.0000",
-     *              "from": "not_pay"
-     *          }
-     *      }  
-     */
-    function  customSendStatsByChannelAndFrom(Request $request) {
-
-
-        $distribution_channel_id = $this->getChannelId();
-
-        $from = $request->has('from') ? $request->input('from') : '';
-        if(empty($from)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        \Log::info('日推送智能分析 渠道ID:'.$distribution_channel_id);
-        \Log::info('日推送智能分析 类型:'.$from);
-
-        $customMsgService = CustomSendStatsService::customSendStatsByChannelAndFrom($distribution_channel_id,$from);
-
-        if (!empty($customMsgService)) {
-            
-            return response()->item(new CustomSendStatsTransformers(), $customMsgService);
-        }else{
-
-            $customMsgService['distribution_channel_id'] = $distribution_channel_id;
-            $customMsgService['date'] = date("Y-m-d");
-            $customMsgService['push_user_num'] = 0;
-            $customMsgService['click_num'] = 0;
-            $customMsgService['amount'] = 0;
-            $customMsgService['success_pay_num'] = 0;
-            $customMsgService['success_pay_rate'] = 0;
-            $customMsgService['click_rate'] = 0;
-            $customMsgService['from'] = $from;
-            return response()->item(new CustomSendStatsTransformers(), $customMsgService);
-        }
-        
-    }
-    
-    /**
-     * 获取智能推送列表
-     * @param Request $request
-     */
-    function  customSendStatsFromTypes(Request $request) {
-    	$customMsgSwitchs = CustomMsgSwitchs::getCustomMsgSwitchs();
-
-    	return response()->success($customMsgSwitchs);
-    }
-    
-}

+ 0 - 165
app/Http/Controllers/Channel/OfficialAccount/DistributionSelfDefineContentsController.php

@@ -1,165 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-
-use App\Http\Controllers\Channel\OfficialAccount\Transformers\SmartPushMsgTransformer;
-use Illuminate\Http\Request;
-use GuzzleHttp\Client;
-use App\Modules\OfficialAccount\Services\MsgService;
-use App\Modules\Statistic\Services\SendStatistics;
-
-/**
- * 关注回复
- */
-class DistributionSelfDefineContentsController extends ChannelBaseController
-{
-
-    /**
-     * @apiDefine OfficialAccount 公众号
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} distribution_self_define_contents 获取关注回复
-     * @apiGroup OfficialAccount
-     * @apiName distribution_self_define_contents
-     * @apiParam   {String}  distribution_channel_id 渠道ID.
-     */
-
-    function getSubReply(Request $request)
-    {
-
-        $distribution_channel_id = $this->getChannelId();
-
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $sub_reply = MsgService::getReply($distribution_channel_id);
-
-        $data = [];
-        $list = [];
-        $data['mode'] = 1;
-
-        if($sub_reply)
-        {
-            isset($sub_reply['current']) && $data['mode'] = $sub_reply['current'];
-            if(isset($sub_reply[2]))//有设置图文
-            {
-                $list[] = [
-                    'content'=>json_decode($sub_reply[2]),
-                    'is_pic'=>1,
-                    'status'=>$data['mode'] == 2 ? 1 : 0
-                ];
-            }
-
-            if(isset($sub_reply[3]))//有设置文本
-            {
-                $list[] = [
-                    'content'=>$sub_reply[3],
-                    'is_pic'=>0,
-                    'status'=>$data['mode'] == 3 ? 1 : 0
-                ];
-            }
-        }
-
-        $data['list'] = $list;
-        return response()->success($data);
-    }
-    
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} distribution_self_define_contents 获取关注回复列表
-     * @apiGroup OfficialAccount
-     * @apiName distribution_self_define_contents
-     * @apiParam   {String}  distribution_channel_id 渠道ID.
-     */
-    
-    function getSubReplyList(Request $request)
-    {
-    
-    	$distribution_channel_id = $this->getChannelId();
-    
-    	if(empty($distribution_channel_id)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    
-    	$sub_reply = MsgService::getReply($distribution_channel_id);
-    	if(!isset($sub_reply['content_mode_2'])){
-    		$sub_reply['content_mode_2'] = '';
-    	}
-    	if(!isset($sub_reply['content_mode_3'])){
-    		$sub_reply['content_mode_3'] = '';
-    	}
-    	if(!isset($sub_reply['current'])){
-    		$sub_reply['current'] = '1';
-    	}
-//     	$pic_list = isset($sub_reply['content_mode_2'])?$sub_reply['content_mode_2']:'';
-//     	$pic_list = object_to_array(json_decode($pic_list));
-//     	$text_list = isset($sub_reply['content_mode_3'])?$sub_reply['content_mode_3']:'';
-//     	$text_list = object_to_array(json_decode($text_list));
-//     	$mode = isset($sub_reply['current'])?$sub_reply['current']:'1';
-//     	\Log::info('pic_list');\Log::info($pic_list);
-//     	\Log::info('text_list');\Log::info($text_list);
-//     	$data = [
-//     	   'pic_list'=>$pic_list,
-//     	   'text_list'=>$text_list,
-//     	   'mode'=>$mode,
-//     	];
-    	return response()->success($sub_reply);
-    }
-    
-    function getCurrentReply(Request $request)
-    {
-    
-    	$distribution_channel_id = $this->getChannelId();
-    
-    	if(empty($distribution_channel_id)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    
-    	$sub_reply = MsgService::getCurrentReply($distribution_channel_id);
-    	$sub_reply = object_to_array($sub_reply);
-    	return response()->success($sub_reply);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} distribution_self_define_contents 设置关注回复
-     * @apiGroup OfficialAccount
-     * @apiName set_distribution_self_define_contents
-     * @apiParam   {String}  distribution_channel_id 渠道ID.
-     */
-
-    function setSubReply(Request $request)
-    {
-
-        $distribution_channel_id = $this->getChannelId();
-        $mode = $request->has('mode') ? (int)$request->input('mode') : 1;
-        $is_pic = $request->has('is_pic') ? (int)$request->input('is_pic') : 0;
-        $start_time = $request->has('start_time') ?$request->input('start_time') : '2018-01-01';
-        $end_time = $request->has('end_time') ? $request->input('end_time') : '2030-01-01';
-        $content = $request->has('content') ? $request->input('content') : '';
-        $key = $request->has('key') ? $request->input('key') : '0';
-        $action = $request->has('action') ? $request->input('action') : 'update';
-        $status = $request->has('status') ? (int)$request->input('status') : 1;
-        $is_pic && $content = json_encode($content);
-
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        
-        \Log::info('setSubReply');\Log::info($content);
-        if(strpos($content,'w.url.cn') > -1){
-        	\Log::info('setSubReply_url_false');
-        	return response()->error("SHORT_URL_NOT_ALLOW_ERROR");
-        }
-
-        $sub_reply = MsgService::setReply(compact('distribution_channel_id','is_pic','content','mode','start_time','end_time','key','action','status'));
-        return response()->success();
-    }
-
-
-}

+ 0 - 284
app/Http/Controllers/Channel/OfficialAccount/OfficialAccountsController.php

@@ -1,284 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-use App\Modules\OfficialAccount\Services\OfficialAccountService;
-use App\Http\Controllers\Channel\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/officialAccountAuthUrl 获取服务号授权URL
-     * @apiGroup OfficialAccount
-     * @apiName officialAccountAuthUrl
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *       {
-     *           "code": 0,
-     *           "msg": "",
-     *           "data": []
-     *       } 
-     */
-    function  officialAccountAuthUrl(Request $request) {
-
-        // $base_url = 'http://auth.aizhuishu.com/oauth_platform?';
-
-        // $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        // if(empty($distribution_channel_id)) {
-        //     return response()->error("PARAM_EMPTY");
-        // }
-        $distribution_channel_id = $this->getChannelId();
-
-        $officialAccount['distribution_channel_id'] = $distribution_channel_id;
-
-        $url = OfficialAccountService::officialAccountAuthUrl($officialAccount);
-
-        return response()->success(compact('url'));
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/allOfficialAccountBydistributionChannelId 根据分销渠道号获取服务号列表
-     * @apiGroup OfficialAccount
-     * @apiName allOfficialAccountBydistributionChannelId
-     * @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 是否可用.
-     * @apiSuccess {Number}  force_subscribe_type 强关类型 1默认强关2弱关注3链接强关
-     * @apiSuccess {Number}  resource_url .链接强关的地址
-     * @apiSuccess {Number}  force_subscribe_type_text .强关类型文本
-     * @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");
-        // }
-        $distribution_channel_id = $this->getChannelId();
-
-        \Log::info('-------------------获取当前渠道下的所有服务号-----------------------------------');
-        \Log::info($distribution_channel_id);
-
-        $officialAccount['distribution_channel_id'] = $distribution_channel_id;
-
-        $officialAccountService = OfficialAccountService::allOfficialAccountBydistributionChannelId($officialAccount);
-        foreach ($officialAccountService as &$v){
-            if(!$v->force_subscribe_type){
-                $v->force_subscribe_type = ["1"];
-                $v->force_subscribe_type_text = '强制关注';
-            }else{
-                $v->force_subscribe_type_text = str_replace([1,2,3],['强制关注','主动关注','强制链接关注'],$v->force_subscribe_type);
-                $type_arr = explode(',',$v->force_subscribe_type);
-                $v->force_subscribe_type = $type_arr;
-            }
-
-        }
-        return response()->collection(new OfficialAccountTransformer(), $officialAccountService);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/officialAccountById 通过Id获取要编辑的公众号
-     * @apiGroup OfficialAccount
-     * @apiName officialAccountById
-     * @apiParam   {String}  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 officialAccountById(Request $request)
-    {
-
-        $id = $request->has('id') ? $request->input('id') : '';
-
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $officialAccount['id'] = $id;
-        $officialAccountService = OfficialAccountService::officialAccountById($officialAccount);
-        return response()->item(new OfficialAccountTransformer(), $officialAccountService);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} OfficialAccount/updateOfficialAccount 修改公众号信息
-     * @apiGroup OfficialAccount
-     * @apiName updateOfficialAccount
-     * @apiParam {String}  id 微信公众号ID.
-     * @apiParam {String}  subscribe_top_num 总阀值.
-     * @apiParam {String}  subscribe_day_maximum 日上线.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *       {
-     *           "code": 0,
-     *           "msg": "",
-     *           "data": []
-     *       }       
-     */
-    function updateOfficialAccount(Request $request) {
-
-        $id = $request->has('id') ? $request->input('id') : '';
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        //$appsecret = $request->has('appsecret') ? $request->input('appsecret') : '';
-
-        $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') : '';
-        
-        $sort_no = $request->has('sort_no') ? $request->input('sort_no') : '0';
-        
-        $officialAccount['id'] = $id;
-        //$officialAccount['appsecret'] = $appsecret;
-        $officialAccount['subscribe_top_num'] = $subscribe_top_num;
-        $officialAccount['subscribe_day_maximum'] = $subscribe_day_maximum;
-        $officialAccount['sort_no'] = $sort_no;
-        \Log::info($officialAccount);
-
-        $resultStatus = OfficialAccountService::updateOfficialAccountTopNum($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');
-        }
-        
-        
-    }
-    
-    function getShortUrl(Request $request) {
-    	\Log::info('getShortUrl');
-    	$url = $request->has('url') ? $request->input('url') : '';
-    	if(empty($url)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    	$distribution_channel_id = $this->getChannelId();
-    
-    	$result = OfficialAccountService::get_short_url($distribution_channel_id,$url);
-    	if ($result['code'] == 1 && !empty($result['url'])) {
-    		return response()->success($result['url']);
-    	}else{
-    		return response()->success($result['msg']);
-    	}
-    
-    }
-    
-}

+ 0 - 270
app/Http/Controllers/Channel/OfficialAccount/SmartPushsController.php

@@ -1,270 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-
-use App\Http\Controllers\Channel\OfficialAccount\Transformers\SmartPushMsgTransformer;
-use Illuminate\Http\Request;
-use GuzzleHttp\Client;
-use App\Modules\OfficialAccount\Services\SmartPushMsgService;
-use App\Modules\Statistic\Services\SendStatistics;
-
-/**
- * 智能推送
- * @author zhoulingjie
- *
- */
-class SmartPushsController extends ChannelBaseController
-{
-
-    /**
-     * @apiDefine OfficialAccount 公众号
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/smartPushMsgById 通过id获取自定义智能推荐内容
-     * @apiGroup OfficialAccount
-     * @apiName smartPushMsgById
-     * @apiParam   {String}  id 关键字信息id.
-     */
-
-    function smartPushMsgById(Request $request)
-    {
-
-        $id = $request->has('id') ? $request->input('id') : '';
-
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $smartPushMsg['id'] = $id;
-
-        $smartPushMsgService = SmartPushMsgService::smartPushMsgById($smartPushMsg);
-
-        return response()->item(new SmartPushMsgTransformer(), $smartPushMsgService);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/smartPushByDistributionChannelIdAndCategorySex 获取自定义智能推送内容
-     * @apiGroup OfficialAccount
-     * @apiName smartPushByDistributionChannelIdAndCategorySex
-     * @apiParam   {String}  category_type 类别.
-     * @apiParam   {String}  sex 性别.
-     */
-
-    function smartPushByDistributionChannelIdAndCategorySex(Request $request)
-    {
-
-        $distribution_channel_id = $this->getChannelId();
-        $category_type = $request->has('category_type') ? $request->input('category_type') : '';
-        if(empty($category_type)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $sex = $request->has('sex') ? $request->input('sex') : '';
-        if(empty($sex)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $smartPushsMsg = array();
-        $smartPushsMsg['distribution_channel_id'] = $distribution_channel_id;
-        $smartPushsMsg['category_type'] = $category_type;
-        $smartPushsMsg['sex'] = $sex;
-
-        $smartPushsMsgService = SmartPushMsgService::smartPushByDistributionChannelIdAndCategorySex($smartPushsMsg);
-        if($smartPushsMsgService->description){
-        	$smartPushsMsgService->description = json_decode($smartPushsMsgService->description);
-        }
-        return response()->item(new SmartPushMsgTransformer(), $smartPushsMsgService);
-    }
-    
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/checkSexAllEdit 检测是否男女都编辑过了
-     * @apiGroup OfficialAccount
-     * @apiName checkSexAllEdit
-     * @apiParam   {String}  category_type 类别.
-     */
-    
-    function checkSexAllEdit(Request $request)
-    {
-    
-    	$distribution_channel_id = $this->getChannelId();
-    	$category_type = $request->has('category_type') ? $request->input('category_type') : '';
-    	if(empty($category_type)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    
-    	$smartPushsMsg = array();
-    	$smartPushsMsg['distribution_channel_id'] = $distribution_channel_id;
-    	$smartPushsMsg['category_type'] = $category_type;
-    
-    	$resultStatus = SmartPushMsgService::checkSexAllEdit($smartPushsMsg);
-    	if ($resultStatus == 1) {
-    		return response()->success();
-    	}else {
-    		return response()->error('SMART_PUSHS_NOT_ALL_EDIT');
-    	}
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} OfficialAccount/addSmartPushMsg 添加自定义智能推送
-     * @apiGroup OfficialAccount
-     * @apiName addSmartPushMsg
-     * @apiParam   {String}  name 标题.
-     * @apiParam   {String}  category_type 分类.
-     * @apiParam   {String}  content 内容.
-     * @apiParam   {String}  sex 性别 男:a  女:b.
-     */
-
-    function addSmartPushMsg(Request $request)
-    {
-    	\Log::info('addSmartPushMsg_start');
-    	\Log::info($request->all());
-
-        $name = $request->has('name') ? $request->input('name') : '';
-        if(empty($name)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $category_type = $request->has('category_type') ? $request->input('category_type') : '';
-        if(empty($category_type)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $content = $request->has('content') ? $request->input('content') : '';
-        if(empty($content)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $sex = $request->has('sex') ? $request->input('sex') : '';
-        if(empty($sex)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        $description = $request->has('description') ? $request->input('description') : '';
-        $book_name = $request->has('book_name') ? $request->input('book_name') : '';
-        if(empty($book_name)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        $chapter_name = $request->has('chapter_name') ? $request->input('chapter_name') : '';
-        if(empty($chapter_name)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $distribution_channel_id = $this->getChannelId();
-
-        $smartPushMsgs['name'] = $name;
-        $smartPushMsgs['category_type'] = $category_type;
-        $smartPushMsgs['content'] = json_encode($content);
-        $smartPushMsgs['description'] = json_encode($description);
-        $smartPushMsgs['book_name'] = $book_name;
-        $smartPushMsgs['chapter_name'] = $chapter_name;
-        $smartPushMsgs['sex'] = $sex;
-        $smartPushMsgs['distribution_channel_id'] = $distribution_channel_id;
-        $smartPushMsgs['status'] = 1;
-        
-        $resultStatus = SmartPushMsgService::addSmartPushMsg($smartPushMsgs);
-
-        if ($resultStatus == 1) {
-            return response()->success();
-        }elseif ($resultStatus == 2) {
-            return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-        }elseif ($resultStatus == 3) {
-            return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-        }
-        elseif ($resultStatus == 0) {
-            return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-        }else{
-            return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-        }
-
-    }
-    
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} OfficialAccount/updateSmartPushMsg 更新自定义智能推送
-     * @apiGroup OfficialAccount
-     * @apiName updateSmartPushMsg
-     * @apiParam   {String}  id 主键.
-     * @apiParam   {String}  name 标题.
-     * @apiParam   {String}  category_type 分类.
-     * @apiParam   {String}  content 内容.
-     * @apiParam   {String}  sex 性别 男:a  女:b.
-     */
-    
-    function updateSmartPushMsg(Request $request)
-    {
-    	\Log::info('updateSmartPushMsg_start');
-    	\Log::info($request->all());
-    
-    	$id = $request->has('id') ? $request->input('id') : '';
-    	if(empty($id)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    	
-    	$name = $request->has('name') ? $request->input('name') : '';
-    	if(empty($name)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    
-    	$category_type = $request->has('category_type') ? $request->input('category_type') : '';
-    	if(empty($category_type)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    
-    	$content = $request->has('content') ? $request->input('content') : '';
-    	if(empty($content)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    
-    	$sex = $request->has('sex') ? $request->input('sex') : '';
-    	if(empty($sex)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    	$description = $request->has('description') ? $request->input('description') : '';
-    	$book_name = $request->has('book_name') ? $request->input('book_name') : '';
-    	if(empty($book_name)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    	$chapter_name = $request->has('chapter_name') ? $request->input('chapter_name') : '';
-    	if(empty($chapter_name)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    	
-    	$distribution_channel_id = $this->getChannelId();
-    
-    	$smartPushMsgs['id'] = $id;
-    	$smartPushMsgs['name'] = $name;
-    	$smartPushMsgs['category_type'] = $category_type;
-    	$smartPushMsgs['content'] = json_encode($content);
-    	$smartPushMsgs['description'] = json_encode($description);
-    	$smartPushMsgs['book_name'] = $book_name;
-    	$smartPushMsgs['chapter_name'] = $chapter_name;
-    	$smartPushMsgs['sex'] = $sex;
-    	$smartPushMsgs['distribution_channel_id'] = $distribution_channel_id;
-    	$smartPushMsgs['status'] = 1;
-    
-    	$resultStatus = SmartPushMsgService::updateSmartPushMsg($smartPushMsgs);
-    
-    	if ($resultStatus == 1) {
-    		return response()->success();
-    	}elseif ($resultStatus == 2) {
-    		return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-    	}elseif ($resultStatus == 3) {
-    		return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-    	}
-    	elseif ($resultStatus == 0) {
-    		return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-    	}else{
-    		return response()->error('SMART_PUSHS_UNSUCCESSFUL');
-    	}
-    
-    }
-
-}

+ 0 - 14
app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomMsgControllerTransformer.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class CustomMsgControllerTransformer
-{
-    public function transform($customMsg){
-        return [
-            // 'id'       =>  isset($customMsg->id) ? $customMsg->id : "",
-            // 'distribution_channel_id'       =>  isset($customMsg->distribution_channel_id) ? $customMsg->distribution_channel_id : "",
-            'customer_img_url'       =>  isset($customMsg->customer_img_url) ? $customMsg->customer_img_url : "",
-        ];
-    }
-}

+ 0 - 20
app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomMsgSwitchMultyTransformer.php

@@ -1,20 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class CustomMsgSwitchMultyTransformer
-{
-    public function transform($customMsgSwitchMsgs){
-        return [
-            'title'       =>  isset($customMsgSwitchMsgs['title']) ? $customMsgSwitchMsgs['title'] : "",
-            'custom_category'       =>  isset($customMsgSwitchMsgs['custom_category']) ? $customMsgSwitchMsgs['custom_category'] : "",
-            'status'       =>  isset($customMsgSwitchMsgs['status']) ? $customMsgSwitchMsgs['status'] : "",
-            'distribution_channel_id'       =>  isset($customMsgSwitchMsgs['distribution_channel_id']) ? $customMsgSwitchMsgs['distribution_channel_id'] : "",
-            'id'       =>  isset($customMsgSwitchMsgs['id']) ? $customMsgSwitchMsgs['id'] : "",
-            'desc_content'       =>  isset($customMsgSwitchMsgs['desc_content']) ? $customMsgSwitchMsgs['desc_content'] : "",
-            'img_url'       =>  isset($customMsgSwitchMsgs['img_url']) ? $customMsgSwitchMsgs['img_url'] : "",
-            'common_is_self_content'       =>  isset($customMsgSwitchMsgs['common_is_self_content']) ? $customMsgSwitchMsgs['common_is_self_content'] : "0",
-            'is_self_content'       =>  isset($customMsgSwitchMsgs['is_self_content']) ? $customMsgSwitchMsgs['is_self_content'] : "0",
-        ];
-    }
-}

+ 0 - 17
app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomMsgSwitchTransformer.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class CustomMsgSwitchTransformer
-{
-    public function transform($customMsgSwitchMsgs){
-        return [
-
-            'title'       =>  isset($customMsgSwitchMsgs->customMsgSwitchs->title) ? $customMsgSwitchMsgs->customMsgSwitchs->title : "",
-            'custom_category'       =>  isset($customMsgSwitchMsgs->custom_category) ? $customMsgSwitchMsgs->custom_category : "",
-            'status'       =>  isset($customMsgSwitchMsgs->status) ? $customMsgSwitchMsgs->status : "",
-            'distribution_channel_id'       =>  isset($customMsgSwitchMsgs->distribution_channel_id) ? $customMsgSwitchMsgs->distribution_channel_id : "",
-            'id'       =>  isset($customMsgSwitchMsgs->id) ? $customMsgSwitchMsgs->id : "",
-        ];
-    }
-}

+ 0 - 36
app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomSendMsgsTransformers.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class CustomSendMsgsTransformers
-{
-    public function transform($customSendMsgs){
-        return [
-            'id'       =>  $customSendMsgs->id,
-            'appid'       =>  $customSendMsgs->appid,
-            'name'       =>  $customSendMsgs->name,
-            'send_time'       =>  $customSendMsgs->send_time,
-            'content'       =>  $customSendMsgs->content,
-            'description'       =>  isset($customSendMsgs->description)?$customSendMsgs->description:'',
-            'is_activity'       =>  isset($customSendMsgs->is_activity)?$customSendMsgs->is_activity:'0',
-            'redirect_url'       =>  $customSendMsgs->redirect_url,
-            'status'       =>  $customSendMsgs->status,
-            'distribution_channel_id'       =>  $customSendMsgs->distribution_channel_id,
-            'subscribe_time'       =>  $customSendMsgs->subscribe_time,
-            'sex'       =>  $customSendMsgs->sex,
-            'balance'       =>  $customSendMsgs->balance,
-            'order_type'       =>  $customSendMsgs->order_type,
-            'category_id'       =>  $customSendMsgs->category_id,
-            'is_full_send'       =>  $customSendMsgs->is_full_send,
-            'user_num'       =>  $customSendMsgs->user_num,
-            'uv'       =>  isset($customSendMsgs->uv)?$customSendMsgs->uv:'',
-            'pv'       =>  isset($customSendMsgs->pv)?$customSendMsgs->pv:'',
-            'register_user_num'       =>  isset($customSendMsgs->register_user_num)?$customSendMsgs->register_user_num:'',
-            'pay_user_num'       =>  isset($customSendMsgs->pay_user_num)?$customSendMsgs->pay_user_num:'',
-            'charge_amount'       =>  isset($customSendMsgs->charge_amount)?$customSendMsgs->charge_amount:'',
-            'book_name'       =>  isset($customSendMsgs->book_name)?$customSendMsgs->book_name:'',
-            'chapter_name'       =>  isset($customSendMsgs->chapter_name)?$customSendMsgs->chapter_name:'',
-            'user_category'       =>  isset($customSendMsgs->user_category)?$customSendMsgs->user_category:'',
-        ];
-    }
-}

+ 0 - 21
app/Http/Controllers/Channel/OfficialAccount/Transformers/CustomSendStatsTransformers.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class CustomSendStatsTransformers
-{
-    public function transform($customSendStats){
-        return [
-            'id'       =>  isset($customSendStats->id) ? $customSendStats->id : "",
-            'distribution_channel_id'       =>  isset($customSendStats->distribution_channel_id) ? $customSendStats->distribution_channel_id : "",
-            'date'       =>  isset($customSendStats->date) ? $customSendStats->date : "",
-            'push_user_num'       =>  isset($customSendStats->push_user_num) ? $customSendStats->push_user_num : 0,
-            'click_num'       =>  isset($customSendStats->click_num) ? $customSendStats->click_num : 0,
-            'amount'       =>  isset($customSendStats->amount) ? $customSendStats->amount : 0,
-            'success_pay_num'       =>  isset($customSendStats->success_pay_num) ? $customSendStats->success_pay_num : 0,
-            'success_pay_rate'       =>  isset($customSendStats->success_pay_rate) ? ($customSendStats->success_pay_rate).'%' : 0,
-            'click_rate'       =>  isset($customSendStats->click_rate) ? ($customSendStats->click_rate).'%' : 0,
-            'from'       =>  isset($customSendStats->from) ? $customSendStats->from : "",
-        ];
-    }
-}

+ 0 - 41
app/Http/Controllers/Channel/OfficialAccount/Transformers/OfficialAccountTransformer.php

@@ -1,41 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class OfficialAccountTransformer
-{
-    public function transform($officialAccount)
-    {
-        return [
-            'id' => $officialAccount->id,
-            'name' => $officialAccount->name,
-            'nickname' => $officialAccount->nickname,
-            'alias' => $officialAccount->alias,
-            'head_img' => $officialAccount->head_img,
-            'appid' => $officialAccount->appid,
-            'appsecret' => $officialAccount->appsecret,
-            'verify_txt' => $officialAccount->verify_txt,
-            'is_auth' => $officialAccount->is_auth,
-            'service_type_info' => $officialAccount->service_type_info,
-            'subscribe_top_num' => $officialAccount->subscribe_top_num,
-            'subscribe_day_maximum' => $officialAccount->subscribe_day_maximum,
-            'distribution_channel_id' => $officialAccount->distribution_channel_id,
-            'qrcode_url' => $officialAccount->qrcode_url,
-            'principal_name' => $officialAccount->principal_name,
-            'func_info' => $officialAccount->func_info,
-            'authorizer_refresh_token' => $officialAccount->authorizer_refresh_token,
-            'cancel_auth_time' => $officialAccount->cancel_auth_time,
-            'official_account_type' => $officialAccount->official_account_type,
-            'verify_type_info' => $officialAccount->verify_type_info,
-            'is_enabled' => $officialAccount->is_enabled,
-            'todayForceSubscribeUsers' => $officialAccount->todayForceSubscribeUsers,
-            'allForceSubscribeUsers' => $officialAccount->allForceSubscribeUsers,
-            'sort_no' => isset($officialAccount->sort_no)?$officialAccount->sort_no:'0',
-            //'subscribe_top_num' => $officialAccount->subscribe_top_num,
-            //'subscribe_day_maximum' => $officialAccount->subscribe_day_maximum,
-            'force_subscribe_type' => isset($officialAccount->force_subscribe_type) ? $officialAccount->force_subscribe_type : 1,
-            'resource_url' => isset($officialAccount->resource_url) ? $officialAccount->resource_url : '',
-            'force_subscribe_type_text'=>isset($officialAccount->force_subscribe_type_text)?$officialAccount->force_subscribe_type_text:''
-        ];
-    }
-}

+ 0 - 28
app/Http/Controllers/Channel/OfficialAccount/Transformers/OfficialImgtextUrlsTransformer.php

@@ -1,28 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-
-class OfficialImgtextUrlsTransformer
-{
-    public function transform($officialImgtextUrls){
-        return [
-            'id'       =>  $officialImgtextUrls->id,
-            'img_url'       =>  $officialImgtextUrls->img_url,
-            'created_at'       =>  $officialImgtextUrls->created_at,
-            'content_source_url'       =>  $officialImgtextUrls->content_source_url,
-            'book_name'       =>  $officialImgtextUrls->book_name,
-            'chapter_sequence'       =>  $officialImgtextUrls->chapter_sequence,
-            'title'       =>  $officialImgtextUrls->title,
-            'send_orders_id'       =>  $officialImgtextUrls->send_orders_id,
-            'send_orders_name'       =>  $officialImgtextUrls->send_orders_name,
-            'send_orders_url'       =>  $officialImgtextUrls->send_orders_url,
-            // 'content'       =>  $officialImgtextUrls->content,
-            // 'author'       =>  $officialImgtextUrls->author,
-            // 'digest'       =>  $officialImgtextUrls->digest,
-            // 'gzh_app_id'       =>  $officialImgtextUrls->gzh_app_id,
-            // 'thumb_media_id'       =>  $officialImgtextUrls->thumb_media_id,
-            // 'distribution_channel_id'       =>  $officialImgtextUrls->distribution_channel_id,
-        ];
-    }
-}

+ 0 - 25
app/Http/Controllers/Channel/OfficialAccount/Transformers/SmartPushMsgTransformer.php

@@ -1,25 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class SmartPushMsgTransformer
-{
-    public function transform($smartPushsMsg){
-        return [
-            'id'       =>   isset($smartPushsMsg->id)?$smartPushsMsg->id:'',
-            'distribution_channel_id'       =>   isset($smartPushsMsg->distribution_channel_id)?$smartPushsMsg->distribution_channel_id:'',
-            'name'       =>   isset($smartPushsMsg->name)?$smartPushsMsg->name:'',
-            'category_type'       =>   isset($smartPushsMsg->category_type)?$smartPushsMsg->category_type:'',
-            'content'       =>   isset($smartPushsMsg->content)?$smartPushsMsg->content:'',
-            'description'       =>   isset($smartPushsMsg->description)?$smartPushsMsg->description:'',
-            'book_name'       =>   isset($smartPushsMsg->book_name)?$smartPushsMsg->book_name:'',
-            'chapter_name'       =>   isset($smartPushsMsg->chapter_name)?$smartPushsMsg->chapter_name:'',
-            'sex'       =>   isset($smartPushsMsg->sex)?$smartPushsMsg->sex:'',
-            'appid'       =>  isset($smartPushsMsg->appid)?$smartPushsMsg->appid:'',
-            'status'       =>   isset($smartPushsMsg->status)?$smartPushsMsg->status:'',
-            'user_num'       =>  isset($smartPushsMsg->user_num)?$smartPushsMsg->user_num:'',
-            'created_at'       =>  isset($smartPushsMsg->created_at)?$smartPushsMsg->created_at:'',
-            'updated_at'       =>  isset($smartPushsMsg->updated_at)?$smartPushsMsg->updated_at:'',
-        ];
-    }
-}

+ 0 - 26
app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatKeyWordsMsgTransformer.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class WechatKeyWordsMsgTransformer
-{
-    public function transform($wechatKeywordsMsg){
-        return [
-            'id'       =>  $wechatKeywordsMsg->id,
-            'keyword'       =>  $wechatKeywordsMsg->keyword,
-            'distribution_channel_id'       =>  $wechatKeywordsMsg->distribution_channel_id,
-            'bid'       =>  $wechatKeywordsMsg->bid,
-            'cid'       =>  $wechatKeywordsMsg->cid,
-            'appids'       =>  $wechatKeywordsMsg->appids,
-            'status'       =>  $wechatKeywordsMsg->status,
-            'book_name'       =>  $wechatKeywordsMsg->book_name,
-            'chapter_name'       =>  $wechatKeywordsMsg->chapter_name,
-            'send_title'       =>  isset($wechatKeywordsMsg->send_title)?$wechatKeywordsMsg->send_title:'',
-            'send_cover'       =>  isset($wechatKeywordsMsg->send_cover)?$wechatKeywordsMsg->send_cover:'',
-            'click_num'       =>  isset($wechatKeywordsMsg->click_num)?$wechatKeywordsMsg->click_num:'0',
-            'uv'       =>  isset($wechatKeywordsMsg->uv)?$wechatKeywordsMsg->uv:'0',
-            'new_subscribe_num'       =>  isset($wechatKeywordsMsg->new_subscribe_num)?$wechatKeywordsMsg->new_subscribe_num:'0',
-            'charge_amount'       =>  isset($wechatKeywordsMsg->charge_amount)?$wechatKeywordsMsg->charge_amount:'0',
-        ];
-    }
-}

+ 0 - 18
app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatPublicTemplatesTransformer.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class WechatPublicTemplatesTransformer
-{
-    public function transform($wechatPublicTemplates){
-        return [
-            'common_template_id'       =>  $wechatPublicTemplates->common_template_id,
-            'title'       =>  $wechatPublicTemplates->title,
-            'primary_industry'       =>  $wechatPublicTemplates->primary_industry,
-            'deputy_industry'       =>  $wechatPublicTemplates->deputy_industry,
-            'content'       =>  $wechatPublicTemplates->content,
-            'example'       =>  $wechatPublicTemplates->example,
-            
-        ];
-    }
-}

+ 0 - 43
app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatTemplatesMsgTransformer.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class WechatTemplatesMsgTransformer
-{
-    public function transform($wechatTemplatesMsg){
-        return [
-            'id'       =>  $wechatTemplatesMsg->id,
-            'template_id'       =>  $wechatTemplatesMsg->template_id,
-            'name'       =>  $wechatTemplatesMsg->name,
-            'send_time'       =>  $wechatTemplatesMsg->send_time,
-            'template_content'       =>  $wechatTemplatesMsg->template_content,
-            'redirect_url'       =>  $wechatTemplatesMsg->redirect_url,
-            'appid'       =>  $wechatTemplatesMsg->appid,
-            'status'       =>  $wechatTemplatesMsg->status,
-            'remark'       =>  $wechatTemplatesMsg->remark,
-            'distribution_channel_id'       =>  $wechatTemplatesMsg->distribution_channel_id,
-            'common_template_id'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->common_template_id,
-            'title'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->title,
-            'primary_industry'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->primary_industry,
-            'deputy_industry'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->deputy_industry,
-            'content'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->content,
-            'example'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->example,
-            'subscribe_time'       =>  $wechatTemplatesMsg->subscribe_time,
-            'sex'       =>  $wechatTemplatesMsg->sex,
-            'balance'       =>  $wechatTemplatesMsg->balance,
-            'order_type'       =>  $wechatTemplatesMsg->order_type,
-            'category_id'       =>  $wechatTemplatesMsg->category_id,
-            'is_full_send'       =>  $wechatTemplatesMsg->is_full_send,
-            'user_num'       =>  $wechatTemplatesMsg->user_num,
-            'is_activity'       =>  isset($wechatTemplatesMsg->is_activity)?$wechatTemplatesMsg->is_activity:'0',
-            'user_category'       =>  isset($wechatTemplatesMsg->user_category)?$wechatTemplatesMsg->user_category:'',
-            'uv'       =>  isset($wechatTemplatesMsg->uv)?$wechatTemplatesMsg->uv:'',
-            'pv'       =>  isset($wechatTemplatesMsg->pv)?$wechatTemplatesMsg->pv:'',
-            'register_user_num'       =>  isset($wechatTemplatesMsg->register_user_num)?$wechatTemplatesMsg->register_user_num:'',
-            'pay_user_num'       =>  isset($wechatTemplatesMsg->pay_user_num)?$wechatTemplatesMsg->pay_user_num:'',
-            'charge_amount'       =>  isset($wechatTemplatesMsg->charge_amount)?$wechatTemplatesMsg->charge_amount:'',
-            'book_name'       =>  isset($wechatTemplatesMsg->book_name)?$wechatTemplatesMsg->book_name:'',
-            'chapter_name'       =>  isset($wechatTemplatesMsg->chapter_name)?$wechatTemplatesMsg->chapter_name:'',
-        ];
-    }
-}

+ 0 - 22
app/Http/Controllers/Channel/OfficialAccount/Transformers/WechatTemplatesTransformer.php

@@ -1,22 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount\Transformers;
-
-class WechatTemplatesTransformer
-{
-    public function transform($wechatTemplates){
-        return [
-            'appid'       =>  $wechatTemplates->appid,
-            'common_template_id'       =>  $wechatTemplates->common_template_id,
-            'template_id'       =>  $wechatTemplates->template_id,
-            // 'name'       =>  $wechatTemplates->WechatTemplateMsg->name,
-            // 'send_time'       =>  $wechatTemplates->WechatTemplateMsg->send_time,
-            // 'template_content'       =>  $wechatTemplates->WechatTemplateMsg->template_content,
-            // 'redirect_url'       =>  $wechatTemplates->WechatTemplateMsg->redirect_url,
-            // 'send_appid'       =>  $wechatTemplates->WechatTemplateMsg->send_appid,
-            // 'status'       =>  $wechatTemplates->WechatTemplateMsg->status,
-            // 'remark'       =>  $wechatTemplates->WechatTemplateMsg->remark,
-            // 'distribution_channel_id'       =>  $wechatTemplates->WechatTemplateMsg->distribution_channel_id,
-        ];
-    }
-}

+ 0 - 323
app/Http/Controllers/Channel/OfficialAccount/WechatKeywordsController.php

@@ -1,323 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-
-use App\Http\Controllers\Channel\OfficialAccount\Transformers\WechatKeyWordsMsgTransformer;
-use Illuminate\Http\Request;
-use GuzzleHttp\Client;
-use App\Modules\OfficialAccount\Services\WechatKeywordMsgService;
-use App\Modules\Statistic\Services\SendStatistics;
-
-class WechatKeywordsController extends ChannelBaseController
-{
-
-
-
-    /**
-     * @apiDefine OfficialAccount 公众号
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/wechatKeywordMsgById 通过id获取关键字信息
-     * @apiGroup OfficialAccount
-     * @apiName wechatKeywordMsgById
-     * @apiParam   {String}  id 关键字信息id.
-     */
-
-    function wechatKeywordMsgById(Request $request)
-    {
-
-        $id = $request->has('id') ? $request->input('id') : '';
-
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $wechatKeywordMsg['id'] = $id;
-
-        $wechatKeywordMsgService = WechatKeywordMsgService::wechatKeywordMsgById($wechatKeywordMsg);
-        $wechatKeywordMsgService = self::get_keyword_statistics($wechatKeywordMsgService);
-
-        return response()->item(new WechatKeyWordsMsgTransformer(), $wechatKeywordMsgService);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/wechatKeywordMsgBydistributionChannelId 获取推送关键字信息列表
-     * @apiGroup OfficialAccount
-     * @apiName wechatKeywordMsgBydistributionChannelId
-     * @apiParam   {String}  distribution_channel_id 渠道id.
-     */
-
-    function wechatKeywordMsgBydistributionChannelId(Request $request)
-    {
-
-        $distribution_channel_id = $this->getChannelId();
-
-        $wechatKeywordsMsg['distribution_channel_id'] = $distribution_channel_id;
-
-        $wechatKeywordsMsgService = WechatKeywordMsgService::wechatKeywordMsgBydistributionChannelId($wechatKeywordsMsg);
-
-        foreach($wechatKeywordsMsgService as $key=>$wechatKeywordsMsg){
-        	$wechatKeywordsMsgService[$key] = self::get_keyword_statistics($wechatKeywordsMsgService[$key]);
-        }
-        return response()->pagination(new WechatKeyWordsMsgTransformer(), $wechatKeywordsMsgService);
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} OfficialAccount/addWechatKeywordMsg 保存关键字信息
-     * @apiGroup OfficialAccount
-     * @apiName addWechatKeywordMsg
-     * @apiParam   {String}  appids 公众号列表,英文逗号隔开.
-     * @apiParam   {String}  keywords 关键字列表,英文逗号隔开.
-     * @apiParam   {String}  bid 书籍id.
-     * @apiParam   {String}  cid 章节id.
-     */
-
-    function addWechatKeywordMsg(Request $request)
-    {
-    	\Log::info('addWechatKeywordMsg_start');
-    	\Log::info($request->all());
-        
-        $appids = $request->has('appids') ? $request->input('appids') : '';
-        if(empty($appids)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $keywords = $request->has('keywords') ? $request->input('keywords') : '';
-        if(empty($keywords)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        if(empty($bid)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $cid = $request->has('cid') ? $request->input('cid') : '';
-        if(empty($cid)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $book_name = $request->has('book_name') ? $request->input('book_name') : '';
-        if(empty($book_name)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $chapter_name = $request->has('chapter_name') ? $request->input('chapter_name') : '';
-        if(empty($chapter_name)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $send_title = $request->has('send_title') ? $request->input('send_title') : '';
-        if(empty($send_title)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        $send_cover = $request->has('send_cover') ? $request->input('send_cover') : '';
-        if(empty($send_cover)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        $send_order_id = $request->has('send_order_id') ? $request->input('send_order_id') : '';
-        
-        $distribution_channel_id = $this->getChannelId();
-
-        $wechatKeywordMsgs['appids'] = $appids;
-        $wechatKeywordMsgs['bid'] = $bid;
-        $wechatKeywordMsgs['cid'] = $cid;
-        $wechatKeywordMsgs['book_name'] = $book_name;
-        $wechatKeywordMsgs['chapter_name'] = $chapter_name;
-        $wechatKeywordMsgs['send_title'] = $send_title;
-        $wechatKeywordMsgs['send_cover'] = $send_cover;
-        $wechatKeywordMsgs['distribution_channel_id'] = $distribution_channel_id;
-        $wechatKeywordMsgs['send_order_id'] = $send_order_id;
-        $wechatKeywordMsgs['status'] = 1;
-        
-        $keywords = explode(',',$keywords);
-        \Log::info($wechatKeywordMsgs);
-        \Log::info($keywords);
-        foreach($keywords as $keyword){
-        	$wechatKeywordMsgs['keyword'] = $keyword;
-        	$resultStatus = WechatKeywordMsgService::addWechatKeywordMsg($wechatKeywordMsgs);
-        }
-
-        if ($resultStatus == 1) {
-            return response()->success();
-        }elseif ($resultStatus == 2) {
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }elseif ($resultStatus == 3) {
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }
-        elseif ($resultStatus == 0) {
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }else{
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }
-
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} OfficialAccount/updateWechatKeywordMsg 更新关键字信息
-     * @apiGroup OfficialAccount
-     * @apiName updateWechatKeywordMsg
-     * @apiParam   {String}  id 关键字id.
-     * @apiParam   {String}  appids 公众号列表,英文逗号隔开.
-     * @apiParam   {String}  keywords 关键字列表,英文逗号隔开.
-     * @apiParam   {String}  bid 书籍id. 
-     * @apiParam   {String}  cid 章节id.
-     */
-    
-    function updateWechatKeywordMsg(Request $request)
-    {
-    	\Log::info('updateWechatKeywordMsg_start');
-    	$id = $request->has('id') ? $request->input('id') : '';
-    	if(empty($id)) {
-    		return response()->error("PARAM_EMPTY");
-    	}
-    	
-    	$appids = $request->has('appids') ? $request->input('appids') : '';
-        if(empty($appids)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $keywords = $request->has('keywords') ? $request->input('keywords') : '';
-        if(empty($keywords)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        if(empty($bid)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $cid = $request->has('cid') ? $request->input('cid') : '';
-        if(empty($cid)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $book_name = $request->has('book_name') ? $request->input('book_name') : '';
-        if(empty($book_name)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $chapter_name = $request->has('chapter_name') ? $request->input('chapter_name') : '';
-        if(empty($chapter_name)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        $send_title = $request->has('send_title') ? $request->input('send_title') : '';
-        if(empty($send_title)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        $send_cover = $request->has('send_cover') ? $request->input('send_cover') : '';
-        if(empty($send_cover)) {
-        	return response()->error("PARAM_EMPTY");
-        }
-        
-        $distribution_channel_id = $this->getChannelId();
-        $wechatKeywordMsgs['id'] = $id;
-        $wechatKeywordMsgs['appids'] = $appids;
-        $wechatKeywordMsgs['bid'] = $bid;
-        $wechatKeywordMsgs['cid'] = $cid;
-        $wechatKeywordMsgs['send_title'] = $send_title;
-        $wechatKeywordMsgs['send_cover'] = $send_cover;
-        $wechatKeywordMsgs['book_name'] = $book_name;
-        $wechatKeywordMsgs['chapter_name'] = $chapter_name;
-        $wechatKeywordMsgs['distribution_channel_id'] = $distribution_channel_id;
-        $wechatKeywordMsgs['status'] = 1;
-        
-        $keywords = explode(',',$keywords);
-        \Log::info($wechatKeywordMsgs);
-        \Log::info($keywords);
-        foreach($keywords as $keyword){
-        	$wechatKeywordMsgs['keyword'] = $keyword;
-        	$resultStatus = WechatKeywordMsgService::updateWechatKeywordMsg($wechatKeywordMsgs);
-        }
-    
-    	if ($resultStatus == 1) {
-    		return response()->success();
-    	}elseif ($resultStatus == 2) {
-    		return response()->error('KEYWORDS_UNSUCCESSFUL');
-    	}elseif ($resultStatus == 3) {
-    		return response()->error('KEYWORDS_UNSUCCESSFUL');
-    	}
-    	elseif ($resultStatus == 0) {
-    		return response()->error('KEYWORDS_UNSUCCESSFUL');
-    	}else{
-    		return response()->error('KEYWORDS_UNSUCCESSFUL');
-    	}
-    	
-    	\Log::info('updateWechatKeywordMsg_end');
-    
-    }
-    
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/updateWechatKeywordMsgStatus 更新关键字信息状态
-     * @apiGroup OfficialAccount
-     * @apiName updateWechatKeywordMsgStatus
-     * @apiParam   {String}  id 关键字信息id.
-     * @apiParam   {String}  status 关键字信息状态 0关闭  1开启.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *       {
-     *           "code": 0,
-     *           "msg": "",
-     *           "data": {
-     *           }
-     *       }
-     */
-
-    function updateWechatKeywordMsgStatus(Request $request)
-    {
-
-        $id = $request->has('id') ? $request->input('id') : '';
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        
-        $status = $request->has('status') ? $request->input('status') : '0';
-        $distribution_channel_id = $this->getChannelId();
-        
-        $wechatKeywordMsg['id'] = $id;
-        $wechatKeywordMsg['status'] = $status;
-        $wechatKeywordMsg['distribution_channel_id'] = $distribution_channel_id;
-        $resultStatus = WechatKeywordMsgService::updateWechatKeywordMsgStatus($wechatKeywordMsg);
-
-        if ($resultStatus == 1) {
-            return response()->success();
-        }elseif ($resultStatus == 2) { 
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }elseif ($resultStatus == 4) {
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }elseif ($resultStatus == 0) {
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }else{
-            return response()->error('KEYWORDS_UNSUCCESSFUL');
-        }
-        
-    }
-    
-    public static function get_keyword_statistics($wechatKeywordMsgService){
-    	$start_date = date('Y-m-d',strtotime('-7 day'));
-    	$end_date = date('Y-m-d',strtotime('+1 day'));
-    	$stat_type = 'keyword_'.$wechatKeywordMsgService->id;
-    	\Log::info('get_keyword_statistics:'.$wechatKeywordMsgService->distribution_channel_id.' start_date:'.$start_date.' end_date:'.$end_date.' stat_type:'.$stat_type);
-    	$user_pay_stat = SendStatistics::getWechatMsgUseRecord($wechatKeywordMsgService->distribution_channel_id,$stat_type,$start_date,$end_date,true);
-    	\Log::info('get_keyword_statistics_pay_stat');\Log::info($user_pay_stat);
-    	$wechatKeywordMsgService->uv = $user_pay_stat['uv'];
-    	$wechatKeywordMsgService->click_num = $user_pay_stat['pv'];
-    	$wechatKeywordMsgService->new_subscribe_num = '0';
-    	$wechatKeywordMsgService->charge_amount = $user_pay_stat['success_order_sum'];
-    	return $wechatKeywordMsgService;
-    }
-
-
-}

+ 0 - 89
app/Http/Controllers/Channel/OfficialAccount/WechatPublicTemplatesController.php

@@ -1,89 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\OfficialAccount;
-
-use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
-use App\Http\Controllers\Channel\OfficialAccount\Transformers\WechatPublicTemplatesTransformer;
-use Illuminate\Http\Request;
-use GuzzleHttp\Client;
-use App\Libs\OSS;
-use App\Modules\OfficialAccount\Services\WechatTemplateService;
-
-class WechatPublicTemplatesController extends ChannelBaseController
-{
-
-    /**
-     * @apiDefine OfficialAccount 公众号
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} OfficialAccount/wechatPublicTemplateList 获取模板消息基础列表
-     * @apiGroup OfficialAccount
-     * @apiName wechatPublicTemplateList
-     * @apiSuccess {String}  title 标题.
-     * @apiSuccess {String}  common_template_id 公共模版的ID.
-     * @apiSuccess {String}  primary_industry 主类别.
-     * @apiSuccess {String}  deputy_industry 副类别.
-     * @apiSuccess {String}  content 模板消息内容.
-     * @apiSuccess {String}  example 模板发送示例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *      {
-     *          "code": 0,
-     *          "msg": "",
-     *          "data": [
-     *              {
-     *                  "common_template_id": "TM00202",
-     *                  "title": "帐户资金变动提醒",
-     *                  "primary_industry": "IT科技",
-     *                  "deputy_industry": "IT软件与服务",
-     *                  "content": "{{first.DATA}}\n\n变动时间:{{date.DATA}}\n变动金额:{{adCharge.DATA}}\n{{type.DATA}}帐户余额:{{cashBalance.DATA}}\n{{remark.DATA}}",
-     *                  "example": "您好,您于2013\/10\/29  15:24 有一笔现金帐户充值到账:\n\n变动时间:2013\/11\/26 14:00\n变动金额:¥5618.63\n现金帐户余额:¥8454.74\n点击“查看详情“立即查阅您的帐户财务记录。"
-     *              },
-     *              {
-     *                  "common_template_id": "TM00155",
-     *                  "title": "会员充值通知",
-     *                  "primary_industry": "文体娱乐",
-     *                  "deputy_industry": "文化|传媒",
-     *                  "content": "{{first.DATA}}\n\n{{accountType.DATA}}:{{account.DATA}}\n充值金额:{{amount.DATA}}\n充值状态:{{result.DATA}}\n{{remark.DATA}}",
-     *                  "example": "您好,您已成功进行会员卡充值。\n\n会员卡号:11912345678\n充值金额:50元\n充值状态:充值成功\n如有疑问,请致电13912345678联系我们。"
-     *              },
-     *              {
-     *                  "common_template_id": "OPENTM217772013",
-     *                  "title": "任务到期通知",
-     *                  "primary_industry": "IT科技",
-     *                  "deputy_industry": "IT软件与服务",
-     *                  "content": "{{first.DATA}}\n到期任务:{{keyword1.DATA}}\n到期时间:{{keyword2.DATA}}\n{{remark.DATA}}",
-     *                  "example": "早上好,你有任务已延误\n到期任务:触屏版点击添加附件无效(9-9)\n到期时间:9月12日\n点击处理"
-     *              },
-     *              {
-     *                  "common_template_id": "TM405959659",
-     *                  "title": "会员卡升级通知",
-     *                  "primary_industry": "IT科技",
-     *                  "deputy_industry": " IT软件与服务",
-     *                  "content": "{{first.DATA}}\n\n会员卡号:{{keynote1.DATA}}\n有效期:{{keynote2.DATA}}\n{{remark.DATA}}",
-     *                  "example": "恭喜你,你的会员卡可以升级为微信会员卡,使用会员卡更加方便,查询 积分更加快捷\n\n会员卡号:光明顶工作坊 \n有效期:222 \n点击详情,立刻升级会员卡。"
-     *              },
-     *              {
-     *                  "common_template_id": "OPENTM410178244",
-     *                  "title": "图书送达通知",
-     *                  "primary_industry": "IT科技",
-     *                  "deputy_industry": "互联网|电子商务",
-     *                  "content": "{{first.DATA}}\r书名:{{keyword1.DATA}}\r送达时间:{{keyword2.DATA}}\r还书日期:{{keyword3.DATA}}\r{{remark.DATA}}",
-     *                  "example": "您的图书已经送达\r书名:三体\r送达时间:2016-09-07\r还书日期:2017-09-08\r祝您阅读愉快!"
-     *              }
-     *          ]
-     *      }   
-     */
-
-    function wechatPublicTemplateList(Request $request)
-    {
-
-        $wechatPublicTemplatesService = WechatTemplateService::wechatPublicTemplateList();
-
-        return response()->collection(new WechatPublicTemplatesTransformer(), $wechatPublicTemplatesService);
-    }
-
-    
-}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1016
app/Http/Controllers/Channel/OfficialAccount/WechatTemplatesController.php


+ 0 - 203
app/Http/Controllers/Channel/Order/OrdersController.php

@@ -1,203 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Order;
-
-use App\Http\Controllers\Wap\BaseController;
-use Illuminate\Http\Request;
-use App\Modules\Subscribe\Services\BookOrderService;
-use App\Modules\Subscribe\Services\ChapterOrderService;
-use App\Modules\Subscribe\Services\OrderService;
-use App\Http\Controllers\Channel\Order\Transformers\BookOrderTransformer;
-use App\Http\Controllers\Channel\Order\Transformers\ChapterOrderTransformer;
-use App\Http\Controllers\Channel\Order\Transformers\ChargeListTransformer;
-
-
-class OrdersController extends BaseController
-{
-    /**
-     * @apiDefine Order 订单
-     */
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 单本消费记录
-     * @api {get} order/bookOrderList 单本消费记录
-     * @apiGroup Order
-     * @apiName bookOrderList
-     * @apiParam  {int}         uid   uid
-     * @apiParam  {int}         [uid]  page_size
-     * @apiParam  {int}         [page]  页码
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {int}         id     序号
-     * @apiSuccess {int}         type   类型
-     * @apiSuccess {Int}         detail 详情
-     * @apiSuccess {Int}         fee    书币
-     * @apiSuccess {Int}         book_name 书名
-     * @apiSuccess {Int}         chapter_name 章节名
-     * @apiSuccess {String}      created_at 时间
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: list:[
-     *                  {
-     *                       id: 40,
-     *                       type: "消耗",
-     *                       detail: "单本订购",
-     *                       book_name: "你的爱情那么伤",
-     *                       chapter_name: "",
-     *                       fee: 899,
-     *                       created_at: "2017-12-08 20:07:27"
-     *                  }
-     *               ]
-     *            meta: {
-     *                       total: 1,
-     *                       per_page: 15,
-     *                       current_page: 1,
-     *                       last_page: 1,
-     *                       next_page_url: "",
-     *                       prev_page_url: ""
-     *               }
-     *       }
-     */
-    public function bookOrderList(Request $request)
-    {
-        $uid = $request->input('uid');
-
-        $page_size = $request->input('page_size', 15);
-        $book_order = BookOrderService::getRecord($uid, $page_size);
-        return response()->pagination(new BookOrderTransformer(), $book_order);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 章节消费记录
-     * @api {get} order/chapterOrderList 章节消费记录
-     * @apiGroup Order
-     * @apiName chapterOrderList
-     * @apiParam  {int}         uid   uid
-     * @apiParam  {int}         [uid]  page_size
-     * @apiParam  {int}         [page]  页码
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {int}         id     序号
-     * @apiSuccess {int}         type   类型
-     * @apiSuccess {Int}         detail 详情
-     * @apiSuccess {Int}         fee    书币
-     * @apiSuccess {Int}         book_name 书名
-     * @apiSuccess {Int}         chapter_name 章节名
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: list:[
-     *               {
-     *                       id: 40,
-     *                       type: "消耗",
-     *                       detail: "单本订购",
-     *                       book_name: "你的爱情那么伤",
-     *                       chapter_name: "",
-     *                       fee: 899,
-     *                       created_at: "2017-12-08 20:07:27"
-     *                  }
-     *               ]
-     *            meta: {
-     *                       total: 1,
-     *                       per_page: 15,
-     *                       current_page: 1,
-     *                       last_page: 1,
-     *                       next_page_url: "",
-     *                       prev_page_url: ""
-     *               }
-     *       }
-     */
-    public function chapterOrderList(Request $request)
-    {
-        $uid = $request->input('uid');
-        $chapter_model = new ChapterOrderService();
-        $page_size = $request->input('page_size', 15);
-        $chapter_order = $chapter_model->getByUid($uid, $page_size);
-        return response()->pagination(new ChapterOrderTransformer(), $chapter_order);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 充值记录
-     * @api {get} order/chargeRecordLists 充值记录
-     * @apiGroup Order
-     * @apiName chargeRecordLists
-     * @apiParam  {int}         uid   uid
-     * @apiParam  {int}         [uid]  page_size
-     * @apiParam  {int}         [page]  页码
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {int}         id     序号
-     * @apiSuccess {int}         type   类型
-     * @apiSuccess {Int}         detail 详情
-     * @apiSuccess {Int}         fee    书币
-     * @apiSuccess {Int}         book_name 书名
-     * @apiSuccess {Int}         chapter_name 章节名
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *    {
-     *       code: 0,
-     *       msg: "",
-     *           data: {
-     *               list: [
-     *               {
-     *                       id: 40,
-     *                       type: "消耗",
-     *                       detail: "单本订购",
-     *                       book_name: "你的爱情那么伤",
-     *                       chapter_name: "",
-     *                       fee: 899,
-     *                       created_at: "2017-12-08 20:07:27"
-     *                  }
-     *       ],
-     *           meta: {
-     *               total: 1,
-     *               per_page: 15,
-     *               current_page: 1,
-     *               last_page: 1,
-     *               next_page_url: "",
-     *               prev_page_url: ""
-     *           }
-     *       }
-     *    }
-     */
-    public function chargeRecordLists(Request $request)
-    {
-        $page_size = $request->input('page_size', 15);
-        $uid = $request->input('uid');
-        $res = OrderService::getSuccessOrderList($uid, $page_size);
-        foreach ($res as &$v){
-            $v->type = '充值';
-            $v->detail = '充值';
-            if($v->order_type == 'RECHARGE'){
-
-                $v->type = '充值';
-                $v->detail = '充值书币';
-            }
-            if($v->order_type == 'BOOK'){
-                $v->type = '充值';
-                $v->detail = '单本购买';
-            }
-            if($v->order_type == 'YEAR'){
-                $v->type = '充值';
-                $v->detail = '包年';
-            }
-        }
-        return response()->pagination(new ChargeListTransformer(), $res);
-    }
-
-}

+ 0 - 19
app/Http/Controllers/Channel/Order/Transformers/BookOrderTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Order\Transformers;
-use Hashids;
-class BookOrderTransformer
-{
-    public function transform($res){
-        return [
-            'id'          =>  $res->id,
-            'type'          =>  '消耗',
-            'detail'        => '单本订购',
-            'book_name'    =>  $res->book_name,
-            'chapter_name'    =>  '',
-            'fee'            =>  (int)$res->fee,
-            'created_at'      => date("Y-m-d H:i:s",strtotime($res->created_at)),
-
-        ];
-    }
-}

+ 0 - 30
app/Http/Controllers/Channel/Order/Transformers/ChapterOrderTransformer.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Order\Transformers;
-use Hashids;
-class ChapterOrderTransformer
-{
-    public function transform($res){
-        /*
-        return [
-            'uid'          		=>  $res->uid,
-            //'bid_no_hash'       =>  $res->bid,
-            'bid'            	=>  Hashids::encode($res->bid),
-            'cid'   		    =>  $res->cid,
-            'book_name'         =>  $res->book_name,
-            'chapter_name'      =>  $res->chapter_name,
-            'fee'               =>  $res->fee,
-            'created_at'        =>  date("Y-m-d H:i:s",strtotime($res->created_at)),
-        ];
-        */
-        return [
-            'id'          		=>  $res->id,
-            'type'            	=>  '消耗',
-            'detail'   		    =>  '章节消费',
-            'book_name'         =>  $res->book_name,
-            'chapter_name'      =>  $res->chapter_name,
-            'fee'               =>  $res->fee,
-            'created_at'        =>  date("Y-m-d H:i:s",strtotime($res->created_at)),
-        ];
-    }
-}

+ 0 - 18
app/Http/Controllers/Channel/Order/Transformers/ChargeListTransformer.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Order\Transformers;
-class ChargeListTransformer
-{
-
-    public function transform($res){
-        return [
-            'id'       =>  $res->id,
-            'type'      => $res->type,
-            'detail'      => $res->detail,
-            'book_name'      => '',
-            'chapter_name'      => '',
-            'fee'       =>  $res->price,
-            'created_at'   =>  date("Y-m-d H:i:s",strtotime($res->created_at))
-        ];
-    }
-}

+ 0 - 19
app/Http/Controllers/Channel/Order/Transformers/OrderTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Order\Transformers;
-
-class OrderTransformer
-{
-    public function transform($order){
-        return [
-            'merchant_order_id'       =>  $order->merchant_order_id,
-            'user_id'       =>  $order->user_id,
-            'user_nickname'       =>  $order->user_nickname,
-            'pay_money'       =>  (int)$order->pay_money/100,
-            'pay_flag'   =>  $order->pay_flag,
-            'pay_time'   =>  $order->pay_time ? date('Y-m-d H:i:s',$order->pay_time) : '',
-            'send_order_id' => isset($order->send_order_id) ? $order->send_order_id : 0,
-            'send_order_name' => isset($order->send_order_name) ? $order->send_order_name : ''
-        ];
-    }
-}

+ 0 - 63
app/Http/Controllers/Channel/Promotion/BgImagesController.php

@@ -1,63 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/20
- * Time: 16:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\BgInagesTransformer;
-use App\Http\Controllers\Channel\Promotion\Transformers\QrCodeTransformer;
-use App\Modules\Promotion\Services\PromotionService;
-use DB;
-
-class BgImagesController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/getBgImages 获取二维码列表
-     * @apiGroup promotion
-     * @apiName getBgImages
-     * @apiSuccess {Number}  id  ID.
-     * @apiSuccess {Number}  sequence 序号
-     * @apiSuccess {String}  link  模板图片地址.
-     * @apiSuccess {String}  created_at 创建时间.
-     * @apiSuccess {String}  updated_at 更新时间.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "sequence": 1,
-     *              "created_at": "2018-08-02 15:28:30"
-     *              "update_at": "2018-08-02 15:28:30"
-     *              "link": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "sequence": 1,
-     *              "created_at": "2018-08-02 15:28:30"
-     *              "update_at": "2018-08-02 15:28:30"
-     *              "link": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getBgImages()
-    {
-        $getBgImagesResult = PromotionService::getBgImages();
-        return response()->collection(new BgInagesTransformer(), $getBgImagesResult);
-    }
-}

+ 0 - 52
app/Http/Controllers/Channel/Promotion/BodyTemplatesController.php

@@ -1,52 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/20
- * Time: 16:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\BodyTemplatesTransformer;
-use App\Modules\Promotion\Services\PromotionService;
-use DB;
-
-class BodyTemplatesController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/bodyTemplates 获取推广内容模板列表
-     * @apiGroup promotion
-     * @apiName getPromotionBodyTemplates
-     * @apiSuccess {Number}  id 标题ID.
-     * @apiSuccess {String}  content 内容.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "content": "sfsd"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "content": "sfsd"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getPromotionBodyTemplates()
-    {
-        $promotionBodyTemplatesResult = PromotionService::getAllBodyTemplates();
-        return response()->collection(new BodyTemplatesTransformer(), $promotionBodyTemplatesResult);
-    }
-}

+ 0 - 54
app/Http/Controllers/Channel/Promotion/DocumentCoversController.php

@@ -1,54 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/20
- * Time: 16:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\DocumentCoversTransformer;
-use App\Modules\Promotion\Services\PromotionService;
-use DB;
-
-class DocumentCoversController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/documentCovers 获取推广文案封面列表
-     * @apiGroup promotion
-     * @apiName getPromotionDocumentCovers
-     * @apiSuccess {Number}  id 文案封面id..
-     * @apiSuccess {String}  origin_cover 封面地址.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "origin_cover": "sfsd"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "origin_cover": "sfsd"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getPromotionDocumentCovers()
-    {
-        $distribution_channel_id = $this->getChannelId();
-        $promotionDocumentCoversResult = PromotionService::getAllDocumentCovers($distribution_channel_id);
-        return response()->collection(new DocumentCoversTransformer(), $promotionDocumentCoversResult);
-    }
-}

+ 0 - 60
app/Http/Controllers/Channel/Promotion/HeadlineController.php

@@ -1,60 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/20
- * Time: 16:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\HeadlinelTransformer;
-use App\Modules\Promotion\Services\PromotionService;
-use DB;
-use Illuminate\Http\Request;
-
-class HeadlineController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/headlines 获取推广标题列表
-     * @apiGroup promotion
-     * @apiName getPromotionHeadlines
-     * @apiParam{String}type 类型(1:男频、2:女频)
-     *
-     * @apiSuccess {Number}  id 标题ID.
-     * @apiSuccess {String}  title 标题内容.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "title": "sfsd"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "title": "sfsd"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getPromotionHeadlines(Request $request)
-    {
-        $type = $request->has('type') ? $request->input('type') : '';
-        if (empty($type)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $promotionHeadlinesResult = PromotionService::getAllHeadlines($type);
-        return response()->collection(new HeadlinelTransformer(), $promotionHeadlinesResult);
-    }
-}

+ 0 - 54
app/Http/Controllers/Channel/Promotion/OriginalGuidesController.php

@@ -1,54 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/20
- * Time: 16:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\OriginalGuidesTransformer;
-use App\Http\Controllers\Controller;
-use App\Modules\Promotion\Services\PromotionService;
-use DB;
-
-class OriginalGuidesController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/originalGuides 获取原文引导列表
-     * @apiGroup promotion
-     * @apiName getPromotion0riginalGuides
-     * @apiSuccess {Number}  id  ID.
-     * @apiSuccess {String}  content 内容.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "content": "sfsd"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "content": "sfsd"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getPromotion0riginalGuides()
-    {
-        $promotionOriginalGuidesResult = PromotionService::getAllOriginalGuides();
-        return response()->collection(new OriginalGuidesTransformer(), $promotionOriginalGuidesResult);
-    }
-}

+ 0 - 58
app/Http/Controllers/Channel/Promotion/PromotionPagesController.php

@@ -1,58 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/22
- * Time: 10:45
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\PromotionPagesTransformer;
-use App\Modules\Promotion\Services\PromotionService;
-
-class PromotionPagesController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/promotionPages 获取推广页面列表
-     * @apiGroup promotion
-     * @apiName getPromotionPages
-     * @apiSuccess {Number}  id ID.
-     * @apiSuccess {String}  title 标题
-     * @apiSuccess {String}  description 描述
-     * @apiSuccess {String}  link 推广链接
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "title": "sfsd",
-     *              "link": "111111111",
-     *              "description": "测试1111"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "title": "sfsd",
-     *               "link": "111111111",
-     *                "description": "测试1111"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getPromotionPages()
-    {
-        $promotionPagesResult = PromotionService::getAllPromotionPage();
-        return response()->collection(new PromotionPagesTransformer(), $promotionPagesResult);
-    }
-}

+ 0 - 53
app/Http/Controllers/Channel/Promotion/QrCodeController.php

@@ -1,53 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/20
- * Time: 16:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\Promotion\Transformers\QrCodeTransformer;
-use App\Modules\Promotion\Services\PromotionService;
-use DB;
-
-class QrCodeController extends BaseController
-{
-    /**
-     * @apiDefine promotion 推广
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} promotion/getQrCodes 获取二维码列表
-     * @apiGroup promotion
-     * @apiName getQrCodes
-     * @apiSuccess {Number}  id  ID.
-     * @apiSuccess {String}  codeUrl 链接地址.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *
-     *         "data": [
-     *           {
-     *              "id": 1,
-     *              "codeUrl": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
-     *            },
-     *           {
-     *              "id": 2,
-     *              "codeUrl": "https://yueduyun.oss-cn-hangzhou.aliyuncs.com/distribution/push/continue-3.jpg"
-     *            }
-     *        ]
-     *     }
-     */
-
-    function getQrCodes()
-    {
-        $qrCodesResult = PromotionService::getQrCodes();
-        return response()->collection(new QrCodeTransformer(), $qrCodesResult);
-    }
-}

+ 0 - 27
app/Http/Controllers/Channel/Promotion/Transformers/BgInagesTransformer.php

@@ -1,27 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/21
- * Time: 10:53
- */
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-/**
- * Class QrCodeTransformer  模板图
- * @package App\Modules\Promotion\Transformers
- */
-class BgInagesTransformer
-{
-    public function transform($bgInageItem)
-    {
-        return [
-            'id' => $bgInageItem->id,
-            'sequence' => $bgInageItem->sequence,
-            'link' => $bgInageItem->link,
-            'created_at' => date("Y-m-d H:i:s",strtotime($bgInageItem->created_at)),
-            'updated_at' => date("Y-m-d H:i:s",strtotime($bgInageItem->updated_at))
-        ];
-    }
-}

+ 0 - 25
app/Http/Controllers/Channel/Promotion/Transformers/BodyTemplatesTransformer.php

@@ -1,25 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/21
- * Time: 10:53
- */
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-/**
- * Class BodyTemplatesTransformer  内容模板
- * @package App\Modules\Promotion\Transformers
- */
-class BodyTemplatesTransformer
-{
-    public function transform($bodyTemplatesItem)
-    {
-        return [
-            'id' => $bodyTemplatesItem->id,
-            'content' => $bodyTemplatesItem->content,
-            'style'=>isset($bodyTemplatesItem->style)?$bodyTemplatesItem->style:''
-        ];
-    }
-}

+ 0 - 25
app/Http/Controllers/Channel/Promotion/Transformers/DocumentCoversTransformer.php

@@ -1,25 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/21
- * Time: 11:17
- */
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-
-/**
- * Class DocumentCoversTransformer  文案封面
- * @package App\Modules\Promotion\Transformers
- */
-class DocumentCoversTransformer
-{
-    public function transform($documentCoversItem)
-    {
-        return [
-            'id' => $documentCoversItem->id,
-            'origin_cover' => $documentCoversItem->link
-        ];
-    }
-}

+ 0 - 18
app/Http/Controllers/Channel/Promotion/Transformers/HeadlinelTransformer.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-/**
- * Class HeadlinelTransformer 标题
- * @package App\Modules\Promotion\Transformers
- */
-class HeadlinelTransformer
-{
-    public function transform($healineItem)
-    {
-        return [
-            'id' => $healineItem->id,
-            'title' => $healineItem->title
-        ];
-    }
-}

+ 0 - 25
app/Http/Controllers/Channel/Promotion/Transformers/OriginalGuidesTransformer.php

@@ -1,25 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/21
- * Time: 11:05
- */
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-
-/**  原文引导
- * Class OriginalGuidesTransformer
- * @package App\Modules\Promotion\Transformers
- */
-class OriginalGuidesTransformer
-{
-    public function transform($originalGuidesItem)
-    {
-        return [
-            'id' => $originalGuidesItem->id,
-            'content' => $originalGuidesItem->content
-        ];
-    }
-}

+ 0 - 28
app/Http/Controllers/Channel/Promotion/Transformers/PromotionPagesTransformer.php

@@ -1,28 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/22
- * Time: 10:49
- */
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-class PromotionPagesTransformer
-{
-    /**推广页面链接
-     * Class PromotionPagesTransformer
-     * @package App\Modules\Promotion\Transformers
-     */
-
-    public function transform($promotionPagesItem)
-    {
-        return [
-            'id' => $promotionPagesItem->id,
-            'title' => $promotionPagesItem->title,
-            'description' => $promotionPagesItem->description,
-            'link' => $promotionPagesItem->link
-        ];
-    }
-
-}

+ 0 - 24
app/Http/Controllers/Channel/Promotion/Transformers/QrCodeTransformer.php

@@ -1,24 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/21
- * Time: 10:53
- */
-
-namespace App\Http\Controllers\Channel\Promotion\Transformers;
-
-/**
- * Class QrCodeTransformer  二维码
- * @package App\Modules\Promotion\Transformers
- */
-class QrCodeTransformer
-{
-    public function transform($QrCodeItem)
-    {
-        return [
-            'id' => $QrCodeItem->id,
-            'codeUrl' => $QrCodeItem->code_url
-        ];
-    }
-}

+ 0 - 198
app/Http/Controllers/Channel/SendOrder/SendOrderBatchHandleController.php

@@ -1,198 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/11/22
- * Time: 11:36
- */
-
-namespace App\Http\Controllers\Channel\SendOrder;
-
-use App\Http\Controllers\Channel\BaseController;
-
-use App\Modules\Book\Models\BookConfig;
-use App\Modules\Book\Services\BookConfigService;
-use App\Modules\Book\Services\BookSubscribleChapterService;
-use App\Modules\Book\Services\ChapterService;
-use App\Modules\SendOrder\Services\SendOrderService;
-use Hashids;
-use Illuminate\Http\Request;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use DB;
-
-
-class SendOrderBatchHandleController extends BaseController
-{
-    /**
-     * @apiDefine sendOrder 派单
-     */
-    public function downloadTemplate(Request $request) {
-        $bids = $request->input('bids',[]);
-        if(!$bids) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!is_array($bids)) {
-            return response()->error('PARAM_ERROR');
-        };
-        foreach ($bids as $key=>$bid) {
-            $bids[$key] = Hashids::decode($bid)[0];
-        }
-        $header = ['书本编号','派单渠道名称','成本', '书名','阅读章节原文','派单类型','推广类型'];
-        $books = BookConfig::leftjoin('books','books.id','=','book_configs.bid')
-            ->leftjoin('chapters','chapters.id','=','book_configs.recommend_cid')
-            ->select(['books.id as bid','book_configs.book_name','chapters.sequence'])
-            ->whereIn('book_configs.bid',$bids)
-            ->get();
-        $data = array();
-        foreach ($books as $book) {
-            $data[] = array(
-                Hashids::encode($book->bid),
-                '','',
-                $book->book_name,
-                $book->sequence,
-                1,
-                1
-            );
-        }
-
-        saveExcelData($header,$data,'',[
-            ['cell'=>'I2','contents'=>'1、推广类型一栏请填写1或者2 ,1代表微信,2代表站外'],
-            ['cell'=>'I3','contents'=>'2、派单类型一栏请填写1或者2 ,1代表内部,2代表外部'],
-            ['cell'=>'I4','contents'=>'3、阅读章节原文默认为推荐章节,原文链接为当前章节'],
-            ['cell'=>'I5','contents'=>'4、同一书本编号可产生多条记录,上传后一条记录对应产生一条派单链接'],
-        ]);
-    }
-
-    public function importSendOrders(Request $request) {
-        if(!$request->hasFile('send_orders')) {
-            return response()->error('PARAM_ERROR');
-        }
-        $file_obj = $request->file('send_orders');
-        $spreadsheet = IOFactory::load($file_obj->path());
-        $sheetData = $spreadsheet->getActiveSheet(0)->toArray(null, true, true, true);
-        //\Log::info('sheetData:'.json_encode($sheetData));
-        $sheetDataLength = count($sheetData);
-        $distribution_channel_id = $this->getChannelId();
-        DB::beginTransaction();
-        try{
-            for($i=2;$i<=$sheetDataLength;$i++) {
-                $chapter_sequnce = $sheetData[$i]['E'];
-                $book_id = $sheetData[$i]['A'];
-                \Log::info('book_id'.$book_id);
-                if($book_id){
-                    $bid = Hashids::decode($book_id)[0];
-                    if($bid==2423 && time() >= strtotime('2018-10-10 00:00:00') && time() <= strtotime('2018-10-15 23:59:59')) {
-                        DB::rollback();
-                        return response()->error('UPLOAD_FAILED');
-                        //return response()->error('PARAM_ERROR');
-                    }
-                    $chapter_info = ChapterService::getChapterInfoByBidAndSeq($bid,$chapter_sequnce);
-                    $chapter_id = $chapter_info->id;
-                    $book_info = BookConfig::getBookById($bid);
-                    $subscribe_chapter_seq =$this->getSubscribeChapterNum($book_info,$distribution_channel_id);
-                    $subscribe_chapter_info = ChapterService::getChapterInfoByBidAndSeq($bid,$subscribe_chapter_seq);
-                    $name = $sheetData[$i]['B'];
-                    $cost = $sheetData[$i]['C']?$sheetData[$i]['C']:0;
-
-                    $book_name = $sheetData[$i]['D'];
-                    $qr_code_id =  '';
-                    $chapter_name = $chapter_info?$chapter_info->name:'';
-                    $channel_type = '';
-                    $promotion_type = $sheetData[$i]['F']==1?'INTERNAL':'EXTERNAL';
-                    $subscribe_chapter_id = $subscribe_chapter_info ? $subscribe_chapter_info->id : '';
-                    //$subscribe_chapter_seq = $book_info->force_subscribe_chapter_seq ? $book_info->force_subscribe_chapter_seq : '';
-                    $subscribe_chapter_name = $subscribe_chapter_info ? $subscribe_chapter_info->name : '';
-                    $promotion_point = $sheetData[$i]['G']==1?1:2;
-                    if (!in_array($promotion_point, [1, 2])) {
-                        $promotion_point = 1;
-                    }
-
-                    //if (!$name || !$channel_type || !$promotion_type || !$book_id || !$book_name || !$chapter_id || !$chapter_name || !$subscribe_chapter_id || !$subscribe_chapter_seq || !$subscribe_chapter_name) return response()->error('PARAM_EMPTY');
-
-                    if (empty($qr_code_id)) {
-                        $qr_code_id = 0;
-                    }
-                    $redirect_url = "/reader?bid={$book_id}&cid={$chapter_info->id}";
-                    $book_id = Hashids::decode($book_id)[0];
-                    if ($promotion_point == 2) {
-                        $domain = 'chunnuan555.com';
-                    } else {
-                        $domain = $this->getDomainByBid($book_id);
-                    }
-                    $charge_type = $this->getBookChargeTypeByBid($book_id);
-                    $sendOrder = SendOrderService::createFromDirectory(compact(
-                        'name',
-                        'channel_type',
-                        'promotion_type',
-                        'charge_type',
-                        'cost',
-                        'domain',
-                        'book_id',
-                        'qr_code_id',
-                        'book_name',
-                        'chapter_id',
-                        'subscribe_chapter_id',
-                        'subscribe_chapter_name',
-                        'subscribe_chapter_seq',
-                        'chapter_name',
-                        'distribution_channel_id',
-                        'redirect_url',
-                        'promotion_point'
-                    ));
-
-                    // $promotion_url = '/yun/' . $sendOrder->id;
-                    if ($promotion_point == 2) {
-                        $promotion_url = 'https://bsite' . encodeDistributionChannelId($distribution_channel_id) . '.chunnuan555.com/yun/' . $sendOrder->id;
-                    } else {
-                        $promotion_url = 'https://site' . encodeDistributionChannelId($distribution_channel_id) . '.' . $this->getDomainByBid($book_id) . '/yun/' . $sendOrder->id;
-                    }
-                }
-
-            }
-        }catch (\Exception $e) {
-            DB::rollback();
-            \Log::error($e->getMessage());
-            return response()->error('UPLOAD_FAILED',$e->getMessage());
-        }
-        DB::commit();
-        return response()->success();
-
-    }
-
-    /**
-     * 根据图书id获取域名
-     * @param $bid
-     */
-    function getDomainByBid($bid = '')
-    {
-        $domain = 'chunnuan555.com';
-        return $domain;
-    }
-
-    /**
-     * 根据图书id获取图书的收费类型
-     * @param string $bid
-     */
-    function getBookChargeTypeByBid($bid = '')
-    {
-        $charge_type = '';
-        $bookConfig = BookConfigService::getBookById($bid);
-        if ($bookConfig) {
-            $charge_type = $bookConfig->charge_type;
-        }
-        return $charge_type;
-    }
-
-    protected function getSubscribeChapterNum($book,$distribution_channel_id)
-    {
-
-        //渠道设置的强关
-        $subscribe = BookSubscribleChapterService::getSubcribleChapter($book->bid, $distribution_channel_id);
-        if ($subscribe) {
-            return (isset($subscribe->subscribe_chapter_id) && $subscribe->subscribe_chapter_id > 0) ? $subscribe->subscribe_chapter_id : $book->force_subscribe_chapter_seq;
-        }
-        //默认强关
-        return $book->force_subscribe_chapter_seq;
-    }
-
-}

+ 0 - 167
app/Http/Controllers/Channel/SendOrder/SendOrderBreakevenStatsController.php

@@ -1,167 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/12/1
- * Time: 14:17
- */
-
-namespace App\Http\Controllers\Channel\SendOrder;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Http\Controllers\Channel\SendOrder\Transformers\SendOrderBreakevenStatsTransformer;
-use App\Modules\Statistic\Services\SendOrderBreakevenStatsService;
-use Illuminate\Http\Request;
-
-
-class SendOrderBreakevenStatsController extends BaseController
-{
-
-    /**
-     * @apiDefine sendOrder 派单
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} sendOrder/getSendOrderBreakevenStats 获取30日回本率数据
-     * @apiGroup sendOrder
-     * @apiName getSendOrderBreakevenStats
-     * @apiParam   {String}  [start_date] 开始日期
-     * @apiParam   {String}  [end_date] 结束日期
-     *
-     * @apiSuccess {Number}  id  id.
-     * @apiSuccess {Number}  distribution_channel_id 渠道id.
-     * @apiSuccess {Number}  official_account_id 服务号id.
-     * @apiSuccess {String}  official_account_name 服务号名称.
-     * @apiSuccess {String}  date  日期
-     * @apiSuccess {Number}  force_user_num 粉丝数
-     * @apiSuccess {Number}  total_force_user_num 总粉丝数
-     * @apiSuccess {Number}  unsubscribe_in_one_day_user_num 24小时取关用户数
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccess {String}  updated_at 更新时间
-     * @apiSuccess {Number}  recharge_amount_in_one_day 24小时充值
-     * @apiSuccess {Number}  recharge_amount_in_three_days 72小时充值
-     * @apiSuccess {Number}  recharge_amount_in_one_month 30天充值
-     * @apiSuccess {Number}  recharge_amount_in_two_months 60天充值
-     * @apiSuccess {Number}  recharge_amount_in_three_months 90天充值
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *            {
-     *              "id": 2,
-     *              "distribution_channel_id": 2,
-     *              "official_account_id": 1233,
-     *              "official_account_name": "杭州掌维",
-     *              "date": "2018-2-9",
-     *              "force_user_num": 11,
-     *              "total_force_user_num": 111,
-     *              "unsubscribe_in_one_day_user_num": 5,
-     *              "created_at": ""2017-12-01 10:20:04"",
-     *              "updated_at": ""2017-12-01 10:20:04"",
-     *              "recharge_amount_in_one_day": 9,
-     *              "recharge_amount_in_three_days": 6,
-     *              "recharge_amount_in_one_month": 23,
-     *              "recharge_amount_in_two_months":11,
-     *              "recharge_amount_in_three_months": 112
-     *            }
-     *        ]
-     *     }
-     */
-    function getSendOrderBreakevenStats(Request $request)
-    {
-        $params = [];
-        $distribution_channel_id = $this->getChannelId();
-        $request->has('end_date') && $request->input('end_date') && $params['end_date'] = $request->input('end_date');
-        $request->has('start_date') && $request->input('start_date') && $params['start_date'] = $request->input('start_date');
-        $params['distribution_channel_id'] = $distribution_channel_id;
-        $data = SendOrderBreakevenStatsService::getInfos($params, false);
-        return response()->pagination(new SendOrderBreakevenStatsTransformer(), $data);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} sendOrder/exportSendOrderBreakevenStats 导出30日回本率数据
-     * @apiGroup sendOrder
-     * @apiName exportSendOrderBreakevenStats
-     *
-     * @apiParam   {String}  [start_date] 开始日期
-     * @apiParam   {String}  [end_date] 结束日期
-     * @apiSuccess {Number}  id  id.
-     * @apiSuccess {Number}  distribution_channel_id 渠道id.
-     * @apiSuccess {Number}  official_account_id 服务号id.
-     * @apiSuccess {String}  official_account_name 服务号名称.
-     * @apiSuccess {String}  date  日期
-     * @apiSuccess {Number}  force_user_num 粉丝数
-     * @apiSuccess {Number}  total_force_user_num 总粉丝数
-     * @apiSuccess {Number}  unsubscribe_in_one_day_user_num 24小时取关用户数
-     * @apiSuccess {String}  created_at 创建时间
-     * @apiSuccess {String}  updated_at 更新时间
-     * @apiSuccess {Number}  recharge_amount_in_one_day 24小时充值
-     * @apiSuccess {Number}  recharge_amount_in_three_days 72小时充值
-     * @apiSuccess {Number}  recharge_amount_in_one_month 30天充值
-     * @apiSuccess {Number}  recharge_amount_in_two_months 60天充值
-     * @apiSuccess {Number}  recharge_amount_in_three_months 90天充值
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *            {
-     *              "id": 2,
-     *              "distribution_channel_id": 2,
-     *              "official_account_id": 1233,
-     *              "official_account_name": "杭州掌维",
-     *              "date": "2018-2-9",
-     *              "force_user_num": 11,
-     *              "total_force_user_num": 111,
-     *              "unsubscribe_in_one_day_user_num": 5,
-     *              "created_at": ""2017-12-01 10:20:04"",
-     *              "updated_at": ""2017-12-01 10:20:04"",
-     *              "recharge_amount_in_one_day": 9,
-     *              "recharge_amount_in_three_days": 6,
-     *              "recharge_amount_in_one_month": 23,
-     *              "recharge_amount_in_two_months":11,
-     *              "recharge_amount_in_three_months": 112
-     *            }
-     *        ]
-     *     }
-     */
-    function exportSendOrderBreakevenStats(Request $request)
-    {
-        $params = [];
-        $distribution_channel_id = $this->getChannelId();
-        $params['distribution_channel_id'] = $distribution_channel_id;
-        $request->has('end_date') && $request->input('end_date') && $params['end_date'] = $request->input('end_date');
-        $request->has('start_date') && $request->input('start_date') && $params['start_date'] = $request->input('start_date');
-        $data = SendOrderBreakevenStatsService::getInfos($params, true);
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "数据统计" . date("YmdHis") . ".csv");
-
-        echo("\"" . mb_convert_encoding("\"日期\",\"渠道id\",\"服务号id\",\"服务号名称\",\"粉丝数\",\"总粉丝数\",\"24小时取关用户数\",\"创建时间\",\"更新时间\",\"24小时充值\",\"72小时充值\",\"30天充值\",\"60天充值\",\"90天充值\"\r\n", "GBK", "UTF-8") . "\",");
-        if ($data) {
-            foreach ($data as $item) {
-
-                echo("\"" . mb_convert_encoding(date('Y-m-d', strtotime($item->date)), "GBK", "UTF-8") . "\",");
-                echo("\"" . $item->distribution_channel_id . "\",");
-                echo("\"" . $item->official_account_id . "\",");
-                echo("\"" . mb_convert_encoding($item->official_account_name, "GBK", "UTF-8") . "\",");
-                echo("\"" . $item->force_user_num . "\",");
-                echo("\"" . $item->total_force_user_num . "\",");
-                echo("\"" . $item->unsubscribe_in_one_day_user_num . "\",");
-                echo("\"" . mb_convert_encoding(date('Y-m-d H:i:s', strtotime($item->created_at)), "GBK", "UTF-8") . "\",");
-                echo("\"" . mb_convert_encoding(date('Y-m-d H:i:s', strtotime($item->updated_at)), "GBK", "UTF-8") . "\",");
-                echo("\"" . $item->recharge_amount_in_one_day . "\",");
-                echo("\"" . $item->recharge_amount_in_three_days . "\",");
-                echo("\"" . $item->recharge_amount_in_one_month . "\",");
-                echo("\"" . $item->recharge_amount_in_two_months . "\",");
-                echo("\"" . $item->recharge_amount_in_three_months . "\"\r\n");
-            }
-        }
-        exit();
-    }
-}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1351
app/Http/Controllers/Channel/SendOrder/SendOrderController.php


+ 0 - 35
app/Http/Controllers/Channel/SendOrder/SendOrderStatisticsController.php

@@ -1,35 +0,0 @@
-<?php
-/**
- * 派单统计数据
- */
-
-namespace App\Http\Controllers\Channel\SendOrder;
-
-use App\Http\Controllers\Channel\BaseController;
-use App\Modules\SendOrder\Services\SendOrderStatisticsService;
-use Hashids;
-use Illuminate\Http\Request;
-
-
-class SendOrderStatisticsController extends BaseController
-{
-    /**
-     * @apiDefine sendOrder 派单
-     */
-
-	/**
-	 * 渠道周报表数据
-	 * @param Request $request
-	 */
-    function getWeeklySendOrderStatistics(Request $request)
-    {
-        $distribution_channel_id = $this->getChannelId();
-        if(empty($distribution_channel_id)){
-        	return response()->error('PARAM_EMPTY');
-        }
-        $data = SendOrderStatisticsService::getWeeklySendOrderStatistics($distribution_channel_id);
-        \Log::info($data);
-        return response()->success($data);
-    }
-
-}

+ 0 - 0
app/Http/Controllers/Channel/SendOrder/Transformers/SendOrderBreakevenStatsTransformer.php


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä