Browse Source

delete no referance file 2

zz 6 years ago
parent
commit
43caa80629
100 changed files with 0 additions and 12519 deletions
  1. 0 80
      app/Http/Controllers/Finance/AuthController.php
  2. 0 32
      app/Http/Controllers/Finance/OfficialBillController.php
  3. 0 417
      app/Http/Controllers/Manage/Activity/ActivityController.php
  4. 0 25
      app/Http/Controllers/Manage/Activity/Transformers/ActivityChargeInfoTransformer.php
  5. 0 28
      app/Http/Controllers/Manage/Activity/Transformers/ActivityTransformer.php
  6. 0 29
      app/Http/Controllers/Manage/BadInfo/BookSensitiveStatController.php
  7. 0 37
      app/Http/Controllers/Manage/BadInfo/SensitiveChapterController.php
  8. 0 16
      app/Http/Controllers/Manage/BadInfo/Transformers/BookSensitiveStatTransformer.php
  9. 0 18
      app/Http/Controllers/Manage/BadInfo/Transformers/SensitiveChapterTransformer.php
  10. 0 66
      app/Http/Controllers/Manage/BaseController.php
  11. 0 66
      app/Http/Controllers/Manage/Book/BadBookController.php
  12. 0 81
      app/Http/Controllers/Manage/Book/BookCategoryController.php
  13. 0 1749
      app/Http/Controllers/Manage/Book/BookController.php
  14. 0 81
      app/Http/Controllers/Manage/Book/BookDomainController.php
  15. 0 95
      app/Http/Controllers/Manage/Book/BookGiftsController.php
  16. 0 279
      app/Http/Controllers/Manage/Book/BookPromotionController.php
  17. 0 96
      app/Http/Controllers/Manage/Book/BooksTagController.php
  18. 0 493
      app/Http/Controllers/Manage/Book/ChapterController.php
  19. 0 48
      app/Http/Controllers/Manage/Book/ChapterImageController.php
  20. 0 505
      app/Http/Controllers/Manage/Book/CpBookController.php
  21. 0 57
      app/Http/Controllers/Manage/Book/GatherController.php
  22. 0 196
      app/Http/Controllers/Manage/Book/ProductController.php
  23. 0 158
      app/Http/Controllers/Manage/Book/ReadRecordController.php
  24. 0 160
      app/Http/Controllers/Manage/Book/SuperiorBookController.php
  25. 0 35
      app/Http/Controllers/Manage/Book/SuspendBookController.php
  26. 0 16
      app/Http/Controllers/Manage/Book/Transformers/BadBookInfoTransformer.php
  27. 0 18
      app/Http/Controllers/Manage/Book/Transformers/BookDomainTransformer.php
  28. 0 19
      app/Http/Controllers/Manage/Book/Transformers/BookGiftDailyTransformer.php
  29. 0 19
      app/Http/Controllers/Manage/Book/Transformers/BookGiftTransformer.php
  30. 0 27
      app/Http/Controllers/Manage/Book/Transformers/BookPromotionCheckedTransformer.php
  31. 0 29
      app/Http/Controllers/Manage/Book/Transformers/BookPromotionTransformer.php
  32. 0 53
      app/Http/Controllers/Manage/Book/Transformers/BookTransformer.php
  33. 0 24
      app/Http/Controllers/Manage/Book/Transformers/ChapterListTransformer.php
  34. 0 22
      app/Http/Controllers/Manage/Book/Transformers/ChapterTransformer.php
  35. 0 16
      app/Http/Controllers/Manage/Book/Transformers/ProductTransformer.php
  36. 0 28
      app/Http/Controllers/Manage/Book/Transformers/SmartPushBookTransformer.php
  37. 0 21
      app/Http/Controllers/Manage/Book/Transformers/SuperiorHistoryBookTransformer.php
  38. 0 19
      app/Http/Controllers/Manage/Book/Transformers/SuspendBookTransformer.php
  39. 0 675
      app/Http/Controllers/Manage/Channel/BusinessChannelController.php
  40. 0 92
      app/Http/Controllers/Manage/Channel/BusinessChannelDataController.php
  41. 0 36
      app/Http/Controllers/Manage/Channel/ChannelActivityController.php
  42. 0 36
      app/Http/Controllers/Manage/Channel/ChannelDataController.php
  43. 0 83
      app/Http/Controllers/Manage/Channel/ChannelQuestionNaireController.php
  44. 0 290
      app/Http/Controllers/Manage/Channel/ChannelSellPlatformController.php
  45. 0 270
      app/Http/Controllers/Manage/Channel/ChannelUserController.php
  46. 0 495
      app/Http/Controllers/Manage/Channel/ChannelsController.php
  47. 0 487
      app/Http/Controllers/Manage/Channel/CompanyController.php
  48. 0 26
      app/Http/Controllers/Manage/Channel/Transformers/BusinessChannelDataTransformer.php
  49. 0 39
      app/Http/Controllers/Manage/Channel/Transformers/BusinessChannelDayStatTransformer.php
  50. 0 42
      app/Http/Controllers/Manage/Channel/Transformers/BusinessChannelStatTransformer.php
  51. 0 41
      app/Http/Controllers/Manage/Channel/Transformers/BusinessCompanyStatTransformer.php
  52. 0 46
      app/Http/Controllers/Manage/Channel/Transformers/BusinessStatDataTransformer.php
  53. 0 25
      app/Http/Controllers/Manage/Channel/Transformers/ChannelBookSellTransformer.php
  54. 0 17
      app/Http/Controllers/Manage/Channel/Transformers/ChannelQuestionNaireTransformer.php
  55. 0 19
      app/Http/Controllers/Manage/Channel/Transformers/ChannelSellPlatformTransformer.php
  56. 0 30
      app/Http/Controllers/Manage/Channel/Transformers/ChannelTransformer.php
  57. 0 32
      app/Http/Controllers/Manage/Channel/Transformers/ChannelUserTransformer.php
  58. 0 27
      app/Http/Controllers/Manage/Channel/Transformers/CompanyTransformer.php
  59. 0 98
      app/Http/Controllers/Manage/Cp/CpSubController.php
  60. 0 49
      app/Http/Controllers/Manage/Cp/Transformers/CpSubTransformer.php
  61. 0 86
      app/Http/Controllers/Manage/Finance/BaseController.php
  62. 0 132
      app/Http/Controllers/Manage/Finance/BillsController.php
  63. 0 68
      app/Http/Controllers/Manage/Finance/CashAccountsController.php
  64. 0 163
      app/Http/Controllers/Manage/Finance/CommissionRateController.php
  65. 0 126
      app/Http/Controllers/Manage/Finance/FinanceController.php
  66. 0 102
      app/Http/Controllers/Manage/Finance/FinancialConfigController.php
  67. 0 365
      app/Http/Controllers/Manage/Finance/FinancialStatController.php
  68. 0 51
      app/Http/Controllers/Manage/Finance/LiquidatedStatController.php
  69. 0 202
      app/Http/Controllers/Manage/Finance/LiquidationController.php
  70. 0 549
      app/Http/Controllers/Manage/Finance/PaymentController.php
  71. 0 121
      app/Http/Controllers/Manage/Finance/PaymentStatisticController.php
  72. 0 146
      app/Http/Controllers/Manage/Finance/TransformAccountRecordController.php
  73. 0 24
      app/Http/Controllers/Manage/Finance/Transformers/BillTransformer.php
  74. 0 29
      app/Http/Controllers/Manage/Finance/Transformers/CashAccountTransformer.php
  75. 0 22
      app/Http/Controllers/Manage/Finance/Transformers/CommissionRateTransformer.php
  76. 0 20
      app/Http/Controllers/Manage/Finance/Transformers/FinancialConfigTransformer.php
  77. 0 37
      app/Http/Controllers/Manage/Finance/Transformers/FinancialStatDetailTransformer.php
  78. 0 25
      app/Http/Controllers/Manage/Finance/Transformers/FinancialStatTransformer.php
  79. 0 26
      app/Http/Controllers/Manage/Finance/Transformers/LiquidatedStatTransformer.php
  80. 0 36
      app/Http/Controllers/Manage/Finance/Transformers/LiquidationTransformer.php
  81. 0 43
      app/Http/Controllers/Manage/Finance/Transformers/PaymentDetailTransformer.php
  82. 0 30
      app/Http/Controllers/Manage/Finance/Transformers/PaymentStatisticTransformer.php
  83. 0 29
      app/Http/Controllers/Manage/Finance/Transformers/PaymentTransformer.php
  84. 0 28
      app/Http/Controllers/Manage/Finance/Transformers/TransformAccountRecordTransformer.php
  85. 0 40
      app/Http/Controllers/Manage/Finance/Transformers/WithdrawCashFinancialTransformer.php
  86. 0 31
      app/Http/Controllers/Manage/Finance/Transformers/WithdrawCashTransformer.php
  87. 0 764
      app/Http/Controllers/Manage/Finance/WithdrawCashController.php
  88. 0 40
      app/Http/Controllers/Manage/ForceSub/ForceUsersDateActiveController.php
  89. 0 12
      app/Http/Controllers/Manage/ForceSub/Transformers/ForceUsersDateActiveTransformer.php
  90. 0 177
      app/Http/Controllers/Manage/Help/HelpController.php
  91. 0 53
      app/Http/Controllers/Manage/Help/JumpController.php
  92. 0 24
      app/Http/Controllers/Manage/Help/Transformers/HelpTransformer.php
  93. 0 118
      app/Http/Controllers/Manage/Manage/AccountController.php
  94. 0 64
      app/Http/Controllers/Manage/Manage/AuthController.php
  95. 0 132
      app/Http/Controllers/Manage/Manage/ManageController.php
  96. 0 23
      app/Http/Controllers/Manage/Manage/Transformers/ManageTransformer.php
  97. 0 14
      app/Http/Controllers/Manage/Manage/Transformers/ManageTransformer1.php
  98. 0 106
      app/Http/Controllers/Manage/Notice/NoticeTypesController.php
  99. 0 348
      app/Http/Controllers/Manage/Notice/NoticesController.php
  100. 0 0
      app/Http/Controllers/Manage/Notice/Transformers/NoticeSmsTransformer.php

+ 0 - 80
app/Http/Controllers/Finance/AuthController.php

@@ -1,80 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Finance;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Http\Request;
-use Cache;
-use DB;
-
-class AuthController extends Controller
-{
-    /**
-     * @apiDefine Manage 管理
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 管理后台登陆
-     * @api {POST} auth/login 管理后台登陆
-     * @apiGroup Manage
-     * @apiName login
-     * @apiParam {String}  username 账号.
-     * @apiParam {String}  password 密码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function login(Request $request)
-    {
-        $username = $request->has('username') ? trim($request->input('username')) : '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-        //return 1111;
-        if (!$username || !$password) {
-            //return '账号或者密码不能为空';
-             $msg = '账号或者密码不能为空';
-            return back()->withErrors(['message' => $msg]);
-        }
-
-        $user = DB::table('channel_users')->where('phone',$username)->select('id','password')->first();
-
-        if ($user && $user->password == md5($password . "^-^zhuishuyun^_^")) {
-            $request->session()->put('finance_manage_channel_uer_id', $user->id);
-            // 成功后跳后台
-            return redirect('/');
-        }
-        //return '账号或者密码错误';
-        $msg = '账号或者密码错误';
-        return back()->withErrors(['message' => $msg]);
-    }
-
-    function loginView(){
-        return view('finance.auth.login',['msg'=>'登录']);
-    }
-
-    /**
-     * Get a validator for an incoming registration request.
-     *
-     * @param  array $data
-     * @return \Illuminate\Contracts\Validation\Validator
-     */
-    protected function validator(array $data)
-    {
-        return Validator::make($data, [
-            'name' => 'required|max:255',
-            'email' => 'required|email|max:255|unique:users',
-            'password' => 'required|confirmed|min:6',
-        ]);
-    }
-
-    public function logout(Request $request)
-    {
-        $request->session()->forget('finance_manage_channel_uer_id');
-        return redirect()->to('/login');
-    }
-
-}

+ 0 - 32
app/Http/Controllers/Finance/OfficialBillController.php

@@ -1,32 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2018/6/29
- * Time: 15:48
- */
-
-namespace App\Http\Controllers\Finance;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use DB;
-class OfficialBillController extends Controller
-{
-
-    public function __construct()
-    {
-        $this->middleware(['official_finance']);
-    }
-
-    public function BillLists(){
-        $uid = session('finance_manage_channel_uer_id');
-        $data = DB::table('distribution_channels')
-            ->join('official_accounts','distribution_channels.id','=','official_accounts.distribution_channel_id')
-            ->join('official_account_day_sub_stats as a','a.appid','=','official_accounts.appid')
-            ->where('distribution_channels.channel_user_id',$uid)
-            ->select('a.appid','a.official_account_name',DB::raw('sum(a.reward_balance) as reward_balance'),DB::raw('sum(a.charge_balance) charge_balance'),DB::raw('sum(a.fee) as fee'),'a.month')
-            ->groupBy('a.month','a.appid','a.official_account_name')
-            ->paginate(30);
-        return view('finance.fiance.lists',['data'=>$data]);
-    }
-}

+ 0 - 417
app/Http/Controllers/Manage/Activity/ActivityController.php

@@ -1,417 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2018/1/29
- * Time: 19:45
- */
-
-namespace App\Http\Controllers\Manage\Activity;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Activity\Transformers\ActivityChargeInfoTransformer;
-use App\Http\Controllers\Manage\Activity\Transformers\ActivityTransformer;
-use App\Modules\Activity\Services\ActivityService;
-use App\Modules\Trade\Services\OrderService;
-use Illuminate\Http\Request;
-use OSS\Core\OssException;
-use OSS\OssClient;
-use App\Modules\Product\Services\ProductService;
-use Redis;
-use DB;
-use Storage;
-/**
- * 活动
- * Class ActivityController
- * @package App\Http\Controllers\Manage\Activity
- */
-class ActivityController extends Controller
-{
-    /**
-     * @apiDefine Activity 活动模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/getActivities 获取活动信息
-     * @apiGroup Activity
-     * @apiName getActivities
-     * @apiParam   {Number}  [activity_id] 活动ID
-     * @apiParam   {Number}  [distribution_channel_id] 渠道ID
-     * @apiParam   {String}  [start_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}  totalOrderCount 总订单数
-     * @apiSuccess {Number}  successOrderCount 成功订单数
-     * @apiSuccess {Number}  totalChargeAmount 活动的总充值额
-     * @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,
-     *              "totalOrderCount": 50,
-     *              "successOrderCount": 50
-     *            }
-     *        ]
-     *     }
-     */
-    function getActivities(Request $request)
-    {
-        $params = [];
-        $request->has('end_time') && $request->input('end_time') && $params['end_time'] = trim($request->input('end_time'));
-        $request->has('start_time') && $request->input('start_time') && $params['begin_time'] = $request->input('start_time');
-        $request->has('activity_id') && $request->input('activity_id') && $params['activity_id'] = $request->input('activity_id');
-        $params['distribution_channel_id'] = [0];
-        $activities = ActivityService::search($params);
-        $distribution_channel_id = 0;
-        foreach ($activities as $item) {
-            $activity_id = $item->id;
-            if ($distribution_channel_id) {
-                $item->totalChargeAmount = OrderService::getAmount(['activity_id' => $activity_id, 'distribution_channel_id' => $distribution_channel_id]);
-                $item->totalOrderCount = OrderService::getActivityOrderNum(['activity_id' => $activity_id, 'distribution_channel_id' => $distribution_channel_id]);
-                $item->successOrderCount = OrderService::getActivityOrderNum(['activity_id' => $activity_id, 'status' => 'PAID', 'distribution_channel_id' => $distribution_channel_id]);
-            } else {
-                $item->totalChargeAmount = OrderService::getAmount(['activity_id' => $activity_id,'begin_time'=>$item->start_time,'end_time'=>$item->end_time]);
-                $item->totalOrderCount = OrderService::getActivityOrderNum(['activity_id' => $activity_id,'begin_time'=>$item->start_time,'end_time'=>$item->end_time]);
-                $item->successOrderCount = OrderService::getActivityOrderNum(['activity_id' => $activity_id, 'status' => 'PAID','begin_time'=>$item->start_time,'end_time'=>$item->end_time]);
-            }
-        }
-        return response()->pagination(new ActivityTransformer(), $activities);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {GET} activity/delActivity 删除活动
-     * @apiGroup Activity
-     * @apiName delActivity
-     * @apiParam   {Number}  activity_id 活动ID
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *        ]
-     *     }
-     */
-    function delActivity(Request $request){
-        $activity_id = $request->has('activity_id') ? $request->input('activity_id') : '';
-        if (empty($activity_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        //$activity = ActivityService::getById($activity_id);
-        //if($activity)
-        DB::table('activity')->where('id',$activity_id)->update(['distribution_channel_id'=>14,'updated_at'=>date('Y-m-d H:i:s')]);
-        return response()->success();
-    }
-    /**
-     * @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/ChannelActivityStats 获取明细
-     * @apiGroup Activity
-     * @apiName ChannelActivityStats
-     * @apiParam   {Number}  activity_id 活动ID
-     * @apiSuccess {Number}  sum 充值金额.
-     * @apiSuccess {Number}  site_id site_id.
-     * @apiSuccess {String}  nickname 商户名称.
-     * @apiSuccess {String}  allorder 订单比数.
-     * @apiSuccess {String}  success 成功顶顶单数
-     * @apiSuccess {Number}  rate 成功订单率
-     * @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 ChannelActivityStats(Request $request){
-        $activity_id = $request->has('activity_id') ? $request->input('activity_id') : '';
-        if (empty($activity_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $activity = ActivityService::getById($activity_id);
-
-        $sql_fromat = "SELECT a.*,distribution_channels.nickname from(
-SELECT a.sum,a.success,b.allorder,b.distribution_channel_id
-from (
-SELECT distribution_channel_id,SUM(price) as sum,  COUNT(*) as success
-FROM orders WHERE created_at BETWEEN '%s' and '%s' and activity_id = %s and `status` = 'PAID' GROUP BY distribution_channel_id
-) a
-RIGHT  join (
-SELECT distribution_channel_id, COUNT(*) as allorder
-FROM orders WHERE created_at BETWEEN '%s' and '%s' and activity_id = %s  GROUP BY distribution_channel_id
-) b on a.distribution_channel_id =b.distribution_channel_id
-) a join distribution_channels on a.distribution_channel_id=distribution_channels.id";
-
-        $sql = sprintf($sql_fromat,$activity->start_time,$activity->end_time,$activity->id,$activity->start_time,$activity->end_time,$activity->id);
-        $res = DB::select($sql);
-        foreach ($res as &$v){
-            $v->rate = '-';
-            if(isset($v->success) && !empty($v->success) && isset($v->allorder) && !empty($v->allorder)){
-                $v->rate = sprintf("%.2f", ($v->success/$v->allorder)*100).'%';
-            }
-        }
-
-        return response()->success($res);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @api {POST} activity/createdActivity 创捷活动
-     * @apiGroup Activity
-     * @apiName createdActivity
-     * @apiParam   {String} name  活动名称
-     * @apiParam   {String} start_time  开始时间
-     * @apiParam   {String} end_time  结束时间
-     * @apiParam   {String} price  单价
-     * @apiParam   {String} page_bd_img  活动页面背景
-     * @apiParam   {String} page_btn_pre_img  活动未开始按钮
-     * @apiParam   {String} page_btn_doing_img  活动开始按钮
-     * @apiParam   {String} page_btn_end_img  活动结束按钮
-     * @apiParam   {String} template_name  模板名称
-     * @apiParam   {String} template_content  模板内容
-     * @apiParam   {String} common_template_id  模板id
-     * @apiParam   {String} customer_img  客服消息图片
-     * @apiParam   {String} customer_title  客服消息标题
-     * @apiParam   {String} wap_bottom_img  章节阅读页底部图片
-     * @apiParam   {String} sign_call_back_text  签到回调推广标题
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    public function createdActivity(Request $request)
-    {
-        $token = str_random(32);
-        $param = [];
-        $param['name'] = $request->input('name');
-        $param['start_time'] = $request->input('start_time');
-        $param['end_time'] = $request->input('end_time');
-        $param['price'] = $request->input('price');
-        $param['page_bd_img'] = $request->input('page_bd_img');
-        $param['page_btn_pre_img'] = $request->input('page_btn_pre_img');
-        $param['page_btn_doing_img'] = $request->input('page_btn_doing_img');
-        $param['page_btn_end_img'] = $request->input('page_btn_end_img');
-
-        $check = checkParam($param, ['name', 'start_time', 'end_time', 'price', 'page_bd_img', 'page_btn_pre_img', 'page_btn_doing_img', 'page_btn_end_img']);
-        if ($check) {
-            return response()->error("PARAM_EMPTY", ['lack' => $check]);
-        }
-        $reward = $request->input('reward');
-        if ($reward) {
-            $reward *= 100;
-        }
-        $product = ProductService::addProduct([
-            'price' => (int)$param['price'],
-            'type' => 'TICKET_RECHARGE',
-            'given' => $reward,
-            'is_default' => 0,
-            'is_enabled' => 0,
-        ]);
-        $activity_settng_key = 'activity:setting';
-
-        $template_name = $request->input('template_name');
-        $template_content = $request->has('template_content') ? $request->input('template_content') : '';
-        $common_template_id = $request->has('common_template_id') ? $request->input('common_template_id') : '';
-        $customer_img = $request->input('customer_img');
-        $customer_title = $request->input('customer_title');
-        $wap_bottom_img = $request->input('wap_bottom_img');
-        $sign_call_back_text = $request->input('sign_call_back_text');
-        Redis::del($activity_settng_key);
-
-        $customer_msg = json_encode([
-            'pic' => $customer_img,
-            'title' => $customer_title
-        ]);
-        $page_img['page_bd_img'] = $param['page_bd_img'];
-        $page_img['page_btn_pre_img'] = $param['page_btn_pre_img'];
-        $page_img['page_btn_doing_img'] = $param['page_btn_doing_img'];
-        $page_img['page_btn_end_img'] = $param['page_btn_end_img'];
-
-        $activity = ActivityService::createActivity([
-            'name' => $param['name'],
-            'start_time' => $param['start_time'],
-            'end_time' => $param['end_time'],
-            'activity_page' => '/sale?token=' . $token,
-            'product_id' => $product->id,
-            'token' => $token,
-            'customer_msg' => $customer_msg,
-            'setting' => json_encode($page_img)
-        ]);
-
-        if ($template_content && $common_template_id) {
-            $wechat_public_templates = DB::table('wechat_public_templates')->select('id')->where('common_template_id',$common_template_id)->first();
-            if($wechat_public_templates){
-                $id = DB::table('default_template_themes')->insertGetId([
-                    'title' => $template_name,
-                    'activity_id' => $activity->id,
-                    'template_id' => $wechat_public_templates->id,
-                    'template_content' => '['.$template_content.']',
-                    'created_at' => date('Y-m-d H:i:s'),
-                    'updated_at' => date('Y-m-d H:i:s'),
-                ]);
-
-                DB::table('activity')->where('id',$activity->id)->update([
-                    'default_template_id' => $id
-                ]);
-            }
-        }
-        $setting = ['activity_id' => $activity->id, 'wap_bottom_img' => $wap_bottom_img, 'sign_call_back_text' => $sign_call_back_text,'activity_title'=>''];
-        Redis::set($activity_settng_key, json_encode($setting));
-        return response()->success();
-    }
-
-    public function uploadImg(Request $request)
-    {
-
-        if (!$request->hasFile('photo')) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $file = $request->file('photo');
-
-        $extension = $file->extension();
-        $file_name = date('YmdHis') . '.' . $extension;
-        $upload_res = $this->ossObject()->uploadFile(env('OSS_BUCKET','zhuishuyun'), 'book/cover/' . $file_name, $file->path());
-        $data = ['cover' => $upload_res['oss-request-url']];
-        return response()->success($data);
-    }
-
-    private function ossObject()
-    {
-        $accessKeyId = env('OSS_ACCESS_ID');
-        $accessKeySecret = env('OSS_ACCESS_KEY');
-        $endpoint = env('OSS_END_POINT');
-        $ossClient = null;
-        try {
-            $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
-        } catch (OssException $e) {
-            return null;
-        }
-        return $ossClient;
-    }
-
-    /**
-     * 活动导出
-     * @param Request $request
-     * @return $this|\Symfony\Component\HttpFoundation\BinaryFileResponse
-     */
-    public function exportActivity(Request $request){
-        set_time_limit(0);
-        $id = $request->input('activity_id');
-        if (!$id) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $info = ActivityService::ActivityStatsI($id);
-        $filename = 'Activit'.date('YmdHis').'.csv';
-
-        Storage::append($filename,mb_convert_encoding("日期,site id,活动页面访问uv,按钮uv,生成订单数,成功支付订单数,首充用户数,点击阅读页面文字链uv,阅读页面文字链订单数,阅读页面文字链成功订单数,阅读页面文字链首充用户数,签到回调文字链uv,签到回调文字链生成订单数,签到回调文字链成功成功订单数,签到回调文字链首充用户数",'gbk'));
-        $str = '';
-        foreach ($info as $val){
-            $str .= "{$val['day']},{$val['siteid']},{$val['uv']},{$val['button_uv']},{$val['order_num']},{$val['success_order_num']},{$val['first_charge_num']},{$val['reader_uv']},{$val['reader_order']},{$val['reader_success_order']},{$val['reader_first_charge']},{$val['signcallback_uv']},{$val['signcallback_order']},{$val['signcallback_success_order']},{$val['signcallback_first_charge']}\r\n";
-        }
-        Storage::append($filename,mb_convert_encoding($str,'gbk'));
-        return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-    }
-
-    /**
-     * 包年活动导出
-     * @param Request $request
-     * @return $this|\Symfony\Component\HttpFoundation\BinaryFileResponse
-     */
-    public function yearActivityExport(Request $request){
-        set_time_limit(0);
-        $id = $request->input('activity_id');
-        if (!$id) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $info = ActivityService::yearActivityStats($id);
-        $filename = 'Activit'.date('YmdHis').'.csv';
-
-        Storage::append($filename,mb_convert_encoding("site id,日期,充值档位,订单数,成功订单数,UV,首充人数,充值总额",'gbk'));
-        $str = '';
-        foreach ($info as $val){
-            $str .= "{$val['siteid']},{$val['day']},{$val['price']},{$val['order_num']},{$val['success']},{$val['uv']},{$val['first_charge']},{$val['sums']}\r\n";
-        }
-        Storage::append($filename,mb_convert_encoding($str,'gbk'));
-        return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-    }
-}

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

@@ -1,25 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Manage\Activity\Transformers;
-
-class ActivityChargeInfoTransformer
-{
-    public function transform($activityChargeItem)
-    {
-        return [
-            'uid' => $activityChargeItem->uid,
-            'trade_no' => $activityChargeItem->trade_no,
-            'price' => (float)$activityChargeItem->price,
-            '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 - 28
app/Http/Controllers/Manage/Activity/Transformers/ActivityTransformer.php

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

+ 0 - 29
app/Http/Controllers/Manage/BadInfo/BookSensitiveStatController.php

@@ -1,29 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\BadInfo;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\BadInfo\Transformers\BookSensitiveStatTransformer;
-use App\Modules\BadInfo\Services\BookSensitiveStatService;
-
-use DB;
-use Hashids;
-use Illuminate\Http\Request;
-
-
-class BookSensitiveStatController extends Controller
-{
-    /**
-     * 不良书籍信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function index(Request $request)
-    {
-        $stats = BookSensitiveStatService::getCurrentObj()->paginate();
-        return response()->pagination(new BookSensitiveStatTransformer(), $stats);
-    }
-
-
-}
-

+ 0 - 37
app/Http/Controllers/Manage/BadInfo/SensitiveChapterController.php

@@ -1,37 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\BadInfo;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\BadInfo\Transformers\SensitiveChapterTransformer;
-use App\Modules\BadInfo\Services\SensitiveChapterService;
-use App\Modules\BadInfo\Services\BookSensitiveStatService;
-
-use App\Modules\Book\Services\ChapterService;
-use Illuminate\Http\Request;
-
-
-class SensitiveChapterController extends Controller
-{
-    /**
-     * 不良章节
-     * @param Request $request
-     * @return mixed
-     */
-    public function index(Request $request)
-    {
-        $bid = $request->has('bid') ? $request->input('bid') : null;
-        $time = BookSensitiveStatService::getMaxTime();
-        if(!$bid) return response()->error('PARAM_ERROR');
-
-        $chapters = SensitiveChapterService::getListObj(compact('bid','time'))->paginate();
-        foreach ($chapters as $chapter)
-        {
-            $chapter->content = ChapterService::getChapterById($chapter->cid)->content;
-        }
-        return response()->pagination(new SensitiveChapterTransformer(), $chapters);
-    }
-
-
-}
-

+ 0 - 16
app/Http/Controllers/Manage/BadInfo/Transformers/BookSensitiveStatTransformer.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\BadInfo\Transformers;
-
-class BookSensitiveStatTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'bid' => $item->bid,
-            'num' => $item->num,
-            'book_name' => $item->book_name,
-            'time'=>date('Y-m-d H:i:s',$item->time)
-        ];
-    }
-}

+ 0 - 18
app/Http/Controllers/Manage/BadInfo/Transformers/SensitiveChapterTransformer.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\BadInfo\Transformers;
-
-class SensitiveChapterTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'bid' => $item->bid,
-            'cid' => $item->cid,
-            'name' => $item->name,
-            'words' => $item->words,
-            'sequence' => $item->sequence,
-            'content'=>$item->content
-        ];
-    }
-}

+ 0 - 66
app/Http/Controllers/Manage/BaseController.php

@@ -1,66 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/22
- * Time: 下午1:41
- */
-
-namespace App\Http\Controllers\Manage;
-
-use App\Http\Controllers\Controller;
-
-class BaseController extends Controller
-{
-
-
-    //获取当前登录用户ID
-    function getLoginUserId() {
-        if(empty(session('manage_user'))) {
-            if(env('APP_ENV') =='local') return 1;
-        }
-
-        $user = unserialize(session('manage_user'));
-        return $user->id;
-    }
-
-    //获取当前登录用户角色
-    function getLoginUserRole() {
-        if(empty(session('manage_user'))) {
-            if(env('APP_ENV') =='local') return 'admin';
-        }
-
-        $user = unserialize(session('manage_user'));
-        return $user->role;
-    }
-    
-    //获取当前登录用户
-    function getLoginUserAccount() {
-    	if(empty(session('manage_user'))) {
-    		if(env('APP_ENV') =='local') return 'admin';
-    	}
-    
-    	$user = unserialize(session('manage_user'));
-    	return $user->account;
-    }
-
-    function getLoginUser() {
-        if(empty(session('manage_user'))) {
-            if(env('APP_ENV') =='local') return '';
-        }
-
-        $user = unserialize(session('manage_user'));
-        return $user;
-    }
-    
-    // 编辑权限
-    function  checkEditRole(){
-    	// check 当前是老司机才有权限
-    	$account = $this->getLoginUserAccount();
-    	
-    	if($account == 'zsy_sjj' || $account == 'zsy_zlj' || $account == 'zsy_gdy'){
-    		return true;
-    	}
-    	return false;
-    }
-}

+ 0 - 66
app/Http/Controllers/Manage/Book/BadBookController.php

@@ -1,66 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Book\Transformers\BadBookInfoTransformer;
-use App\Modules\Book\Services\BadBookInfoService;
-use DB;
-use Hashids;
-use Illuminate\Http\Request;
-use OSS\Core\OssException;
-use OSS\OssClient;
-use Storage;
-
-class BadBookController extends Controller
-{
-    /**
-     * 添加不良书籍信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function addBadBookInfo(Request $request)
-    {
-        $badInfo = trim($request->input('badInfo'));
-        if (empty($badInfo)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $data = BadBookInfoService::addBadInfo(compact('badInfo'));
-        if ($data) {
-            return response()->success();
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-    /**
-     * 添加不良书籍信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function editBadBookInfo(Request $request)
-    {
-        $id = $request->input('id');
-        $badInfo = trim($request->input('badInfo'));
-        if (empty($badInfo) || !$id) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $data = BadBookInfoService::editBadInfo(compact('id','badInfo'));
-        if ($data) {
-            return response()->success();
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-    /**获取不良书籍信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function getBadBookInfos(Request $request)
-    {
-        $data = BadBookInfoService::getBadInfos(false);
-        return response()->pagination(new BadBookInfoTransformer(), $data);
-    }
-}
-

+ 0 - 81
app/Http/Controllers/Manage/Book/BookCategoryController.php

@@ -1,81 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Modules\Book\Services\BookCategoryService;
-use App\Modules\Book\Services\BookService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class BookCategoryController extends Controller
-{
-    /**
-     * @apiDefine Book 图书模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取分类
-     * @api {get} books/getCategory 获取分类
-     * @apiGroup Book
-     * @apiName getCategory
-     * @apiParam   {int}    [all]      全部
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:  [
-     *                   {
-     *                   id: 1,
-     *                   name: "男频",
-     *                   children: [
-     *                           {
-     *                               id: 7,
-     *                               name: "灵异鬼怪"
-     *                           },
-     *                           {
-     *                               id: 8,
-     *                               name: "历史穿越"
-     *                           },
-     *                           {
-     *                               id: 30,
-     *                               name: "青春爱情"
-     *                           }
-     *                       ]
-     *                   },
-     *                   {
-     *                   id: 2,
-     *                   name: "女频",
-     *                   children: [
-     *                           {
-     *                               id: 26,
-     *                               name: "豪门总裁"
-     *                           },
-     *                           {
-     *                               id: 35,
-     *                               name: "民国爱情"
-     *                           }
-     *                       ]
-     *                   }
-     *               ]
-     *       }
-     */
-    public function getCategory(Request $request){
-        $all = $request->input('all');
-        $res = BookCategoryService::getCategory($all);
-        foreach ($res as &$v){
-            $v['value'] = $v['id'];
-            $v['label'] = $v['name'];
-            foreach ($v['children'] as &$val){
-                $val['value'] = $val['id'];
-                $val['label'] = $val['name'];
-            }
-
-        }
-        return response()->success($res);
-    }
-}

File diff suppressed because it is too large
+ 0 - 1749
app/Http/Controllers/Manage/Book/BookController.php


+ 0 - 81
app/Http/Controllers/Manage/Book/BookDomainController.php

@@ -1,81 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use App\Modules\Book\Services\BookDomainService;
-use App\Http\Controllers\Manage\Book\Transformers\BookDomainTransformer;
-class BookDomainController extends Controller
-{
-
-    /**
-     * @apiDefine Book 图书模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取图书域名
-     * @api {get} books/domain 获取图书域名
-     * @apiGroup Book
-     * @apiName getBookDomain
-     * @apiSuccess {int}         code          态码
-     * @apiSuccess {String}      msg           信息
-     * @apiSuccess {object}      data          结果集
-     * @apiSuccess {Int}         data.id       id
-     * @apiSuccess {String}      data.domain   域名
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *       {
-     *           code: 0,
-     *           msg: "",
-     *           data: [
-     *               {
-     *                   id: 1,
-     *                   domain: "aizhuishu.com"
-     *               },
-     *               {
-     *                   id: 2,
-     *                   domain: "leyue"
-     *               }
-     *           ]
-     *       }
-     */
-    public function getBookDomain(){
-        $res = BookDomainService::getEnableDomain();
-        return response()->collection(new BookDomainTransformer(),$res);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 图书域名添加
-     * @api {post} books/domain 图书域名添加
-     * @apiParam {String} domain 图书域名添加
-     * @apiGroup Book
-     * @apiName addBookDomain
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *     }
-     */
-    public function addBookDomain(Request $request){
-        $domain = $request->input('domain');
-        if(empty($domain)){
-            return response()->error('PARAM_EMPTY');
-        }
-
-        if(BookDomainService::isExists($domain)){
-            return response()->error('PARAM_ERROR');
-        }
-        BookDomainService::addDomain(['domain'=>$domain,'is_enabled'=>1]);
-        return response()->success();
-    }
-}

+ 0 - 95
app/Http/Controllers/Manage/Book/BookGiftsController.php

@@ -1,95 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Manage\Book\Transformers\BookGiftDailyTransformer;
-use App\Http\Controllers\Manage\Book\Transformers\BookGiftTransformer;
-use App\Modules\Book\Services\BookCategoryService;
-use App\Modules\Book\Services\BookConfigService;
-use App\Modules\Book\Services\BookGiftsService;
-use App\Modules\Book\Services\BookService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class BookGiftsController extends Controller
-{
-    /**
-     * 获取按书统计送礼数据
-     * @param Request $request
-     * @return mixed
-     */
-   public function getBookGiftsStatsByBook(Request $request){
-        $time = $request->input('time','');
-        if(!in_array($time,['last_week','last_month','today'])){
-            return response()->error('PARAM_ERROR');
-        }
-        if($time=='last_week'){
-            $start = date('Y-m-d H:i:s',mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y')));
-            $end =  date('Y-m-d H:i:s',mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y')));
-        }
-        if($time=='last_month'){
-            $start = date('Y-m-01 00:00:00',strtotime('-1 month'));
-            $end =  date('Y-m-d 23:59:59',strtotime(date('Y-m-01 H:i:s -1 day')));
-        }
-        if($time=='today'){
-            $start = date('Y-m-d 00:00:00');
-            $end =  date('Y-m-d 23:59:59');
-        }
-        $res = BookGiftsService::getGiftsSendStatisticByBook($start,$end);
-        foreach ($res as $value){
-            $res->book_name = (BookConfigService::getBookById($value->bid))->book_name;
-        }
-        return response()->pagination(new BookGiftTransformer(),$res);
-   }
-
-    /**
-     * 获取按礼物分组统计送礼数据
-     * @param Request $request
-     * @return mixed
-     */
-    public function getBookGiftsStatsByGift(Request $request){
-        $time = $request->input('time','');
-        if(!in_array($time,['last_week','last_month','today'])){
-            return response()->error('PARAM_ERROR');
-        }
-        if($time=='last_week'){
-            $start = date('Y-m-d H:i:s',mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y')));
-            $end =  date('Y-m-d H:i:s',mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y')));
-        }
-        if($time=='last_month'){
-            $start = date('Y-m-01 00:00:00',strtotime('-1 month'));
-            $end =  date('Y-m-d 23:59:59',strtotime(date('Y-m-01 H:i:s -1 day')));
-        }
-        if($time=='today'){
-            $start = date('Y-m-d 00:00:00');
-            $end =  date('Y-m-d 23:59:59');
-        }
-        $res = BookGiftsService::getGiftsSendStatisticByGift($start,$end);
-
-        return response()->pagination(new BookGiftTransformer(),$res);
-    }
-
-    /**
-     * 获取按书分组每日送礼统计
-     * @param Request $request
-     * @return mixed
-     */
-    public function getBookGiftDailyStatsByBook(Request $request) {
-        $start = $request->input('start_date','');
-        $end = $request->input('end_date','');
-        $res = BookGiftsService::getGiftsSendDaillyStatsByBook($start,$end);
-        return response()->pagination(new BookGiftDailyTransformer(),$res);
-    }
-
-    /**
-     * 获取按书分组每日送礼统计
-     * @param Request $request
-     * @return mixed
-     */
-    public function getBookGiftDailyStatsByGift(Request $request) {
-        $res = BookGiftsService::getGiftsSendDaillyStatsByGift();
-        return response()->pagination(new BookGiftDailyTransformer(),$res);
-    }
-
-
-}

+ 0 - 279
app/Http/Controllers/Manage/Book/BookPromotionController.php

@@ -1,279 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Book\Transformers\BookPromotionCheckedTransformer;
-use App\Http\Controllers\Manage\Book\Transformers\BookPromotionTransformer;
-use App\Modules\Book\Models\BookConfig;
-use App\Modules\Book\Models\BookPromotionChecked;
-use App\Modules\Book\Services\BookConfigService;
-use App\Modules\Book\Services\BookPromotionCheckedService;
-use App\Modules\Channel\Models\Channel;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Manage\Services\ManageService;
-use App\Modules\SendOrder\Models\SendOrder;
-use App\Modules\SendOrder\Models\SendOrderStat;
-use App\Modules\SendOrder\Services\SendOrderService;
-use App\Modules\SendOrder\Services\SendOrderStatService;
-use Cache;
-use Cookie;
-use DB;
-use Illuminate\Http\Request;
-use Storage;
-
-class BookPromotionController extends Controller
-{
-    /**
-     * @apiDefine BookPromotion 书籍推广
-     */
-
-
-    /**
-     * 获取书籍推广数据
-     * @param Request $request
-     */
-    public function getBookPromotionInfo(Request $request)
-    {
-        $result = [];
-        $end_date = $request->input('end_date');
-        $book_name = $request->input('book_name');
-        $begin_date = $request->input('begin_date');
-        $orderBy = $request->input('orderBy');
-        $company_name = $request->input('company_name');
-
-        $manageId = $request->session()->get('manage_auth');
-        if ($manageId) {
-            $manageModel = ManageService::getById($manageId);
-            if ($manageModel) {
-                $role = $manageModel->role;
-                $channels = ($role == 'admin' || $role == 'business_leader') ? [] : ChannelService::getChannelIdList($manageId);
-                $param = compact('company_name', 'book_name', 'begin_date', 'end_date', 'orderBy');
-                $result = SendOrderStatService::getChannelPromotionBook($channels, $param, false);
-                foreach ($result as &$item) {
-                    $company_id = $item->company_id;
-                    $channels = Channel::getChanneIdByCompanyId($company_id);
-                    $params = [
-                        'channels' => $channels,
-                        'book_id' => $item->bid,
-                        'begin_time' => $item->date,
-                        'end_time' => $item->date . ' 23:59:59'
-                    ];
-                    if (!$item->uv_three_day) {
-                        $item->uv_three_day = 0;
-                    }
-
-                    if (!$item->percent_recharge_devide_uv_three_day) {
-                        $item->percent_recharge_devide_uv_three_day = 0;
-                    }
-                    $item->send_order_count = SendOrderService::getPromotionCount($params);
-                    $item->percent_recharge_devide_uv = number_format($item->percent_recharge_devide_uv, 2);
-                }
-            }
-        }
-        return response()->pagination(new BookPromotionTransformer(), $result);
-    }
-
-
-    /**
-     * 设置当期推广的书籍的信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function setPromotionStatus_v1(Request $request)
-    {
-        $cacheKey = 'setPromotionStatus';
-        $book_id = $request->input('book_id');
-        $promotion_status = $request->input('promotion_status', 0);
-
-        $tempBookString = '';
-        $exist = Cache::get($cacheKey, '');
-        if (1 == $promotion_status) {
-            $tempBookString = $exist . ',' . $book_id;
-            Cache::put($cacheKey, $tempBookString, 3 * 24 * 60);
-        } else {
-            $book_ids = explode(',', $exist);
-            foreach ($book_ids as $book_id_item) {
-                if (!empty($book_id_item) && $book_id_item != $book_id) {
-                    $tempBookString = $tempBookString . ',' . $book_id_item;
-                }
-
-                if ($book_id_item == $book_id) {
-                    Cache::forget('infos' . $book_id);
-                }
-            }
-            Cache::put($cacheKey, $tempBookString, 3 * 24 * 60);
-        }
-        return response()->success(['promotion_status' => $promotion_status, 'tempBookString' => $tempBookString]);
-    }
-
-    public function setPromotionStatus(Request $request)
-    {
-        //$cacheKey = 'setPromotionStatus';
-        $book_id = $request->input('book_id');
-        $promotion_status = $request->input('promotion_status', 0);
-
-
-        if (1 == $promotion_status) {
-            BookConfig::where('bid', $book_id)->update(['is_current_week_promotion' => 1]);
-        } else {
-            BookConfig::where('bid', $book_id)->update(['is_current_week_promotion' => 0]);
-        }
-        return response()->success(['promotion_status' => $promotion_status]);
-    }
-
-    public function commitPromotionStatus(Request $request)
-    {
-        $cacheKey = 'setPromotionStatus';
-        $bidString = Cache::get($cacheKey, '');
-        $book_ids = explode(',', $bidString);
-        $period = BookPromotionCheckedService::getMaxPeriod();
-        foreach ($book_ids as $book_id) {
-            if ($book_id) {
-                $book = Cache::get('infos' . $book_id);
-                if ($book) {
-                    $book = json_decode($book, true);
-                    $book['onshelf_date'] = $book['created_at'];
-                    unset($book['created_at']);
-                    $book['periods'] = $period;
-                    BookPromotionCheckedService::create($book);
-                    Cache::forget('infos' . $book_id);
-                }
-            }
-        }
-        Cache::forget($cacheKey);
-        return response()->success();
-    }
-
-    public function getPromotionBooksUnCheck(Request $request)
-    {
-        $res = [];
-        $exist = Cache::get('setPromotionStatus', '');
-        $operator = unserialize($request->session()->get('manage_user'))->nickname;
-        $book_ids = explode(',', $exist);
-        foreach ($book_ids as $book_id) {
-            $book_info = Cache::get('infos' . $book_id);
-            if ($book_info) {
-                $book_info = json_decode($book_info, true);
-            } else {
-                $book_info = $this->getBookPromotionData($operator, $book_id);
-            }
-            if ($book_info) {
-                $res[] = $book_info;
-            }
-        }
-        return response()->success($res);
-    }
-
-
-    public function getPromotionBooksChecked(Request $request)
-    {
-        $periods = $request->input('periods');
-        $result = BookPromotionChecked::getInfo($periods, false);
-        return response()->pagination(new BookPromotionCheckedTransformer(), $result);
-    }
-
-
-    private function getBookPromotionData($operator, $book_id)
-    {
-        $book_config = BookConfigService::getBookById($book_id);
-
-        if ($book_config) {
-            $data = [];
-            $data['book_id'] = $book_id;
-            $data['operator'] = $operator;
-            $data['size'] = $book_config->size;
-            $data['status'] = $book_config->status;
-            $data['author'] = $book_config->author;
-            $data['book_name'] = $book_config->book_name;
-            $data['cp_source'] = $book_config->cp_source;
-            $data['created_at'] = date("Y-m-d H:i:s", strtotime($book_config->created_at));
-            $data['is_on_shelf'] = $book_config->is_on_shelf;
-
-            $now_time = date('Y-m-d H:i:s', strtotime(time()));
-            $send_30_day_time = date('Y-m-d H:i:s', strtotime(time()) - 86400 * 30);
-
-            $recharge_amount_in_24h_outside = SendOrderStat::getRechargeAmountByBookId(['book_id' => $book_id, 'start_time' => $send_30_day_time, 'end_time' => $now_time], true, true);
-            $recharge_amount_in_24h_inside = SendOrderStat::getRechargeAmountByBookId(['book_id' => $book_id, 'start_time' => $send_30_day_time, 'end_time' => $now_time], false, true);
-            $recharge_amount_in_72h_inside = SendOrderStat::getRechargeAmountByBookId(['book_id' => $book_id, 'start_time' => $send_30_day_time, 'end_time' => $now_time], false, false);
-            $recharge_amount_in_72h_outside = SendOrderStat::getRechargeAmountByBookId(['book_id' => $book_id, 'start_time' => $send_30_day_time, 'end_time' => $now_time], true, false);
-
-            //获取一个月内的总派单书
-            $promotionCount = SendOrder::getDuringPromotionCountByBid($book_id, $send_30_day_time, $now_time);
-            if (is_numeric($promotionCount) && $promotionCount > 0) {
-                $recharge_amount_in_24h_outside = $recharge_amount_in_24h_outside / $promotionCount;
-                $recharge_amount_in_24h_inside = $recharge_amount_in_24h_inside / $promotionCount;
-                $recharge_amount_in_72h_inside = $recharge_amount_in_72h_inside / $promotionCount;
-                $recharge_amount_in_72h_outside = $recharge_amount_in_72h_outside / $promotionCount;
-            }
-
-            $data['recharge_amount_in_24h_outside'] = $recharge_amount_in_24h_outside ? $recharge_amount_in_24h_outside : 0;
-            $data['recharge_amount_in_24h_inside'] = $recharge_amount_in_24h_inside ? $recharge_amount_in_24h_inside : 0;
-            $data['recharge_amount_in_72h_inside'] = $recharge_amount_in_72h_inside ? $recharge_amount_in_72h_inside : 0;
-            $data['recharge_amount_in_72h_outside'] = $recharge_amount_in_72h_outside ? $recharge_amount_in_72h_outside : 0;
-            Cache::put("infos" . $book_id, json_encode($data), 3 * 24 * 60);
-            return $data;
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * 导出书籍推广数据
-     * @param Request $request
-     */
-    public function exportBookPromotionInfo(Request $request)
-    {
-        set_time_limit(0);
-        $end_date = $request->input('end_date');
-        $book_name = $request->input('book_name');
-        $begin_date = $request->input('begin_date');
-        $orderBy = $request->input('orderBy');
-        $company_name = $request->input('company_name');
-
-        $manage_id = $request->session()->get('manage_auth');
-        if ($manage_id) {
-            $manageModel = ManageService::getById($manage_id);
-            if ($manageModel) {
-                $role = $manageModel->role;
-                $channels = ($role == 'admin' || $role == 'business_leader') ? [] : ChannelService::getChannelIdList($manage_id);
-                $param = compact('company_name', 'book_name', 'begin_date', 'end_date', 'orderBy');
-                $result = SendOrderStatService::getChannelPromotionBook($channels, $param, true);
-
-                header("Content-type:application/vnd.ms-excel");
-                header("Content-Disposition:attachment;filename=" . "明细" . date("YmdHis") . ".csv");
-                echo iconv("UTF-8", "GBK", "\"日期\",\"公司名称\",\"书本名称\",\"书本id\",\"24小时充值\",\"72小时充值\",\"注册用户数\",\"24小时UV\",\"24小时充值/24小时UV\",\"72小时UV\",\"72小时充值/72小时UV\",\"当日创建派单数\"\r\n");
-                foreach ($result as $item) {
-                    $company_id = $item->company_id;
-                    $channels = Channel::getChanneIdByCompanyId($company_id);
-                    $params = [
-                        'channels' => $channels,
-                        'book_id' => $item->bid,
-                        'begin_time' => $item->date,
-                        'end_time' => $item->date . ' 23:59:59'
-                    ];
-                    $item->uv_three_day = $item->uv_three_day ? $item->uv_three_day : 0;
-                    if (!$item->percent_recharge_devide_uv_three_day) {
-                        $item->percent_recharge_devide_uv_three_day = 0;
-                    }
-                    $item->send_order_count = SendOrderService::getPromotionCount($params);
-                    $item->percent_recharge_devide_uv = number_format($item->percent_recharge_devide_uv, 2);
-
-                    echo("\"" . mb_convert_encoding($item->date, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->company_name, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->book_name, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->bid, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->recharge_amount_in_one_day, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->recharge_amount_in_three_days, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->register_user_num, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->uv_one_day, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->percent_recharge_devide_uv, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->uv_three_day, "GBK", "UTF-8") . "\",");
-                    echo("\"" . mb_convert_encoding($item->percent_recharge_devide_uv_three_day, "GBK", "UTF-8") . "\",");
-                    echo("\"" . $item->send_order_count . "\"\r\n");
-                }
-            }
-        }
-        exit();
-    }
-}

+ 0 - 96
app/Http/Controllers/Manage/Book/BooksTagController.php

@@ -1,96 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Controller;
-
-use App\Modules\Book\Models\BookTags;
-use App\Modules\Book\Services\BookTagsService;
-use App\Modules\Book\Services\TagsService;
-use Illuminate\Http\Request;
-
-class BooksTagController extends Controller
-{
-    public function getTags(){
-        $tags = TagsService::getAllTags();
-        return response()->success($tags);
-    }
-
-    public function getSearchBooks(Request $request){
-        if(!$request->has('tags')) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $tags = $request->input('tags');
-        $page_size = $request->input('page_size',15);
-        $books = BookTagsService::getSearchBooks($tags);
-        $res = [];
-        foreach ($books as $book){
-               $res[] = ['book_id' => $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) ? '' : $book->updated_at,
-                'copyright' => isset($book->copyright) ? '' : $book->copyright,
-                'charge_type' => isset($book->charge_type) ? '' : $book->charge_type,
-                'force_subscribe_chapter_id' => $book->force_subscribe_chapter_seq,
-                'update_time' => $book->updated_at,
-                'is_on_shelf' => $book->is_on_shelf,
-                //'book_price' => isset($book->price) ? 0 : $book->price,
-                'keyword' => $book->keyword,
-                //'roles' => isset($book->roles) ? $book->roles : '',
-                '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,
-                'category_array' => [$book->channel_name == '男频' ? 1 : 2, $book->category_id],
-                'copyright_limit_data' => isset($book->copyright_limit_data) ? '' : $book->copyright_limit_data,
-                'promotion_domain' => $book->promotion_domain,
-                'old_name' => $book->old_name,
-                'recommend_text' => $book->recommend_text,
-                'book_special_channels' => $book->book_special_channels,
-                'is_high_quality' => $book->is_high_quality,
-                'is_promotion' => isset($book->is_promotion) ? $book->is_promotion : 0,
-                'tags'=>BookTagsService::getBookTags($book->bid),
-            ];
-        }
-        return response()->success($books);
-    }
-
-    public function addBookTags(Request $request) {
-        if(!$request->has('tags')) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!$request->has('bid')) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $bid = $request->input('bid');
-        $tags = $request->input('tags');
-        BookTags::addBookTag($bid,$tags);
-        return response()->success();
-    }
-
-    public function deleteBookTags(Request $request){
-        if(!$request->has('tags')) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!$request->has('bid')) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $bid = $request->input('bid');
-        $tags = $request->input('tags');
-        if(BookTags::deleteTagBook($bid,$tags)){
-            return response()->success();
-        }
-        return response()->error('PARAM_ERROR');
-    }
-}

+ 0 - 493
app/Http/Controllers/Manage/Book/ChapterController.php

@@ -1,493 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Modules\Book\Models\Book;
-use App\Http\Controllers\Manage\Book\Transformers\ChapterListTransformer;
-use App\Http\Controllers\Manage\Book\Transformers\ChapterTransformer;
-use App\Modules\Book\Services\BookConfigService;
-use App\Modules\Book\Services\ChapterService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use Storage;
-use Hashids;
-use DB;
-
-class ChapterController extends Controller
-{
-
-
-
-
-    /**
-     * @apiDefine BookChapter 图书章节模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 章节列表分页
-     * @api {get} books/{bid}/chapter 章节列表分页
-     * @apiGroup BookChapter
-     * @apiName getChapterLists
-     * @apiParam   {Int}         page_size  分页大小(默认15)
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {Array}       data.list 分页结果集
-     * @apiSuccess {Int}         data.list.bid   bid
-     * @apiSuccess {Int}         data.list.chapter_id   章节id
-     * @apiSuccess {String}      data.list.chapter_name   章节名称
-     * @apiSuccess {Int}         data.list.chapter_sequence   序号
-     * @apiSuccess {Int}         data.list.chapter_is_vip   是否vip
-     * @apiSuccess {Int}         data.list.chapter_size   章节大小
-     * @apiSuccess {Int}         data.list.prev_cid   上一章节id
-     * @apiSuccess {Int}         data.list.next_cid   下一章节
-     * @apiSuccess {String}      data.list.recent_update_at   更新时间
-     * @apiSuccess {String}      data.list.is_need_subscirbe   是否强制关注
-     * @apiSuccess {object}      data.meta   分页信息
-     * @apiSuccess {Int}         data.meta.total  总条数
-     * @apiSuccess {Int}         data.meta.per_page  每页条数
-     * @apiSuccess {Int}         data.meta.current_page 当前页
-     * @apiSuccess {Int}         data.meta.last_page  最后页
-     * @apiSuccess {String}      data.meta.next_page_url  下一页
-     * @apiSuccess {String}      data.meta.prev_page_url  上一页
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:
-     *            list:[
-     *             {
-     *               bid: 5,
-     *               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,
-     *               is_need_subscirbe: 1,
-     *            },
-     *             {
-     *               bid: 5,
-     *               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,
-     *               is_need_subscirbe: 1,
-     *            },
-     *          ]
-     *          meta:{
-     *              total: 1253,
-     *              per_page: 15,
-     *              current_page: 1,
-     *              last_page: 84,
-     *              next_page_url: "http://myapi.cn/api/books/1/chapter?page=2",
-     *              prev_page_url: ""
-     *         }
-     *       }
-     */
-    public function getChapterLists(Request $request,$bid){
-        $page_size = $request->input('page_size',15);
-        $lists = ChapterService::getChapterListsPage($bid,$page_size);
-        $book = BookConfigService::getBookById($bid);//force_subscribe_chapter_seq
-        foreach ($lists as &$item){
-            $item->is_recommend = 0;
-            $item->recommend_text = '';
-            if($item->sequence>= ($book->force_subscribe_chapter_seq)){
-                $item->is_need_subscirbe = 1;
-            }else{
-                $item->is_need_subscirbe = 0;
-            }
-            if($item->id == $book->recommend_cid ){
-                $item->is_recommend = 1;
-                if( Storage::exists('RecommendChapterPositionWord.txt')){
-                    $item->recommend_text = Storage::get('RecommendChapterPositionWord.txt');
-                }else{
-                    $item->recommend_text = '建议此章节生成推广文案(原文转化率好)';
-                }
-                
-            }
-        }
-        return response()->pagination(new ChapterListTransformer,$lists);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 前5章章节内容
-     * @api {get} books/{bid}/fivechapter 前5章章节内容
-     * @apiGroup BookChapter
-     * @apiName getTopFiveChapter
-     * @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: "叶妩被司行霈的阴阳怪气一吓,思路偏得太远了。 她张口结舌,忘记了自己要说什么。",
-     *            },
-     *           ]
-     *       }
-     */
-    public function getTopFiveChapter($bid){
-        $res = ChapterService::getTopFiveChapter($bid);
-        return response()->collection(new ChapterTransformer,$res);
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 章节列表和内容
-     * @api {get} books/{bid}/chapter 章节列表和内容
-     * @apiGroup BookChapter
-     * @apiName getCatalogPagination
-     * @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_recommend  是否是推荐章节
-     * @apiSuccess {String}      data.recommend_text  推荐章节标题
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: list:[
-     *             {
-     *               bid: 5,
-     *               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,
-     *               is_need_subscirbe: 1,
-     *               chapter_content:"这事儿还得从2010年的暑假说起"
-     *            },
-     *             {
-     *               bid: 5,
-     *               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,
-     *               is_need_subscirbe: 1,
-     *               chapter_content:"这事儿还得从2010年的暑假说起"
-     *            },
-     *          ]
-     *          meta:{
-     *              total: 1253,
-     *              per_page: 15,
-     *              current_page: 1,
-     *              last_page: 84,
-     *              next_page_url: "http://myapi.cn/api/books/1/chapter?page=2",
-     *              prev_page_url: ""
-     *         }
-     *       }
-     */
-    function getCatalogPagination(Request $request, $bid)
-    {
-        if(!is_numeric($bid)){
-            $bid = Hashids::decode($bid)[0];
-        }
-        $page_size = $request->input('page_size',15);
-        $lists = ChapterService::getChapterPage($bid,$page_size);
-        $book = BookConfigService::getBookById($bid);
-        foreach ($lists as &$item){
-            $item->is_recommend = '';
-            $item->recommend_text = '';
-            if($item->sequence>= ($book->force_subscribe_chapter_seq)){
-                $item->is_need_subscirbe = 1;
-            }else{
-                $item->is_need_subscirbe = 0;
-            }
-
-            if($item->id == $book->recommend_cid ){
-                $item->is_recommend = 1;
-                if( Storage::exists('RecommendChapterPositionWord.txt')){
-                    $item->recommend_text = Storage::get('RecommendChapterPositionWord.txt');
-                }else{
-                    $item->recommend_text = '建议此章节生成推广文案(原文转化率好)';
-                }
-                
-            }
-        }
-        return response()->pagination(new ChapterListTransformer,$lists);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改vip章节
-     * @api {get} chapter/setvip 修改vip章节
-     * @apiGroup BookChapter
-     * @apiName editChapterVip
-     * @apiParam   {int}         bid  bid
-     * @apiParam   {int}         vip  vip数
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *       }
-     */
-    public function editChapterVip(Request $request){
-        $bid = $request->get('bid');
-        $vip_num = $request->get('vip');
-        if(empty($bid) || $vip_num == ''){
-            return response()->error('PARAM_EMPTY');
-        } 
-        ChapterService::editVip($bid,$vip_num);
-        BookConfigService::editVipSeq($bid,$vip_num);
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改章节内容
-     * @api {post} chapter/content 修改章节内容
-     * @apiGroup BookChapter
-     * @apiName editChapterVip
-     * @apiParam   {int}         bid  bid
-     * @apiParam   {int}         cid  章节id
-     * @apiParam   {String}      content  内容
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *       }
-     */
-    public function editChapterContent(Request $request){
-        $cid = $request->input('cid');
-        $bid = $request->input('bid');
-        $content = $request->input('content');
-        if(empty($cid) || empty($bid) || empty($content)){
-            return response()->error('PARAM_EMPTY');
-        }
-        $chapter = ChapterService::getChapterFromDb($bid,$cid);
-        $chapter->content = $content;
-        $chapter->size = ceil(strlen($content)/3);
-        ChapterService::editChapter($chapter);
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改章节名
-     * @api {get} chapter/editChapterName 修改章节名
-     * @apiGroup BookChapter
-     * @apiName editChapterName
-     * @apiParam   {int}         cid  章节id
-     * @apiParam   {String}      chaper_name  章节名
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *       }
-     */
-    public function editChapterName(Request $request){
-        $cid = $request->get('cid');
-        $chaper_name = $request->get('chaper_name');
-        if(empty($cid) || empty($chaper_name)){
-            return response()->error('PARAM_EMPTY');
-        }
-        ChapterService::updateChapterName($cid,$chaper_name);
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除章节
-     * @api {get} chapter/deleteChapter 删除章节
-     * @apiGroup BookChapter
-     * @apiName deleteChapter
-     * @apiParam   {int}         cid  章节id
-     * @apiParam   {int}         bid  bid
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *       }
-     */
-    public function deleteChapter(Request $request){
-        $cid = $request->get('cid');
-        $bid = $request->get('bid');
-        if(empty($cid) || empty($bid)){
-            return response()->error('PARAM_EMPTY');
-        }
-
-        $chapter = ChapterService::getChapterById($cid);
-        if(!$chapter || $chapter->bid< 0){
-            return response()->error('PARAM_EMPTY');
-        }
-
-        $book = Book::where('id',$bid)->first();
-        $chapter->bid = -$chapter->bid;
-        $chapter->save();
-        ChapterService::updateSequence($bid,$chapter->sequence);
-        $this->adjustSequentOne($bid,$chapter->sequence-1,$chapter->sequence+1);
-
-        $book->size -= $chapter->size;
-
-        if($chapter->sequence == 1){
-            $next = ChapterService::getChapterInfoByBidAndSeq($bid,1);
-            ChapterService::updateOne($chapter->next_cid,['prev_cid'=>0]);
-            if($next){
-                $book->first_cid = $next->id;
-            }
-        }
-
-        if($chapter->sequence == $book->chapter_count){
-            $prev = ChapterService::getChapterInfoByBidAndSeq($bid,$chapter->sequence-1);
-            ChapterService::updateOne($chapter->prev_cid,['next_cid'=>0]);
-            if($prev){
-                $book->last_cid = $prev->id;
-                $book->last_chapter = $prev->name;
-            }
-        }
-        $book->chapter_count -= 1;
-        $book->save();
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 新增章节
-     * @api {post} chapter/addChapter 新增章节
-     * @apiGroup BookChapter
-     * @apiName addChapter
-     * @apiParam   {string}      name  章节名
-     * @apiParam   {string}      content  内容
-     * @apiParam   {int}         sequence  顺序
-     * @apiParam   {int}         is_vip  是否vip
-     * @apiParam   {int}         bid   bid
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *       }
-     */
-    public function addChapter(Request $request){
-        $param = $request->except('_url');
-        $res = checkParam($param,['name','content','sequence','is_vip','bid']);
-        if($res){
-            return response()->error('PARAM_EMPTY',['msg'=>$res]);
-        }
-        if(!is_numeric($param['sequence'])){
-            return response()->error('PARAM_ERROR',['msg'=>'sequence']);
-        }
-
-        $book = Book::where('id',$param['bid'])->first();
-        if(!$book){
-            return response()->error('PARAM_ERROR',['msg'=>'bid not exist']);
-        }
-        DB::beginTransaction();
-        try{
-            ChapterService::updateSequenceIncr($param['bid'],$param['sequence']);
-            $param['size'] = mb_strlen($param['content']);
-            $param['recent_update_at'] = date('Y-m-d H:i:s');
-            $param['prev_cid'] = 0;
-            $param['next_cid'] = 0;
-            $param['ly_chapter_id'] = 0;
-            $result = ChapterService::createChapter($param);
-            if($param['sequence'] == 1){
-                $book->first_cid = $result->id;
-            }
-
-            if($param['sequence'] == $book->chapter_count+1){
-                $book->last_cid = $result->id;
-                $book->last_chapter = $param['name'];
-            }
-            $this->adjustSequentOne($param['bid'],$param['sequence']-1,$param['sequence']+1);
-            $book->chapter_count++;
-            $book->size += $param['size'] ;
-            $book->save();
-            DB::commit();
-            return response()->success();
-        }catch (\Exception $e){
-            DB::rollBack();
-        }
-
-        return response()->error('UNKNOWN_ERROR');
-    }
-
-    private function adjustSequentOne($bid,$startsequence,$endsequence){
-        $chapter_list = DB::table('chapters')
-            ->whereBetween('sequence',[$startsequence,$endsequence])->orderBy('sequence')->where('bid',$bid)->get();
-        $prev = 0;
-
-        foreach ($chapter_list as $chapter){
-            if($prev){
-                DB::table('chapters')->where('id',$chapter->id)->update(['prev_cid'=>$prev]);
-                DB::table('chapters')->where('id',$prev)->update(['next_cid'=>$chapter->id]);
-            }
-            $prev = $chapter->id;
-        }
-    }
-}

+ 0 - 48
app/Http/Controllers/Manage/Book/ChapterImageController.php

@@ -1,48 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Controller;
-use App\Libs\ChapterToImage;
-use App\Libs\OSS;
-use App\Modules\Book\Services\ChapterImageService;
-use App\Modules\Book\Services\ChapterService;
-use Hashids;
-use Illuminate\Http\Request;
-use Storage;
-
-class ChapterImageController extends Controller
-{
-
-    /**
-     * @apiDefine chapter 图书模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除书本的章节图片
-     * @api {post} books/deleteBookChapterImage 删除书本的章节图片
-     * @apiGroup Book
-     * @apiName deleteBookChapterImage
-     * @apiParam   {int}    bid  bid
-     * @apiSuccess {int}    code 状态码
-     * @apiSuccess {String}  msg  信息
-     * @apiSuccess {object}  data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *       }
-     */
-    public function deleteBookChapterImage(Request $request)
-    {
-        $bid = $request->input('bid');
-        if (empty($bid)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        ChapterImageService::delete($bid);
-        return response()->success();
-    }
-}

+ 0 - 505
app/Http/Controllers/Manage/Book/CpBookController.php

@@ -1,505 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use App\Modules\Book\Models\BookCp;
-use App\Modules\Book\Models\BookConfig;
-use DB;
-use App\Modules\Subscribe\Models\BookOrder;
-use Illuminate\Support\Facades\Storage;
-class CpBookController extends Controller
-{
-    /**
-     * @apiDefine BookCP 图书CP模块
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取所有cp
-     * @api {get} bookcp/getAllCp 获取所有cp
-     * @apiGroup BookCP
-     * @apiName getAllCp
-     * @apiSuccess {int}         code          态码
-     * @apiSuccess {String}      msg           信息
-     * @apiSuccess {object}      data          结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *       {
-     *           code: 0,
-     *           msg: "",
-     *           data: [
-     *               "quyuewang",
-     *               "tianya",
-     *               "zhongtian",
-     *               "ycsd",
-     *               "zhizihuan",
-     *               "timeread",
-     *               "shuhai",
-     *           ]
-     *       }
-     */
-    public function getAllCp(){
-        $cps = BookCp::select('cp')->get()->pluck('cp');
-        return response()->success($cps);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription cp统计数据
-     * @api {get} bookcp/cpTotal cp统计数据
-     * @apiGroup BookCP
-     * @apiName cpTotal
-     * @apiParam   {String}      cp            cp名称
-     * @apiParam   {String}      [export]      要导出需要传值等于1
-     * @apiSuccess {int}         code          态码
-     * @apiSuccess {String}      msg           信息
-     * @apiSuccess {object}      data          结果集
-     * @apiSuccess {object}      data.cp_source     cp名称
-     * @apiSuccess {object}      data.count         图书数量
-     * @apiSuccess {object}      data.bids          bids(每日数据需要传递的参数)
-     * @apiSuccess {object}      data.yesterday     昨日订阅量
-     * @apiSuccess {object}      data.month         本月订阅量
-     * @apiSuccess {object}      data.prev_month    上月订阅量
-     * @apiSuccess {object}      data.today    上月订阅量
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *       {
-     *           code: 0,
-     *           msg: "",
-     *           data: [
-     *               {
-     *                   cp_source: "17k",
-     *                   bids: "21,22,582,583,584,591,612,629,634,635,637,638,639,641,642,843,844",
-     *                   count: 17,
-     *                   yesterday: "68194",
-     *                   month: "660188",
-     *                   prev_month: "55172"
-     *               }
-     *           ]
-     *       }
-     */
-    public function cpTotal2(Request $request){
-        $cp = $request->input('cp');
-        $res = BookConfig::select('cp_source',DB::raw('GROUP_CONCAT(bid) as bids'),DB::raw('count(*) as count'))->where('cp_source','!=','');
-        if($cp){
-            $res = $res->where('cp_source','like','%'.$cp.'%');
-        }
-        $res = $res->groupBy('cp_source')->get();
-        //return $res;
-
-        $yesterday = date('Y-m-d',time()-86400);
-        $today = date('Y-m-d');
-        $tomorrow = date('Y-m-d',time()+86400);
-        $month = date('Y-m').'-01';
-        $prev_month = date('Y-m',strtotime('-1 month')).'-01';
-        $next_month = date('Y-m',strtotime('+1 month')).'-01';
-        //echo $next_month;
-        $sql = '(select ifnull(sum(fee),0) as %s from chapter_order_total where bid in (%s) and day BETWEEN "%s" and "%s") %s';
-        $book_sql = '(select ifnull(sum(fee),0) as %s from book_orders where bid in (%s) and created_at BETWEEN "%s" and "%s") %s';
-        //BookOrder::join('book_config','book_orders.bid','=','book_config.bid')->select()->get();
-        foreach ($res as &$v){
-
-            $yesterday_sql = sprintf($sql,'yesterday',$v->bids,$yesterday,$today,'a');
-            $month_sql = sprintf($sql,'month',$v->bids,$month,$next_month,'b');
-            $prev_month_sql = sprintf($sql,'prev_month',$v->bids,$prev_month,$month,'c');
-            $total_sql = 'select * from ('.$yesterday_sql.' join '.$month_sql.' join '.$prev_month_sql.')';
-            $temp_res = DB::connection('chapter_order_mysql')->select($total_sql);
-
-            $book_yesterday_sql = sprintf($book_sql,'yesterday',$v->bids,$yesterday,$today,'a');
-            $book_month_sql = sprintf($book_sql,'month',$v->bids,$month,$next_month,'b');
-            $book_prev_month_sql = sprintf($book_sql,'prev_month',$v->bids,$prev_month,$month,'c');
-            $book_total_sql = 'select * from ('.$book_yesterday_sql.' join '.$book_month_sql.' join '.$book_prev_month_sql.')';
-            $book_temp_res = DB::select($book_total_sql);
-
-            $v->yesterday = (int)$book_temp_res[0]->yesterday+(int)$temp_res[0]->yesterday;
-            $v->month = (int)$book_temp_res[0]->month+(int)$temp_res[0]->month;
-            $v->prev_month = (int)$book_temp_res[0]->prev_month+(int)$temp_res[0]->prev_month;
-            $v->today = '-';
-            $temp_res = null;
-            $total_sql = null;
-        }
-
-        if($request->input('export')){
-            $filename = 'cptotal'.date('YmdHis').'.csv';
-
-            Storage::append($filename,mb_convert_encoding("书籍数量,今日订阅量,昨日订阅量,本月订阅量,上月订阅量",'gbk'));
-            $str = '';
-            foreach ($res as $val){
-                $str .= "{$val->count},{$val->today},{$val->yesterday},{$val->month},{$val->prev_month}\r\n";
-            }
-            Storage::append($filename,mb_convert_encoding($str,'gbk'));
-            return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-        }
-
-        return response()->success($res);
-    }
-
-    public function cpTotal(Request $request){
-        $cp = $request->input('cp');
-        $sql_format = '
- SELECT "-" as today,a.bids,a.cp_source,a.count,a.yesterday,a.yesterday_charge_balance,a.yesterday_reward_balance,b.`month`,b.month_charge_balance,b.month_reward_balance,c.prev_month,c.prev_month_charge_balance,c.prev_month_reward_balance from(
-
-(SELECT SUM(a.fee) as yesterday,sum(reward_balance) as yesterday_reward_balance,sum(charge_balance) as yesterday_charge_balance,b.cp_source,count(*) as `count`,GROUP_CONCAT(b.bid) as bids from book_order_statistical a join book_configs  b on  a.bid=b.bid  where a.`day` = "%s" and %s GROUP BY b.cp_source) a
- join 
-
-(SELECT SUM(a.fee)as `month`,sum(reward_balance) as month_reward_balance,sum(charge_balance) as month_charge_balance,b.cp_source from book_order_statistical a join book_configs  b on  a.bid=b.bid  where a.`day` >= "%s" and a.`day` < "%s" and %s GROUP BY b.cp_source) b
-on a.cp_source = b.cp_source
-
- JOIN (
-
-SELECT SUM(a.fee) as prev_month,sum(reward_balance) as prev_month_reward_balance,sum(charge_balance) as prev_month_charge_balance,b.cp_source from book_order_statistical a join book_configs  b on  a.bid=b.bid  where a.`day` >= "%s" and a.`day`< "%s" and %s GROUP BY b.cp_source
-) c on a.cp_source = c.cp_source
-
-) 
-';
-        $yesterday = date('Y-m-d',time()-86400);
-        $today = date('Y-m-d');
-        $tomorrow = date('Y-m-d',time()+86400);
-        $month = date('Y-m').'-01';
-        $now_month = date('n');
-        if($now_month == 1){
-            $year = date('Y');
-            $prev_month = ($year-1).'-12-01';
-        }else{
-            $year = date('Y');
-            $prev_month = ($year).'-'.($now_month-1).'-01';
-        }
-
-        //$prev_month = date('Y-m',strtotime('-1 month')).'-01';
-        $next_month = date('Y-m',strtotime('+1 month')).'-01';
-        if($cp){
-            $where = 'b.cp_source like '.'"%'.$cp.'%"';
-        }else{
-            $where = '1=1';
-        }
-        $sql = sprintf($sql_format,$yesterday,$where,$month,$next_month,$where,$prev_month,$month,$where);
-        $res = DB::select($sql);
-
-        if($request->input('export')){
-            $filename = 'cptotal'.date('YmdHis').'.csv';
-
-            Storage::append($filename,mb_convert_encoding("书籍数量,今日订阅量,昨日订阅量,昨日订阅量充值币,昨日订阅量赠送币,本月订阅量,本月订阅量充值币,本月订阅量赠送币,上月订阅量,上月订阅量充值币,上月订阅量赠送币",'gbk'));
-            $str = '';
-            foreach ($res as $val){
-                $str .= "{$val->count},{$val->today},
-                {$val->yesterday},{$val->yesterday_charge_balance},{$val->yesterday_reward_balance},
-                {$val->month},{$val->month_charge_balance},{$val->month_reward_balance},
-                {$val->prev_month},{$val->prev_month_charge_balance},{$val->prev_month_reward_balance}\r\n";
-            }
-            Storage::append($filename,mb_convert_encoding($str,'gbk'));
-            return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-        }
-        return response()->success($res);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription cp每日数据
-     * @api {get} bookcp/everyDayCpTotal cp每日数据
-     * @apiGroup BookCP
-     * @apiName everyDayCpTotal
-     * @apiParam   {String}      cp            cp名称
-     * @apiParam   {String}      bids          bids(cp统计数据返回的bids)
-     * @apiParam   {String}      [export]      要导出需要传值等于1
-     * @apiParam   {String}      page          页码
-     * @apiParam   {String}      pagesize      每页数据
-     * @apiSuccess {int}         code          态码
-     * @apiSuccess {String}      msg           信息
-     * @apiSuccess {object}      data          结果集
-     * @apiSuccess {object}      data.list.fee      订阅量
-     * @apiSuccess {object}      data.list.day      图书数量量
-     * @apiSuccess {object}      data.meta.last_page      最后意一页
-     * @apiSuccess {object}      data.meta.current_page   当前页
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *       {
-     *           code: 0,
-     *           msg: "",
-     *           data: {
-     *              list:[
-     *               {
-     *                   fee: "96",
-     *                   day: "2017-12-21"
-     *               },
-     *               {
-     *                   fee: "1262",
-     *                   day: "2017-12-22"
-     *               },
-     *               {
-     *                   fee: "382",
-     *                   day: "2017-12-24"
-     *               },
-     *           ],
-     *           meta{
-     *               last_page:3,
-     *               current_page:1
-     *            }
-     *           }
-     *       }
-     */
-    public function everyDayCpTotal(Request $request){
-        $cp = $request->input('cp');
-        $bids = $request->input('bids');
-        $page = (int)$request->input('page',1);
-        $pagesize = (int)$request->input('pagesize',15);
-        $start = ($page-1)*$pagesize;
-        $sql = 'select sum(fee) as fee,`day` from chapter_order_total where bid in ('.$bids.') group by `day` limit '.$start.','.$pagesize;
-        $count_sql = 'select count(*) as count from (select sum(fee) as fee,`day` from chapter_order_total where bid in ('.$bids.') group by `day`) a';
-
-        if($request->input('export')){
-            $book_order_bids = $this->getBookOrderBid();
-            $this_book_bid = array_intersect($book_order_bids,explode(',',$bids));
-            $sqls = 'select sum(fee) as fee,`day` from chapter_order_total where bid in ('.$bids.') group by `day`';
-            $res = DB::connection('chapter_order_mysql')->select($sqls);
-            if($this_book_bid){
-                $book_order_res = BookOrder::whereIn('bid',$this_book_bid)
-                    ->select(DB::raw('date(created_at) as day'),DB::raw('sum(fee) as fee'))
-                    ->groupBy(DB::raw('date(created_at)'))
-                    ->get();
-                foreach ($res as &$v){
-                    foreach ($book_order_res as $value){
-                        if($v->day == $value->day){
-                            $v->fee = $v->fee+$value->fee;
-                        }
-                        continue;
-                    }
-                }
-            }
-            $filename = 'cptotal'.date('YmdHis').'.csv';
-
-            Storage::append($filename,mb_convert_encoding("日期,订阅量",'gbk'));
-            $str = '';
-            foreach ($res as $val){
-                $str .= "{$val->day},{$val->fee}\r\n";
-            }
-            Storage::append($filename,mb_convert_encoding($str,'gbk'));
-            return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-        }
-
-        $count =  DB::connection('chapter_order_mysql')->select($count_sql);
-
-        $res = DB::connection('chapter_order_mysql')->select($sql);
-        $book_order_bids = $this->getBookOrderBid();
-        $this_book_bid = array_intersect($book_order_bids,explode(',',$bids));
-        if($this_book_bid){
-            $book_order_res = BookOrder::whereIn('bid',$this_book_bid)
-                ->select(DB::raw('date(created_at) as day'),DB::raw('sum(fee) as fee'))
-                ->groupBy(DB::raw('date(created_at)'))
-                ->get();
-            foreach ($res as &$v){
-                foreach ($book_order_res as $value){
-                    if($v->day == $value->day){
-                        $v->fee = $v->fee+$value->fee;
-                    }
-                    continue;
-                }
-            }
-        }
-
-
-        $data = [
-            'meta'=>['last_page'=>ceil($count[0]->count/$pagesize),'current_page'=>$page],
-            'list'=>$res
-        ];
-        return response()->success($data);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription cp图书统计数据
-     * @api {get} bookcp/bookCpTotal cp图书统计数据
-     * @apiGroup BookCP
-     * @apiName bookCpTotal
-     * @apiParam   {String}      cp            cp名称
-     * @apiParam   {String}      [export]      要导出需要传值等于1
-     * @apiParam   {String}      bids          bids(cp统计数据返回的bids)
-     * @apiSuccess {int}         code          态码
-     * @apiSuccess {String}      msg           信息
-     * @apiSuccess {object}      data          结果集
-     * @apiSuccess {object}      data.book_name         书名
-     * @apiSuccess {object}      data.bid           bid
-     * @apiSuccess {object}      data.yesterday     昨日订阅量
-     * @apiSuccess {object}      data.month         本月订阅量
-     * @apiSuccess {object}      data.prev_month    上月订阅量
-     * @apiSuccess {object}      data.today    上月订阅量
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *       {
-     *           code: 0,
-     *           msg: "",
-     *           data: {
-     *                yesterday: "32",
-     *                month: "2762",
-     *                prev_month: "0",
-     *                book_name: "将军在上",
-     *                today: "-",
-     *                bid: "21"
-     *           },
-     *           }
-     *       }
-     */
-    public function bookCpTotal(Request $request){
-
-        $bids = $request->input('bids');
-        $yesterday = date('Y-m-d',time()-86400);
-        $today = date('Y-m-d');
-        $tomorrow = date('Y-m-d',time()+86400);
-        $month = date('Y-m').'-01';
-        $prev_month = date('Y-m',strtotime('-1 month')).'-01';
-        $next_month = date('Y-m',strtotime('+1 month')).'-01';
-        $sql_format = '(select ifnull(sum(fee),0) as %s from chapter_order_total where bid = %s and day BETWEEN "%s" and "%s") %s';
-        $book_sql_format = '(select ifnull(sum(fee),0) as %s from book_orders where bid = %s and date(created_at) BETWEEN "%s" and "%s") %s';
-        $book_array = explode(',',$bids);
-        $res = [];
-        $book_order_bids = $this->getBookOrderBid();
-        for ($i = 0;$i<count($book_array);$i++ ){
-            $yesterday_sql = sprintf($sql_format,'yesterday',$book_array[$i],$yesterday,$today,'a');
-            $month_sql = sprintf($sql_format,'month',$book_array[$i],$month,$next_month,'b');
-            $prev_month_sql = sprintf($sql_format,'prev_month',$book_array[$i],$prev_month,$month,'c');
-            $total_sql = 'select * from ('.$yesterday_sql.' join '.$month_sql.' join '.$prev_month_sql.'
-              join (select book_name from chapter_order_total where bid='.$book_array[$i].' limit 1) d
-            )';
-
-
-            $temp_res = DB::connection('chapter_order_mysql')->select($total_sql);
-            if(in_array($book_array[$i],$book_order_bids)){
-                $book_yesterday_sql = sprintf($book_sql_format,'yesterday',$book_array[$i],$yesterday,$today,'a');
-                $book_month_sql = sprintf($book_sql_format,'month',$book_array[$i],$month,$next_month,'b');
-                $book_prev_month_sql = sprintf($book_sql_format,'prev_month',$book_array[$i],$prev_month,$month,'c');
-                $book_total_sql = 'select * from ('.$book_yesterday_sql.' join '.$book_month_sql.' join '.$book_prev_month_sql.'
-              join (select book_name from chapter_order_total where bid='.$book_array[$i].' limit 1) d
-            )';
-                $book_temp_res = DB::connection('chapter_order_mysql')->select($book_total_sql);
-                $temp_res[0]->yesterday = $book_temp_res[0]->yesterday;
-                $temp_res[0]->yesterday = $book_temp_res[0]->month;
-                $temp_res[0]->yesterday = $book_temp_res[0]->prev_month;
-                $temp_res[0]->yesterday = $book_temp_res[0]->book_name;
-            }
-            $res[$i]['yesterday'] = $temp_res[0]->yesterday;
-            $res[$i]['month'] = $temp_res[0]->month;
-            $res[$i]['prev_month'] = $temp_res[0]->prev_month;
-            $res[$i]['book_name'] = $temp_res[0]->book_name;
-            $res[$i]['today'] = '-';
-            $res[$i]['bid'] = $book_array[$i];
-            $temp_res = null;
-        }
-
-        if($request->input('export')){
-            $filename = 'cptotal'.date('YmdHis').'.csv';
-
-            Storage::append($filename,mb_convert_encoding("书籍ID,书名,今日订阅量,昨日订阅量,本月订阅量,上月订阅量",'gbk'));
-            $str = '';
-            foreach ($res as $val){
-                $str .= "{$val['bid']},{$val['book_name']},{$val['today']},{$val['yesterday']},{$val['month']},{$val['prev_month']}\r\n";
-            }
-            Storage::append($filename,mb_convert_encoding($str,'gbk'));
-            return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-        }
-
-        return response()->success($res);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription cp每本书数据
-     * @api {get} bookcp/everyBookTotal cp每本书数据
-     * @apiGroup BookCP
-     * @apiName everyBookTotal
-     * @apiParam   {String}      bid           bid
-     * @apiParam   {String}      [export]      要导出需要传值等于1
-     * @apiParam   {String}      page          页码
-     * @apiParam   {String}      pagesize      每页数据
-     * @apiSuccess {int}         code          态码
-     * @apiSuccess {String}      msg           信息
-     * @apiSuccess {object}      data          结果集
-     * @apiSuccess {object}      data.list.fee      订阅量
-     * @apiSuccess {object}      data.list.day      图书数量量
-     * @apiSuccess {object}      data.meta.last_page      最后意一页
-     * @apiSuccess {object}      data.meta.current_page   当前页
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *       {
-     *           code: 0,
-     *           msg: "",
-     *           data: {
-     *              list:[
-     *               {
-     *                   fee: "96",
-     *                   day: "2017-12-21"
-     *               },
-     *               {
-     *                   fee: "1262",
-     *                   day: "2017-12-22"
-     *               },
-     *               {
-     *                   fee: "382",
-     *                   day: "2017-12-24"
-     *               },
-     *           ],
-     *           meta{
-     *               last_page:3,
-     *               current_page:1
-     *            }
-     *           }
-     *       }
-     */
-    public function everyBookTotal(Request $request){
-        $bid = $request->input('bid');
-        $page = (int)$request->input('page',1);
-        $pagesize = (int)$request->input('pagesize',15);
-        $start = ($page-1)*$pagesize;
-
-        $data = [];
-        if(in_array($bid,$this->getBookOrderBid())){
-            $book_sql = 'select sum(fee) as fee,date(created_at) as `day`  from book_orders where bid='.$bid.' group by date(created_at) limit '.$start.','.$pagesize;
-            $count_sql = 'select count(*) as count from (select sum(fee) as fee  from book_orders where bid='.$bid.' group by date(created_at)) a';
-            $temp_res = DB::select($book_sql);
-            $count = DB::select($count_sql);
-            $data = [
-                'meta'=>['last_page'=>ceil($count[0]->count/$pagesize),'current_page'=>$page],
-                'list'=>$temp_res
-            ];
-        }else{
-            $sql = 'select sum(fee) as fee,`day`  from chapter_order_total where bid='.$bid.' group by `day` limit '.$start.','.$pagesize;
-            $count_sql = 'select count(*) as count from (select sum(fee) as fee,day  from chapter_order_total where bid='.$bid.' group by `day`) a';
-            $temp_res = DB::connection('chapter_order_mysql')->select($sql);
-            $count = DB::connection('chapter_order_mysql')->select($count_sql);
-            $data = [
-                'meta'=>['last_page'=>ceil($count[0]->count/$pagesize),'current_page'=>$page],
-                'list'=>$temp_res
-            ];
-        }
-
-        if($request->input('export')){
-            $filename = 'cptotal'.date('YmdHis').'.csv';
-
-            Storage::append($filename,mb_convert_encoding("日期,订阅量",'gbk'));
-            $str = '';
-            foreach ($data['list'] as $val){
-                $str .= "{$val->day},{$val->fee}\r\n";
-            }
-            Storage::append($filename,mb_convert_encoding($str,'gbk'));
-            return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
-        }
-
-        return response()->success($data);
-    }
-
-
-
-    protected  function getBookOrderBid(){
-        static $book_order_bid = null;
-        if(is_null($book_order_bid)){
-            $book_order_bid_obj = BookOrder::select(DB::raw('DISTINCT bid'))->get();
-            foreach ($book_order_bid_obj as $v){
-                $book_order_bid[] = $v->bid;
-            }
-        }
-        return $book_order_bid;
-    }
-}

+ 0 - 57
app/Http/Controllers/Manage/Book/GatherController.php

@@ -1,57 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Modules\Book\Services\BookService;
-use App\Http\Controllers\Controller;
-
-
-class GatherController extends Controller
-{
-
-    public  function  __construct()
-    {
-    }
-
-
-    /**
-     * 更新所有书的章节
-     */
-    public function updateAll(){
-        BookService::updateAll();
-    }
-
-    /**
-     * 更新章节内容 一本书的
-     * @param $bid
-     * @return int|string
-     */
-    public function updateOne($bid){
-        BookService::updateOne($bid);
-    }
-
-    /**
-     * 更新书籍列表
-     * @return int
-     */
-    public function updateBookList(){
-        BookService::updateBookList();
-    }
-
-
-    /**
-     * 调整所有顺序
-     */
-    public function adjustSequentAll(){
-        BookService::adjustSequentAll();
-    }
-
-    /**
-     * 调整单本书的顺序
-     * @param $bid
-     */
-    public function adjustSequentOne($bid){
-        BookService::adjustSequentOne($bid);
-    }
-
-}

+ 0 - 196
app/Http/Controllers/Manage/Book/ProductController.php

@@ -1,196 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Modules\Book\Services\ProductService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-
-class ProductController extends Controller
-{
-    /**
-     * @apiDefine Product 产品/充值
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 充值列表
-     * @api {get} product/chargelists 充值列表
-     * @apiGroup Product
-     * @apiName getChargeLists
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:  [
-     *                   {
-     *                       product_id: 1,
-     *                       price: "30.00",
-     *                       given: 0,
-     *                       is_default: 0,
-     *                       type: "TICKET_RECHARGE"
-     *                   },
-     *                   {
-     *                       product_id: 4,
-     *                       price: "500.00",
-     *                       given: 20000,
-     *                       is_default: 0,
-     *                       type: "TICKET_RECHARGE"
-     *                   },
-     *                   {
-     *                       product_id: 5,
-     *                       price: "365.00",
-     *                       given: 0,
-     *                       is_default: 1,
-     *                       type: "TICKET_RECHARGE"
-     *                   }
-     *               ]
-     *       }
-     */
-    public function getChargeLists(){
-        $res = ProductService::getChargeProduct();
-        return  response()->collection(new ProductTransformer,$res);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加产品
-     * @api {post} product 添加产品
-     * @apiGroup   Product
-     * @apiName createProduct
-     * @apiParam   {float}     price    价格
-     * @apiParam   {String}    type     类型
-     * @apiParam   {int}       given    奖励
-     * @apiParam   {int}       is_enabled    是否启用
-     * @apiParam   {int}       [sequence]    排序
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:
-     *                   {
-     *                       product_id: 1,
-     *                       price: "30.00",
-     *                       given: 0,
-     *                       is_default: 0,
-     *                       type: "TICKET_RECHARGE"
-     *                   }
-     *
-     *       }
-     */
-    public function createProduct(Request $request){
-        $param = $request->except('_url');
-        if(checkParam($param,['price','type','given','is_enabled'])){
-            return response()->error('PARAM_ERROR');
-        }
-        $param['is_default'] = 0;
-        $res = ProductService::addProduct($param);
-        return response()->item(new ProductTransformer,$res);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 编辑产品
-     * @api {post} product/update 编辑产品
-     * @apiGroup Product
-     * @apiName updateProduct
-     * @apiParam   {int}       is_default(1|0)    是否默认(只能有一个)
-     * @apiParam   {int}       is_enabled(1|0)   是否启用
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:  [
-     *                   {
-     *                       product_id: 1,
-     *                       price: "30.00",
-     *                       given: 0,
-     *                       is_default: 0,
-     *                       type: "TICKET_RECHARGE"
-     *                   },
-     *                   {
-     *                       product_id: 4,
-     *                       price: "500.00",
-     *                       given: 20000,
-     *                       is_default: 0,
-     *                       type: "TICKET_RECHARGE"
-     *                   },
-     *                   {
-     *                       product_id: 5,
-     *                       price: "365.00",
-     *                       given: 0,
-     *                       is_default: 1,
-     *                       type: "TICKET_RECHARGE"
-     *                   }
-     *               ]
-     *       }
-     */
-    public function updateProduct(Request $request){
-        $id = $request->input('product_id');
-        if(empty($id)) return response()->error('PARAM_ERROR');
-
-        $default = $request->input('is_default');
-        $is_enabled = $request->input('is_enabled');
-
-        if($default == '' && $is_enabled == ''){
-            return response()->error('PARAM_ERROR');
-        }
-
-        ProductService::updateProductDefault($id, $default);
-
-        ProductService::updateProductEnabled($id, $is_enabled);
-
-        return response()->success();
-
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 根据id获取产品
-     * @api {get} product/{id} 根据id获取产品
-     * @apiGroup   Product
-     * @apiName getProductInfoById
-     * @apiSuccess   {int}         code 状态码
-     * @apiSuccess   {String}      msg  信息
-     * @apiSuccess   {object}      data 结果集
-     * @apiSuccess   {Int}       product_id    product_id
-     * @apiSuccess   {float}       price    价格
-     * @apiSuccess   {String}      type     类型
-     * @apiSuccess   {int}         given    奖励
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:
-     *                   {
-     *                       product_id: 1,
-     *                       price: "30.00",
-     *                       given: 0,
-     *                       is_default: 0,
-     *                       type: "TICKET_RECHARGE"
-     *                   }
-     *
-     *       }
-     */
-    public function getProductInfoById(Request $request,$id){
-        $res = ProductService::getProductSingle($id);
-        return response()->item(new ProductTransformer,$res);
-    }
-}

+ 0 - 158
app/Http/Controllers/Manage/Book/ReadRecordController.php

@@ -1,158 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use Illuminate\Http\Request;
-
-use App\Http\Requests;
-use App\Http\Controllers\Controller;
-use Redis;
-
-class ReadRecordController extends Controller
-{
-
-
-    /**
-     * @apiDefine readrecord 阅读记录
-     */
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 保存阅读记录
-     * @api {post} books/readrecord 保存阅读记录
-     * @apiGroup readrecord
-     * @apiName saveRecordRecord
-     * @apiParam {Int}  uid
-     * @apiParam {Int}  bid
-     * @apiParam {Int}  cid
-     * @apiParam {String}  book_name
-     * @apiParam {String}  chapter_name
-     * @apiParam {Int}  cid
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *            }
-     *       }
-     */
-    public function saveRecordRecord(Request $request){
-        $uid = $request->input('uid');
-        $bid = $request->input('bid');
-        $cid = $request->input('cid');
-        $book_name = $request->input('book_name');
-        $chapter_name = $request->input('chapter_name');
-        if(empty($uid) || empty($bid) || empty($cid) || empty($book_name) || empty($chapter_name)){
-            return response()->error('PARAM_ERROR');
-        }
-        Redis::hset('book_base:'.$uid, 'last_read', "{$bid}_{$cid}_{$book_name}_{$chapter_name}_".time());
-        //Redis::hset('book_read:'.$uid, $bid, $cid."_".time());
-        Redis::hset('book_read:'.$uid, $bid, "{$cid}_{$book_name}_{$chapter_name}_".time());
-        return response()->success();
-
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取阅读记录
-     * @api {get} books/readrecord 获取阅读记录
-     * @apiGroup readrecord
-     * @apiName getReadRecord
-     * @apiParam {Int}  uid
-     * @apiSuccess {Int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {Array}       data 结果集
-     * @apiSuccess {Int}         data.bid  书籍id
-     * @apiSuccess {Int}         data.cid  章节id
-     * @apiSuccess {Int}         data.time 时间
-     * @apiSuccess {String}      data.book_name  书名
-     * @apiSuccess {String}      data.chapter_name  章节名
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data:[
-     *             {
-     *                 bid:5,
-     *                 cid:564,
-     *                 book_name:"hello world",
-     *                 chapter_name:"hello world",
-     *                 time:1511246882
-     *             },
-     *             {
-     *                 bid:5,
-     *                 cid:564,
-     *                 book_name:"hello world",
-     *                 chapter_name:"hello world",
-     *                 time:1511246882,
-     *             },
-     *         ]
-     *
-     *       }
-     */
-    public function getReadRecord(Request $request){
-        $uid = $request->input('uid');
-        //$bid = $request->input('bid');
-        if(empty($uid)) return response()->error('PARAM_ERROR');
-        $read_bids = Redis::hgetall('book_read:'.$uid);
-        if(!$read_bids) return response()->success();
-        $res = [];
-        $i = 0;
-        foreach ($read_bids as $key=>$v){
-            $record = explode('_',$v);
-            $latest_read_cid = $record[0];
-            $book_name = $record[1];
-            $chapter_name = $record[2];
-            $latest_read_time = $record[count($record)-1];
-            $res[$i] = ['book_name'=>$book_name,'bid'=>$key,'cid'=>(int)$latest_read_cid,'time'=>(int)$latest_read_time,'chapter_name'=>$chapter_name];
-            //$res[$i] = ['bid'=>$key,'cid'=>$latest_read_cid,'book_name'=>,'time'=>$latest_read_time];
-            $i++;
-        }
-        usort($res,function($a,$b){
-            if($a['time'] >= $b['time']) return -1;
-            return 1;
-
-        });
-
-        return response()->success($res);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除阅读记录
-     * @api {post} books/del/readrecord 删除阅读记录
-     * @apiGroup readrecord
-     * @apiName deleteRecord
-     * @apiParam {Int}  uid
-     * @apiParam {Int}  bid
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *     HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {
-     *            }
-     *       }
-     */
-    public function deleteRecord(Request $request){
-        $uid = $request->input('uid');
-        $bid = $request->input('bid');
-        if(empty($uid) || empty($cid)){
-            response()->error('PARAM_ERROR');
-        }
-        if(Redis::hexists('book_read:'.$uid,$bid)){
-            Redis::hdel('book_read:'.$uid,$bid);
-        }
-        return response()->success();
-    }
-}

+ 0 - 160
app/Http/Controllers/Manage/Book/SuperiorBookController.php

@@ -1,160 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Book\Transformers\SuperiorHistoryBookTransformer;
-use App\Modules\Book\Services\SuperiorHistoryBookService;
-use App\Modules\Book\Services\SuperiorNewBookService;
-use Illuminate\Http\Request;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use DB;
-
-
-class SuperiorBookController extends Controller
-{
-    public function getSuperiorNewBook(Request $request){
-        $channel = $request->input('channel','');
-        $book_name = $request->input('book_name','');
-        $bid=$request->input('bid','');
-        $serach = [];
-        if($book_name){
-            $serach[] = ['book_configs.book_name','like','%'.$book_name.'%'];
-        }
-        if($bid){
-            $serach[] = ['book_configs.bid',$bid];
-        }
-        $list = SuperiorNewBookService::getSuperiorList($channel,$serach);
-        foreach ($list as $item){
-            $list->gender=$item->pid==1?'男':'女';
-        }
-        return response()->success($list);
-    }
-
-    public function getSuperiorHistoryBook(Request $request){
-        $channel = $request->input('channel','');
-        $book_name = $request->input('book_name','');
-        $bid=$request->input('bid','');
-        $serach = [];
-        if($book_name){
-            $serach[] = ['book_configs.book_name','like','%'.$book_name.'%'];
-        }
-        if($bid){
-            $serach[] = ['book_configs.bid','=',$bid];
-        }
-        $paginate = $request->input('paginate',15);
-        $list = SuperiorHistoryBookService::getSuperiorList($channel,$paginate,$serach);
-        return response()->pagination(new SuperiorHistoryBookTransformer(),$list);
-    }
-
-    /**
-     * 导出历史优质书库
-     * @param Request $request
-     */
-    public function exportSuperiorHistoryBook(Request $request) {
-        $channel = $request->input('channel','');
-        $list = SuperiorHistoryBookService::getSuperiorList($channel,'',[],false);
-        $res = collectionTransform(new SuperiorHistoryBookTransformer(),$list);
-        //$superior_books = json_decode(json_encode($res),true);
-        //$total = count($res);
-        $superiors = [];
-        foreach ($res as $key=>$superior_book){
-            $superiors[] = array(
-                $key+1,
-                $superior_book['add_time'],
-                $superior_book['bid'],
-                $superior_book['book_name'],
-                $superior_book['gender'],
-                $superior_book['register_uv_rate'],
-                $superior_book['pay_uv_rate'],
-                $superior_book['charge_uv_rate'],
-            );
-        }
-        $header = ['序号','入库时间','书籍id','书名','男女频','注册/UV','付费/UV','充值/UV'];
-        saveExcelData($header,$superiors,'');
-    }
-
-    public function sortSuperiorHistoryBooks(Request $request){
-        if(!$request->hasFile('superior_books_sort')) {
-            return response()->error('PARAM_ERROR');
-        }
-        $file_obj = $request->file('superior_books_sort');
-        $spreadsheet = IOFactory::load($file_obj->path());
-        $sheetData = $spreadsheet->getActiveSheet(0)->toArray(null, true, true, true);
-        //$sequence = $sheetDataLength = count($sheetData)-1;
-        \Log::info($sheetData);
-        DB::beginTransaction();
-        try{
-            foreach ($sheetData as $key=>$value) {
-                if($key==1){
-                    continue;
-                }
-                if(!intval($value['A'])) throw new \Exception('第'.$key.'序号错误');
-                SuperiorHistoryBookService::updateOne(intval($value['C']),['order_index'=>intval($value['A'])]);
-               // $sequence;
-            }
-        }catch (\Exception $e){
-            \Log::error('sort history superior books failed:'.($e->getMessage()));
-            DB::rollback();
-            return response()->error('UPLOAD_FAILED',$e->getMessage());
-        }
-        DB::commit();
-        return response()->success();
-    }
-
-    public function adjustHistorySuperiorBooksSequence(Request $request) {
-        $bid = $request->input('bid','');
-        $sequence = $request->input('sequence','');
-        if(empty($bid) && !intval($sequence)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        DB::beginTransaction();
-        try{
-            SuperiorHistoryBookService::adjustSequence($bid,$sequence);
-        }catch (\Exception $e){
-            DB::rollback();
-            if($e->getCode()==10001) return ['code'=>10001,'msg'=>'序号超出范围'];
-            return ['code'=>'304','msg'=>$e->getMessage()];
-        }
-        DB::commit();
-        return response()->success();
-    }
-
-    public function modifySuperiorNewBook(Request $request) {
-        $action = $request->input('action');
-        $bid = $request->input('bid');
-        if(!$bid){
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!in_array($action,['delete','set_top'])){
-            return response()->error('PARAM_ERROR');
-        }
-        if($action == 'delete') {
-            SuperiorNewBookService::deleteOne($bid);
-        }
-        if($action =='set_top') {
-            SuperiorNewBookService::setTop($bid);
-        }
-
-        return response()->success();
-    }
-    public function modifySuperiorHistoryBook(Request $request) {
-        $action = $request->input('action');
-        $bid = $request->input('bid');
-        if(!$bid){
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!in_array($action,['delete','set_top'])){
-            return response()->error('PARAM_ERROR');
-        }
-        if($action == 'delete') {
-            SuperiorHistoryBookService::deleteOne($bid);
-            SuperiorHistoryBookService::resortSuperiorBooks();
-        }
-        if($action =='set_top') {
-            SuperiorHistoryBookService::setTop($bid);
-        }
-        return response()->success();
-    }
-}
-

+ 0 - 35
app/Http/Controllers/Manage/Book/SuspendBookController.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Book\Transformers\BadBookInfoTransformer;
-use App\Http\Controllers\Manage\Book\Transformers\SuspendBookTransformer;
-use App\Modules\Book\Services\BadBookInfoService;
-use App\Modules\Statistic\Services\ProductionStatsEmailService;
-use DB;
-use Hashids;
-use Illuminate\Http\Request;
-use OSS\Core\OssException;
-use OSS\OssClient;
-use Storage;
-
-class SuspendBookController extends Controller
-{
-    public function getSuspendBooks(Request $request){
-        $page_size = $request->input('page_size');
-        if(!$page_size){
-            $page_size = 15;
-        }
-        $filter = '';
-        $book_name = $request->input('book_name');
-        if($book_name){
-            $filter = [
-                ['b.name','like','%'.$book_name.'%']
-            ];
-        }
-        $suspend = ProductionStatsEmailService::getSuspendProducts(true,$page_size,$filter);
-        return response()->pagination(new SuspendBookTransformer(),$suspend);
-    }
-}
-

+ 0 - 16
app/Http/Controllers/Manage/Book/Transformers/BadBookInfoTransformer.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BadBookInfoTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'id' => $item->id,
-            'info' => $item->badInfo,
-            'updated_at' => date("Y-m-d H:i:s", strtotime($item->updated_at)),
-            'created_at' => date("Y-m-d H:i:s", strtotime($item->created_at)),
-        ];
-    }
-}

+ 0 - 18
app/Http/Controllers/Manage/Book/Transformers/BookDomainTransformer.php

@@ -1,18 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookDomainTransformer
-{
-    public function transform($book_domain){
-        return [
-            'id'=>$book_domain->id,
-            'domain'=>$book_domain->domain
-        ];
-    }
-}

+ 0 - 19
app/Http/Controllers/Manage/Book/Transformers/BookGiftDailyTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookGiftDailyTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'bid' => isset($item->bid)?$item->bid:'',
-            'book_name' => isset($item->book_name)?$item->book_name:'',
-            'gift_id'=>isset($item->gift_id)?$item->gift_id:'',
-            'gift_name'=>isset($item->gift_name)?$item->gift_name:'',
-            'gift_send_times'=>$item->gift_send_times,
-            'gift_send_user_num'=>$item->gift_send_user_num,
-            'gift_send_cost'=>$item->gift_send_cost,
-        ];
-    }
-}

+ 0 - 19
app/Http/Controllers/Manage/Book/Transformers/BookGiftTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookGiftTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'bid' => isset($item->bid)?$item->bid:'',
-            'book_name' => isset($item->book_name)?$item->book_name:'',
-            'gift_id'=>isset($item->gift_id)?$item->gift_id:'',
-            'gift_name'=>isset($item->gift_name)?$item->gift_name:'',
-            'gift_send_times'=>$item->send_times,
-            'gift_send_user_num'=>$item->send_user_num,
-            'gift_send_cost'=>$item->cost_sum,
-        ];
-    }
-}

+ 0 - 27
app/Http/Controllers/Manage/Book/Transformers/BookPromotionCheckedTransformer.php

@@ -1,27 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookPromotionCheckedTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'id' => $item->id,
-            'book_id' => $item->book_id,
-            'operator' => $item->operator,
-            'size' => $item->size,
-            'status' => $item->status,
-            'author' => $item->author,
-            'book_name' => $item->book_name,
-            'cp_source' => $item->cp_source,
-            'is_on_shelf' => $item->is_on_shelf,
-            'periods'=>$item->periods,
-            'recharge_amount_in_24h_outside' => $item->recharge_amount_in_24h_outside,
-            'recharge_amount_in_24h_inside' => $item->recharge_amount_in_24h_inside,
-            'recharge_amount_in_72h_inside' => $item->recharge_amount_in_72h_inside,
-            'recharge_amount_in_72h_outside' => $item->recharge_amount_in_72h_outside,
-            'created_at' => date("Y-m-d H:i:s", strtotime($item->onshelf_date))
-        ];
-    }
-}

+ 0 - 29
app/Http/Controllers/Manage/Book/Transformers/BookPromotionTransformer.php

@@ -1,29 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookPromotionTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'bid' => $item->bid,
-            'date' => $item->date,
-            'book_name' => $item->book_name,
-            'uv_one_day' => $item->uv_one_day,
-            'uv_three_day' => $item->uv_three_day,
-            'company_name' => $item->company_name,
-            'send_order_count' => $item->send_order_count,
-            'register_user_num' => $item->register_user_num,
-            'recharge_amount_in_one_day' => $item->recharge_amount_in_one_day,
-            'percent_recharge_devide_uv' => $item->percent_recharge_devide_uv,
-            'recharge_amount_in_three_days' => $item->recharge_amount_in_three_days,
-            'percent_recharge_devide_uv_three_day' => $item->percent_recharge_devide_uv_three_day,
-        ];
-    }
-}

+ 0 - 53
app/Http/Controllers/Manage/Book/Transformers/BookTransformer.php

@@ -1,53 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookTransformer
-{
-    public function transform($book)
-    {
-        return [
-            'book_id' => $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' => is_null($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_id' => $book->force_subscribe_chapter_seq,
-            'update_time' => $book->updated_at,
-            'is_on_shelf' => $book->is_on_shelf,
-            'book_price' => is_null($book->price) ? 0 : $book->price,
-            'keyword' => $book->keyword,
-            'roles' => isset($book->roles) ? $book->roles : '',
-            '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,
-            'category_array' => [$book->channel_name == '男频' ? 1 : 2, $book->category_id],
-            'copyright_limit_data' => is_null($book->copyright_limit_data) ? '' : $book->copyright_limit_data,
-            'promotion_domain' => $book->promotion_domain,
-            'old_name' => $book->old_name,
-            'recommend_text' => $book->recommend_text,
-            'book_special_channels' => $book->book_special_channels,
-            'is_high_quality' => $book->is_high_quality,
-            'is_promotion' => isset($book->is_promotion) ? $book->is_promotion : 0,
-            'tags'=>isset($book->tags) ? $book->tags:[]
-        ];
-    }
-}

+ 0 - 24
app/Http/Controllers/Manage/Book/Transformers/ChapterListTransformer.php

@@ -1,24 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class ChapterListTransformer
-{
-    public function transform($chapter){
-        return [
-            'bid'       =>  $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,
-            'is_need_subscirbe'=>$chapter->is_need_subscirbe,
-			'chapter_content'   =>  $chapter->content,
-            'is_recommend'=>(isset($chapter->is_recommend) && $chapter->is_recommend)?$chapter->is_recommend:0,
-            'recommend_text'=>(isset($chapter->recommend_text) && $chapter->recommend_text)?$chapter->recommend_text:''
-        ];
-    }
-}

+ 0 - 22
app/Http/Controllers/Manage/Book/Transformers/ChapterTransformer.php

@@ -1,22 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class ChapterTransformer
-{
-    public function transform($chapter){
-        return [
-            'bid'       =>  $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/Manage/Book/Transformers/ProductTransformer.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\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 - 28
app/Http/Controllers/Manage/Book/Transformers/SmartPushBookTransformer.php

@@ -1,28 +0,0 @@
-<?php
-
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class SmartPushBookTransformer
-{
-    public function transform($book)
-    {
-        return [
-            'book_id' => $book->bid,
-            'book_name' => $book->book_name,
-            'update_time' => isset($book->updated_at) ? date('Y-m-d H:i:s',strtotime($book->updated_at)):'',
-            'is_on_shelf' => $book->is_on_shelf,
-            'test_status'=>isset($book->test_status) ? $book->test_status:'',
-            'test_update_time'=>isset($book->test_update_time) ? date('Y-m-d H:i:s',strtotime($book->test_update_time)):'',
-            'plan_push_user_num'=>isset($book->plan_push_user_num) ? $book->plan_push_user_num:'',
-            'real_push_user_num'=>isset($book->real_push_user_num) ? $book->real_push_user_num:'',
-            'uv'=>isset($book->uv) ? $book->uv:'',
-            'pv'=>isset($book->pv) ? $book->pv:'',
-            'charge_amount'=>isset($book->charge_amount) ? $book->charge_amount:'',
-            'charge_user_num'=>isset($book->charge_user_num) ? $book->charge_user_num:'',
-            'book_amount'=>isset($book->book_amount) ? $book->book_amount:'',
-            'book_user_num'=>isset($book->book_user_num) ? $book->book_user_num:'',
-            'second_chapter_uv'=>isset($book->second_chapter_uv) ? $book->second_chapter_uv:'',
-        ];
-    }
-}

+ 0 - 21
app/Http/Controllers/Manage/Book/Transformers/SuperiorHistoryBookTransformer.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class SuperiorHistoryBookTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'id'=>$item->id,
-            'bid'=>$item->bid,
-            'book_name'=>$item->book_name,
-            'gender'=>($item->pid==1)?'男':'女',
-            'register_uv_rate'=>$item->register_uv_rate,
-            'pay_uv_rate'=>$item->pay_uv_rate,
-            'charge_uv_rate'=>$item->charge_uv_rate,
-            'add_time'=>$item->created_at->format('Y-m-d H:i:s'),
-            'sequence'=>$item->order_index
-        ];
-    }
-}

+ 0 - 19
app/Http/Controllers/Manage/Book/Transformers/SuspendBookTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class SuspendBookTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'bid' => $item->id,
-            'book_name' => $item->name,
-            'pid'=>$item->pid,
-            'suspend_time'=>$item->updated_at,
-            'suspend_hours'=>round((time()-strtotime($item->updated_at))/3600,1),
-            'suspend_days'=>round((time()-strtotime($item->updated_at))/(3600*24),1),
-            'channel'=>($item->pid==1)?'男频':'女频'
-        ];
-    }
-}

+ 0 - 675
app/Http/Controllers/Manage/Channel/BusinessChannelController.php

@@ -1,675 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:32
- */
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Manage\Channel\Transformers\BusinessChannelDayStatTransformer;
-use App\Http\Controllers\Manage\Channel\Transformers\BusinessChannelStatTransformer;
-use App\Http\Controllers\Manage\Channel\Transformers\BusinessCompanyStatTransformer;
-use App\Http\Controllers\Manage\Channel\Transformers\BusinessStatDataTransformer;
-use App\Http\Controllers\Manage\Finance\BaseController;
-use App\Modules\Channel\Models\BusinessChannelStat;
-use App\Modules\Channel\Services\BusinessChannelDayStatService;
-use App\Modules\Channel\Services\BusinessChannelStatService;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Channel\Services\CompanyService;
-use App\Modules\Manage\Services\ManageService;
-use App\Modules\SendOrder\Services\SendOrderService;
-use App\Modules\Trade\Services\OrderDayStatService;
-use App\Modules\Trade\Services\OrderService;
-use App\Modules\Trade\Services\OrderStatService;
-use App\Modules\User\Services\UserService;
-use DB;
-use Illuminate\Http\Request;
-
-class BusinessChannelController extends BaseController
-{
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 商务渠道数据统计每日列表
-     * @api {GET} channel/getBusinessChannelDayList 商务渠道数据统计每日列表
-     * @apiGroup channel
-     * @apiName channel/getBusinessChannelDayList
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_enabled] 0:待审核; 1:已审核.(可不传)
-     * @apiParam   {Number}  [distribution_manages_id] 管理员ID.(可不传)
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccess {String}  business_channel_day_stats_date 统计时间
-     * @apiSuccess {String}  business_channel_day_stats_register_user_num 注册用户数
-     * @apiSuccess {String}  business_channel_day_stats_send_order_num 派单数
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": "zsy_finance",
-     *                   "distribution_manages_number": "",
-     *                   "distribution_manages_nickname": "3333",
-     *                   "business_channel_day_stats_date": "2017-12-25",
-     *                   "business_channel_day_stats_register_user_num": 0,
-     *                   "business_channel_day_stats_send_order_num": 0
-     *              }
-     *          ]
-     *     }
-     */
-    public function getBusinessChannelDayList(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        //商务,只获取到当前商务下的渠道列表
-        if ($this->getLoginUserRole() == "business") {
-            $distribution_manages_id = $this->getLoginUserId();
-        }
-//        dd($this->getLoginUserId());
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'distribution_manages_id' => $distribution_manages_id,
-            'is_enabled' => $isEnabled,
-            'search_name' => $search_name,
-        ];
-
-        $result = BusinessChannelDayStatService::getList($params);
-
-        return response()->pagination(new BusinessChannelDayStatTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获商务渠道数据统计列表
-     * @api {GET} channel/getBusinessChannelList 商务渠道数据统计列表
-     * @apiGroup channel
-     * @apiName channel/getBusinessChannelList
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_enabled] 0:待审核; 1:已审核.(可不传)
-     * @apiParam   {Number}  [distribution_manages_id] 管理员ID.(可不传)
-     * @apiParam   {Number}  [yesterday_register_user_num_sort] 昨日注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [current_month_register_user_num_sort] 当月注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [last_month_register_user_num_sort] 上月注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [total_register_user_num_sort] 总注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [total_send_order_num_sort] 总派单数  0:升序,1:降序.(可不传)
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccess {String}  business_channel_stats_today_register_user_num 今日注册用户数
-     * @apiSuccess {String}  business_channel_stats_yesterday_register_user_num 昨日注册用户数
-     * @apiSuccess {String}  business_channel_stats_current_month_register_user_num 当月注册用户数
-     * @apiSuccess {String}  business_channel_stats_last_month_register_user_num 上月注册用户数
-     * @apiSuccess {String}  business_channel_stats_total_register_user_num 总注册用户数
-     * @apiSuccess {String}  business_channel_stats_total_send_order_num 总派单数
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": "zsy_finance",
-     *                   "distribution_manages_number": "",
-     *                   "distribution_manages_nickname": "3333",
-     *                   "business_channel_stats_today_register_user_num": 4,
-     *                   "business_channel_stats_yesterday_register_user_num": 0,
-     *                   "business_channel_stats_current_month_register_user_num": 0,
-     *                   "business_channel_stats_last_month_register_user_num": 0,
-     *                   "business_channel_stats_total_register_user_num": 0,
-     *                   "business_channel_stats_total_send_order_num": 0
-     *              }
-     *          ]
-     *     }
-     */
-    public function getBusinessChannelList(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        //商务,只获取到当前商务下的渠道列表
-        if ($this->getLoginUserRole() == "business") {
-            $distribution_manages_id = $this->getLoginUserId();
-        }
-
-        $yesterday_register_user_num_sort = $request->has('yesterday_register_user_num_sort') ? $request->input('yesterday_register_user_num_sort') : '';
-        $current_month_register_user_num_sort = $request->has('current_month_register_user_num_sort') ? $request->input('current_month_register_user_num_sort') : '';
-        $last_month_register_user_num_sort = $request->has('last_month_register_user_num_sort') ? $request->input('last_month_register_user_num_sort') : '';
-        $total_register_user_num_sort = $request->has('total_register_user_num_sort') ? $request->input('total_register_user_num_sort') : '';
-        $total_send_order_num_sort = $request->has('total_send_order_num_sort') ? $request->input('total_send_order_num_sort') : '';
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'distribution_manages_id' => $distribution_manages_id,
-            'is_enabled' => $isEnabled,
-            'search_name' => $search_name,
-            'yesterday_register_user_num_sort' => $yesterday_register_user_num_sort,
-            'current_month_register_user_num_sort' => $current_month_register_user_num_sort,
-            'last_month_register_user_num_sort' => $last_month_register_user_num_sort,
-            'total_register_user_num_sort' => $total_register_user_num_sort,
-            'total_send_order_num_sort' => $total_send_order_num_sort,
-        ];
-
-        $result = BusinessChannelStatService::getList($params);
-        $today = date('Y-m-d');
-
-        if ($result) {
-            foreach ($result as $item) {
-                $item['business_channel_stats_today_register_user_num'] = UserService::getChannelDayTotal($item['id'], $today);
-                $item['business_channel_stats_total_register_user_num'] = UserService::getChannelTotal($item['id']);
-            }
-        }
-        return response()->pagination(new BusinessChannelStatTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获商务所有渠道数据统计汇总
-     * @api {GET} channel/getBusinessChannelSingle 获商务所有渠道数据统计汇总
-     * @apiGroup channel
-     * @apiName channel/getBusinessChannelSingle
-     * @apiParam   {Number}  [distribution_manages_id] 管理员ID.(可不传)
-     * @apiSuccess {String}  today_register_user_num 今日注册用户数
-     * @apiSuccess {String}  yesterday_register_user_num 昨日注册用户数
-     * @apiSuccess {String}  current_month_register_user_num 当月注册用户数
-     * @apiSuccess {String}  last_month_register_user_num 上月注册用户数
-     * @apiSuccess {String}  stats_total_register_user_num 总注册用户数
-     * @apiSuccess {String}  stats_total_send_order_num 总派单数
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {
-     *                   "today_register_user_num": 4,
-     *                   "yesterday_register_user_num": 0,
-     *                   "current_month_register_user_num": 0,
-     *                   "last_month_register_user_num": 0,
-     *                   "total_register_user_num": 0,
-     *                   "total_send_order_num": 0
-     *          }
-     *     }
-     */
-    public function getBusinessChannelSingle(Request $request)
-    {
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-        //商务,只获取到当前商务下的渠道列表
-        if ($this->getLoginUserRole() == "business") {
-            $distribution_manages_id = $this->getLoginUserId();
-        }
-
-        if ($this->getLoginUserRole() == "admin") {
-            $distribution_manages_id = '';
-        }
-
-        $channelIds = ChannelService::getChannelIdList($distribution_manages_id);
-
-        $yesterStartDay = date('Y-m-d', strtotime(date("Y-m-d") . " -1 day")) . " 00:00:00";
-        $yesterEndDay = date('Y-m-d', strtotime(date("Y-m-d"))) . " 00:00:00";
-        $toDayEndDay = date('Y-m-d', strtotime(date("Y-m-d"))) . " 23:59:59";
-        $last_monthStartDay = date('Y-m', strtotime(date("Y-m") . " -1 month")) . "-01 00:00:00";
-        $current_monthStartDay = date('Y-m', strtotime(date("Y-m"))) . "-01  00:00:00";
-
-        $lastMonthStart = date('Y-m-01 00:00:00',strtotime('-1 month'));
-        $lastMonthEnd = date('Y-m-d 23:59:59',strtotime(date('Y-m-01').'-1 day'));
-        $today_register_user_num = UserService::getChannelsDayToDayTotal($channelIds, $yesterEndDay, $toDayEndDay);
-
-        $currentMonthStart = date('Y-m-01 00:00:00');
-//        $yesterday_register_user_num = UserService::getChannelsDayToDayTotal($channelIds, $yesterStartDay, $yesterEndDay);
-//        $current_month_register_user_num = UserService::getChannelsDayToDayTotal($channelIds, $current_monthStartDay, $yesterEndDay);
-//        $last_month_register_user_num = UserService::getChannelsDayToDayTotal($channelIds, $last_monthStartDay, $current_monthStartDay);
-//        $total_register_user_num = UserService::getChannelsDayToDayTotal($channelIds);
-//        $total_send_order_num = SendOrderService::getTotalPromotionCountByChannelIds($channelIds);
-
-        $yesterday_register_user_num = BusinessChannelStat::whereIn('distribution_channel_id', $channelIds)
-//            ->where('created_at', '>=', $yesterStartDay)
-//            ->where('created_at', '<', $yesterEndDay)
-            ->sum('yesterday_register_user_num');
-        $current_month_register_user_num = BusinessChannelStat::whereIn('distribution_channel_id', $channelIds)
-//            ->where('created_at', '>=', $current_monthStartDay)
-//            ->where('created_at', '<', $yesterEndDay)
-            ->sum('current_month_register_user_num');
-        $last_month_register_user_num = BusinessChannelStat::whereIn('distribution_channel_id', $channelIds)
-//            ->where('created_at', '>=', $last_monthStartDay)
-//            ->where('created_at', '<', $current_monthStartDay)
-            ->sum('last_month_register_user_num');
-        $total_register_user_num = BusinessChannelStat::whereIn('distribution_channel_id', $channelIds)
-            ->sum('total_register_user_num');
-        $total_send_order_num = BusinessChannelStat::whereIn('distribution_channel_id', $channelIds)
-            ->sum('total_send_order_num');
-        $yesterday_new_companies_num = BusinessChannelStat::getNewAddedCompaniesNum($yesterStartDay,$yesterEndDay,$channelIds);
-        $yesterday_new_channel_num = BusinessChannelStat::getNewwAddedChannelNum($yesterStartDay,$yesterEndDay,$channelIds);
-
-        $last_month_new_companies_num = BusinessChannelStat::getNewAddedCompaniesNum($currentMonthStart,date('Y-m-d H:i:s'),$channelIds);
-        $last_month_new_channel_num = BusinessChannelStat::getNewwAddedChannelNum($currentMonthStart,date('Y-m-d H:i:s'),$channelIds);
-        $recharge_data = OrderStatService::getRechargeAmount($channelIds);
-        $manage_company_total_charge_amount = $recharge_data->total_recharge_amount_sum;
-
-        $month_begin_time = date('Y-m-01 00:00:00');
-        $manage_company_total_charge_amount_current_month = $recharge_data->current_month_recharge_amount_sum;//OrderDayStatService::getRechargeByChannels($channelIds,$time_range=['begin_time' => $month_begin_time, 'end_time' => $yesterEndDay]);
-        //$manage_company_total_charge_amount_current_month = OrderService::getAmount($manage_order_params_current_month);
-
-        return response()->success(compact(
-            'today_register_user_num',
-            'yesterday_register_user_num',
-            'current_month_register_user_num',
-            'last_month_register_user_num',
-            'total_register_user_num',
-            'total_send_order_num',
-            'last_month_new_companies_num',
-            'last_month_new_channel_num',
-            'yesterday_new_companies_num',
-            'yesterday_new_channel_num',
-            'manage_company_total_charge_amount',
-            'manage_company_total_charge_amount_current_month'
-        ));
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获商务数据统计列表
-     * @api {GET} channel/getBusinessDataList 商务数据统计列表
-     * @apiGroup channel
-     * @apiName channel/getBusinessDataList
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_enabled]: 0:不可用; 1:可用
-     *
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccess {String}  today_register_user_num 今日注册用户数
-     * @apiSuccess {String}  yesterday_register_user_num 昨日注册用户数
-     * @apiSuccess {String}  current_month_register_user_num 当月注册用户数
-     * @apiSuccess {String}  last_month_register_user_num 上月注册用户数
-     * @apiSuccess {String}  total_register_user_num 总注册用户数
-     * @apiSuccess {String}  total_send_order_num 总派单数
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": "zsy_finance",
-     *                   "distribution_manages_nickname": "3333",
-     *                   "distribution_manages_latest_login_time": "",
-     *                   "distribution_manages_latest_login_ip": "",
-     *                   "distribution_manages_is_enabled": 1,
-     *                   "distribution_manages_remark": "",
-     *                   "distribution_manages_register_ip": "",
-     *                   "distribution_manages_create_time": "",
-     *                   "distribution_manages_update_time": "",
-     *                   "distribution_manages_number": "",
-     *                   "today_register_user_num": 4,
-     *                   "yesterday_register_user_num": 0,
-     *                   "current_month_register_user_num": 0,
-     *                   "last_month_register_user_num": 0,
-     *                   "total_register_user_num": 0,
-     *                   "total_send_order_num": 0
-     *              }
-     *          ]
-     *     }
-     */
-    public function getBusinessDataList(Request $request)
-    {
-
-        $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);
-
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        $params = [
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'is_enabled' => $isEnabled,
-            'search_name' => $search_name,
-        ];
-
-        $business = ManageService::getBusinessManageList($params);
-
-        $today = date('Y-m-d');
-        $todayEnd = $today . " 23:59:59";
-
-        if ($business) {
-            foreach ($business as $item) {
-                $channelIds = ChannelService::getChannelIdList($item['id']);
-                $business_channel_stats = BusinessChannelStatService::getBusinessChannelStatSingle($channelIds);
-
-                $item['yesterday_register_user_num'] = $business_channel_stats->yesterday_register_user_num;
-                $item['current_month_register_user_num'] = $business_channel_stats->current_month_register_user_num;
-                $item['last_month_register_user_num'] = $business_channel_stats->last_month_register_user_num;
-                $item['total_register_user_num'] = $business_channel_stats->total_register_user_num;
-                $item['total_send_order_num'] = $business_channel_stats->total_send_order_num;
-
-                $item['current_month_new_channels_recharge'] = $business_channel_stats->current_month_new_channels_recharge_sum;
-                $item['current_month_channels_recharge'] = $business_channel_stats->current_month_channels_recharge_sum;
-                $item['last_month_channels_recharge_sum'] = $business_channel_stats->last_month_channels_recharge_sum;
-                $item['last_month_new_channels_recharge_sum'] = $business_channel_stats->last_month_new_channels_recharge_sum;
-
-                $item['today_register_user_num'] = UserService::getChannelsDayToDayTotal($channelIds, $today, $todayEnd);
-                $item['current_month_companies_num'] = BusinessChannelStat::getNewAddedCompaniesNum(date('Y-m-01 00:00:00', time()), date('Y-m-d H:i:s'), $channelIds);
-                $item['current_month_channel_num'] = BusinessChannelStat::getNewwAddedChannelNum(date('Y-m-01 00:00:00', time()), date('Y-m-d H:i:s'), $channelIds);
-                $item['last_month_companies_num'] = BusinessChannelStat::getNewAddedCompaniesNum(date('Y-m-01',strtotime('-1 month')),date('Y-m-d H:i:s',strtotime(date('Y-m-01 23:59:59').' -1 day')),$channelIds);
-                $item['last_month_channel_num'] = BusinessChannelStat::getNewwAddedChannelNum(date('Y-m-01',strtotime('-1 month')),date('Y-m-d H:i:s',strtotime(date('Y-m-01 23:59:59').' -1 day')),$channelIds);
-            }
-        }
-        return response()->pagination(new BusinessStatDataTransformer(), $business);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获商务渠道数据统计列表
-     * @api {GET} channel/getBusinessChannelList2 商务渠道数据统计列表
-     * @apiGroup channel
-     * @apiName channel/getBusinessChannelList2
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_enabled] 0:待审核; 1:已审核.(可不传)
-     * @apiParam   {Number}  [distribution_manages_id] 管理员ID.(可不传)
-     * @apiParam   {Number}  [yesterday_register_user_num_sort] 昨日注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [current_month_register_user_num_sort] 当月注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [last_month_register_user_num_sort] 上月注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [total_register_user_num_sort] 总注册用户数排序  0:升序,1:降序.(可不传)
-     * @apiParam   {Number}  [total_send_order_num_sort] 总派单数  0:升序,1:降序.(可不传)
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * company_name--公司名
-     * business_channel_stats_today_register_user_num  今日注册数
-     * business_channel_stats_yesterday_register_user_num 昨日注册用户数
-     * business_channel_stats_current_month_register_user_num 当月注册用户数
-     * business_channel_stats_last_month_register_user_num 上月注册用户数
-     * business_channel_stats_total_register_user_num 总注册用户数
-     * business_channel_stats_total_send_order_num 总派单数
-     * business_channel_stats_service_account_sum 服务号数
-     * business_channel_stats_last_week_actual_send_orders_sum 上周实际派单
-     * business_channel_stats_current_week_actual_send_orders_sum 本周实际派单
-     * business_channel_stats_yesterday_create_orders_sum 昨日创建派单
-     * business_channel_stats_last_week_login_day_sum 上周登录天数
-     * business_channel_stats_current_week_login_days_sum 本周登录天数
-     * business_channel_stats_is_yesterday_login 昨日是否登录
-     *
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccess {String}  business_channel_stats_today_register_user_num 今日注册用户数
-     * @apiSuccess {String}  business_channel_stats_yesterday_register_user_num 昨日注册用户数
-     * @apiSuccess {String}  business_channel_stats_current_month_register_user_num 当月注册用户数
-     * @apiSuccess {String}  business_channel_stats_last_month_register_user_num 上月注册用户数
-     * @apiSuccess {String}  business_channel_stats_total_register_user_num 总注册用户数
-     * @apiSuccess {String}  business_channel_stats_total_send_order_num 总派单数
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": "zsy_finance",
-     *                   "distribution_manages_number": "",
-     *                   "distribution_manages_nickname": "3333",
-     *                   "business_channel_stats_today_register_user_num": 4,
-     *                   "business_channel_stats_yesterday_register_user_num": 0,
-     *                   "business_channel_stats_current_month_register_user_num": 0,
-     *                   "business_channel_stats_last_month_register_user_num": 0,
-     *                   "business_channel_stats_total_register_user_num": 0,
-     *                   "business_channel_stats_total_send_order_num": 0
-     *              }
-     *          ]
-     *     }
-     */
-    public function getBusinessCompanyList(Request $request)
-    {
-        $distribution_channel_id = $request->has('company_id') ? $request->input('company_id') : '';
-        $distribution_channel_name = $request->has('company_name') ? $request->input('company_name') : '';
-        $distribution_manages_name = $request->has('manager_name') ? $request->input('manager_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);
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        //商务,只获取到当前商务下的渠道列表
-        if ($this->getLoginUserRole() == "business") {
-            $distribution_manages_id = $this->getLoginUserId();
-        }
-
-        $yesterday_register_user_num_sort = $request->has('yesterday_register_user_num_sort') ? $request->input('yesterday_register_user_num_sort') : '';
-        $current_month_register_user_num_sort = $request->has('current_month_register_user_num_sort') ? $request->input('current_month_register_user_num_sort') : '';
-        $last_month_register_user_num_sort = $request->has('last_month_register_user_num_sort') ? $request->input('last_month_register_user_num_sort') : '';
-        $total_register_user_num_sort = $request->has('total_register_user_num_sort') ? $request->input('total_register_user_num_sort') : '';
-        $total_send_order_num_sort = $request->has('total_send_order_num_sort') ? $request->input('total_send_order_num_sort') : '';
-
-        $params = [
-            'company_id' => $distribution_channel_id,
-            'company_name' => $distribution_channel_name,
-            'manager_name' => $distribution_manages_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'distribution_manages_id' => $distribution_manages_id,
-            'is_enabled' => $isEnabled,
-            'search_name' => $search_name,
-            'yesterday_register_user_num_sort' => $yesterday_register_user_num_sort,
-            'current_month_register_user_num_sort' => $current_month_register_user_num_sort,
-            'last_month_register_user_num_sort' => $last_month_register_user_num_sort,
-            'total_register_user_num_sort' => $total_register_user_num_sort,
-            'total_send_order_num_sort' => $total_send_order_num_sort,
-        ];
-        //\Log::info('time_check:getListNew:before--:'.time());
-        $result = BusinessChannelStatService::getListNew($params);
-       // \Log::info('time_check:getListNew:after--:'.time());
-        $today = date('Y-m-d');
-        //\Log::info('businessChannelStats:' . json_encode($result));
-        if ($result) {
-            foreach ($result as $item) {
-                $company = DB::table('companies')->where('id', $item['company_id'])->first();
-                $distribution_channel_ids = [];
-                if ($company) {
-                    $company_id = $company->id;
-                    $company_name = $company->name;
-                   // \Log::info('time_check:getCompanyServiceAccounts:before--'.time());
-                    $company_service_account = CompanyService::getCompanyServiceAccounts($company_id);
-                   // \Log::info('time_check:getCompanyServiceAccounts:after--'.time());
-                    foreach ($company_service_account as $company_service_account_item) {
-                        $distribution_channel_ids[] = $company_service_account_item->distribution_channel_id;
-                    }
-                    $yesterdayEnd = date('Y-m-d', strtotime(date("Y-m-d") . " -1 day")) . " 23:59:59";
-                    $recharge_data = OrderStatService::getRechargeAmount($distribution_channel_ids);
-                    $item['company_total_charge_amount'] = $recharge_data->total_recharge_amount_sum;// OrderStatService::getRechargeAmount($distribution_channel_ids);
-
-                    $month_begin_time = date('Y-m-01 00:00:00');
-
-                    $item['company_total_charge_amount_current_month'] = $recharge_data->current_month_recharge_amount_sum;//OrderDayStatService::getRechargeByChannels($distribution_channel_ids,$time_range=['begin_time' => $month_begin_time, 'end_time' => $yesterdayEnd]); //OrderService::getAmount($company_order_params_current_month);
-
-                    $item['company_name'] = $company_name;
-                    $fans_gender = $company->fans_gender;
-                    switch ($fans_gender) {
-                        case 1:
-                            $item['fans_gender'] = '男粉';
-                            break;
-                        case 2:
-                            $item['fans_gender'] = '女粉';
-                            break;
-                        case 3:
-                            $item['fans_gender'] = '混合粉';
-                            break;
-                        default:
-                            $item['fans_gender'] = '';
-                    }
-                } else {
-                    $item['company_name'] = '';
-                    $item['fans_gender'] = '';
-                    //\Log::info('company error:' . $item['company_id']);
-                }
-                //\Log::info('time_check:UserService::getCompanyDayTotal:before:'.time());
-                $item['business_channel_stats_today_register_user_num'] = UserService::getCompanyDayTotal($today, $item['company_id']);
-                //\Log::info('time_check:UserService::getCompanyTotal:before:'.time());
-                $item['business_channel_stats_total_register_user_num'] = UserService::getCompanyTotal($item['company_id']);
-                //\Log::info('time_check:UserService::getCompanyTotal:after:'.time());
-            }
-        }
-        return response()->pagination(new BusinessCompanyStatTransformer(), $result);
-    }
-
-    public function getCompanyLastWeekPromotion(Request $request)
-    {
-        $company_id = $request->input('company_id', '');
-        if (!$company_id) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $time = $request->input('time', '');
-        if (!$time) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if (!in_array($time, ['current', 'last'])) {
-            return response()->error('PARAM_ERROR');
-        }
-        $books = [];
-        if ($time == 'current') {
-            $current_week_start = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d") - date("w") + 1, date("Y")));
-            $current_week_end = date("Y-m-d H:i:s", mktime(23, 59, 59, date("m"), date("d") - date("w") + 7, date("Y")));
-            $books = SendOrderService::getCompanyPromotionBooks($company_id, $current_week_start, $current_week_end);
-            //return response()->success($books);
-        }
-        if ($time == 'last') {
-            $beginLastweek = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') - date('w') + 1 - 7, date('Y')));
-            $endLastweek = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m'), date('d') - date('w') + 7 - 7, date('Y')));
-            $books = SendOrderService::getCompanyPromotionBooks($company_id, $beginLastweek, $endLastweek);
-        }
-
-        return response()->success($books);
-    }
-
-    public function getServiceAccount(Request $request)
-    {
-        $company_id = $request->input('company_id', '');
-        if (empty($company_id)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $accounts = CompanyService::getCompanyServiceAccounts($company_id);
-        return response()->success($accounts);
-    }
-}

+ 0 - 92
app/Http/Controllers/Manage/Channel/BusinessChannelDataController.php

@@ -1,92 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:32
- */
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Manage\Channel\Transformers\BusinessChannelDataTransformer;
-use App\Http\Controllers\Manage\Finance\BaseController;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Manage\Services\ManageService;
-use App\Modules\OfficialAccount\Services\OfficialAccountService;
-use Illuminate\Http\Request;
-
-/**
- * 商务运营-渠道粉丝阈值模块
- * Class BusinessChannelDataController
- * @package App\Http\Controllers\Manage\Channel
- */
-class BusinessChannelDataController extends BaseController
-{
-    /**
-     * 获取商务各自的渠道信息
-     * @param Request $request
-     */
-    function getBusinessChannelData(Request $request)
-    {
-        $result = [];
-        $manageId = $request->session()->get('manage_auth');
-        $distribution_channel_id = $request->input('distribution_channel_id');
-        $distribution_channel_name = $request->input('distribution_channel_name');
-        $official_account_name = $request->input('official_account_name');
-
-        if (!empty($manageId)) {
-            $manageModel = ManageService::getById($manageId);
-            if ($manageModel) {
-                $role = $manageModel->role;
-                $channels = ($role == 'admin') ? [] : ChannelService::getByDistributionManagesId($manageId);
-                if ($distribution_channel_id) {
-                    $channels = [$distribution_channel_id];
-                }
-                \Log::info('getBusinessChannelData_official_account_name:'.$official_account_name.' $distribution_channel_name:'.$distribution_channel_name);
-                $result = OfficialAccountService::getBusinessChannelData($channels, $distribution_channel_name, $official_account_name,false);
-            }
-        }
-        return response()->pagination(new BusinessChannelDataTransformer(), $result);
-    }
-
-    /**
-     * 导出商务各自的渠道信息
-     * @param Request $request
-     */
-    function exportBusinessChannelData(Request $request)
-    {
-        $result = [];
-        $distribution_channel_id = $request->input('distribution_channel_id');
-        $distribution_channel_name = $request->input('distribution_channel_name');
-        $official_account_name = $request->input('official_account_name');
-        
-        $manageId = $request->session()->get('manage_auth');
-        if (!empty($manageId)) {
-            $manageModel = ManageService::getById($manageId);
-            if ($manageModel) {
-                $role = $manageModel->role;
-                $channels = ($role == 'admin') ? [] : ChannelService::getByDistributionManagesId($manageId);
-                if ($distribution_channel_id) {
-                    $channels = [$distribution_channel_id];
-                }
-                \Log::info('getBusinessChannelData_official_account_name:'.$official_account_name.' $distribution_channel_name:'.$distribution_channel_name);
-                $result = OfficialAccountService::getBusinessChannelData($channels, $distribution_channel_name, $official_account_name,false);
-            }
-
-            header("Content-type:application/vnd.ms-excel");
-            header("Content-Disposition:attachment;filename=" . "明细" . date("YmdHis") . ".csv");
-            echo iconv("UTF-8", "GBK", "\"渠道ID\",\"渠道名称\",\"服务号名称\",\"日关注粉丝阈值\",\"总关注粉丝阈值\",\"当日实时关注粉丝数\",\"当日实时累计总粉丝数\"\r\n");
-            foreach ($result as $item) {
-                echo("\"" . mb_convert_encoding($item->distribution_channel_id, "GBK", "UTF-8") . "\",");
-                echo("\"" . mb_convert_encoding($item->distribution_channel_name, "GBK", "UTF-8") . "\",");
-                echo("\"" . mb_convert_encoding($item->service_name, "GBK", "UTF-8") . "\",");
-                echo("\"" . mb_convert_encoding($item->subscribe_day_maximum, "GBK", "UTF-8") . "\",");
-                echo("\"" . mb_convert_encoding($item->subscribe_top_num, "GBK", "UTF-8") . "\",");
-                echo("\"" . mb_convert_encoding($item->day_fans_num, "GBK", "UTF-8") . "\",");
-                echo("\"" . $item->day_total_fans_num . "\"\r\n");
-            }
-            exit();
-        }
-    }
-}
-

+ 0 - 36
app/Http/Controllers/Manage/Channel/ChannelActivityController.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelQuestionNaireTransformer;
-use App\Modules\Channel\Models\ChannelActivities;
-use App\Modules\Channel\Models\ChannelQuestionNaire;
-use App\Modules\Channel\Services\ChannelActivitiesService;
-use App\Modules\Channel\Services\ChannelQuestionNaireService;
-use App\Modules\Channel\Services\CompanyService;
-use Illuminate\Http\Request;
-
-
-class ChannelActivityController extends BaseController
-{
-    public function addActivity(Request $request) {
-        $channel_id = $request->input('channel_id','');
-        $begin_time = $request->input('start_time','');
-        $end_time = $request->input('end_time','');
-        $amount = $request->input('amount',500);
-        if(empty($channel_id)||empty($begin_time)||empty($end_time)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if(!in_array($amount,[500,1000])) {
-            return response()->error('PARAM_ERROR');
-        }
-        $res = ChannelActivitiesService::addChannelActivity($channel_id,['begin_time'=>$begin_time,'end_time'=>$end_time,'amount'=>$amount]);
-        return response()->success($res);
-    }
-
-    public function getActivities(Request $request) {
-        $res = ChannelActivitiesService::getAll();
-        return response()->success($res);
-    }
-}

+ 0 - 36
app/Http/Controllers/Manage/Channel/ChannelDataController.php

@@ -1,36 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/12/1
- * Time: 17:18
- */
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Controller;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Trade\Services\OrderService;
-use Illuminate\Http\Request;
-
-/**
- * 渠道数据统计
- * Class ChannelDataController
- * @package App\Http\Controllers\Manage\Channel
- */
-class ChannelDataController extends Controller
-{
-    function getChannleData(Request $request)
-    {
-        //获取所有的渠道
-        $channels = ChannelService::getAllChannels();
-        if (!empty($channels)) {
-            //遍历循环获取每个渠道下面的数据
-            foreach ($channels as $channelItem) {
-                $channelId = $channelItem->id;
-                $channelItem->dataInfo = OrderService::getChannelToday($channelId);
-            }
-        }
-        return json_encode($channels);
-    }
-}

+ 0 - 83
app/Http/Controllers/Manage/Channel/ChannelQuestionNaireController.php

@@ -1,83 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelQuestionNaireTransformer;
-use App\Modules\Channel\Models\ChannelQuestionNaire;
-use App\Modules\Channel\Services\ChannelQuestionNaireService;
-use App\Modules\Channel\Services\CompanyService;
-use Illuminate\Http\Request;
-
-//结算比例
-
-/**
- * 渠道问卷调查
- * Class ChannelSwitchController
- * @package App\Http\Controllers\Channel\Channel
- */
-class ChannelQuestionNaireController extends BaseController
-{
-    /**
-     * 获取问卷调查信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function get_question_naires(Request $request)
-    {
-        $business_name = $request->input('business_name', '');
-
-        $params = [];
-        if ($business_name) {
-            $params['business_name'] = $business_name;
-        }
-
-        $data = ChannelQuestionNaireService::getQuestionNaires($params, false);
-
-        foreach ($data as $item) {
-            $channel_user_id = $item->channel_user_id;
-            $distribution_manages_id = $item->distribution_manages_id;
-
-            $total_grade = $this->getTotalGradePreMonth($distribution_manages_id, false);
-            $total_naire_company_count = $this->getNaireCompanyCountPreMonth($distribution_manages_id, false);
-
-            $total_grade_pre_month = $this->getTotalGradePreMonth($distribution_manages_id, true);
-            $naire_company_count_pre_month = $this->getNaireCompanyCountPreMonth($distribution_manages_id, true);
-
-            $item->company_count = CompanyService::getCompanyCountByManageId($distribution_manages_id);;
-            $item->un_naire_company_count = $item->company_count - $naire_company_count_pre_month;
-
-            if ($naire_company_count_pre_month == 0) {
-                $item->average_grade_pre_month = 0;
-            } else {
-                $item->average_grade_pre_month = round(($total_grade_pre_month / $naire_company_count_pre_month), 2);
-            }
-
-            if ($total_naire_company_count == 0) {
-                $item->total_average_grade = 0;
-            } else {
-                $item->total_average_grade = round(($total_grade / $total_naire_company_count), 2);
-            }
-        }
-        return response()->pagination(new ChannelQuestionNaireTransformer(), $data);
-    }
-
-    /**
-     * 获取上个月调查的公司的数量
-     * @param $channel_user_id
-     * @return mixed
-     */
-    public static function getNaireCompanyCountPreMonth($distribution_manages_id, $isPreMonth = true)
-    {
-        return ChannelQuestionNaire::getNaireCompanyCount($distribution_manages_id, $isPreMonth);
-    }
-
-    /**
-     * 获取商务上个月的总分数
-     * @param $channel_user_id
-     */
-    public static function getTotalGradePreMonth($distribution_manages_id, $isPreMonth = true)
-    {
-        return ChannelQuestionNaire::getTotalGrade($distribution_manages_id, $isPreMonth);
-    }
-}

+ 0 - 290
app/Http/Controllers/Manage/Channel/ChannelSellPlatformController.php

@@ -1,290 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: hp
- * Date: 2017/12/1
- * Time: 17:18
- */
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelBookSellTransformer;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelSellPlatformTransformer;
-use App\Modules\Book\Models\Book;
-use App\Modules\Channel\Models\ChannelBookSell;
-use App\Modules\Channel\Services\ChannelSellPlatformService;
-use DB;
-use GuzzleHttp\Client;
-use Illuminate\Http\Request;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-
-/**
- * Class ChannelSellPlatformController
- * @package App\Http\Controllers\Manage\Channel
- */
-class ChannelSellPlatformController extends Controller
-{
-    /**
-     * 根据id 查找信息
-     * @param Request $request
-     * @return mixed
-     */
-    function getChannelSellPlatformById(Request $request)
-    {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if (empty($id)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        if (!is_numeric($id)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        $data = ChannelSellPlatformService::getById($id);
-        return response()->item(new ChannelSellPlatformTransformer(), $data);
-    }
-
-    /**
-     * 根据code查找信息
-     * @param Request $request
-     * @return mixed
-     */
-    function getChannelSellPlatformByCode(Request $request)
-    {
-        $code = $request->has('code') ? $request->input('code') : '';
-        if (empty($code)) {
-            return response()->error('PARAM_EMPTY');
-        }
-
-        if (!preg_match("/^[a-zA-Z\s]+$/", $code)) {
-            return response()->error('PARAM_ERROR');
-        }
-
-        $data = ChannelSellPlatformService::getByCode($code);
-        return response()->item(new ChannelSellPlatformTransformer(), $data);
-    }
-
-    /**
-     * 获取列表
-     * @param Request $request
-     * @return mixed
-     */
-    function getList(Request $request)
-    {
-        $data = ChannelSellPlatformService::getList();
-        return response()->pagination(new ChannelSellPlatformTransformer(), $data);
-    }
-
-    /**
-     * 添加或更新信息
-     * @param Request $request
-     * @return mixed
-     */
-    function createOrUpdateChannelSellPlatform(Request $request)
-    {
-        $name = $request->has('name') ? $request->input('name') : '';
-        $code = $request->has('code') ? $request->input('code') : '';
-        $desc = $request->has('desc') ? $request->input('desc') : '';
-        $bill_type = $request->has('bill_type') ? $request->input('bill_type') : '';
-
-        if (!$code) {
-            return response()->error('PARAM_EMPTY');
-        }
-
-        if (!preg_match("/^[a-zA-Z\s]+$/", $code)) {
-            return response()->error('PARAM_ERROR');
-        }
-
-        $params = [];
-        if ($name) {
-            $params['name'] = $name;
-        }
-
-        if ($desc) {
-            $params['desc'] = $desc;
-        }
-
-        if ($bill_type) {
-            $params['bill_type'] = $bill_type;
-        }
-
-        $params['code'] = $code;
-
-        $data = ChannelSellPlatformService::getByCode($code);
-        //存在就更新,不存在就添加
-        if ($data) {
-            $res = ChannelSellPlatformService::updateById($data->id, $params);
-        } else {
-            $res = ChannelSellPlatformService::addInfo($params);
-        }
-
-        if ($res) {
-            return response()->success();
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-    public function importChannelBookSell(Request $request)
-    {
-        if (!$request->hasFile('channel_book_sell')) {
-            return response()->error('PARAM_ERROR');
-        }
-        $file_obj = $request->file('channel_book_sell');
-        $spreadsheet = IOFactory::load($file_obj->path());
-        $sheetData = $spreadsheet->getActiveSheet(0)->toArray(null, true, true, true);
-        \Log::info('sheetData:' . json_encode($sheetData));
-        $sheetDataLength = count($sheetData);
-        DB::beginTransaction();
-        try {
-            for ($i = 2; $i <= $sheetDataLength; $i++) {
-                $plaform = $sheetData[$i]['A'];
-                $zsy_bid = $sheetData[$i]['B'];
-                $book_name = $sheetData[$i]['C'];
-                $plaform_code = $sheetData[$i]['D'];
-                $amount = $sheetData[$i]['E'];
-                $sub_num = $sheetData[$i]['F'];
-                $date = $sheetData[$i]['G'];
-                $month = $sheetData[$i]['H'];
-
-                if (!$plaform || !$zsy_bid || !$book_name || !$plaform_code
-                    || !$date || !$sub_num || !$month) {
-                    return response()->error('PARAM_EMPTY');
-                }
-
-                $channelSellPlatform = ChannelSellPlatformService::getByCode($plaform_code);
-                if ($channelSellPlatform) {
-                    $is_checked = 0;
-                    $is_pushed = 0;
-
-                    $bill_type = $channelSellPlatform->bill_type;
-                    $data = compact(
-                        'plaform', 'zsy_bid', 'book_name', 'plaform_code',
-                        'amount', 'sub_num', 'date', 'month', 'is_checked', 'is_pushed', 'bill_type'
-                    );
-                    ChannelBookSell::addInfo($data);
-                } else {
-                    DB::rollback();
-                    return ['code'=>304,'msg'=>'第'.$i.'行填写的平台code有误,数据已回滚,请更改后重新上传!'];
-                }
-            }
-        } catch (\Exception $e) {
-            DB::rollback();
-            \Log::error($e->getMessage());
-            return response()->error('UPLOAD_FAILED', $e->getMessage());
-        }
-        DB::commit();
-        return response()->success();
-    }
-
-    /**
-     * 获取列表
-     * @param Request $request
-     * @return mixed
-     */
-    function getChannelBookShellList(Request $request)
-    {
-        $data = ChannelBookSell::getList();
-        return response()->pagination(new ChannelBookSellTransformer(), $data);
-    }
-
-    function updateStatus(Request $request)
-    {
-        $id = $request->has('id') ? $request->input('id') : '';
-        $isPush = $request->has('isPush') ? $request->input('isPush') : '';
-        $isChecked = $request->has('isChecked') ? $request->input('isChecked') : '';
-        if (!$id) {
-            return response()->error('PARAM_EMPTY');
-        }
-
-        if (!$isPush && !$isChecked) {
-            return response()->error('PARAM_ERROR');
-        }
-        $params = [];
-        if ($isPush) {
-            $params['is_pushed'] = $isPush;
-        }
-
-        if ($isChecked) {
-            $params['is_checked'] = $isChecked;
-        }
-
-        \Log::info('id is: ' . $id);
-        $data = ChannelBookSell::getById($id);
-        if ($isChecked) {
-            //已审核通过
-            if ($data && 1 == $data->is_checked) {
-                return response()->error("ALREADY_CHECKED");
-            } else {
-                $res = ChannelBookSell::updateStatus($id, $params);
-                if ($res) {
-                    return response()->success();
-                } else {
-                    return response()->error("HANDLE_FAILED");
-                }
-            }
-        } else {
-            //如果没有审核通过进行推送
-            if (!$data || (1 != $data->is_checked && 1 == $isPush)) {
-                return response()->error("NOT_CHECKED");
-            }
-
-            //已经推送了
-            if ($data && 1 == $isPush && 1 == $data->is_pushed) {
-                return response()->error("ALREADY_PUSHED");
-            }
-
-            if ($data && 1 == $isPush && 1 == $data->is_checked) {
-                $content = $this->uploadToYcsd($data);
-                \Log::info('content is: ' . $content);
-                if ($content) {
-                    $content = json_decode($content);
-                    if (isset($content->code)) {
-                        if ($content->code == 0) {
-                            \Log::info("推送到原创成功");
-                            ChannelBookSell::updateStatus($id, $params);
-                            return response()->success();
-                        } else {
-                            $data = ['code' => $content->code, 'msg' => $content->msg, 'data' => ''];
-                            return response()->json($data);
-                        }
-                    }
-                }
-            }
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-    function uploadToYcsd($data)
-    {
-        $content = '';
-        try {
-            $bill_type = $data->bill_type;
-            $book = Book::getBook($data->zsy_bid);
-            $daytime = ($bill_type == 'month') ? ($data->month . '00') : $data->date;
-
-            $params = [
-                'daytime' => $daytime,
-                'amount' => $data->amount,
-                'platform' => $data->plaform,
-                'lybid' => $book ? $book->ly_bid : '',
-                'platform_code' => $data->plaform_code,
-                'itype' => ($bill_type == 'month') ? 1 : 0,
-                'sign' => md5($daytime . 'ycsd2015')
-            ];
-
-            $path = 'http://www.ycsd.cn/ycsdApp/own/?action=getOutChannelPay';
-            $client = new Client(['timeout' => 3.0,]);
-            \Log::info($params);
-            $response = $client->request('POST', $path, ['form_params' => $params]);
-            $resultCode = $response->getStatusCode();
-            \Log::info("code is: " . $resultCode);
-            if ($resultCode == 200 || $resultCode == 302) {
-                $content = $response->getBody()->getContents();
-            }
-        } catch (\Exception $e) {
-            \Log::info($e->getMessage());
-        }
-        return $content;
-    }
-}

+ 0 - 270
app/Http/Controllers/Manage/Channel/ChannelUserController.php

@@ -1,270 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelUserTransformer;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Channel\Services\CompanyService;
-use Illuminate\Http\Request;
-
-/**
- * Class ChannelUserController 渠道
- * @package App\Http\Controllers\Manage\Channel
- */
-class ChannelUserController extends BaseController
-{
-    /**
-     * @apiDefine channel 渠道
-     */
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 更新渠道信息新
-     * @api {POST} channel/updateChannelUserInfo 更新渠道信息新
-     * @apiGroup channel
-     * @apiName channel/updateChannelUserInfo
-     * @apiParam {Number} distribution_channel_id 渠道id
-     * @apiParam {String} [name] 渠道名称
-     * @apiParam {String} [nickname] 渠道昵称
-     * @apiParam {Number} [pay_merchant_id] 渠道支付通道
-     * @apiParam {Number} [distribution_manages_id] 渠道管理员
-     * @apiParam {String} [phone] 渠道电话
-     * @apiParam {String} [person_in_charge_name] 渠道负责人
-     * @apiParam {String} [remark] 备注
-     * @apiParam {Number} [is_enabled] 是否开通 0:未审核; 1:审核通过
-     * @apiParam {Number} [company_id] 设置公司
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *            "id": 1,
-     *            "phone": "1586810210",
-     *            "name": "分销1",
-     *            "pay_merchant": "ALLINPAY_NALAN",
-     *            "nickname": "昵称",
-     *            "password": "34sdfsdfdsf23",
-     *            "latest_login_time": "2017-12-12 12:12:12",
-     *            "latest_login_ip": "56.3.21.2",
-     *            "remark": "啦啦啦",
-     *            "register_ip": "123.25.21.21",
-     *         }
-     *
-     *     }
-     */
-    function updateChannelData(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-
-        if (empty(ChannelUserService::getById($distribution_channel_id))) {
-            return response()->error('PARAM_ERROR');
-        }
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('distribution_channel_name') : '';
-        $nickname = $request->has('nickname') ? $request->input('nickname') : '';
-        $pay_merchant_id = $request->has('pay_merchant_id') ? $request->input('pay_merchant_id') : '';
-        $phone = $request->has('phone') ? $request->input('phone') : '';
-        $person_in_charge_name = $request->has('person_in_charge_name') ? $request->input('person_in_charge_name') : '';
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-
-        $params = [
-            'name' => $distribution_channel_name,
-            'nickname' => $nickname,
-            'pay_merchant_id' => $pay_merchant_id,
-            'phone' => $phone,
-            'person_in_charge_name' => $person_in_charge_name,
-            'distribution_manages_id' => $distribution_manages_id,
-            'remark' => $remark,
-            'is_enabled' => $isEnabled,
-        ];
-
-        $company_id = $request->has('company_id') ? $request->input('company_id') : '';
-        if ($company_id) {
-            $company = CompanyService::getCompany($company_id);
-            if ($company) {
-                $params['company_id'] = $company->id;
-                $params['company_name'] = $company->name;
-            }
-        }
-
-        $channel = ChannelUserService::updateChannelData($distribution_channel_id, $params);
-        return response()->item(new ChannelUserTransformer(), $channel);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取渠道列表新
-     * @api {GET} channel/getChannelUserList 获取渠道列表新
-     * @apiGroup channel
-     * @apiName channel/getChannelUserList
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [phone] 搜索手机号码
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_enabled] 0:待审核; 1:已审核.(可不传)
-     * @apiParam   {Number}  [distribution_manages_id] 管理员ID.(可不传)
-     * @apiParam   {Number}  [company_id] 公司ID.(可不传)
-     * @apiParam   {Number}  [is_important] 公司是否重要
-     * @apiParam   {String}  [orderByDesc] 排序字段.(可不传)['nickname', 'phone', 'create_time', 'company_id']
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": null,
-     *                   "distribution_manages_number": null,
-     *                   "distribution_manages_nickname": null
-     *              }
-     *          ]
-     *     }
-     */
-    function getList(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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'))) : '';
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-        $company_id = $request->has('company_id') ? $request->input('company_id') : '';
-        $is_important = $request->input('is_important');
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        $phone = $request->has('phone') ? $request->input('phone') : '';
-        $orderByDesc = $request->has('orderByDesc') ? $request->input('orderByDesc') : '';
-
-        //商务,只获取到当前商务下的渠道列表
-        if ($this->getLoginUserRole() == "business") {
-            $distribution_manages_id = $this->getLoginUserId();
-        }
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'distribution_manages_id' => $distribution_manages_id,
-            'is_enabled' => $isEnabled,
-            'search_name' => $search_name,
-            'phone' => $phone,
-            'orderByDesc' => $orderByDesc,
-            'company_id' => $company_id,
-            'is_important' => $is_important,
-        ];
-        $result = ChannelUserService::getChannelList($params);
-
-        return response()->pagination(new ChannelUserTransformer(), $result);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取所有渠道列表新
-     * @api {GET} channel/getChannelAllUserList 获取所有渠道列表新
-     * @apiGroup channel
-     * @apiName channel/getChannelAllUserList
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": null,
-     *                   "distribution_manages_number": null,
-     *                   "distribution_manages_nickname": null
-     *              }
-     *          ]
-     *     }
-     */
-    function getAllList(Request $request)
-    {
-        $isEnabled = 1;
-        $params = [
-            'is_enabled' => $isEnabled,
-        ];
-        $result = ChannelUserService::getChannelList($params, true);
-
-        return response()->collection(new ChannelUserTransformer(), $result);
-    }
-}

+ 0 - 495
app/Http/Controllers/Manage/Channel/ChannelsController.php

@@ -1,495 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel;
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelTransformer;
-use App\Modules\Channel\Models\Channel;
-use App\Modules\Channel\Services\ChannelService;
-use Illuminate\Http\Request;
-
-/**
- * Class ChannelsController 渠道
- * @package App\Http\Controllers\Manage\Channel
- */
-class ChannelsController extends BaseController
-{
-    /**
-     * @apiDefine channel 渠道
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取所有渠道
-     * @api {GET} channel/getChannelList 获取所有渠道
-     * @apiGroup channel
-     * @apiName getChannelList
-     * @apiParam {Number}  [channel_user_id] 账户ID
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                 "id": 1,
-     *                 "name": "分销1",
-     *                 "phone": "1586810210",
-     *                 "pay_merchant": "ALLINPAY_NALAN",
-     *                 "nickname": "昵称",
-     *                 "password": "34sdfsdfdsf23",
-     *                 "latest_login_time": "2017-12-12 12:12:12",
-     *                 "latest_login_ip": "56.3.21.2",
-     *                 "remark": "啦啦啦",
-     *                 "register_ip": "123.25.21.21",
-     *              }
-     *          ]
-     *     }
-     */
-
-    function getChannelList(Request $request)
-    {
-        $channel_user_id = $request->has('channel_user_id') ? $request->input('channel_user_id') : '';
-
-        $params = [
-            'channel_user_id' => $channel_user_id,
-        ];
-
-        $channelList = ChannelService::getAllChannels($params);
-        return response()->collection(new ChannelTransformer(), $channelList);
-    }
-    
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 创建渠道
-     * @api {POST} channel/createChannel 创建渠道
-     * @apiGroup channel
-     * @apiName createChannel
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiParam {String}  [name] 渠道名称.
-     * @apiParam {String}  [pay_merchant] 支付商户.
-     * @apiParam {String}  [nickname] 昵称.
-     * @apiParam {String}  phone 手机号码.
-     * @apiParam {String}  password 密码.
-     * @apiParam {String}  [latest_login_time] 最后登陆时间.
-     * @apiParam {String}  [latest_login_ip] 最后登陆IP.
-     * @apiParam {String}  [remark] 备注.
-     * @apiParam {String}  [register_ip] 注册IP.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": 
-     *         {
-     *            "id": 1,
-     *            "phone": "1586810210",
-     *            "name": "分销1",
-     *            "pay_merchant": "ALLINPAY_NALAN",
-     *            "nickname": "昵称",
-     *            "password": "34sdfsdfdsf23",
-     *            "latest_login_time": "2017-12-12 12:12:12",
-     *            "latest_login_ip": "56.3.21.2",
-     *            "remark": "啦啦啦",
-     *            "register_ip": "123.25.21.21",
-     *         }
-     *        
-     *     }
-     */
-    function create(Request $request)
-    {
-        $name = $request->has('name') ? trim($request->input('name')) : '';
-        $pay_type = $request->has('pay_type') ? trim($request->input('pay_type')) : 'ALLINPAY_NALAN';
-        $phone = $request->has('phone') ? trim($request->input('phone')) : '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-        $nickname = $request->has('nickname') ? trim($request->input('nickname')) : '';
-        $latest_login_time = date("Y-m-d H:i:s");
-        $remark = $request->has('remark') ? trim($request->input('remark')) : '';
-        $latest_login_ip = $register_ip = $request->has('register_ip') ? trim($request->input('register_ip')) : '';
-
-        if(!$phone || !$password) return response()->error('PARAM_ERROR');
-
-        $password = md5($password."^-^zhuishuyun^_^");
-
-        $channel = Channel::firstOrCreate(compact('phone'),compact('password','name','pay_type','nickname','latest_login_ip','latest_login_time','remark','register_ip'));
-        return response()->item(new ChannelTransformer(), $channel);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 通过手机号码获取渠道
-     * @api {GET} channel/getByPhone 通过手机号码获取渠道
-     * @apiGroup channel
-     * @apiName getByPhone
-     * @apiParam {Number} phone 手机号码
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": 
-     *         {
-     *            "id": 1,
-     *            "phone": "1586810210",
-     *            "name": "分销1",
-     *            "pay_merchant": "ALLINPAY_NALAN",
-     *            "nickname": "昵称",
-     *            "password": "34sdfsdfdsf23",
-     *            "latest_login_time": "2017-12-12 12:12:12",
-     *            "latest_login_ip": "56.3.21.2",
-     *            "remark": "啦啦啦",
-     *            "register_ip": "123.25.21.21",
-     *         }
-     *        
-     *     }
-     */
-    function getByPhone(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')) : '';
-
-        if(!$phone) return response()->error('PARAM_ERROR');
-        $channel = Channel::getByPhone($phone);
-        return response()->item(new ChannelTransformer(), $channel);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 校验密码
-     * @api {POST} checkPassword 校验密码
-     * @apiGroup channel
-     * @apiName checkPassword
-     * @apiParam {String}  phone 手机号码.
-     * @apiParam {String}  password 密码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function checkPassword(Request $request)
-    {
-        $phone = $request->has('phone') ? trim($request->input('phone')) : '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-
-        if(!$phone || !$password) return response()->error('PARAM_ERROR');
-
-        $channel = Channel::getByPhone($phone);
-        if($channel->password == md5($password."^-^zhuishuyun^_^"))
-        {
-            return response()->success();
-        }else{
-            return response()->error('LOGIN_VERIFY_ERROR');
-        }
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 通过id获取渠道
-     * @api {GET} channel/getById 通过id获取渠道
-     * @apiGroup channel
-     * @apiName getById
-     * @apiParam {Number} id 渠道id
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *            "id": 1,
-     *            "phone": "1586810210",
-     *            "name": "分销1",
-     *            "pay_merchant": "ALLINPAY_NALAN",
-     *            "nickname": "昵称",
-     *            "password": "34sdfsdfdsf23",
-     *            "latest_login_time": "2017-12-12 12:12:12",
-     *            "latest_login_ip": "56.3.21.2",
-     *            "remark": "啦啦啦",
-     *            "register_ip": "123.25.21.21",
-     *         }
-     *
-     *     }
-     */
-    function getById(Request $request)
-    {
-        $id = $request->has('id') ? trim($request->input('id')) : '';
-
-        if(!$id) return response()->error('PARAM_ERROR');
-        $channel = ChannelService::getById($id);
-        return response()->item(new ChannelTransformer(), $channel);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 通过id获取渠道名称
-     * @api {GET} channel/getChannelNameById 通过id获取渠道
-     * @apiGroup channel
-     * @apiName getChannelNameById
-     * @apiParam {Number} id 渠道id
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *            "name": "分销1",
-     *         }
-     *     }
-     */
-    function getChannelNameById(Request $request)
-    {
-        $id = $request->has('id') ? trim($request->input('id')) : '';
-
-        if(!$id) return response()->error('PARAM_ERROR');
-        $channelName = ChannelService::getChannelNameById($id);
-        return response()->json($channelName);
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 更新渠道信息
-     * @api {POST} channel/updateInfo 更新渠道信息
-     * @apiGroup channel
-     * @apiName channel/updateInfo
-     * @apiParam {Number} distribution_channel_id 渠道id
-     * @apiParam {String} [name] 渠道名称
-     * @apiParam {String} [nickname] 渠道昵称
-     * @apiParam {Number} [pay_merchant_id] 渠道支付通道
-     * @apiParam {Number} [distribution_manages_id] 渠道管理员
-     * @apiParam {String} [phone] 渠道电话
-     * @apiParam {String} [person_in_charge_name] 渠道负责人
-     * @apiParam {String} [remark] 备注
-     * @apiParam {Number} [is_enabled] 是否开通 0:未审核; 1:审核通过
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  password 密码.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *            "id": 1,
-     *            "phone": "1586810210",
-     *            "name": "分销1",
-     *            "pay_merchant": "ALLINPAY_NALAN",
-     *            "nickname": "昵称",
-     *            "password": "34sdfsdfdsf23",
-     *            "latest_login_time": "2017-12-12 12:12:12",
-     *            "latest_login_ip": "56.3.21.2",
-     *            "remark": "啦啦啦",
-     *            "register_ip": "123.25.21.21",
-     *         }
-     *
-     *     }
-     */
-    function updateChannelData(Request $request) {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-
-        if(empty(ChannelService::getById($distribution_channel_id))) {
-            return response()->error('PARAM_ERROR');
-        }
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('distribution_channel_name') : '';
-        $nickname = $request->has('nickname') ? $request->input('nickname') : '';
-        $pay_merchant_id = $request->has('pay_merchant_id') ? $request->input('pay_merchant_id') : '';
-        $phone = $request->has('phone') ? $request->input('phone') : '';
-        $person_in_charge_name = $request->has('person_in_charge_name') ? $request->input('person_in_charge_name') : '';
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-
-        $params = [
-            'name'=>$distribution_channel_name,
-            'nickname'=>$nickname,
-            'pay_merchant_id'=>$pay_merchant_id,
-            'phone'=>$phone,
-            'person_in_charge_name'=>$person_in_charge_name,
-            'distribution_manages_id'=>$distribution_manages_id,
-            'remark'=>$remark,
-            'is_enabled'=>$isEnabled,
-        ];
-
-        $channel = ChannelService::updateChannelData($distribution_channel_id, $params);
-
-        return response()->item(new ChannelTransformer(), $channel);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取渠道列表
-     * @api {GET} channel/getList 获取渠道列表
-     * @apiGroup channel
-     * @apiName channel/getList
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_enabled] 0:待审核; 1:已审核.(可不传)
-     * @apiParam   {Number}  [distribution_manages_id] 管理员ID.(可不传)
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": null,
-     *                   "distribution_manages_number": null,
-     *                   "distribution_manages_nickname": null
-     *              }
-     *          ]
-     *     }
-     */
-    function getList(Request $request) {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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'))) : '';
-
-        $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-        $isEnabled = $request->has('is_enabled') ? $request->input('is_enabled') : '';
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-
-        //商务,只获取到当前商务下的渠道列表
-        if($this->getLoginUserRole() == "business") {
-            $distribution_manages_id = $this->getLoginUserId();
-        }
-//        dd($this->getLoginUserId());
-
-        $params = [
-            'channel_id'=>$distribution_channel_id,
-            'channel_name'=>$distribution_channel_name,
-            'start_date'=>$start_time,
-            'end_date'=>$end_time,
-            'distribution_manages_id'=>$distribution_manages_id,
-            'is_enabled'=>$isEnabled,
-            'search_name'=>$search_name,
-        ];
-        $result = ChannelService::getChannelList($params);
-
-        return response()->pagination(new ChannelTransformer(),  $result);
-    }
-}

+ 0 - 487
app/Http/Controllers/Manage/Channel/CompanyController.php

@@ -1,487 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2018/3/23
- * Time: 上午9:09
- */
-
-namespace App\Http\Controllers\Manage\Channel;
-
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Channel\Transformers\ChannelTransformer;
-use App\Http\Controllers\Manage\Channel\Transformers\CompanyTransformer;
-use App\Modules\Book\Services\BookService;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Channel\Services\CompanyService;
-use App\Modules\Channel\Services\CompanySpecialBookService;
-use Illuminate\Http\Request;
-
-class CompanyController extends BaseController
-{
-
-    /**
-     * @apiDefine channel 渠道
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加公司
-     * @api {POST} channel/company/add 添加公司
-     * @apiGroup channel
-     * @apiName channel/company/add
-     * @apiParam   {String}  name 公司名称
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    public function addCompany(Request $request) {
-        $name = $request->has('name') ? $request->input('name') : '';
-        if(empty($name)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $company = CompanyService::findByName($name);
-        if($company) {
-            return response()->error("COMPANY_EXIST");
-        }
-
-        $data = ['name' => $name, 'is_important' => 0];
-        $company = CompanyService::addCompany($data);
-
-        return response()->item(new CompanyTransformer(), $company);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除公司
-     * @api {POST} channel/company/remove 删除公司
-     * @apiGroup channel
-     * @apiName channel/company/remove
-     * @apiParam   {Number}  id 公司ID
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    public function rmCompany(Request $request) {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $company = CompanyService::getCompany($id);
-        if(!$company) {
-            return response()->error("PARAM_ERROR");
-        }
-        CompanySpecialBookService::rmCompany($id);
-        $company->delete();
-
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 更新公司
-     * @api {POST} channel/company/update 更新公司
-     * @apiGroup channel
-     * @apiName channel/company/update
-     * @apiParam   {Number}  id 公司ID
-     * @apiParam   {String}  [name] 公司名称
-     * @apiParam   {Number}  [is_important] 是否重要 0:不是重点,默认    1:重点商户
-     * @apiParam   {Number}  [distribution_manages_id] 商务ID
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    public function updateCompany(Request $request) {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if(empty($id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $is_important = $request->input('is_important','');
-
-        if($request->has('is_important') && !in_array($is_important, [0,1])) {
-            return response()->error("PARAM_ERROR");
-        }
-        if(!CompanyService::getCompany($id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $name = $request->has('name') ? $request->input('name') : '';
-        $data = [];
-        if($name){
-            $data['name'] =$name;
-        }
-        if($request->has('is_important') && in_array($is_important,[0,1])) {
-            $data['is_important'] = $is_important;
-        }
-        //$data = ['name' => $name, 'is_important' => $is_important];
-
-        if($this->getLoginUserRole() == "business_leader" || $this->getLoginUserRole() == "admin" || $this->getLoginUserRole()=="business") {
-            //只有商务主管能修改 公司对应商务,
-            $distribution_manages_id = $request->has('distribution_manages_id') ? $request->input('distribution_manages_id') : '';
-            if(is_numeric($distribution_manages_id) && $distribution_manages_id > 0) {
-                //更新公司对应用户的所属商务
-                $data['distribution_manages_id']= $distribution_manages_id;
-                ChannelUserService::updateChannelUserManager($distribution_manages_id, $id);
-            }
-        }
-        $fans_type = $request->input('fans_gender','');
-        if($fans_type){
-            if(!in_array($fans_type,[1,2,3])){
-                return response()->error('PARAM_ERROR');
-            }
-            $data['fans_gender'] = $fans_type;
-        }
-        if($data){
-            //\Log::info('delete_company_books:rmCompany:$id'.$id);
-            $company_old = CompanyService::getCompany($id);
-            $company = CompanyService::updateCompany($id, $data);
-
-            if($request->has('is_important') && $is_important == 0) {
-                //设置为普通商户之后,对应书籍删除
-                \Log::info('delete_company_books:rmCompany:$id'.$id.'is_important:'.$is_important);
-                CompanySpecialBookService::rmCompany($id);
-            }
-            if($request->has('is_important') && $is_important == 1 && $company_old->is_important==0) {
-                \Log::info('delete_company_books:rmCompany:$id'.$id.'is_important:'.$is_important);
-                CompanySpecialBookService::rmCompany($id);
-
-                $bids = CompanySpecialBookService::getBidByFirst();
-                if($bids) {
-                    foreach ($bids as $i) {
-                        CompanySpecialBookService::addBook($i, $id);
-                    }
-                }
-            }
-        }
-        $company = CompanyService::getCompany($id);
-        return response()->item(new CompanyTransformer(), $company);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 公司列表分页
-     * @api {GET} channel/company/list 公司列表分页
-     * @apiGroup channel
-     * @apiName channel/company/list
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {Number}  [is_important] 是否重要
-     * @apiSuccess {Number}  id 公司ID
-     * @apiSuccess {String}  name 公司名称
-     * @apiSuccess {Number}  is_important 是否重要
-     * @apiSuccess {String}  create_time 创建时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {
-     *          "list": [
-     *          {
-     *          "id": 2,
-     *          "name": "杭州掌维科技有限公司",
-     *          "is_important": 0,
-     *          "create_time": "2018-03-23 09:32:29"
-     *          },
-     *          ],
-     *          "meta": {
-     *          "total": 2,
-     *          "per_page": 15,
-     *          "current_page": 1,
-     *          "last_page": 1,
-     *          "next_page_url": "",
-     *          "prev_page_url": ""
-     *          }
-     *          }
-     *     }
-     */
-    public function getList(Request $request) {
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-        $is_important = $request->input('is_important');
-
-        $searchData = [
-            'search_name' => $search_name,
-            'is_important' => $is_important,
-        ];
-
-        $manager_info= json_decode(json_encode(unserialize($request->session()->get('manage_user'))),true);
-        $manager_id = '';
-        if($manager_info['role']=='business'){
-            $manager_id = $manager_info['id'];
-        }
-        $data = CompanyService::getList($searchData,false,$manager_id);
-
-        return response()->pagination(new CompanyTransformer(), $data);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 公司列表
-     * @api {GET} channel/company/allList 公司列表
-     * @apiGroup channel
-     * @apiName channel/company/allList
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {Number}  [is_important] 是否重要
-     * @apiSuccess {Number}  id 公司ID
-     * @apiSuccess {String}  name 公司名称
-     * @apiSuccess {Number}  is_important 是否重要
-     * @apiSuccess {String}  create_time 创建时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[
-     *              {
-     *          "id": 2,
-     *          "name": "杭州掌维科技有限公司",
-     *          "is_important": 0,
-     *          "create_time": "2018-03-23 09:32:29"
-     *          }
-     *          ]
-     *     }
-     */
-    public function getAllList(Request $request) {
-        $search_name = $request->has('search_name') ? $request->input('search_name') : '';
-        $is_important = $request->input('is_important');
-
-        $searchData = [
-            'search_name' => $search_name,
-            'is_important' => $is_important,
-        ];
-
-        $data = CompanyService::getList($searchData, true);
-
-        return response()->collection(new CompanyTransformer(), $data);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 公司列表图书ID
-     * @api {GET} channel/company/listByBookId 公司列表图书ID
-     * @apiGroup channel
-     * @apiName channel/company/listByBookId
-     * @apiParam   {Number}  bid 书籍ID
-     * @apiSuccess {Number}  id 公司ID
-     * @apiSuccess {String}  name 公司名称
-     * @apiSuccess {Number}  is_important 是否重要
-     * @apiSuccess {String}  create_time 创建时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":[
-     *              {
-     *          "id": 2,
-     *          "name": "杭州掌维科技有限公司",
-     *          "is_important": 0,
-     *          "create_time": "2018-03-23 09:32:29"
-     *          }
-     *          ]
-     *     }
-     */
-    public function getListByBookId(Request $request) {
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        if(empty($bid) || !is_numeric($bid)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        $data = CompanySpecialBookService::findCompanyToBid($bid);
-
-        return response()->collection(new CompanyTransformer(), $data);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取公司渠道列表
-     * @api {GET} channel/company/getChannelList 获取公司渠道列表
-     * @apiGroup channel
-     * @apiName channel/company/getChannelList
-     * @apiParam   {Number}  company_id 公司id
-     * @apiParam   {Number}  channel_user_id 账户id
-     *
-     * @apiSuccess {Number}  id 渠道ID.
-     * @apiSuccess {String}  name 渠道名称.
-     * @apiSuccess {String}  phone 手机号码.
-     * @apiSuccess {String}  pay_merchant 支付商户.
-     * @apiSuccess {String}  nickname 昵称.
-     * @apiSuccess {String}  latest_login_time  最后登陆时间.
-     * @apiSuccess {String}  latest_login_ip 最后登陆IP.
-     * @apiSuccess {String}  remark 备注.
-     * @apiSuccess {String}  register_ip 注册IP.
-     * @apiSuccess {String}  person_in_charge_name 负责人.
-     * @apiSuccess {String}  create_time 注册时间
-     * @apiSuccess {Number}  distribution_manages_id 管理员ID
-     * @apiSuccess {String}  distribution_manages_account 管理员
-     * @apiSuccess {String}  distribution_manages_number 管理员
-     * @apiSuccess {String}  distribution_manages_nickname 管理员昵称
-     * @apiSuccess {String}  price_rate 章节价格
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": [
-     *             {
-     *                  "id": 1,
-     *                   "phone": "",
-     *                   "name": "121",
-     *                   "pay_merchant_id": 1,
-     *                   "nickname": "是说",
-     *                   "latest_login_time": "",
-     *                   "latest_login_ip": "",
-     *                   "is_enabled": 1,
-     *                   "register_ip": "",
-     *                   "remark": "",
-     *                   "person_in_charge_name": "波哥帅",
-     *                   "create_time": "2017-11-20 18:34:17",
-     *                   "distribution_manages_id": 0,
-     *                   "distribution_manages_account": null,
-     *                   "distribution_manages_number": null,
-     *                   "distribution_manages_nickname": null
-     *              }
-     *          ]
-     *     }
-     */
-    public function getChannelList(Request $request) {
-        $company_id = $request->has('company_id') ? $request->input('company_id') : '';
-        $channel_user_id = $request->has('channel_user_id') ? $request->input('channel_user_id') : '';
-
-        if($company_id && !is_numeric($company_id) && !is_numeric($channel_user_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        if($company_id == 0) {
-            $channelUser = ChannelUserService::getById($channel_user_id);
-            if($channelUser) {
-                $company_id = $channelUser->company_id;
-            }
-        }
-
-        $channelUserIds = [];
-        if(is_numeric($company_id) && $company_id > 0) {
-            $channelUserIds = ChannelUserService::getChannelUserIdListByCompany($company_id);
-        } else {
-            $channelUserIds[] = $channel_user_id;
-        }
-//        $channelUserIds = ChannelUserService::getChannelUserIdListByCompany($company_id);
-        $channels = ChannelUserService::getChannelListByChannelUserIds($channelUserIds);
-        foreach ($channels as &$v){
-            $price_rate = BookService::getChapterPrice($v->id);
-            $default_rate = (float)env('DEFAULT_CHAPTER_PRICE',0.015)*100;
-            $v->price_rate = $price_rate?$price_rate:$default_rate;
-        }
-        return response()->collection(new ChannelTransformer(), $channels);
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加书籍
-     * @api {POST} channel/company/addBook 添加书籍
-     * @apiGroup channel
-     * @apiName channel/company/addBook
-     * @apiParam   {Number}  bid 书籍ID
-     * @apiParam   {Number}  company_ids 公司ids [1,2,3,4]
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    public function addCompanyBook(Request $request) {
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        $company_ids = $request->has('company_ids') ? $request->input('company_ids') : '';
-
-        if(!is_numeric($bid)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-//        if(count($ids) == 0) {
-//            return response()->error("PARAM_ERROR");
-//        }
-        \Log::info('delete_special_book_log:addCompanyBook:$bid:'.$bid);
-        CompanySpecialBookService::rmAllBook($bid);
-
-        if(!empty($company_ids)) {
-            $ids = explode(',', $company_ids);
-
-            foreach ($ids as $id) {
-                $data = CompanySpecialBookService::addBook($bid, $id);
-            }
-        }
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除书籍
-     * @api {POST} channel/company/rmBook 删除书籍
-     * @apiGroup channel
-     * @apiName channel/company/rmBook
-     * @apiParam   {Number}  bid 书籍ID
-     * @apiParam   {Number}  company_ids 公司id[1,2,3,4]
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    public function rmCompanyBook(Request $request) {
-        $bid = $request->has('bid') ? $request->input('bid') : '';
-        $company_ids = $request->has('company_ids') ? $request->input('company_ids') : '';
-
-        if(!is_numeric($bid) || empty($company_ids)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $ids = explode(',', $company_ids);
-        if(count($ids) == 0) {
-            return response()->error("PARAM_ERROR");
-        }
-        \Log::info('delete_special_book_log:rmCompanyBook:ids:'.json_encode($ids).'bid:'.$bid);
-        foreach ($ids as $id) {
-            $data = CompanySpecialBookService::rmBook($bid, $id);
-        }
-
-        return response()->success();
-    }
-
-    /**
-     * 设置商务公司所在的城市
-     * @param Request $request
-     * @return mixed
-     */
-    function setChannelCityInfo(Request $request)
-    {
-        $city = $request->has('city') ? $request->input('city') : '';
-        $companyId = $request->has('companyId') ? trim($request->input('companyId')) : '';
-
-        if (empty($companyId) || empty($city)) {
-            return response()->error('PARAM_ERROR');
-        }
-        $result = CompanyService::updateCompany($companyId, ['city' => $city]);
-        if ($result) {
-            return response()->success();
-        }
-        return response()->error("HANDLE_FAILED");
-    }
-}

+ 0 - 26
app/Http/Controllers/Manage/Channel/Transformers/BusinessChannelDataTransformer.php

@@ -1,26 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:37
- */
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-
-class BusinessChannelDataTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'distribution_manages_id' => $item->distribution_channel_id,
-            'distribution_manages_nickname' => $item->distribution_channel_name,
-            'service_name' => $item->service_name,
-            'subscribe_day_maximum' => $item->subscribe_day_maximum,
-            'subscribe_top_num' => $item->subscribe_top_num,
-            'day_fans_num' => $item->day_fans_num,
-            'day_total_fans_num' => $item->day_total_fans_num,
-        ];
-    }
-}

+ 0 - 39
app/Http/Controllers/Manage/Channel/Transformers/BusinessChannelDayStatTransformer.php

@@ -1,39 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:37
- */
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-
-class BusinessChannelDayStatTransformer
-{
-    public function transform($channelItem)
-    {
-        return [
-            'id' => $channelItem->id,
-            'phone' => $channelItem->phone,
-            'name' => $channelItem->name,
-            'pay_merchant_id' => (float)$channelItem->pay_merchant_id,
-            'nickname' => $channelItem->nickname,
-            'latest_login_time'   =>  isset($channelItem->latest_login_time) ? date("Y-m-d H:i:s",strtotime($channelItem->latest_login_time)) : "",
-            'latest_login_ip' => $channelItem->latest_login_ip,
-            'is_enabled' => $channelItem->is_enabled,
-            'remark' => $channelItem->remark,
-            'register_ip' => $channelItem->register_ip,
-            'person_in_charge_name'=>$channelItem->person_in_charge_name,
-            'create_time'   =>  isset($channelItem->created_at) ? date("Y-m-d H:i:s",strtotime($channelItem->created_at)) : "",
-            'distribution_manages_id'=>(float)$channelItem->distribution_manages_id,
-//            'distribution_manages_account'=>$channelItem->distribution_manages_account,
-            'distribution_manages_number'=>$channelItem->distribution_manages_number,
-            'distribution_manages_nickname'=>$channelItem->distribution_manages_nickname,
-            'business_channel_day_stats_date'   =>  isset($channelItem->business_channel_day_stats_date) ? date("Y-m-d",strtotime($channelItem->business_channel_day_stats_date)) : "",
-            'business_channel_day_stats_register_user_num'   =>  (float)$channelItem->business_channel_day_stats_register_user_num,
-            'business_channel_day_stats_send_order_num'   =>  (float)$channelItem->business_channel_day_stats_send_order_num,
-        ];
-    }
-
-}

+ 0 - 42
app/Http/Controllers/Manage/Channel/Transformers/BusinessChannelStatTransformer.php

@@ -1,42 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:37
- */
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-
-class BusinessChannelStatTransformer
-{
-    public function transform($channelItem)
-    {
-        return [
-            'id' => $channelItem->id,
-            'phone' => $channelItem->phone,
-            'name' => $channelItem->name,
-            'pay_merchant_id' => (float)$channelItem->pay_merchant_id,
-            'nickname' => $channelItem->nickname,
-            'latest_login_time'   =>  isset($channelItem->latest_login_time) ? date("Y-m-d H:i:s",strtotime($channelItem->latest_login_time)) : "",
-            'latest_login_ip' => $channelItem->latest_login_ip,
-            'is_enabled' => $channelItem->is_enabled,
-            'remark' => $channelItem->remark,
-            'register_ip' => $channelItem->register_ip,
-            'person_in_charge_name'=>$channelItem->person_in_charge_name,
-            'create_time'   =>  isset($channelItem->created_at) ? date("Y-m-d H:i:s",strtotime($channelItem->created_at)) : "",
-            'distribution_manages_id'=>(float)$channelItem->distribution_manages_id,
-//            'distribution_manages_account'=>$channelItem->distribution_manages_account,
-            'distribution_manages_number'=>$channelItem->distribution_manages_number,
-            'distribution_manages_nickname'=>$channelItem->distribution_manages_nickname,
-            'business_channel_stats_today_register_user_num'=>(float)$channelItem->business_channel_stats_today_register_user_num,
-            'business_channel_stats_yesterday_register_user_num'=>(float)$channelItem->business_channel_stats_yesterday_register_user_num,
-            'business_channel_stats_current_month_register_user_num'=>(float)$channelItem->business_channel_stats_current_month_register_user_num,
-            'business_channel_stats_last_month_register_user_num'=>(float)$channelItem->business_channel_stats_last_month_register_user_num,
-            'business_channel_stats_total_register_user_num'=>(float)$channelItem->business_channel_stats_total_register_user_num,
-            'business_channel_stats_total_send_order_num'=>(float)$channelItem->business_channel_stats_total_send_order_num,
-        ];
-    }
-
-}

+ 0 - 41
app/Http/Controllers/Manage/Channel/Transformers/BusinessCompanyStatTransformer.php

@@ -1,41 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:37
- */
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-
-class BusinessCompanyStatTransformer
-{
-    public function transform($channelItem)
-    {
-        return [
-            'city'=>$channelItem->city,
-            'manage_name'=>$channelItem->manage_name,
-            'company_name'=>$channelItem->company_name,
-            'company_id'=>$channelItem->company_id,
-            'fans_gender'=>$channelItem->fans_gender,
-            'company_total_charge_amount'=>$channelItem->company_total_charge_amount,
-            'company_total_charge_amount_current_month'=>$channelItem->company_total_charge_amount_current_month,
-            'business_channel_stats_today_register_user_num'=>(float)$channelItem->business_channel_stats_today_register_user_num,
-            'business_channel_stats_yesterday_register_user_num'=>(float)$channelItem->business_channel_stats_yesterday_register_user_num,
-            'business_channel_stats_current_month_register_user_num'=>(float)$channelItem->business_channel_stats_current_month_register_user_num,
-            'business_channel_stats_last_month_register_user_num'=>(float)$channelItem->business_channel_stats_last_month_register_user_num,
-            'business_channel_stats_total_register_user_num'=>(float)$channelItem->business_channel_stats_total_register_user_num,
-            'business_channel_stats_total_send_order_num'=>(float)$channelItem->business_channel_stats_total_send_order_num,
-            'business_channel_stats_service_account_sum'=>(float)$channelItem->service_account_sum,
-            'business_channel_stats_last_week_actual_send_orders_sum'=>(float)$channelItem->last_week_actual_send_orders_sum,
-            'business_channel_stats_current_week_actual_send_orders_sum'=>(float)$channelItem->current_week_actual_send_orders_sum,
-            'business_channel_stats_yesterday_create_orders_sum'=>(float)$channelItem->yesterday_create_orders_sum,
-            'business_channel_stats_last_week_login_day_sum'=>(float)$channelItem->last_week_login_day_sum,
-            'business_channel_stats_current_week_login_days_sum'=>(float)$channelItem->current_week_login_days_sum,
-            'business_channel_stats_is_yesterday_login'=>$channelItem->is_yesterday_login,
-            'last_month_recharge_sum'=> $channelItem->last_month_channel_recharge_sum
-        ];
-    }
-
-}

+ 0 - 46
app/Http/Controllers/Manage/Channel/Transformers/BusinessStatDataTransformer.php

@@ -1,46 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午5:37
- */
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-
-class BusinessStatDataTransformer
-{
-    public function transform($channelItem)
-    {
-        return [
-            'distribution_manages_id'=>(float)$channelItem->id,
-//            'distribution_manages_account'=>$channelItem->account,
-            'distribution_manages_nickname'=>$channelItem->nickname,
-            'distribution_manages_latest_login_time'=>isset($channelItem->latest_login_time) ? ($channelItem->latest_login_time ? date('Y-m-d H:i:s', strtotime($channelItem->latest_login_time)) : "") : "",
-            'distribution_manages_latest_login_ip'=>$channelItem->latest_login_ip,
-            'distribution_manages_is_enabled'=>(float)$channelItem->is_enabled,
-            'distribution_manages_remark'=>$channelItem->remark,
-            'distribution_manages_register_ip'=>$channelItem->register_ip,
-            'distribution_manages_create_time'=>isset($channelItem->created_at) ? ($channelItem->created_at ? date('Y-m-d H:i:s', strtotime($channelItem->created_at)) : "") : "",
-            'distribution_manages_update_time'=>isset($channelItem->updated_at) ? ($channelItem->updated_at ? date('Y-m-d H:i:s', strtotime($channelItem->updated_at)) : "") : "",
-            'distribution_manages_number'=>$channelItem->number,
-            'today_register_user_num'=>(float)$channelItem->today_register_user_num,
-            'yesterday_register_user_num'=>(float)$channelItem->yesterday_register_user_num,
-            'current_month_register_user_num'=>(float)$channelItem->current_month_register_user_num,
-            'last_month_register_user_num'=>(float)$channelItem->last_month_register_user_num,
-            'total_register_user_num'=>(float)$channelItem->total_register_user_num,
-            'total_send_order_num'=>(float)$channelItem->total_send_order_num,
-            'current_month_companies_num'=>(float)$channelItem->current_month_companies_num,
-            'current_month_channel_num'=>(float)$channelItem->current_month_channel_num,
-            'last_month_companies_num'=>(float)$channelItem->last_month_companies_num,
-            'last_month_channel_num'=>(float)$channelItem->last_month_channel_num,
-            'current_month_new_channels_recharge'=>(float)$channelItem->current_month_new_channels_recharge,
-            'current_month_channels_recharge'=>(float)$channelItem->current_month_channels_recharge,
-            'last_month_new_channels_recharge'=>(float)$channelItem->last_month_new_channels_recharge_sum,
-            'last_month_channels_recharge'=>(float)$channelItem->last_month_channels_recharge_sum,
-
-        ];
-    }
-
-}

+ 0 - 25
app/Http/Controllers/Manage/Channel/Transformers/ChannelBookSellTransformer.php

@@ -1,25 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-class ChannelBookSellTransformer
-{
-    public function transform($Item)
-    {
-        return [
-            'id' => $Item->id,
-            'plaform' => $Item->plaform,
-            'zsy_bid' => $Item->zsy_bid,
-            'book_name' => $Item->book_name,
-            'bill_type' => $Item->bill_type,
-            'amount' => $Item->amount,
-            'sub_num' => $Item->sub_num,
-            'date' => $Item->date,
-            'month' => $Item->month,
-            'is_checked' => $Item->is_checked,
-            'is_pushed' => $Item->is_pushed,
-            'created_at' => date("Y-m-d H:i:s", strtotime($Item->created_at)),
-            'updated_at' => date("Y-m-d H:i:s", strtotime($Item->updated_at))
-        ];
-    }
-}

+ 0 - 17
app/Http/Controllers/Manage/Channel/Transformers/ChannelQuestionNaireTransformer.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-class ChannelQuestionNaireTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'business_name' => $item->business_name,
-            'company_count' => $item->company_count,
-            'un_naire_company_count' => $item->un_naire_company_count,
-            'average_grade_pre_month' => $item->average_grade_pre_month,
-            'total_average_grade' => $item->total_average_grade
-        ];
-    }
-}

+ 0 - 19
app/Http/Controllers/Manage/Channel/Transformers/ChannelSellPlatformTransformer.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-class ChannelSellPlatformTransformer
-{
-    public function transform($Item)
-    {
-        return [
-            'id' => $Item->id,
-            'name' => $Item->name,
-            'code' => $Item->code,
-            'desc' => $Item->desc,
-            'bill_type' => $Item->bill_type,
-            'created_at' => date("Y-m-d H:i:s", strtotime($Item->created_at)),
-            'updated_at' => date("Y-m-d H:i:s", strtotime($Item->updated_at))
-        ];
-    }
-}

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

@@ -1,30 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-class ChannelTransformer
-{
-    public function transform($channelItem)
-    {
-        return [
-            'id' => $channelItem->id,
-            'phone' => $channelItem->phone,
-            'name' => $channelItem->name,
-            'pay_merchant_id' => (float)$channelItem->pay_merchant_id,
-            'nickname' => $channelItem->nickname,
-            'latest_login_time'   =>  isset($channelItem->latest_login_time) ? date("Y-m-d H:i:s",strtotime($channelItem->latest_login_time)) : "",
-            'latest_login_ip' => $channelItem->latest_login_ip,
-            'is_enabled' => $channelItem->is_enabled,
-            'remark' => $channelItem->remark,
-            'channel_user_id'=>$channelItem->channel_user_id,
-            'register_ip' => $channelItem->register_ip,
-            'person_in_charge_name'=>$channelItem->person_in_charge_name,
-            'create_time'   =>  isset($channelItem->created_at) ? date("Y-m-d H:i:s",strtotime($channelItem->created_at)) : "",
-            'distribution_manages_id'=>(float)$channelItem->distribution_manages_id,
-            'distribution_manages_account'=>$channelItem->distribution_manages_account,
-            'distribution_manages_number'=>$channelItem->distribution_manages_number,
-            'distribution_manages_nickname'=>$channelItem->distribution_manages_nickname,
-            'price_rate'=>isset($channelItem->price_rate)?$channelItem->price_rate:''
-        ];
-    }
-}

+ 0 - 32
app/Http/Controllers/Manage/Channel/Transformers/ChannelUserTransformer.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-class ChannelUserTransformer
-{
-    public function transform($channelItem)
-    {
-        return [
-            'id' => $channelItem->id,
-            'phone' => $channelItem->phone,
-            'name' => $channelItem->name,
-            'pay_merchant_id' => (float)$channelItem->pay_merchant_id,
-            'nickname' => $channelItem->nickname,
-            'latest_login_time'   =>  isset($channelItem->latest_login_time) ? date("Y-m-d H:i:s",strtotime($channelItem->latest_login_time)) : "",
-            'latest_login_ip' => $channelItem->latest_login_ip,
-            'is_enabled' => $channelItem->is_enabled,
-            'remark' => $channelItem->remark,
-            'channel_user_id'=>$channelItem->id,
-            'register_ip' => $channelItem->register_ip,
-            'person_in_charge_name'=>$channelItem->person_in_charge_name,
-            'create_time'   =>  isset($channelItem->created_at) ? date("Y-m-d H:i:s",strtotime($channelItem->created_at)) : "",
-            'distribution_manages_id'=>(float)$channelItem->distribution_manages_id,
-            'distribution_manages_account'=>$channelItem->distribution_manages_account,
-            'distribution_manages_number'=>$channelItem->distribution_manages_number,
-            'distribution_manages_nickname'=>$channelItem->distribution_manages_nickname,
-            'company_id'=>(int)$channelItem->company_id,
-            'company_name'=>$channelItem->company_name,
-            'is_important'=>(int)$channelItem->is_important,
-        ];
-    }
-}

+ 0 - 27
app/Http/Controllers/Manage/Channel/Transformers/CompanyTransformer.php

@@ -1,27 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2018/3/23
- * Time: 上午9:18
- */
-
-namespace App\Http\Controllers\Manage\Channel\Transformers;
-
-
-class CompanyTransformer
-{
-    public function transform($obj)
-    {
-        return [
-            'id' => $obj->id,
-            'name' => $obj->name,
-            'city'=>$obj->city,
-            'is_important' => (int)$obj->is_important,
-            'distribution_manages_id' => $obj->distribution_manages_id,
-            'distribution_manages_nickname'=>$obj->distribution_manages_nickname,
-            'create_time'   =>  isset($obj->created_at) ? date("Y-m-d H:i:s",strtotime($obj->created_at)) : "",
-            'fans_gender'   =>  isset($obj->fans_gender) ? $obj->fans_gender:''
-        ];
-    }
-}

+ 0 - 98
app/Http/Controllers/Manage/Cp/CpSubController.php

@@ -1,98 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Cp;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Cp\Transformers\CpSubTransformer;
-use App\Modules\Cp\Models\CpSub;
-use Illuminate\Http\Request;
-use DB;
-use Excel;
-
-class CpSubController extends Controller
-{
-	public $msg;
-	
-	public function sub_import_view(){
-		\Log::info('sub_import_view');
-		$msg = '';
-		return view('manage.web.cp.sub_import',compact('msg'));
-	}
-    
-    /**
-     * 书籍数据导入
-     */
-    public function subs_import(Request $request)
-    {
-    	ini_set('memory_limit', '1024M');
-    	$condition = $request->all();
-    	 
-    	$msg = '';
-    	 
-        if($request->file('file')){
-        	Excel::load($request->file('file'), function($reader) {
-		        //获取excel的第几张表
-			    $reader = $reader->getSheet(0);
-			    //获取表中的数据
-			    $results = $reader->toArray();
-			    die($results);
-			    $import_subs = array();
-			    foreach($results as $result){
-			    	$import_sub = array();
-			    	$import_sub['cp_user_id'] = $result[0];
-			    	$import_sub['month'] = $result[1];
-			    	$import_sub['bid'] = $result[2];
-			    	$import_sub['num'] = $result[3];
-			    	$import_sub['book_name'] = mysql_escape_string($result[4]);
-			    	$import_subs[] = $import_sub;
-			    }
-			    $this->import_subs($import_subs,false);
-		    });
-	    
-        }
-        else{
-        	\Log::info('subs_import_null');
-        }
-        
-        return response()->success($this->msg);
-
-    }
-    
-    function import_subs($subs,$need_first_one=false){
-    	$datas = array();
-    	foreach($subs as $key=>$sub){
-    		if($key > 0 || $need_first_one){
-    			$sub = trim($sub);
-    			if(isset($sub['cp_user_id']) && !empty($sub['cp_user_id'])){
-    				$origin_data = DB::table('cp_subs')->where(['cp_user_id'=>$sub['cp_user_id'],'month'=>$sub['month'],'bid'=>$sub['bid']])->first();
-    				if(empty($origin_data)){
-    					$data = array();
-    					$data['cp_user_id'] = $sub['cp_user_id'];
-    					$data['month'] = $sub['month'];
-    					$data['bid'] = $sub['bid'];
-    					$data['num'] = $sub['num'];
-    					$data['book_name'] = mysql_escape_string($sub['book_name']);
-    					$data['created_at'] = date('Y-m-d H:i:s');
-    					$data['updated_at'] = date('Y-m-d H:i:s');
-    					$datas[] = $data;
-    				}else{
-    					\Log::info('subs_import_exist_cu_user_id:'.$sub['cp_user_id'].' month:'.$sub['month'].' bid:'.$sub['bid']);
-    					$this->msg .= $sub.' 已存在<br>';
-    				}
-    	
-    			}else{
-    				\Log::info('subs_import_error_cu_user_id:'.$sub['cp_user_id'].' month:'.$sub['month'].' bid:'.$sub['bid']);
-    				$this->msg .= empty($sub)?'':$sub.' 格式有问题<br>';
-    			}
-    		}
-    	}
-    	
-    	if(!empty($datas)){
-    		CpSub::insert($datas);
-    	}
-    	//			    v('last_data');
-    	//			    v($datas);
-    	$this->msg = empty($this->msg)?'导入成功':$this->msg.',剩下导入成功';
-    	//			    v('$msg');v($this->msg);
-    }
-}

+ 0 - 49
app/Http/Controllers/Manage/Cp/Transformers/CpSubTransformer.php

@@ -1,49 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * Date: 2017/3/31
- * Time: 14:02
- */
-
-namespace App\Http\Controllers\Manage\Book\Transformers;
-
-class BookTransformer
-{
-    public function transform($book){
-        return [
-            'book_id'=>$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'=>is_null($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_id'=>$book->force_subscribe_chapter_seq,
-            'update_time'=>$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,
-            'category_array'=>[$book->channel_name=='男频'?1:2,$book->category_id],
-            'copyright_limit_data'=>is_null($book->copyright_limit_data)?'':$book->copyright_limit_data,
-            'promotion_domain'=>$book->promotion_domain,
-            'old_name'=>$book->old_name,
-            'recommend_text'=>$book->recommend_text,
-            'book_special_channels'=>$book->book_special_channels,
-            'is_high_quality'=>$book->is_high_quality
-        ];
-    }
-}

+ 0 - 86
app/Http/Controllers/Manage/Finance/BaseController.php

@@ -1,86 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Finance;
-use App\Http\Controllers\Manage\BaseController as ManageBaseController;
-use Illuminate\Http\Request;
-
-class BaseController extends ManageBaseController
-{
-    /**
-     * 检测参数有没有为空的
-     * @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 getMinDay($dayTime = '') {
-        if(date('Y-m-d H:i:s', strtotime($dayTime))  == $dayTime) {
-            $inputTime = strtotime($dayTime);
-            $dayTime = date('Y-m-d', $inputTime);
-        }
-
-        //2018-01-01
-        if(!empty($dayTime) && strlen(trim($dayTime)) == 8) {
-            $inputTime = strtotime($dayTime);
-            $dayTime = date('Y-m-d', $inputTime);
-        }
-        if(!empty($dayTime) && strlen(trim($dayTime)) == 10) {
-            $dayTime = $dayTime." 00:00:00";
-        }
-        return $dayTime;
-    }
-
-    /**
-     * 获取当天最大时间
-     * @param string $dayTime
-     * @return mixed
-     */
-    public static function getMaxDay($dayTime = '') {
-        if(date('Y-m-d H:i:s', strtotime($dayTime))  == $dayTime) {
-            $inputTime = strtotime($dayTime);
-            $dayTime = date('Y-m-d', $inputTime);
-        }
-
-        //2018-01-01
-        if(!empty($dayTime) && strlen(trim($dayTime)) == 8) {
-            $inputTime = strtotime($dayTime);
-            $dayTime = date('Y-m-d', $inputTime);
-        }
-        if(!empty($dayTime) && strlen(trim($dayTime)) == 10) {
-            $dayTime = $dayTime." 23:59:59";
-        }
-        return $dayTime;
-    }
-}

+ 0 - 132
app/Http/Controllers/Manage/Finance/BillsController.php

@@ -1,132 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\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   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间2017-01-01.(可不传)
-     * @apiParam   {String}  [end_time] 结束时间2017-02-01.(可不传)
-     * @apiSuccess   {String}  channel_id 渠道ID.
-     * @apiSuccess   {String}  channel_name 渠道名称.
-     * @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":[
-     *                             {
-     *                               "channel_id": "1",
-     *                               "channel_name": "张三渠道",
-     *                               "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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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->settlement_price.  "\"\r\n");
-
-            }
-        }
-        exit();
-    }
-}

+ 0 - 68
app/Http/Controllers/Manage/Finance/CashAccountsController.php

@@ -1,68 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 上午11:36
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\CashAccountTransformer;
-use App\Modules\Finance\Services\CashAccountService;
-use Illuminate\Http\Request;
-
-class CashAccountsController extends BaseController
-{
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 更新银行账号可编辑
-     * @api {GET} updateCashAccountEdit 更新银行账号可编辑
-     * @apiGroup Finance
-     * @apiName updateCashAccountEdit
-     * @apiParam   {Number}  distribution_channel_id 渠道id.
-     * @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}  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": 0,
-     *                   "is_company": 0,
-     *                   "updated_time": "2017-11-20 14:54:50"
-     *               }
-     *     }
-     */
-    function update_cashAccountEdit(Request $request) {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $cashAccount = CashAccountService::getCashAccountSingle($distribution_channel_id);
-
-        if(empty($cashAccount)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $cashAccount = CashAccountService::updateCashAccountEdit($distribution_channel_id);
-        return response()->item(new CashAccountTransformer(), $cashAccount);
-    }
-}

+ 0 - 163
app/Http/Controllers/Manage/Finance/CommissionRateController.php

@@ -1,163 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午4:23
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-use App\Http\Controllers\Manage\Finance\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
-     * @apiParam   {Number}  channel_id 渠道id.
-     * @apiSuccess   {Number}  begin_amount 起始金额.
-     * @apiSuccess   {Number}  end_amount 结束金额.
-     * @apiSuccess   {Number}  rate 比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *             [
-     *              {
-     *                  "id": 1,
-     *                  "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 {POST} addCommissionRate 添加结算比例
-     * @apiGroup Finance
-     * @apiName addCommissionRate
-     * @apiParam   {Number}  distribution_channel_id 渠道id.
-     * @apiParam   {Number}  begin_amount 起始金额.
-     * @apiParam   {Number}  [end_amount] 结束金额.
-     * @apiParam   {Number}  rate 比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function add_commissionRate(Request $request) {
-        if(self::checkParamValueNumber($request, ['distribution_channel_id', 'begin_amount', 'rate'])) {
-            return response()->error("PARAM_ERROR");
-        }
-        $distribution_channel_id = $request->has('channel_id') ? $request->input('channel_id') : '';
-        $begin_amount = $request->has('begin_amount') ? $request->input('begin_amount') : '';
-        $end_amount = $request->has('end_amount') ? $request->input('end_amount') : '';
-        $rate = $request->has('rate') ? $request->input('rate') : '';
-
-        if(is_numeric($rate) && ($rate >= 1 || $rate < 0.1)) {
-            return response()->error("COMMISSION_RATE_WITHOUT");
-        }
-
-        CommissionRateService::addCommissionRate($distribution_channel_id, $begin_amount, $end_amount, $rate);
-
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改佣金结算比例
-     * @api {POST} changeCommissionRate 修改佣金结算比例
-     * @apiGroup Finance
-     * @apiName changeCommissionRate
-     * @apiParam   {Number}  id 佣金结算 id.
-     * @apiParam   {Number}  [channel_id] 渠道id.
-     * @apiParam   {Number}  [begin_amount] 起始金额.
-     * @apiParam   {Number}  [end_amount] 结束金额.
-     * @apiParam   {Number}  [rate] 比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function change_commissionRate(Request $request) {
-        if(self::checkParamValueNumber($request, ['id'])) {
-            return response()->error("PARAM_ERROR");
-        }
-        $id = $request->has('id') ? $request->input('id') : '';
-        $distribution_channel_id = $request->has('channel_id') ? $request->input('channel_id') : '';
-        $begin_amount = $request->has('begin_amount') ? $request->input('begin_amount') : '';
-        $end_amount = $request->has('end_amount') ? $request->input('end_amount') : '';
-        $rate = $request->has('rate') ? $request->input('rate') : '';
-
-        if(is_numeric($rate) && ($rate >= 1 || $rate < 0.1)) {
-            return response()->error("COMMISSION_RATE_WITHOUT");
-        }
-
-        CommissionRateService::updateCommissionRate($id, $begin_amount, $end_amount, $rate, $distribution_channel_id);
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取当前渠道佣金比例
-     * @api {GET} getCommissionRate 获取当前渠道佣金比例
-     * @apiGroup Finance
-     * @apiName getCommissionRate
-     * @apiParam {Number}  channel_id 分销渠道ID.
-     * @apiSuccess {Number}  rate 当前佣金比例.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *         {
-     *             "rate": "0.60"
-     *         }
-     *     }
-     */
-    function get_commissionRate(Request $request) {
-        if($this->checkParamValueEmpty($request, ['channel_id'])) {
-            return response()->error("PARAM_EMPTY");
-        }
-        if($this->checkParamValueNumber($request, ['channel_id'])) {
-            return response()->error("PARAM_ERROR");
-        }
-        $rate = CommissionRateService::getRateCommissionRate($request->input('channel_id'));
-        return response()->success(compact('rate'));
-    }
-}

+ 0 - 126
app/Http/Controllers/Manage/Finance/FinanceController.php

@@ -1,126 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午8:30
- */
-
-namespace App\Http\Controllers\Manage\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(20);
-        return response()->success($result);
-    }
-
-
-
-
-    public function outPayMerchantData(Request $request) {
-        $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
-        $start_time = self::getMinDay($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);
-
-        $channel_ids = $request->has('channel_ids') ? $request->input('channel_ids') : '';
-
-        $idsArray = [];
-        if($channel_ids && count(explode(',', $channel_ids)) > 0) {
-            $ids = explode(',', $channel_ids);
-            foreach ($ids as $id) {
-                if(is_numeric($id)) {
-                    $idsArray[] = $id;
-                }
-            }
-        }
-        $sql = '';
-        if($start_time && $end_time && count($idsArray) > 0) {
-            if( date('Y-m-d H:i:s', strtotime($start_time)) == $start_time && date('Y-m-d H:i:s', strtotime($end_time)) == $end_time) {
-                $idsStr = implode(",", $idsArray);
-
-                //$sql = 'SELECT distribution_channel_id as "渠道ID", DATE(created_at) as "日期", SUM(price) as "美哒总金额", pay_merchant_id as "支付通道" FROM orders ';
-                $sql = 'SELECT distribution_channel_id, DATE(created_at) as createDate, SUM(price) as price, pay_merchant_id FROM orders ';
-                $sql = $sql.' WHERE distribution_channel_id in (' .$idsStr. ')';
-                $sql = $sql.' AND `status` = "PAID"';
-                $sql = $sql.' AND pay_merchant_id in (' .env('not_in_pay_merchant_id').')';
-                $sql = $sql.' AND `status` = "PAID"';
-                $sql = $sql.' AND created_at >= "'.$start_time .'"';
-                $sql = $sql.' AND created_at <= "'.$end_time.'"';
-                $sql = $sql.' GROUP BY DATE(created_at), distribution_channel_id';
-
-
-            }
-        }
-
-        if($sql) {
-            //dd($sql);
-            $result = \DB::select($sql);
-            //dd($result);
-            //exit();
-//            if($result) {
-//                foreach($result as $item) {
-//                    dd($item->distribution_channel_id);
-//                }
-//            }
-//            exit();
-
-            header("Content-type:application/vnd.ms-excel");
-            header("Content-Disposition:attachment;filename=" . "渠道外部充值" . date("YmdHis") . ".csv");
-            echo iconv("UTF-8","GBK","\"渠道ID\",\"日期\",\"外部总金额\",\"外部支付通道\"\r\n");
-            if($result)
-            {
-                foreach($result as $item)
-                {
-                    echo("\"" . $item->distribution_channel_id .  "\",");
-                    echo("\"" . iconv("UTF-8","GBK",trim($item->createDate)) .  "\",");
-                    echo("\"" . iconv("UTF-8","GBK",trim($item->price)) .  "\",");
-                    echo("\"" . iconv("UTF-8","GBK",trim($item->pay_merchant_id)) . "\"\r\n");
-                }
-            }
-            exit();
-        } else {
-            echo("输入条件错误");
-            exit();
-        }
-
-
-//                    WHERE distribution_channel_id in (\'369\', \'370\', \'374\', \'377\')
-//                    AND `status` = \'PAID\'
-//                    AND pay_merchant_id in (\'13\', \'14\')
-//                    AND created_at >= \'2018-06-01 00:00:00\'
-//                    AND created_at <= \'2018-06-07 23:59:59\'
-//                    GROUP BY DATE(created_at), distribution_channel_id';
-//        DB::select('IFNULL(financial_configs.is_frozen, 0) as is_frozen');
-
-    }
-}

+ 0 - 102
app/Http/Controllers/Manage/Finance/FinancialConfigController.php

@@ -1,102 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午3:12
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\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
-     * @apiParam   {Number}  distribution_channel_id 渠道id.
-     * @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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $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);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 账号冻结,与解冻变更
-     * @api {POST} changeFinancialConfig 账号冻结,与解冻变更
-     * @apiGroup Finance
-     * @apiName changeFinancialConfig
-     * @apiParam   {Number}  distribution_channel_id 渠道id.
-     * @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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        $frozen = $request->has('frozen') ? $request->input('frozen') : '';
-
-        if(empty($frozen)) {
-            $frozen = 0;
-        }
-        if($frozen == -1 || $frozen == 0) {
-        } else {
-            $frozen = 0;
-        }
-
-//        dd($distribution_channel_id);
-
-        FinancialConfigService::updateFrozenDistributionChannel($distribution_channel_id, $frozen, $remark);
-        return response()->success(compact('frozen', 'remark'));
-    }
-}

+ 0 - 365
app/Http/Controllers/Manage/Finance/FinancialStatController.php

@@ -1,365 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 上午10:14
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\FinancialStatDetailTransformer;
-use App\Http\Controllers\Manage\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
-     * @apiParam   {Number}  distribution_channel_id 渠道id.
-     * @apiSuccess   {String}  channel_id 渠道id.
-     * @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":{
-     *                   "channel_id": 1,
-     *                   "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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        if(empty($distribution_channel_id)) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $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   {Number}  [distribution_channel_id] 渠道id.
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.
-     * @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
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     * @apiSuccess   {String}  channel_id 渠道id.
-     * @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 渠道冻结解冻时间
-     * @apiSuccess   {Number}  is_company 0:对私, 1:对公司
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                   "list": [
-     *                       {
-     *                           "channel_id": 1,
-     *                           "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": ""
-     *                           "is_company": 0
-     *                       }
-     *                      "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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $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,
-            'is_company'=>$is_company,
-        ];
-        $result = FinancialStatService::getFrozenFinancialStatListParam($params);
-
-        return response()->pagination(new FinancialStatDetailTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 结算明细
-     * @api {GET} financialStatSettlementPriceDetail 结算明细
-     * @apiGroup Finance
-     * @apiName financialStatSettlementPriceDetail
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.
-     * @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
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     * @apiSuccess   {String}  channel_id 渠道id.
-     * @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}  settlement_price_count 总结算金额.
-     * @apiSuccess   {Number}  tallage 手续费
-     * @apiSuccess   {Number}  is_company 0:对私, 1:对公司
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                   "list": [
-     *                       {
-     *                           "channel_id": 1,
-     *                           "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",
-     *                           "settlement_price_count": "6300.00",
-     *                           "tallage": 0
-     *                           "is_company": 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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $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,
-            'is_company'=>$is_company,
-        ];
-
-        $result = FinancialStatService::getFrozenFinancialStatPriceListDetail($params);
-        return response()->pagination(new FinancialStatDetailTransformer(), $result);
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 结算明细导出
-     * @api {GET} financialStatSettlementPriceDetailExport 结算明细导出
-     * @apiGroup Finance
-     * @apiName financialStatSettlementPriceDetailExport
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.
-     * @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
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     */
-    function settlement_price_detail_export(Request $request) {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $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,
-            'is_company'=>$is_company,
-        ];
-
-        $result = FinancialStatService::getFrozenFinancialStatPriceListDetail($params);
-
-
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "结算明细" . date("YmdHis") . ".csv");
-        echo iconv("UTF-8","GBK","\"渠道ID\",\"渠道名称\",\"对私、对公\",\"充值金额\",\"佣金比例\",\"结算金额(元)\",\"扣税金额(元)\",\"提现金额(元)\",\"账户最新余额(元)\"\r\n");
-        if($result)
-        {
-            foreach($result as $item)
-            {
-                echo("\"" . $item->id .  "\",");
-                echo("\"" . iconv("UTF-8","GBK",$item->name) .  "\",");
-                echo("\"" . $item->is_company .  "\",");
-                echo("\"" . $item->recharge_amount_count .  "\",");
-                echo("\"" . ($item->commission_rate * 100)."%" .  "\",");
-                echo("\"" . $item->settlement_price_count .  "\",");
-                echo("\"" . $item->tallage .  "\",");
-                echo("\"" . $item->accumulative_withdrawal_amount .  "\",");
-                echo("\"" . $item->enable_withdrawal_amount .  "\"\r\n");
-            }
-        }
-        exit();
-    }
-}

+ 0 - 51
app/Http/Controllers/Manage/Finance/LiquidatedStatController.php

@@ -1,51 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/7
- * Time: 下午6:03
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\LiquidatedStatTransformer;
-use App\Modules\Finance\Services\LiquidatedStatService;
-use Illuminate\Http\Request;
-
-class LiquidatedStatController extends BaseController
-{
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取清算汇总列表
-     * @api {GET} LiquidatedStat/list 获取清算汇总列表
-     * @apiGroup Finance
-     * @apiName LiquidatedStat/list
-     * @apiSuccess   {String}  pay_merchant_source 渠道支付
-     * @apiSuccess   {String}  pay_merchant_source_name 渠道支付
-     * @apiSuccess   {Number}  amount 清算金额.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *              [
-     *                  {
-     *                    "pay_merchant_source": "ALIPAY",
-     *                    "pay_merchant_source_name": "通联支付",
-     *                    "amount": "15.6000"
-     *                  }
-     *              ]
-     *     }
-     */
-    function get_list(Request $request) {
-        $result = LiquidatedStatService::getLiquidatedStatList();
-
-        return response()->collection(new LiquidatedStatTransformer(), $result);
-    }
-}

+ 0 - 202
app/Http/Controllers/Manage/Finance/LiquidationController.php

@@ -1,202 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/7
- * Time: 下午8:00
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\LiquidationTransformer;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Finance\Services\LiquidatedStatService;
-use App\Modules\Finance\Services\LiquidationService;
-use App\Modules\Trade\Services\PayMerchantService;
-use Illuminate\Http\Request;
-
-class LiquidationController extends BaseController
-{
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加清算支付渠道金额
-     * @api {POST} Liquidated/add 添加清算支付渠道金额
-     * @apiGroup Finance
-     * @apiName Liquidated/add
-     * @apiParam   {String}  pay_merchant_source 支付渠道
-     * @apiParam   {Number}  amount 清算金额
-     * @apiParam   {String}  [remark] 备注说明.
-     * @apiSuccess   {Number}  amount 清算金额.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function add_liquidated(Request $request) {
-        $pay_merchant_source = $request->has('pay_merchant_source') ? $request->input('pay_merchant_source') : '';
-        if(empty($pay_merchant_source)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $amount = $request->has('amount') ? $request->input('amount') : '';
-        if(!is_numeric($amount) || (float)$amount <= 0) {
-            return response()->error("PARAM_ERROR");
-        }
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        $remark = "[支付渠道清算]{".$remark."}";
-
-        $liquidatedStat = LiquidatedStatService::getLiquidatedStatSingleBySource($pay_merchant_source);
-        if(empty($liquidatedStat)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        if($liquidatedStat['amount'] < $amount) {
-            return response()->error("LIQUIDATED_STAT_AMOUNT_WITHOUT");
-        }
-        //添加一条清算记录
-        LiquidationService::addLiquidation(0, $pay_merchant_source, -$amount, 0, $remark);
-        //更新支付通道清算金额
-        LiquidatedStatService::createOrUpdate($pay_merchant_source, -$amount);
-
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取清算明细表列表
-     * @api {GET} Liquidated/list 获取清算明细表列表
-     * @apiGroup Finance
-     * @apiName Liquidated/list
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [pay_merchant_source] 支付通道渠道(可不传,获取所有通道)
-     * @apiParam   {String}  [search_name] 搜索名称(可不传)
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiSuccess   {Number}  id 清算ID
-     * @apiSuccess   {Number}  channel_id 渠道ID
-     * @apiSuccess   {String}  channel_name 渠道名称
-     * @apiSuccess   {String}  pay_merchant_source 渠道支付通道
-     * @apiSuccess   {String}  pay_merchant_source_name 渠道支付通道
-     * @apiSuccess   {Number}  amount 清算金额.
-     * @apiSuccess   {Number}  payment_id 打款ID
-     * @apiSuccess   {String}  date 清算时间
-     * @apiSuccess   {String}  remark 清算备注
-     * @apiSuccess   {String}  phone 渠道联系
-     * @apiSuccess   {String}  created_time
-     * @apiSuccess   {String}  pay_merchant_id
-     * @apiSuccess   {String}  nickname
-     * @apiSuccess   {String}  person_in_charge_name 渠道负责人
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":
-     *              [
-     *                  {
-     *                      "id": 21,
-     *                      "channel_id": 11,
-     *                      "channel_name": "weixiao",
-     *                      "pay_merchant_source": "ALIPAY",
-     *                      "pay_merchant_source_name": "通联支付",
-     *                      "amount": "11.0000",
-     *                      "payment_id": 0,
-     *                      "date": "2017-12-07 00:00:00",
-     *                      "remark": "每日结算",
-     *                      "phone": "13732291699",
-     *                      "created_time": "2017-12-07 18:22:29",
-     *                      "pay_merchant_id": 0,
-     *                      "nickname": "是的方式",
-     *                      "person_in_charge_name": "大波哥"
-     *                  }
-     *              ]
-     *     }
-     */
-    function get_list(Request $request) {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('distribution_channel_name') : '';
-        $pay_merchant_source = $request->has('pay_merchant_source') ? $request->input('pay_merchant_source') : '';
-        $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,
-            'pay_merchant_source'=>$pay_merchant_source,
-            'start_date'=>$start_time,
-            'end_date'=>$end_time,
-            'search_name'=>$search_name,
-        ];
-
-        $result = LiquidationService::getLiquidationList($params);
-
-        return response()->pagination(new LiquidationTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取清算明细表列表导出
-     * @api {GET} Liquidated/listExport 获取清算明细表列表导出
-     * @apiGroup Finance
-     * @apiName Liquidated/listExport
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [pay_merchant_source] 支付通道渠道(可不传,获取所有通道)
-     * @apiParam   {String}  [search_name] 搜索名称(可不传)
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     *
-     */
-    function get_list_export(Request $request) {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('distribution_channel_name') : '';
-        $pay_merchant_source = $request->has('pay_merchant_source') ? $request->input('pay_merchant_source') : '';
-        $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,
-            'pay_merchant_source'=>$pay_merchant_source,
-            'start_date'=>$start_time,
-            'end_date'=>$end_time,
-            'search_name'=>$search_name,
-        ];
-
-        $result = LiquidationService::getLiquidationList($params, true);
-
-
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "清算明细" . date("YmdHis") . ".csv");
-        echo iconv("UTF-8","GBK","\"操作日期\",\"渠道ID\",\"渠道名称\",\"支付通道\",\"清算金额(元)\",\"备注\"\r\n");
-        if($result)
-        {
-            foreach($result as $item)
-            {
-
-                echo("\"" . iconv("UTF-8","GBK",date('Y-m-d H:i:s',strtotime($item->date))) .  "\",");
-                echo("\"" . $item->distribution_channel_id .  "\",");
-                echo("\"" . iconv("UTF-8","GBK",$item->distribution_channel_name) .  "\",");
-                echo("\"" . iconv("UTF-8","GBK",ChannelService::getSourceName(isset($item->pay_merchant_source) ? $item->pay_merchant_source : "")) .  "\",");
-                echo("\"" . ($item->amount) .  "\",");
-                echo("\"" . iconv("UTF-8","GBK",$item->remark) .  "\"\r\n");
-            }
-        }
-        exit();
-    }
-
-}

+ 0 - 549
app/Http/Controllers/Manage/Finance/PaymentController.php

@@ -1,549 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 下午3:23
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\PaymentDetailTransformer;
-use App\Http\Controllers\Manage\Finance\Transformers\PaymentTransformer;
-use App\Libs\PayHelper;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Finance\Models\FinanceMerchantStat;
-use App\Modules\Finance\Models\LiquidatedStat;
-use App\Modules\Finance\Services\CashAccountService;
-use App\Modules\Finance\Services\FinanceMerchantStatService;
-use App\Modules\Finance\Services\FinancialConfigService;
-use App\Modules\Finance\Services\LiquidatedStatService;
-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 {POST} addPayment 创建打款信息
-     * @apiGroup Finance
-     * @apiName addPayment
-     * @apiParam   {Number}  withdraw_cash_id 提现id.
-     * @apiParam   {Number}  amount 打款金额.
-     * @apiParam   {String}  [remark] 备注说明.
-     * @apiParam   {String}  [source] 打款通道[tl, ll].
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              }
-     *     }
-     */
-    function add_payment(Request $request) {
-        $withdraw_cash_id = $request->has('withdraw_cash_id') ? $request->input('withdraw_cash_id') : '';
-        if(!is_numeric($withdraw_cash_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $amount = $request->has('amount') ? $request->input('amount') : '';
-        if(!is_numeric($amount) || (float)$amount <= 0) {
-            return response()->error("PARAM_ERROR");
-        }
-//        $userId = $request->has('user_id') ? $request->input('user_id') : '';
-//        if(!is_numeric($userId)) {
-//            return response()->error("PARAM_ERROR");
-//        }
-        $userId = $this->getLoginUserId();
-
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-
-        $withdrawCash = WithdrawCashService::getWithdrawCash($withdraw_cash_id);
-        if(empty($withdrawCash)) {
-            return response()->error("PARAM_ERROR");
-        }
-        //对公 走手动打款
-        if($withdrawCash['is_company'] == 1) {
-            return response()->error("PAYMENT_AUTO_NOT_OPEN");
-        }
-        //已打款,判断
-        if(WithdrawCashService::isEditWithdrawCashStatus($withdraw_cash_id)) {
-            return response()->error("PAYMENT_WITHDRAW_MONEY_TOO");
-        }
-
-
-        //判断打款钱核对   提现金额 - 手续费 = 实际打款金额
-        $money = (float)$withdrawCash['amount'] - (float)$withdrawCash['tallage'];
-        if($amount != $money) {
-            return response()->error("PAYMENT_WITHDRAW_MONEY");
-        }
-
-        $channelId = $withdrawCash['distribution_channel_id'];
-        //判断渠道是否冻结
-        if(FinancialConfigService::isFrozenDistributionChannel($channelId)) {
-            return response()->error("WITHDRAW_CASH_AMOUNT_FROZEN");
-        }
-        //判断账户是否已经设置
-        if(!CashAccountService::isCashAccountExits($channelId)) {
-            return response()->error("WITHDRAW_CASH_AMOUNT_ACCOUNT");
-        }
-
-        //TODO 先关闭自动打款
-        if(!env('PAYMENT_AUTO_PAY_ON')) {
-            return response()->error("PAYMENT_AUTO_NOT_OPEN");
-        }
-
-        $isTD = 0;
-
-        $source = $request->has('source') ? $request->input('source') : '';
-        if ("tl" == $source || "ll" == $source) {
-            if("tl" == $source) {
-                //通联支付通道账户
-                $tonglianpayLiquidatedStatData = LiquidatedStatService::getLiquidatedStatSingleBySource(config('common.tonglianpay'));
-                if(!empty($tonglianpayLiquidatedStatData) && $tonglianpayLiquidatedStatData['account_balance_amount_day'] > ($money - 1)) {
-                    //判断通联支付通道钱余额大于 提现金额    需要算上每次 手续费 【1块钱】
-                    $isTD = 2;
-                }
-            }
-            if("ll" == $source) {
-                //连连支付通道账户
-                $lianlianpayLiquidatedStatData = LiquidatedStatService::getLiquidatedStatSingleBySource(config('common.lianlianpay'));
-                if(!empty($lianlianpayLiquidatedStatData) && $lianlianpayLiquidatedStatData['account_balance_amount_day'] > ($money - 1)) {
-                    //判断连连支付通道钱余额大于 提现金额    需要算上每次 手续费 【1块钱】
-                    $isTD = 1;
-                }
-            }
-        } else {
-            //通联支付通道账户
-            $tonglianpayLiquidatedStatData = LiquidatedStatService::getLiquidatedStatSingleBySource(config('common.tonglianpay'));
-            if($isTD == 0) {
-                //连连通道钱余额不走,判断通联
-                if(!empty($tonglianpayLiquidatedStatData) && $tonglianpayLiquidatedStatData['account_balance_amount_day'] > ($money - 1)) {
-                    //判断通联支付通道钱余额大于 提现金额    需要算上每次 手续费 【1块钱】
-                    $isTD = 2;
-                }
-            }
-
-            //连连支付通道账户
-            $lianlianpayLiquidatedStatData = LiquidatedStatService::getLiquidatedStatSingleBySource(config('common.lianlianpay'));
-            if($isTD == 0) {
-                //默认看连连通道余额
-                if(!empty($lianlianpayLiquidatedStatData) && $lianlianpayLiquidatedStatData['account_balance_amount_day'] > ($money - 1)) {
-                    //判断连连支付通道钱余额大于 提现金额    需要算上每次 手续费 【1块钱】
-                    $isTD = 1;
-                }
-            }
-        }
-
-        if($isTD == 0) {
-            //连连支付通道,余额不足
-            //通联支付通道,余额不足
-            // 返回,支付通道余额不足,请走人工打款
-            return response()->error("PAYMENT_CHANNEL_AMOUNT_WITHOUT");
-        }
-
-        //正式环境,线上为 2
-        if(env('PAYMENT_AUTO_PAY_TEST') == 2) {
-            if($isTD == 1) {
-                //连连支付通道打款
-                PaymentService::makeThreeSourcePayment($userId, $withdraw_cash_id, (float)$amount, $remark, $lianlianpayLiquidatedStatData);
-                return response()->success();
-            }
-            if($isTD == 2) {
-                //通连支付通道打款
-                PaymentService::makeThreeSourcePayment($userId, $withdraw_cash_id, (float)$amount, $remark, $tonglianpayLiquidatedStatData);
-                return response()->success();
-            }
-        } else {
-            //测试环境直接修改状态为 成功
-            $tradeNo = "测试_".$channelId;
-            $pay_merchant_source = "测试";
-            if($isTD == 1) {
-                $pay_merchant_source = $lianlianpayLiquidatedStatData['pay_merchant_source'];
-            }
-            if($isTD == 2) {
-                $pay_merchant_source = $tonglianpayLiquidatedStatData['pay_merchant_source'];
-            }
-            //测试环境,直接走逻辑打款成功
-            $payment = PaymentService::addPayment($withdraw_cash_id, $amount, $remark, $pay_merchant_source, $tradeNo, WithdrawCashService::getWithdrawCashStatusStr(32), "测试", $withdrawCash['is_company'], 0);
-            //更新单个第三方通道可打款金额
-            FinanceMerchantStatService::createOrUpdate($channelId, $pay_merchant_source, -$amount);
-            //更新当前渠道当天当前支付通道可打款余额
-            LiquidatedStatService::updateAccountBalanceAmountDay($pay_merchant_source, -$amount);
-            //修改状态
-            WithdrawCashService::updateWithdrawCashStatus($withdraw_cash_id, $userId, 32, $remark, $tradeNo);
-
-            return response()->success();
-        }
-        //其他,走人工打款
-        return response()->error("PAYMENT_CHANNEL_AMOUNT_WITHOUT");
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 创建人工打款信息
-     * @api {POST} addPaymentPersonMade 创建人工打款信息
-     * @apiGroup Finance
-     * @apiName addPaymentPersonMade
-     * @apiParam   {Number}  withdraw_cash_id 提现id.
-     * @apiParam   {Number}  amount_person 人工打款金额
-     * @apiParam   {String}  trade_no 银行交易流水号.
-     * @apiParam   {String}  [remark] 备注说明.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              }
-     *     }
-     */
-    function add_paymentPersonMade(Request $request) {
-        $withdraw_cash_id = $request->has('withdraw_cash_id') ? $request->input('withdraw_cash_id') : '';
-        if(!is_numeric($withdraw_cash_id)) {
-            return response()->error("PARAM_ERROR");
-        }
-//        $userId = $request->has('user_id') ? $request->input('user_id') : '';
-//        if(!is_numeric($userId)) {
-//            return response()->error("PARAM_ERROR");
-//        }
-        $userId = $this->getLoginUserId();
-
-        $amount_person = $request->has('amount_person') ? $request->input('amount_person') : '';
-        if(!is_numeric($amount_person)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        $trade_no = $request->has('trade_no') ? $request->input('trade_no') : '';
-        if(empty($trade_no)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        $remark = "[人工打款]{".$remark."}";
-
-        $withdrawCash = WithdrawCashService::getWithdrawCash($withdraw_cash_id);
-        if(empty($withdrawCash)) {
-            return response()->error("PARAM_ERROR");
-        }
-        //已打款,判断
-        if(WithdrawCashService::isWithdrawCashStatusSuccess($withdraw_cash_id)) {
-            return response()->error("PAYMENT_WITHDRAW_MONEY_TOO");
-        }
-        $channelId = $withdrawCash['distribution_channel_id'];
-        //判断渠道是否冻结
-        if(FinancialConfigService::isFrozenDistributionChannel($channelId)) {
-            return response()->error("ACCOUNT_FRONZEN");
-        }
-
-        //判断打款钱核对   提现金额 - 手续费 = 实际打款金额
-        $amount = (float)$withdrawCash['amount'] - (float)$withdrawCash['tallage'];
-
-        //人工打款成功
-        //Payment 插入人工
-        // WithdrawCashStatus
-        // Liquidation 人工 判断渠道支付通道余额,分别生成
-        // LiquidatedStat
-        PaymentService::makePersonMadePayment($userId, $withdraw_cash_id, $amount, $remark, $trade_no, $amount_person);
-        return response()->success();
-    }
-
-    /**
-     * @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   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [account_name] 账户名称
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     * @apiSuccess {Number}  id 打款 id.
-     * @apiSuccess {Number}  withdraw_cash_id 提现 id.
-     * @apiSuccess {Number}  amount 打款金额.
-     * @apiSuccess {String}  remark 备注
-     * @apiSuccess {String}  pay_time 打款时间
-     * @apiSuccess {Number}  channel_id 渠道ID
-     * @apiSuccess {String}  channel_name 渠道名称
-     * @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",
-     *                           "channel_id": 1,
-     *                           "channel_name": "渠道一",
-     *                           "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 = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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'))) : '';
-        $end_time = self::getMaxDay($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') : '';
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $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,
-            'is_company'=>$is_company,
-        ];
-        $payments = PaymentService::getPaymentDetailList($params, $status);
-
-        return response()->pagination(new PaymentDetailTransformer(), $payments);
-    }
-
-    /**
-     * 更新打款状态
-     * id 条目id
-     * status 状态(10:待打款)
-     * @param Request $request
-     * @return mixed
-     */
-    function updatePaymentStatus(Request $request)
-    {
-        $id = $request->has('id') ? $request->input('id') : '';
-        // $status = $request->has('status') ? $request->input('status') : '';
-
-        if (!$id) {
-            return response()->error("PARAM_EMPTY");
-        }
-
-        $status = WithdrawCashService::getWithdrawCashStatusStr(10);
-        $result = PaymentService::updateSimplePaymentStatus($id, $status);
-        if ($result) {
-            return response()->success();
-        } else {
-            return response()->error("HANDLE_FAILED");
-        }
-    }
-
-
-    function test_add_payment(Request $request)
-    {
-        $payType = "ALLINPAY";
-
-
-
-
-//        $transactionSerialNumber = date('YmdHis').mt_rand(10,99)."_1";
-//        $bankCode = "102";
-//        $bankName = '';
-//        $bankAccountNO = "6222031202001646388";
-//        $bankAccountName = "宋栋波";
-//        $amount = 0.01;
-//        $summary = "summary";
-//        $remark = "remark";
-//        $channelId = 1;
-//        $isCompany = 0;
-//        $resultPayData = PayHelper::pay($payType, $transactionSerialNumber, $bankCode, $bankName, $bankAccountNO, $bankAccountName, $amount, $summary, $remark, $channelId, $isCompany);
-//        $resultDataMsg = $remark;
-//        if(!empty($resultPayData) && !empty($resultPayData['msg'])) {
-//            $resultDataMsg = $resultDataMsg."_【".$resultPayData['msg']."】";
-//        }
-//        dd($transactionSerialNumber);
-////        dd($resultPayData);
-//        if(!empty($resultPayData) && $resultPayData['code'] == 1) {
-//            $reqSn = date('YmdHis').mt_rand(100000,999999);
-//            $resultQueryData = PayHelper::payQuery($payType, $transactionSerialNumber, $reqSn);
-//            if(!empty($resultQueryData) && !empty($resultQueryData['msg'])) {
-//                $resultDataMsg = $resultDataMsg."_【".$resultQueryData['msg']."】";
-//            }
-//            if(!empty($resultQueryData) && $resultQueryData['code'] == 1) {
-//            }
-//        }
-//        dd($resultDataMsg);
-
-
-//        $transactionSerialNumber = '2017122511504564_1';
-//        $resultDataMsg = '';
-//        $reqSn = date('YmdHis').mt_rand(100000,999999);
-//        $resultQueryData = PayHelper::payQuery($payType, $transactionSerialNumber, $reqSn);
-//        if(!empty($resultQueryData) && !empty($resultQueryData['msg'])) {
-//            $resultDataMsg = $resultDataMsg."_【".$resultQueryData['msg']."】";
-//        }
-//        if(!empty($resultQueryData) && $resultQueryData['code'] == 1) {
-//        }
-//        return response()->success($resultQueryData);
-
-
-//        $reqSn = date('YmdHis').mt_rand(100000,999999);
-//        $resultQueryData = PayHelper::payAccountInfo($payType, $reqSn);
-//        return response()->success($resultQueryData);
-
-//        $reqSn = date('YmdHis').mt_rand(100000,999999);
-//        $startDay = date('Ymd', strtotime(date("Y-m-d")." -2 day"));
-//        $endDay = date('Ymd');
-//        $resultQueryData = PayHelper::payAccountHistoryBalanceAmount($payType, $reqSn, $startDay, $endDay);
-//        return response()->success($resultQueryData);
-
-//        dd(json_encode($resultQueryData));
-//        dd($resultDataMsg);
-
-
-//        $financeMerchantStat = new FinanceMerchantStat();
-//        $financeMerchantStat['pay_merchant_source'] = "ALLINPAY";
-//        $financeMerchantStat['distribution_channel_id'] = 1;
-//        $withdraw_cash_id = 68;
-//
-//        PaymentService::makeThreeSourcePayment(1, $withdraw_cash_id, 0.01, "测试", $financeMerchantStat);
-
-
-
-
-
-
-        $payType = "LIANLIANPAY";
-//        $transactionSerialNumber = date('YmdHis').mt_rand(10,99)."_1";
-//        $bankCode = "102";
-//        $bankName = '';
-//        $bankAccountNO = "6222031202001646388";
-//        $bankAccountName = "宋栋波";
-//        $amount = 0.01;
-//        $summary = "summary";
-//        $remark = "remark";
-//        $channelId = 1;
-//        $isCompany = 0;
-//        $resultPayData = PayHelper::pay($payType, $transactionSerialNumber, $bankCode, $bankName, $bankAccountNO, $bankAccountName, $amount, $summary, $remark, $channelId, $isCompany);
-//        $resultDataMsg = $remark;
-//        if(!empty($resultPayData) && !empty($resultPayData['msg'])) {
-//            $resultDataMsg = $resultDataMsg."_【".$resultPayData['msg']."】";
-//        }
-////        dd($transactionSerialNumber);
-//        return response()->success($resultPayData);
-
-//        $liquidatedStat = new LiquidatedStat();
-//        $liquidatedStat['pay_merchant_source'] = $payType;
-//        $withdraw_cash_id = 392;
-//        PaymentService::makeThreeSourcePayment(1, $withdraw_cash_id, 1.09, "测试", $liquidatedStat);
-
-//        $transactionSerialNumber = '2017122916450888_1';
-//        $resultDataMsg = '';
-//        $reqSn = date('YmdHis').mt_rand(100000,999999);
-//        $resultQueryData = PayHelper::payQuery($payType, $transactionSerialNumber, $reqSn);
-//        if(!empty($resultQueryData) && !empty($resultQueryData['msg'])) {
-//            $resultDataMsg = $resultDataMsg."_【".$resultQueryData['msg']."】";
-//        }
-//        if(!empty($resultQueryData) && $resultQueryData['code'] == 1) {
-//        }
-//        return response()->success($resultQueryData);
-
-//        $reqSn = date('YmdHis').mt_rand(100000,999999);
-//        $resultQueryData = PayHelper::payAccountInfo($payType, $reqSn);
-//        return response()->success($resultQueryData);
-
-        return response()->success();
-    }
-}

+ 0 - 121
app/Http/Controllers/Manage/Finance/PaymentStatisticController.php

@@ -1,121 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/8
- * Time: 下午3:25
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\PaymentStatisticTransformer;
-use App\Modules\Finance\Services\PaymentStatisticService;
-use Illuminate\Http\Request;
-
-class PaymentStatisticController extends BaseController
-{
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 每天对账统计
-     * @api {GET} paymentStaticDay 每天对账统计
-     * @apiGroup Finance
-     * @apiName paymentStaticDay
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiSuccess {Number}  amount 打款成功金额.
-     * @apiSuccess {Number}  amount_num 打款成功笔.
-     * @apiSuccess {Number}  amount_person 对私打款成功金额.
-     * @apiSuccess {Number}  amount_person_num 对私打款成功笔.
-     * @apiSuccess {Number}  amount_company 对公打款成功金额.
-     * @apiSuccess {Number}  amount_company_num 对公打款成功笔.
-     * @apiSuccess {Number}  amount_audit_fail 审核不通过金额.
-     * @apiSuccess {Number}  amount_audit_fail_num 审核不通过笔数.
-     * @apiSuccess {Number}  amount_fail 打款失败金额.
-     * @apiSuccess {Number}  amount_fail_num 打款失败笔数.
-     * @apiSuccess {Number}  tallage 扣税金额.
-     * @apiSuccess {String}  created_time 每天对账统计时间
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              "list": [
-     *                      {
-     *                          "amount": "2664.0000",
-     *                          "amount_num": "9",
-     *                          "amount_person": "2664.0000",
-     *                          "amount_person_num": "9",
-     *                          "amount_company": "2664.0000",
-     *                          "amount_company_num": "9",
-     *                          "amount_audit_fail": "6660.0000",
-     *                          "amount_audit_fail_num": "12",
-     *                          "amount_fail": "3663.0000",
-     *                          "amount_fail_num": "9",
-     *                          "tallage": "264.0000",
-     *                          "created_time": "2017-12-04 00:00:00"
-     *                      }
-     *                   ],
-     *                     "meta": {
-     *                           "total": 1,
-     *                           "per_page": 15,
-     *                           "current_page": 1,
-     *                          "last_page": 1,
-     *                          "next_page_url": "",
-     *                          "prev_page_url": ""
-     *                   }
-     *              }
-     *     }
-     */
-    function get_list_day(Request $request) {
-        $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 = PaymentStatisticService::getGroupByDayDataStatistic($start_time, $end_time);
-
-        return response()->pagination(new PaymentStatisticTransformer(), $payments);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 每天对账统计导出
-     * @api {GET} paymentStaticDayExport 每天对账统计导出
-     * @apiGroup Finance
-     * @apiName paymentStaticDayExport
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     */
-    function get_list_day_export(Request $request) {
-        $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 = PaymentStatisticService::getGroupByDayDataStatistic($start_time, $end_time, true);
-
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "对账统计" . date("YmdHis") . ".csv");
-        echo iconv("UTF-8","GBK","\"操作日期\",\"打款成功金额\",\"打款成功笔数\",\"对私成功金额\",\"对私成功笔数\",\"对公成功金额\",\"对公成功笔数\",\"审核不通过金额\",\"审核不通过笔数\",\"打款失败金额\",\"打款失败笔数\",\"扣税金额\"\r\n");
-        if($payments)
-        {
-            foreach($payments as $item)
-            {
-                echo("\"" . iconv("UTF-8","GBK",date('Y-m-d H:i:s',strtotime($item->created_at))) .  "\",");
-                echo("\"" . $item->amount .  "\",");
-                echo("\"" . $item->amount_num .  "\",");
-                echo("\"" . $item->amount_person .  "\",");
-                echo("\"" . $item->amount_person_num .  "\",");
-                echo("\"" . $item->amount_company .  "\",");
-                echo("\"" . $item->amount_company_num .  "\",");
-                echo("\"" . $item->amount_audit_fail .  "\",");
-                echo("\"" . ($item->amount_audit_fail_num) .  "\",");
-                echo("\"" . $item->amount_fail .  "\",");
-                echo("\"" . $item->amount_fail_num .  "\",");
-                echo("\"" . $item->tallage .  "\"\r\n");
-            }
-        }
-        exit();
-    }
-}

+ 0 - 146
app/Http/Controllers/Manage/Finance/TransformAccountRecordController.php

@@ -1,146 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\TransformAccountRecordTransformer;
-use App\Modules\Finance\Services\TransformAccountRecordService;
-use Illuminate\Http\Request;
-
-
-class TransformAccountRecordController extends BaseController
-{
-    /**
-     * @apiDefine TransformAccountRecord 到账记录
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加到账记录
-     * @api {POST} addTransformAccountRecord 添加到账记录
-     * @param {fee} 金额
-     * @param {day} 日期
-     * @param {company_name} 公司名称
-     * @param {trade_number} 流水号
-     * @param {status} 状态(成功、失败)
-     * @return mixed
-     */
-    function add_record(Request $request)
-    {
-        $fee = $request->has('fee') ? $request->input('fee') : '';
-        $day = $request->has('day') ? $request->input('day') : '';
-        $status = $request->has('status') ? $request->input('status') : '';
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        $account = $request->has('trade_number') ? $request->input('trade_number') : '';
-        $company_name = $request->has('company_name') ? $request->input('company_name') : '';
-
-        if (!$fee || !$day || !$company_name || !$account || !$status) {
-            return response()->error('PARAM_EMPTY');
-        } else {
-            $result = TransformAccountRecordService::addRecord(compact('day', 'company_name', 'fee', 'account', 'remark', 'status'));
-            if ($result) {
-                return response()->success();
-            } else {
-                return response()->error("HANDLE_FAILED");
-            }
-        }
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改到账记录
-     * @api {POST} updateTransformAccountRecord 修改到账记录
-     * @param {id} id 必传
-     * @param [fee] 金额  可不传
-     * @param [day] 日期  可不传
-     * @param [company_name] 公司名称  可不传
-     * @param [trade_number] 流水号  可不传
-     * @param [status] 状态(成功、失败)  可不传
-     * @return mixed
-     */
-    function update_record(Request $request)
-    {
-        $id = $request->has('id') ? $request->input('id') : '';
-        $fee = $request->has('fee') ? $request->input('fee') : '';
-        $day = $request->has('day') ? $request->input('day') : '';
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        $status = $request->has('status') ? $request->input('status') : '';
-        $company_name = $request->has('company_name') ? $request->input('company_name') : '';
-        $account = $request->has('trade_number') ? $request->input('trade_number') : '';
-
-        if ($id) {
-            $result = TransformAccountRecordService::updateRecord($id, $fee, $day, $status, $company_name, $account, $remark);
-            if ($result) {
-                return response()->success();
-            } else {
-                return response()->error("HANDLE_FAILED");
-            }
-        } else {
-            return response()->error('PARAM_EMPTY');
-        }
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取到账记录
-     * @api {GET} getTransformAccountRecord 获取到账记录
-     * @param [start_time] 开始时间  可不传
-     * @param [end_time] 结束时间  可不传
-     * @param [company_name] 公司名称  可不传
-     * @param [trade_number] 流水号 可不传
-     * @param [status] 状态(成功、失败) 可不传
-     * @return mixed
-     */
-    function get_record(Request $request)
-    {
-        $status = $request->has('status') ? $request->input('status') : '';
-        $end_time = $request->has('end_time') ? $request->input('end_time') : '';
-        $start_time = $request->has('start_time') ? $request->input('start_time') : '';
-        $account = $request->has('trade_number') ? $request->input('trade_number') : '';
-        $company_name = $request->has('company_name') ? $request->input('company_name') : '';
-        $params = ['status' => $status, 'company_name' => $company_name, 'account' => $account, 'start_time' => $start_time, 'end_time' => $end_time];
-        $data = TransformAccountRecordService::getRecord($params, false);
-        return response()->pagination(new TransformAccountRecordTransformer(), $data);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 导出到账记录
-     * @api {GET} exportTransformAccountRecord 导出到账记录
-     * @param [start_time] 开始时间  可不传
-     * @param [end_time] 结束时间  可不传
-     * @param [company_name] 公司名称  可不传
-     * @param [trade_number] 流水号  可不传
-     * @param [status] 状态(成功、失败)  可不传
-     * @return mixed
-     */
-    function export_record(Request $request)
-    {
-        $status = $request->has('status') ? $request->input('status') : '';
-        $end_time = $request->has('end_time') ? $request->input('end_time') : '';
-        $start_time = $request->has('start_time') ? $request->input('start_time') : '';
-        $account = $request->has('trade_number') ? $request->input('trade_number') : '';
-        $company_name = $request->has('company_name') ? $request->input('company_name') : '';
-        $params = ['start_time' => $start_time, 'end_time' => $end_time, 'status' => $status, 'company_name' => $company_name, 'account' => $account];
-        $data = TransformAccountRecordService::getRecord($params, true);
-
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "到账记录" . date("YmdHis") . ".csv");
-
-        echo iconv("UTF-8", "GBK", "\"id\",\"公司名称\",\"流水号\",\"金额\",\"日期\",\"创建时间\",\"最近修改时间\",\"备注\",\"状态\"\r\n");
-        if ($data) {
-            foreach ($data as $item) {
-                echo("\"" . ($item->id ? $item->id : "-1") . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", ($item->company_name ? $item->company_name : "未填")) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", ($item->account ? $item->account : "未填")) . "\",");
-                echo("\"" . ($item->fee ? $item->fee : "-1") . "\",");
-                echo("\"" . $item->day ? $item->day : "未填" . "\",");
-                echo("\"" . $item->created_at->toDateTimeString() . "\",");
-                echo("\"" . $item->updated_at->toDateTimeString() . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", ($item->remark ? $item->remark : "未填")) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", ($item->status ? $item->status : "未填")) . "\"\r\n");
-            }
-        }
-        exit();
-    }
-}

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

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

+ 0 - 29
app/Http/Controllers/Manage/Finance/Transformers/CashAccountTransformer.php

@@ -1,29 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Manage\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 : "",
-            '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 - 22
app/Http/Controllers/Manage/Finance/Transformers/CommissionRateTransformer.php

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

+ 0 - 20
app/Http/Controllers/Manage/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\Manage\Finance\Transformers;
-
-
-class FinancialConfigTransformer
-{
-    public function transform($financialConfig){
-        return [
-            'frozen'       =>  $financialConfig->is_frozen,
-            'remark'       =>  $financialConfig->remark,
-        ];
-    }
-}

+ 0 - 37
app/Http/Controllers/Manage/Finance/Transformers/FinancialStatDetailTransformer.php

@@ -1,37 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/22
- * Time: 上午10:41
- */
-
-namespace App\Http\Controllers\Manage\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),
-            'settlement_price_count'       =>  (float)(isset($financialStat->settlement_price_count) ? ($financialStat->settlement_price_count) : 0),
-            'tallage'  =>  (float)(isset($financialStat->tallage) ? ($financialStat->tallage) : 0),
-            'is_company'  =>  (float)(isset($financialStat->is_company) ? ($financialStat->is_company) : 0),
-        ];
-    }
-}

+ 0 - 25
app/Http/Controllers/Manage/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\Manage\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 - 26
app/Http/Controllers/Manage/Finance/Transformers/LiquidatedStatTransformer.php

@@ -1,26 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/7
- * Time: 下午6:07
- */
-
-namespace App\Http\Controllers\Manage\Finance\Transformers;
-
-
-use App\Modules\Channel\Services\ChannelService;
-
-class LiquidatedStatTransformer
-{
-    public function transform($liquidatedStat){
-        return [
-            'pay_merchant_source'       =>  $liquidatedStat->pay_merchant_source,
-            'pay_merchant_source_name' => ChannelService::getSourceName($liquidatedStat->pay_merchant_source),
-            'amount'       =>  (float)($liquidatedStat->amount),
-            'account_balance_amount'       =>  (float)($liquidatedStat->account_balance_amount),
-        ];
-    }
-
-
-}

+ 0 - 36
app/Http/Controllers/Manage/Finance/Transformers/LiquidationTransformer.php

@@ -1,36 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/7
- * Time: 下午8:03
- */
-
-namespace App\Http\Controllers\Manage\Finance\Transformers;
-
-
-use App\Modules\Channel\Services\ChannelService;
-
-class LiquidationTransformer
-{
-    public function transform($liquidation){
-        return [
-            'id'       =>  isset($liquidation->id) ? $liquidation->id : 0,
-            'channel_id'       =>  isset($liquidation->distribution_channel_id) ? $liquidation->distribution_channel_id : 0,
-            'channel_name'       =>  isset($liquidation->distribution_channel_name) ? $liquidation->distribution_channel_name : "",
-            'pay_merchant_source'       =>  isset($liquidation->pay_merchant_source) ? $liquidation->pay_merchant_source : "",
-            'pay_merchant_source_name' => ChannelService::getSourceName(isset($liquidation->pay_merchant_source) ? $liquidation->pay_merchant_source : ""),
-            'amount'       =>  (float)(isset($liquidation->amount) ? $liquidation->amount : 0),
-            'payment_id'       =>  isset($liquidation->payment_id) ? $liquidation->payment_id : 0,
-            'date'       =>  isset($liquidation->date) ? ($liquidation->date ? date('Y-m-d H:i:s', strtotime($liquidation->date)) : "") : "",
-            'payment_id'       =>  isset($liquidation->payment_id) ? $liquidation->payment_id : 0,
-            'remark'       =>  isset($liquidation->remark) ? $liquidation->remark : "",
-            'created_time'       =>  isset($liquidation->created_at) ? ($liquidation->created_at ? date('Y-m-d H:i:s', strtotime($liquidation->created_at)) : "") : "",
-            'phone'       =>  isset($liquidation->phone) ? $liquidation->phone : "",
-            'pay_merchant_id'       =>  isset($liquidation->pay_merchant_id) ? $liquidation->pay_merchant_id : 0,
-            'nickname'       =>  isset($liquidation->nickname) ? $liquidation->nickname : "",
-            'person_in_charge_name'       =>  isset($liquidation->person_in_charge_name) ? $liquidation->person_in_charge_name : "",
-        ];
-    }
-
-}

+ 0 - 43
app/Http/Controllers/Manage/Finance/Transformers/PaymentDetailTransformer.php

@@ -1,43 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Manage\Finance\Transformers;
-
-
-class PaymentDetailTransformer
-{
-    public function transform($payment){
-        return [
-            'id'=>$payment->id,
-            'withdraw_cash_id' => $payment->cash_id,
-            'amount' => (float)($payment->amount),
-            'amount_person' => (float)($payment->amount_person),
-            '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 - 30
app/Http/Controllers/Manage/Finance/Transformers/PaymentStatisticTransformer.php

@@ -1,30 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/8
- * Time: 下午3:27
- */
-
-namespace App\Http\Controllers\Manage\Finance\Transformers;
-
-
-class PaymentStatisticTransformer
-{
-    public function transform($payment){
-        return [
-            'amount' => (float)($payment->amount),
-            'amount_num' => (float)($payment->amount_num),
-            'amount_person' => (float)($payment->amount_person),
-            'amount_person_num' => (float)($payment->amount_person_num),
-            'amount_company' => (float)($payment->amount_company),
-            'amount_company_num' => (float)($payment->amount_company_num),
-            'amount_audit_fail' => (float)($payment->amount_audit_fail),
-            'amount_audit_fail_num' => (float)($payment->amount_audit_fail_num),
-            'amount_fail' => (float)($payment->amount_fail),
-            'amount_fail_num' => (float)($payment->amount_fail_num),
-            'tallage' => (float)($payment->tallage),
-            'created_time'   =>  date('Y-m-d',strtotime($payment->date)),
-        ];
-    }
-}

+ 0 - 29
app/Http/Controllers/Manage/Finance/Transformers/PaymentTransformer.php

@@ -1,29 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Manage\Finance\Transformers;
-
-
-class PaymentTransformer
-{
-    public function transform($payment){
-        return [
-            'withdraw_cash_id' => $payment->withdraw_cash_id,
-            'amount' => (float)($payment->amount),
-            'amount_person' => (float)($payment->amount_person),
-            'remark' => $payment->remark,
-            '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->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,
-        ];
-    }
-}

+ 0 - 28
app/Http/Controllers/Manage/Finance/Transformers/TransformAccountRecordTransformer.php

@@ -1,28 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/17
- * Time: 下午4:40
- */
-
-namespace App\Http\Controllers\Manage\Finance\Transformers;
-
-
-class TransformAccountRecordTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'id' => $item->id,
-            'company_name' => $item->company_name,
-            'account' => $item->account,
-            'fee' => $item->fee,
-            'day' => $item->day,
-            'remark' => $item->remark,
-            'staus' => $item->status,
-            'created_at' => date("Y-m-d H:i:s", strtotime($item->created_at)),
-            'updated_at' => date("Y-m-d H:i:s", strtotime($item->updated_at)),
-        ];
-    }
-}

+ 0 - 40
app/Http/Controllers/Manage/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\Manage\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/Manage/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\Manage\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,
-            'serial_number'   =>  $withdrawCash->serial_number,
-            'is_company'   =>  (float)$withdrawCash->is_company,
-            'remark'   =>  $withdrawCash->remark,
-            '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)),
-        ];
-    }
-}

+ 0 - 764
app/Http/Controllers/Manage/Finance/WithdrawCashController.php

@@ -1,764 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午4:12
- */
-
-namespace App\Http\Controllers\Manage\Finance;
-
-
-use App\Http\Controllers\Manage\Finance\Transformers\WithdrawCashFinancialTransformer;
-use App\Http\Controllers\Manage\Finance\Transformers\WithdrawCashTransformer;
-use App\Modules\Finance\Services\CashAccountService;
-use App\Modules\Finance\Services\FinanceService;
-use App\Modules\Finance\Services\FinancialConfigService;
-use App\Modules\Finance\Services\FinancialStatService;
-use App\Modules\Finance\Services\WithdrawCashService;
-use Illuminate\Http\Request;
-
-class WithdrawCashController extends BaseController
-{
-
-    /**
-     * @apiDefine Finance 结算提现模块
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 申请提现
-     * @api {POST} addWithdrawCash 添加提现信息
-     * @apiGroup Finance
-     * @apiName addWithdrawCash
-     * @apiParam   {Number}  distribution_channel_id 渠道id.
-     * @apiParam   {Number}  amount 提现金额.
-     * @apiParam   {String}  [remark] 备注说明.
-     * @apiSuccess   {Number}  enable_amount 可提现总额.
-     * @apiSuccess   {Number}  withdraw_pending_amount 提现中金额.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *                  "enable_amount": 70,
-     *                  "withdraw_pending_amount": 1100
-     *              }
-     *     }
-     */
-    function add_withdrawCash(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");
-        }
-
-        $amount = $request->has('amount') ? $request->input('amount') : '';
-        if (!is_numeric($amount)) {
-            return response()->error("PARAM_ERROR");
-        }
-        if ($amount < 100) {
-            return response()->error("WITHDRAW_CASH_AMOUNT");
-        }
-
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-
-        $financialStat = FinancialStatService::getFinancialStatSingle($distribution_channel_id);
-        if (empty($financialStat) || $financialStat['enable_withdrawal_amount'] < $amount) {
-            //可提现金额不够
-            return response()->error("WITHDRAW_CASH_AMOUNT_INSUFFICIEN");
-        }
-
-        if (FinancialConfigService::isFrozenDistributionChannel($distribution_channel_id)) {
-            //渠道被冻结
-            return response()->error("WITHDRAW_CASH_AMOUNT_FROZEN");
-        }
-
-        //判断账户是否设置
-        if (!CashAccountService::isCashAccountExits($distribution_channel_id)) {
-            return response()->error("WITHDRAW_CASH_AMOUNT_ACCOUNT");
-        }
-
-        //判断今天是否已经提现
-        if (WithdrawCashService::isWithdrawCashChannelToToday($distribution_channel_id)) {
-            return response()->error("WITHDRAW_CASH_TODAY_USE");
-        }
-
-
-        WithdrawCashService::addWithdrawCash($distribution_channel_id, $amount, $remark);
-
-        $financialStatUp = FinancialStatService::updateFinancialStatByWithdraw($distribution_channel_id, $amount);
-        //修改可提现总额
-        $enable_amount = $financialStatUp['enable_withdrawal_amount'];
-        //修改提现中金额
-        $withdraw_pending_amount = $financialStatUp['withdraw_pending_amount'];
-
-        return response()->success(compact('enable_amount', 'withdraw_pending_amount'));
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改提现状态
-     * @api {POST} updateWithdrawCash 修改提现状态信息
-     * @apiGroup Finance
-     * @apiName updateWithdrawCash
-     * @apiParam   {Number}  id 提现id.
-     * @apiParam   {Number}  status 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {String}  remark 备注说明.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              }
-     *     }
-     */
-    function update_withdrawCash(Request $request)
-    {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if (!is_numeric($id)) {
-            return response()->error("PARAM_ERROR");
-        }
-//        $userId = $request->has('user_id') ? $request->input('user_id') : '';
-//        if(!is_numeric($userId)) {
-//            return response()->error("PARAM_ERROR");
-//        }
-        $userId = $this->getLoginUserId();
-
-
-        $remark = $request->has('remark') ? $request->input('remark') : '';
-        $statusIn = $request->has('status') ? $request->input('status') : '';
-        if (!is_numeric($statusIn)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        //审核通过 2, 审核失败 9, 待打款 10, 自动待打款  11  人工待打款 12
-        if ($statusIn == 2 || $statusIn == 9 || $statusIn == 10 || $statusIn == 12) {
-        } else {
-            return response()->error("PARAM_ERROR");
-        }
-
-        $withdrawCash = WithdrawCashService::getWithdrawCash($id);
-        if (empty($withdrawCash)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        if (WithdrawCashService::isEditWithdrawCashStatus($id)) {
-            return response()->error("WITHDRAW_CASH_AMOUNT_NO_CHANGE");
-        }
-        if ($statusIn == 2) {
-            //已审核 , 私
-            if ($withdrawCash['is_company'] == 0) {
-                $statusIn = 11;//,'name' => "自动待打款"
-            }
-            if ($withdrawCash['is_company'] == 1) {
-                //对公,直接 人工打款
-                $statusIn = 12;//,12,'name' => "人工待打款"
-            }
-        }
-        WithdrawCashService::updateWithdrawCashStatus($id, $userId, $statusIn, $remark);
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取提现列表
-     * @api {GET} withdrawCashs 获取提现列表信息
-     * @apiGroup Finance
-     * @apiName withdrawCashs
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiSuccess   {Number}  channel_id 渠道ID.
-     * @apiSuccess   {String}  channel_name 渠道名称.
-     * @apiSuccess   {Number}  amount 提现金额.
-     * @apiSuccess   {Number}  tallage 扣税金额.
-     * @apiSuccess   {String}  status 状态.
-     * @apiSuccess   {String}  remark 备注.
-     * @apiSuccess   {Number}  check_user_id 审核人ID.
-     * @apiSuccess   {String}  check_user_name 审核人姓名.
-     * @apiSuccess   {String}  created_time 提现时间.
-     * @apiSuccess   {String}  updated_time 最后更新时间.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {
-     *                   "list": [
-     *                           {
-     *                                       "channel_id": 2,
-     *                                       "channel_name": "渠道二",
-     *                                       "amount": "330.00",
-     *                                       "tallage": "11",
-     *                                       "status": "待审核",
-     *                                       "remark": null,
-     *                                       "check_user_id": null,
-     *                                       "check_user_name": null,
-     *                                       "created_time": "2017-12-01 16:58:55",
-     *                                       "updated_time": "2017-12-01 16:58:59"
-     *                               }
-     *                       ],
-     *                   "meta": {
-     *                       "total": 2,
-     *                       "per_page": 15,
-     *                       "current_page": 1,
-     *                       "last_page": 1,
-     *                       "next_page_url": "",
-     *                       "prev_page_url": ""
-     *                   }
-     *              }
-     *     }
-     */
-    function get_list(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $statusIn = $request->has('status') ? $request->input('status') : '';
-        $result = WithdrawCashService::getList($distribution_channel_id, $distribution_channel_name, $start_time, $end_time, $statusIn);
-        return response()->pagination(new WithdrawCashTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 财务对账
-     * @api {get} WithdrawCash/financialCounting 财务对账
-     * @apiGroup Finance
-     * @apiName WithdrawCash/financialCounting
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [account_name] 账户名称
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_frozen] 0:正常状态; -1:冻结状态.
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     * @apiSuccess   {Number}  id 提现ID.
-     * @apiSuccess   {Number}  channel_id 渠道ID.
-     * @apiSuccess   {String}  channel_name 渠道名称.
-     * @apiSuccess   {Number}  amount 提现金额.
-     * @apiSuccess   {Number}  pay_amount 打款金额.
-     * @apiSuccess   {String}  status 打款状态
-     * @apiSuccess   {String}  remark 备注
-     * @apiSuccess   {String}  check_user_name 审核人名称
-     * @apiSuccess   {Number}  check_user_id 审核人ID
-     * @apiSuccess   {String}  account_name 银行卡户主名称
-     * @apiSuccess   {String}  identity_card 银行卡户主身份证
-     * @apiSuccess   {String}  card_number 银行卡账号
-     * @apiSuccess   {String}  account_bank 银行支行
-     * @apiSuccess   {String}  bank 银行名称
-     * @apiSuccess   {String}  province 银行地址
-     * @apiSuccess   {String}  created_time 提现时间.
-     * @apiSuccess   {String}  updated_time 审核时间
-     * @apiSuccess   {Number}  tallage 税
-     * @apiSuccess   {Number}  is_frozen 0:正常状态; -1:冻结状态.
-     * @apiSuccess   {String}  fc_remark 冻结备注.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {
-     *                   "list": [
-     *                           {
-     *                              "id": 14,
-     *                              "channel_id": 2,
-     *                              "channel_name": "渠道二",
-     *                              "amount": "330.00",
-     *                              "pay_amount": "220.00",
-     *                              "status": "已打款",
-     *                              "remark": "的发生的饭",
-     *                              "check_user_name": "波哥的锅",
-     *                              "check_user_id": 2,
-     *                              "account_name": "宋晓",
-     *                              "identity_card": "33038119930901821X",
-     *                              "card_number": "6222520177654916",
-     *                              "account_bank": "钱江支行",
-     *                              "bank": "杭州银行",
-     *                              "province": "北京市",
-     *                              "created_time": "2017-11-30 16:24:25",
-     *                              "updated_time": "2017-11-30 16:24:27",
-     *                              "tallage": "110",
-     *                              "is_frozen": 0,
-     *                              "fc_remark": ""
-     *                            }
-     *                       ],
-     *                   "meta": {
-     *                       "total": 2,
-     *                       "per_page": 15,
-     *                       "current_page": 1,
-     *                       "last_page": 1,
-     *                       "next_page_url": "",
-     *                       "prev_page_url": ""
-     *                   }
-     *              }
-     *     }
-     */
-    function financial_counting(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $isFrozen = $request->has('is_frozen') ? $request->input('is_frozen') : '';
-        $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') : '';
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'is_frozen' => $isFrozen,
-            'account_name' => $account_name,
-            'search_name' => $search_name,
-            'is_company' => $is_company,
-        ];
-        $result = WithdrawCashService::getFinancialCounting($params, $status);
-
-        return response()->pagination(new WithdrawCashFinancialTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 财务对账导出
-     * @api {get} WithdrawCash/financialCountingExport 财务对账导出
-     * @apiGroup Finance
-     * @apiName WithdrawCash/financialCountingExport
-     * @apiParam   {String}  [account_name] 账户名称
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_frozen] 0:正常状态; -1:冻结状态.
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     */
-    function financial_counting_export(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $isFrozen = $request->has('is_frozen') ? $request->input('is_frozen') : '';
-        $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') : '';
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'is_frozen' => $isFrozen,
-            'account_name' => $account_name,
-            'search_name' => $search_name,
-            'is_company' => $is_company,
-        ];
-        $result = WithdrawCashService::getFinancialCounting($params, $status, true);
-
-
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "财务对账" . date("YmdHis") . ".csv");
-        echo iconv("UTF-8", "GBK", "\"操作日期\",\"渠道ID\",\"渠道名称\",\"私/公\",\"姓名\",\"打款金额(元)\",\"打款状态\",\"银行卡\",\"交易银行\",\"开户支行\"\r\n");
-        if ($result) {
-            foreach ($result as $item) {
-
-                echo("\"" . iconv("UTF-8", "GBK", date('Y-m-d H:i:s', strtotime($item->updated_at))) . "\",");
-                echo("\"" . ($item->channel_id) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", $item->channel_name) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", $item->is_company) . "\",");
-                echo("\"" . mb_convert_encoding($item->account_name, "GBK") . "\",");
-                echo("\"" . ($item->amount - $item->tallage) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", $item->wc_status) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", "`" . ($item->card_number)) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", $item->bank) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", $item->account_bank) . "\"\r\n");
-            }
-        }
-        exit();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 财务审核
-     * @api {get} WithdrawCash/financialAudit 财务审核
-     * @apiGroup Finance
-     * @apiName WithdrawCash/financialAudit
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [account_name] 账户名称
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_frozen] 0:正常状态; -1:冻结状态.
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     * @apiSuccess   {Number}  id 提现ID.
-     * @apiSuccess   {Number}  channel_id 渠道ID.
-     * @apiSuccess   {String}  channel_name 渠道名称.
-     * @apiSuccess   {Number}  amount 提现金额.
-     * @apiSuccess   {Number}  pay_amount 打款金额.
-     * @apiSuccess   {String}  status 打款状态
-     * @apiSuccess   {String}  remark 备注
-     * @apiSuccess   {String}  check_user_name 审核人名称
-     * @apiSuccess   {Number}  check_user_id 审核人ID
-     * @apiSuccess   {String}  account_name 银行卡户主名称
-     * @apiSuccess   {String}  identity_card 银行卡户主身份证
-     * @apiSuccess   {String}  card_number 银行卡账号
-     * @apiSuccess   {String}  account_bank 银行支行
-     * @apiSuccess   {String}  bank 银行名称
-     * @apiSuccess   {String}  province 银行地址
-     * @apiSuccess   {String}  created_time 提现时间.
-     * @apiSuccess   {String}  updated_time 审核时间
-     * @apiSuccess   {Number}  tallage 税
-     * @apiSuccess   {Number}  is_frozen 0:正常状态; -1:冻结状态.
-     * @apiSuccess   {String}  fc_remark 冻结备注.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {
-     *                   "list": [
-     *                           {
-     *                              "id": 14,
-     *                              "channel_id": 2,
-     *                              "channel_name": "渠道二",
-     *                              "amount": "330.00",
-     *                              "pay_amount": "220.00",
-     *                              "status": "已打款",
-     *                              "remark": "的发生的饭",
-     *                              "check_user_name": "波哥的锅",
-     *                              "check_user_id": 2,
-     *                              "account_name": "宋晓",
-     *                              "identity_card": "33038119930901821X",
-     *                              "card_number": "6222520177654916",
-     *                              "account_bank": "钱江支行",
-     *                              "bank": "杭州银行",
-     *                              "province": "北京市",
-     *                              "created_time": "2017-11-30 16:24:25",
-     *                              "updated_time": "2017-11-30 16:24:27",
-     *                              "tallage": "110",
-     *                              "is_frozen": 0,
-     *                              "fc_remark": ""
-     *                            }
-     *                       ],
-     *                   "meta": {
-     *                       "total": 2,
-     *                       "per_page": 15,
-     *                       "current_page": 1,
-     *                       "last_page": 1,
-     *                       "next_page_url": "",
-     *                       "prev_page_url": ""
-     *                   }
-     *              }
-     *     }
-     */
-    function financial_audit(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $isFrozen = $request->has('is_frozen') ? $request->input('is_frozen') : '';
-        $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') : '';
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'is_frozen' => $isFrozen,
-            'account_name' => $account_name,
-            'search_name' => $search_name,
-            'is_company' => $is_company,
-        ];
-        $result = WithdrawCashService::getFinancialAudit($params, $status);
-
-        return response()->pagination(new WithdrawCashFinancialTransformer(), $result);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 财务审核导出
-     * @api {get} WithdrawCash/financialAuditExport 财务审核导出
-     * @apiGroup Finance
-     * @apiName WithdrawCash/financialAuditExport
-     * @apiParam   {Number}  [distribution_channel_id] 渠道id.(可不传,获取所有渠道)
-     * @apiParam   {String}  [distribution_channel_name] 渠道名称.(可不传,获取所有渠道)
-     * @apiParam   {String}  [account_name] 账户名称
-     * @apiParam   {String}  [search_name] 搜索名称
-     * @apiParam   {String}  [start_time] 开始时间(可不传)
-     * @apiParam   {String}  [end_time] 结束时间(可不传)
-     * @apiParam   {Number}  [is_frozen] 0:正常状态; -1:冻结状态.
-     * @apiParam   {Number}  [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
-     * @apiParam   {Number}  [is_company] 0:对私, 1:对公司.(可不传,获取所有渠道)
-     */
-    function financial_audit_export(Request $request)
-    {
-        $distribution_channel_id = $request->has('distribution_channel_id') ? $request->input('distribution_channel_id') : '';
-        $distribution_channel_name = $request->has('distribution_channel_name') ? $request->input('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);
-
-        $isFrozen = $request->has('is_frozen') ? $request->input('is_frozen') : '';
-        $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') : '';
-
-        $is_company = $request->has('is_company') ? $request->input('is_company') : '';
-
-        $params = [
-            'channel_id' => $distribution_channel_id,
-            'channel_name' => $distribution_channel_name,
-            'start_date' => $start_time,
-            'end_date' => $end_time,
-            'is_frozen' => $isFrozen,
-            'account_name' => $account_name,
-            'search_name' => $search_name,
-            'is_company' => $is_company,
-        ];
-        $result = WithdrawCashService::getFinancialAudit($params, $status, true);
-
-
-        //mb_convert_encoding()
-        header("Content-type:application/vnd.ms-excel");
-        header("Content-Disposition:attachment;filename=" . "财务审核" . date("YmdHis") . ".csv");
-        echo iconv("UTF-8", "GBK", "\"创建日期\",\"操作日期\",\"渠道ID\",\"渠道名称\",\"私/公\",\"姓名\",\"打款金额(元)\",\"手续费\",\"备注\",\"打款状态\",\"银行卡\",\"交易银行\",\"开户支行\"\r\n");
-        if ($result) {
-            foreach ($result as $item) {
-                echo("\"" . iconv("UTF-8", "GBK", date('Y-m-d H:i:s', strtotime($item->created_at))) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", date('Y-m-d H:i:s', strtotime($item->updated_at))) . "\",");
-                echo("\"" . $item->channel_id . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", trim($item->channel_name)) . "\",");
-                echo("\"" . iconv("UTF-8", "GBK", trim($item->is_company)) . "\",");
-                echo("\"" . mb_convert_encoding(trim($item->account_name), "GBK") . "\",");
-                echo("\"" . ($item->amount - $item->tallage) . "\",");
-                echo("\"" . ($item->tallage) . "\",");
-                echo("\"" . mb_convert_encoding(trim($item->remark), "GBK") . "\",");
-                echo("\"" . mb_convert_encoding(trim($item->wc_status), "GBK") . "\",");
-                echo("\"" . "`" . ($item->card_number) . "\",");
-                echo("\"" . mb_convert_encoding(trim($item->bank), "GBK") . "\",");
-                echo("\"" . mb_convert_encoding(trim($item->account_bank), "GBK") . "\"\r\n");
-            }
-        }
-        exit();
-
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 对账统计数据
-     * @api {get} WithdrawCash/dataStatistics 对账统计数据
-     * @apiGroup Finance
-     * @apiName WithdrawCash/dataStatistics
-     * @apiSuccess   {Number}  yesterday_amount_audit_success 昨日已审核金额
-     * @apiSuccess   {Number}  all_amount_audit_success 所有已审核金额
-     * @apiSuccess   {Number}  yesterday_amount_apply 昨日申请提现金额
-     * @apiSuccess   {Number}  all_amount_apply 所有申请提现金额
-     * @apiSuccess   {Number}  yesterday_amount_audit_fail 昨日审核不通过
-     * @apiSuccess   {Number}  all_amount_audit_fail 所有审核不通过
-     * @apiSuccess   {Number}  yesterday_amount_wait 昨日待打款金额
-     * @apiSuccess   {Number}  all_amount_wait 所有待打款金额
-     * @apiSuccess   {Number}  yesterday_amount_apply_success 昨日成功提现金额
-     * @apiSuccess   {Number}  all_amount_apply_success 所有成功提现金额
-     * @apiSuccess   {Number}  yesterday_amount_apply_person_success 昨日对私成功提现金额
-     * @apiSuccess   {Number}  all_amount_apply_person_success 所有对私成功提现金额
-     * @apiSuccess   {Number}  yesterday_amount_apply_company_success 昨日对公成功提现金额
-     * @apiSuccess   {Number}  all_amount_apply_company_success 所有对公成功提现金额
-     * @apiSuccess   {Number}  yesterday_apply_num 昨日累积提现笔数
-     * @apiSuccess   {Number}  all_apply_num 所有累积提现笔数
-     * @apiSuccess   {Number}  yesterday_tallage_count 昨日累积提现手续费
-     * @apiSuccess   {Number}  all_stallage_count 所有累积提现手续费
-     * @apiSuccess   {Number}  yesterday_payment_count 昨日累积打款金额
-     * @apiSuccess   {Number}  all_payment_count 所有累积打款金额
-     * @apiSuccess   {Number}  all_amount_apply_success_count 所有累积已提现金额
-     * @apiSuccess   {Number}  all_amount_apply_count 所有累积可提现金额
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {
-     *                   "yesterday_amount_audit_success": "660.00",
-     *                   "all_amount_audit_success": "660.00",
-     *                   "yesterday_amount_apply": "660.00",
-     *                   "all_amount_apply": "660.00",
-     *                   "yesterday_amount_audit_fail": "440.00",
-     *                   "all_amount_audit_fail": "440.00",
-     *                   "yesterday_amount_wait": "440.00",
-     *                   "all_amount_wait": "440.00",
-     *                   "yesterday_amount_apply_success": "220.00",
-     *                   "all_amount_apply_success": "220.00",
-     *                   "yesterday_apply_num": 3,
-     *                   "all_apply_num": 3,
-     *                   "yesterday_tallage_count": 3,
-     *                   "all_stallage_count": 3,
-     *                   "yesterday_payment_count":200,
-     *                   "all_payment_count":200,
-     *                   "all_amount_apply_success_count": 3,
-     *                   "all_amount_apply_count": 3,
-     *              }
-     *     }
-     */
-    function data_statistics(Request $request)
-    {
-        $dataWithdrawCash = FinanceService::getDataStatisticsWithdrawCash();
-
-        //昨日已审核金额
-        $yesterday_amount_audit_success = $dataWithdrawCash['yesterday_amount_audit_success'];
-        //所有已审核金额
-        $all_amount_audit_success = $dataWithdrawCash['all_amount_audit_success'];
-        //昨日申请提现金额
-        $yesterday_amount_apply = $dataWithdrawCash['yesterday_amount_apply'];
-        //所有申请提现金额
-        $all_amount_apply = $dataWithdrawCash['all_amount_apply'];
-        //昨日审核不通过
-        $yesterday_amount_audit_fail = $dataWithdrawCash['yesterday_amount_audit_fail'];
-        //所有审核不通过
-        $all_amount_audit_fail = $dataWithdrawCash['all_amount_audit_fail'];
-
-        //昨日待打款
-        $yesterday_amount_wait = $dataWithdrawCash['yesterday_amount_wait'];
-        //所有待打款
-        $all_amount_wait = $dataWithdrawCash['all_amount_wait'];
-        //所有待笔数
-        $all_amount_wait_num = $dataWithdrawCash['all_amount_wait_num'];
-
-        //昨日对私成功提现金额
-        $yesterday_amount_apply_person_success = $dataWithdrawCash['yesterday_amount_apply_person_success'];
-        //所有对私成功提现金额
-        $all_amount_apply_person_success = $dataWithdrawCash['all_amount_apply_person_success'];
-        //昨日对公成功提现金额
-        $yesterday_amount_apply_company_success = $dataWithdrawCash['yesterday_amount_apply_company_success'];
-        //所有对公成功提现金额
-        $all_amount_apply_company_success = $dataWithdrawCash['all_amount_apply_company_success'];
-
-
-        //昨日成功提现金额
-        $yesterday_amount_apply_success = $dataWithdrawCash['yesterday_amount_apply_success'];
-        //所有成功提现金额
-        $all_amount_apply_success = $dataWithdrawCash['all_amount_apply_success'];
-        //昨日累积提现笔数
-        $yesterday_apply_num = $dataWithdrawCash['yesterday_apply_num'];
-        //所有累积提现笔数
-        $all_apply_num = $dataWithdrawCash['all_apply_num'];
-        //昨日累积提现手续费
-        $yesterday_tallage_count = $dataWithdrawCash['yesterday_tallage_count'];
-        //所有累积提现手续费
-        $all_stallage_count = $dataWithdrawCash['all_stallage_count'];
-
-
-        $dataPayment = FinanceService::getDataStatisticsPayment();
-        //昨日累积打款金额
-        $yesterday_payment_count = $dataPayment['yesterday_payment_count'];
-        //所有累积打款金额
-        $all_payment_count = $dataPayment['all_payment_count'];
-
-
-        $dataFinancialStat = FinanceService::getDataStatisticsFinancialStat();
-        //所有累积已提现金额
-        $all_amount_apply_success_count = $dataFinancialStat['all_amount_apply_success_count'];
-        //所有累积可提现金额
-        $all_amount_apply_count = $dataFinancialStat['all_amount_apply_count'];
-
-        return response()->success(
-            compact(
-                'yesterday_amount_audit_success',
-                'all_amount_audit_success',
-                'yesterday_amount_apply',
-                'all_amount_apply',
-                'yesterday_amount_audit_fail',
-                'all_amount_audit_fail',
-                'yesterday_amount_wait',
-                'all_amount_wait',
-                'all_amount_wait_num',
-                'yesterday_amount_apply_success',
-                'all_amount_apply_success',
-                'yesterday_amount_apply_person_success',
-                'all_amount_apply_person_success',
-                'yesterday_amount_apply_company_success',
-                'all_amount_apply_company_success',
-                'yesterday_apply_num',
-                'all_apply_num',
-                'yesterday_tallage_count',
-                'all_stallage_count',
-                'yesterday_payment_count',
-                'all_payment_count',
-                'all_amount_apply_success_count',
-                'all_amount_apply_count'
-            ));
-    }
-
-    public function updateWithdrawType(Request $request)
-    {
-        $id = $request->input('id', '');
-        $param = $request->input('param', '');
-        $param_value = $request->input('param_value', '');
-        if (empty($id)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $withdrawCash = WithdrawCashService::getWithdrawCash($id);
-        if (!$withdrawCash) {
-            return response()->error('PARAM_ERROR');
-        }
-        if ($param == 'is_company') {
-            $withdrawCash->is_company = $param_value;
-            $withdrawCash->save();
-        }
-        //WithdrawCashService::updateWithdrawCashType($id,);
-        return response()->success();
-    }
-
-    /**
-     * 更新打款状态
-     * id 条目id
-     * status 状态(10:待打款)
-     * @param Request $request
-     * @return mixed
-     */
-    function updatePaymentStatus(Request $request)
-    {
-        $id = $request->input('id', '');
-        if (empty($id)) {
-            return response()->error('PARAM_EMPTY');
-        }
-        $withdrawCash = WithdrawCashService::getWithdrawCash($id);
-        if (!$withdrawCash) {
-            return response()->error('PARAM_ERROR');
-        }
-
-        $status = WithdrawCashService::getWithdrawCashStatusStr(10);
-        $withdrawCash->status = $status;
-        $withdrawCash->save();
-        //WithdrawCashService::updateWithdrawCashType($id,);
-        return response()->success();
-    }
-}

+ 0 - 40
app/Http/Controllers/Manage/ForceSub/ForceUsersDateActiveController.php

@@ -1,40 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\ForceSub;
-
-use App\Http\Controllers\Controller;
-use App\Modules\Sys\Services\SysConfigService;
-use Illuminate\Http\Request;
-
-use App\Jobs\ForceActiveJob;
-
-
-class ForceUsersDateActiveController extends Controller
-{
-
-    function run(Request $request)
-    {
-        $start_date = $request->has('start_date') ? $request->input('start_date') : '';
-        $end_date = $request->has('end_date') ? $request->input('end_date') : '';
-        if(!$start_date || !$end_date) return response()->error('PARAM_ERROR');
-
-        //查看开关
-        $switch = SysConfigService::getForceActiveSwitch();
-        if($switch)
-        {
-             return response()->error('TASK_IN_PROGRESS');
-        }else{
-            try {
-                $job = (new ForceActiveJob(compact('start_date', 'end_date')))->onConnection('rabbitmq')->onQueue('force_active');
-                dispatch($job);
-                //开启开关
-                SysConfigService::openForceActiveSwitch();
-                //添加到执行命令
-            }catch (\Exception $e)
-            {
-
-            }
-        }
-        return response()->success();
-    }
-}

+ 0 - 12
app/Http/Controllers/Manage/ForceSub/Transformers/ForceUsersDateActiveTransformer.php

@@ -1,12 +0,0 @@
-<?php
-
-
-namespace App\Http\Controllers\Manage\ForceSub\Transformers;
-
-class ForceUsersDateActiveTransformer
-{
-    public function transform()
-    {
-
-    }
-}

+ 0 - 177
app/Http/Controllers/Manage/Help/HelpController.php

@@ -1,177 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Help;
-
-use App\Http\Controllers\Manage\Help\Transformers\HelpTransformer;
-use App\Modules\Help\Services\HelpService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class HelpController extends Controller
-{
-    /**
-     * @apiDefine Help 帮助
-     */
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取帮助
-     * @api {get} help/getAllHelpList 获取帮助
-     * @apiGroup Help
-     * @apiName getAllHelpList
-     * @apiParam   {string}      status状态(enbale,disable)
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {object}      data.id id
-     * @apiSuccess {object}      data.title 标题
-     * @apiSuccess {object}      data.content 内容
-     * @apiSuccess {object}      data.created_at 创建时间
-     * @apiSuccess {object}      data.updated_at 更新时间
-     * @apiSuccess {object}      data.is_enabled 是否启用(0不启用,1启用)
-     * @apiSuccessExample {json} Success-Response:
-     *      HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *     }
-     */
-    public function getAllHelpList(Request $request){
-        $status = $request->get('is_enabled');
-        $status_array = ['enbale'=>1,'disable'=>0];
-        $where = [];
-        if($status && isset($status_array[$status])){
-            $where[] = ['is_enabled'=>$status_array[$status]];
-        }
-        $res = HelpService::getAllHelpList($where);
-
-        return response()->pagination(new HelpTransformer(),$res);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取帮助
-     * @api {get} help/getHelp/{id} 获取帮助
-     * @apiGroup Help
-     * @apiName getHelp
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccess {object}      data.id id
-     * @apiSuccess {object}      data.title 标题
-     * @apiSuccess {object}      data.content 内容
-     * @apiSuccess {object}      data.created_at 创建时间
-     * @apiSuccess {object}      data.updated_at 更新时间
-     * @apiSuccess {object}      data.is_enabled 是否启用(0不启用,1启用)
-     * @apiSuccessExample {json} Success-Response:
-     *      HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *     }
-     */
-    public function getHelp($id){
-        return response()->item(new HelpTransformer(),HelpService::getById($id));
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加帮助
-     * @api {post} help/createHelp 添加帮助
-     * @apiGroup Help
-     * @apiName createHelp
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiParam    {string}     content内容
-     * @apiParam    {string}     title标题
-     * @apiSuccessExample {json} Success-Response:
-     *       HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *     }
-     */
-    public function createHelp(Request $request){
-        $content = $request->post('content');
-        $title = $request->post('title');
-        if(empty($content) || empty($title)){
-            return response()->error('PARAM_EMPTY');
-        }
-        $data = compact('title','content');
-        if(HelpService::create($data)){
-            return response()->success();
-        }else{
-            return response()->error('UNKNOWN_ERROR');
-        }
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 编辑帮助
-     * @api {post} help/editHelp 编辑帮助
-     * @apiGroup Help
-     * @apiName editHelp
-     * @apiParam   {string}     content 内容
-     * @apiParam   {string}     title  标题
-     * @apiParam   {int}        id     id
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiSuccessExample {json} Success-Response:
-     *       HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *     }
-     */
-    public function editHelp(Request $request){
-        $content = $request->post('content');
-        $title = $request->post('title');
-        $id = $request->post('id');
-        if(empty($content) || empty($title) || empty($id)){
-            return response()->error('PARAM_EMPTY');
-        }
-
-        HelpService::updateHelp($id,compact('content','title'));
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 编辑帮助状态
-     * @api {post} help/editStatus 编辑帮助状态
-     * @apiGroup Help
-     * @apiName editStatus
-     * @apiSuccess {int}         code 状态码
-     * @apiSuccess {String}      msg  信息
-     * @apiSuccess {object}      data 结果集
-     * @apiParam   {string}     status状态(enbale,disable)
-     * @apiParam   {int}        id
-     * @apiSuccessExample {json} Success-Response:
-     *      HTTP/1.1 200 OK
-     *     {
-     *       code: 0,
-     *       msg: "",
-     *       data: {}
-     *     }
-     */
-    public function editStatus(Request $request){
-        $status = $request->post('status');
-        $id = $request->post('id');
-        $status_array = ['enbale'=>1,'disable'=>0];
-        if(empty($status) || empty($id) || !isset($status_array[$status])) {
-            return response()->error('PARAM_EMPTY');
-        }
-
-        HelpService::enableHelpStatus($id,$status_array[$status]);
-        return response()->success();
-    }
-
-}

+ 0 - 53
app/Http/Controllers/Manage/Help/JumpController.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Help;
-
-use App\Http\Controllers\Manage\Help\Transformers\HelpTransformer;
-use App\Modules\Help\Services\HelpService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-use DB;
-use Hashids;
-
-class JumpController extends Controller
-{
-    public function index(){
-        return view('jump.index');
-    }
-
-    public function addLink(Request $request){
-        $description = $request->input('description');
-        $url = $request->input('url');
-        $data = compact('description','url');
-        $data['status'] = 1;
-        $data['created_at']=date('Y-m-d H:i:s');
-        $res = DB::table('url_agent')->insert($data);
-        return response()->success($res);
-    }
-
-    public function getLinksList(Request $request) {
-        $page = $request->input('page');
-        $pagesize = $request->input('pagesize');
-        $recordsTotal = DB::table('url_agent')->count('id');
-
-        $pagecount = ceil($recordsTotal/$pagesize);
-        $offset = ($page-1)*$pagesize;
-        $res = DB::table('url_agent')
-            ->offset($offset)
-            ->limit($pagesize)
-            ->get();
-        foreach ($res as $item){
-            $item->final_url = env('JUMP_AGENT_URL').'/jump?sign='.Hashids::encode($item->id);
-        }
-        return response()->success(['data'=>$res,'pagecount'=>$pagecount]);
-    }
-
-    public function jump(Request $request){
-        $sign = $request->input('sign','');
-        if($sign){
-            $id= Hashids::decode($sign)[0];
-            $url = DB::table('url_agent')->where('id',$id)->first()->url;
-            header('Location: ' . $url);
-        }
-    }
-}

+ 0 - 24
app/Http/Controllers/Manage/Help/Transformers/HelpTransformer.php

@@ -1,24 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Help\Transformers;
-/**
- * Created by PhpStorm.
- * User: zhaoy
- * Date: 20181/07/02
- * Time: 下午2:17
- */
-
-class HelpTransformer
-{
-    public function transform($item)
-    {
-        return [
-            'id' => $item->id,
-            'title' => $item->title,
-            'content' => $item->content,
-            'created_at' =>$item->created_at,
-            'updated_at' => $item->updated_at,
-            'is_enabled' => $item->is_enabled
-        ];
-    }
-}

+ 0 - 118
app/Http/Controllers/Manage/Manage/AccountController.php

@@ -1,118 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Manage;
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Manage\Transformers\ManageTransformer1;
-use App\Http\Controllers\Manage\Manage\Transformers\ManageTransformer;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Manage\Services\ManageService;
-use App\Modules\Manage\Models\Manage;
-use Illuminate\Http\Request;
-use Cache;
-use Redis;
-
-/**
- * 账户管理
- * @author zhoulingjie
- */
-class AccountController extends BaseController
-{
-
-    function getAccounts(Request $request) {
-    	//商务,只获取到当前商务下的渠道列表
-    	if (!$this->checkEditRole()) {
-    		return response()->error('MANAGE_PRIV_ERROR');
-    	}
-        $params = [];
-        $accounts = Manage::getAll(1);
-
-        return response()->pagination(new ManageTransformer(), $accounts);
-
-    }
-    
-    function addAccount(Request $request) {
-    	$account = $request->has('account') ? trim($request->input('account')) : '';
-    	$number = $request->has('number') ? trim($request->input('number')) : '';
-    	$password = $request->has('password') ? trim($request->input('password')) : '';
-    	$nickname = $request->has('nickname') ? trim($request->input('nickname')) : '';
-    	$role = $request->has('role') ? trim($request->input('role')) : '';
-  
-    	//商务,只获取到当前商务下的渠道列表
-    	if (!$this->checkEditRole()) {
-    		return response()->error('MANAGE_PRIV_ERROR');
-    	}
-    	
-    	// 是否存在
-    	$origin_account = Manage::getByAccount($account);
-    	if(!empty($origin_account)){
-    		return response()->error('MANAGE_USER_EXIST');
-    	}
-    	$new_password = md5($password."^-^zhuishuyun^_^");
-    	// 添加
-    	$params = [
-    	   'account'=>$account,
-    	   'number'=>$number,
-    	   'password'=>$new_password,
-    	   'nickname'=>$nickname,
-    	   'role'=>$role,
-    	];
-    	
-    	Manage::add($params);
-    
-    	return response()->success();
-    }
-    
-    function updateAccount(Request $request) {
-    	$account = $request->has('account') ? trim($request->input('account')) : '';
-    	$number = $request->has('number') ? trim($request->input('number')) : '';
-    	$password = $request->has('password') ? trim($request->input('password')) : '';
-    	$nickname = $request->has('nickname') ? trim($request->input('nickname')) : '';
-    	$role = $request->has('role') ? trim($request->input('role')) : '';
-    	$is_enabled = $request->has('is_enabled') ? trim($request->input('is_enabled')) : '1';
-    	 
-    	//商务,只获取到当前商务下的渠道列表
-    	if (!$this->checkEditRole()) {
-    		return response()->error('MANAGE_PRIV_ERROR');
-    	}
-    	// 是否存在
-    	$origin_account = Manage::getByAccount($account);
-    	if(empty($origin_account)){
-    		return response()->error('ACCOUNT_NOT_EXIST');
-    	}
-    	$new_password = md5($password."^-^zhuishuyun^_^");
-    	$origin_account->number=$number;
-    	$origin_account->password=$new_password;
-    	$origin_account->nickname=$nickname;
-    	$origin_account->role=$role;
-    	$origin_account->is_enabled=$is_enabled;
-    	$origin_account->save();
-    
-    	return response()->success();
-    }
-    
-    function get_role_list(){
-    	$data= [
-    	  'product_operate'=>'产品运营',
-    	  'finance'=>'财务',
-    	  'content_operate'=>'内容运营',
-    	  'content_leader'=>'内容主管',
-    	  'business'=>'商务',
-    	  'business_leader'=>'商务主管',
-    	  'admin'=>'管理员',
-    	  'customer'=>'客服',
-    	];
-    	return response()->success($data);
-    }
-    
-    function get_edit_user_priv_list(){
-    	$data= [
-    	  'zsy_sjj',
-    	  'zsy_zlj',
-    	  'zsy_gdy',
-    	];
-    	return response()->success($data);
-    }
-
-}

+ 0 - 64
app/Http/Controllers/Manage/Manage/AuthController.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Manage;
-
-use App\Http\Controllers\Controller;
-use App\Modules\Manage\Services\ManageService;
-use Illuminate\Http\Request;
-use Cache;
-
-class AuthController extends Controller
-{
-    /**
-     * @apiDefine Manage 管理
-     */
-
-
-     /**
-     * @apiVersion 1.0.0
-     * @apiDescription 管理后台登陆
-     * @api {POST} auth/login 管理后台登陆
-     * @apiGroup Manage
-     * @apiName login
-     * @apiParam {String}  accout 账号.
-     * @apiParam {String}  password 密码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function login(Request $request)
-    {
-        $account = $request->has('account') ? trim($request->input('account')) : '';
-        $password = $request->has('password') ? trim($request->input('password')) : '';
-//         var_dump('$password:'.$password.' $account:'.$account);die();
-
-        if(!$account || !$password) return response()->error('PARAM_ERROR');
-
-        $manage = ManageService::getByAccount($account);
-//         var_dump($manage);
-
-        if($manage && $manage->password == md5($password."^-^zhuishuyun^_^"))
-        {
-            if($manage->is_enabled == 0) return response()->error('MANAGE_NOT_ENABLED');
-            $request->session()->put('manage_auth', $manage->id);
-            $request->session()->put('manage_user', serialize($manage));
-            
-            $options = [];
-            $options =[
-            	'role'=>$manage->role
-            ];
-
-//             $options = json_encode($options);
-            
-            return response()->success(compact('options'));
-        }
-
-        return response()->error('LOGIN_VERIFY_ERROR');
-    }
-
-
-}

+ 0 - 132
app/Http/Controllers/Manage/Manage/ManageController.php

@@ -1,132 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Manage;
-
-use App\Http\Controllers\Manage\BaseController;
-use App\Http\Controllers\Manage\Manage\Transformers\ManageTransformer1;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Manage\Services\ManageService;
-use Illuminate\Http\Request;
-use Cache;
-use Redis;
-
-class ManageController extends BaseController
-{
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改密码
-     * @api {POST} auth/modifyPassword 修改密码
-     * @apiGroup Manage
-     * @apiName modifyPassword
-     * @apiParam {String}  account 账号.
-     * @apiParam {String}  password 密码.
-     * @apiParam {String}  new_password 新密码.
-     * @apiParam {String}  new_password_repeat 重复新密码.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function modifyPassword(Request $request)
-    {
-    	$account = $request->has('account') ? trim($request->input('account')) : '';
-        $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(!$account || !$password || !$new_password || !$new_password_repeat) return response()->error('PARAM_ERROR');
-
-        if($new_password != $new_password_repeat) return response()->error('PASSWORD_NOT_SAME');
-        
-        
-        $manage = ManageService::getByAccount($account);
-
-        if($manage->password != md5($password."^-^zhuishuyun^_^")) return response()->error('PASSWORD_WRONG');
-
-        if($manage->account)
-        {
-            $password = md5($new_password."^-^zhuishuyun^_^");
-            if(ManageService::modifyPassword($manage->account, $password))
-            {
-                return response()->success();
-            }
-        }
-    }
-
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取商务列表
-     * @api {GET} auth/business 获取商务列表
-     * @apiGroup Manage
-     * @apiName auth/business
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function getBusiness(Request $request) {
-        $params = [];
-        $data = ManageService::getBusinessManageList($params, true);
-
-        return response()->collection(new ManageTransformer1(), $data);
-
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 获取渠道修改账号信息短信验证码
-     * @api {GET} channel/getChannelAccountSmsCode 获取渠道修改账号信息短信验证码
-     * @apiGroup Manage
-     * @apiName channel/getChannelAccountSmsCode
-     *
-     * @apiParam   {channelId}  channelId 渠道ID.
-     *
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data": {}
-     *     }
-     */
-    function getChannelAccountSms(Request $request) {
-        $channelId = $request->has('channelId') ? $request->input('channelId') : '';
-        if(!$channelId) {
-            //return response("渠道ID输入错误");
-            return response()->error('PARAM_ERROR');
-        }
-        $channel = ChannelService::getById($channelId);
-        if(!$channel) {
-            return response()->error('PARAM_ERROR');
-        }
-        $channelUser = ChannelUserService::getById($channel->channel_user_id);
-        if(!$channelUser) {
-            //return response("渠道ID输入错误");
-            return response()->error('PARAM_ERROR');
-        }
-        $phone = $channelUser->phone;
-        $phoneCode = Redis::get('sms_'.$channelId."_".$phone);
-        if(!$phoneCode) {
-            $phoneCode = Cache::get('sms_'.$channelId."_".$phone);
-        }
-
-        if(empty($phoneCode)) {
-            //return response("没有找到验证码!");
-            return response()->error('PHONE_CODE_ERROR');
-        } else {
-            return response()->success($phoneCode);
-            //return response("渠道【".$channelId."】的验证码为【".$phoneCode."】");
-        }
-    }
-}

+ 0 - 23
app/Http/Controllers/Manage/Manage/Transformers/ManageTransformer.php

@@ -1,23 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Manage\Transformers;
-
-class ManageTransformer
-{
-    public function transform($manageItem)
-    {
-        return [
-            'id' => $manageItem->id,
-            'account' => $manageItem->account,
-            'password' => $manageItem->password,
-            'nickname' => $manageItem->nickname,
-            'number' => isset($manageItem->number)?$manageItem->number:'',
-            'role' => $manageItem->role,
-            'latest_login_time' => (string)$manageItem->latest_login_time,
-            'latest_login_ip' => $manageItem->latest_login_ip,
-            'is_enabled' => $manageItem->is_enabled,
-            'remark' => $manageItem->remark,
-            'register_ip' => $manageItem->register_ip,
-        ];
-    }
-}

+ 0 - 14
app/Http/Controllers/Manage/Manage/Transformers/ManageTransformer1.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Manage\Transformers;
-
-class ManageTransformer1
-{
-    public function transform($manageItem)
-    {
-        return [
-            'id' => $manageItem->id,
-            'nickname' => $manageItem->nickname,
-        ];
-    }
-}

+ 0 - 106
app/Http/Controllers/Manage/Notice/NoticeTypesController.php

@@ -1,106 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Notice;
-
-use App\Http\Controllers\Manage\Notice\Transformers\NoticeTypeTransformer;
-use App\Modules\Notice\Services\NoticeService;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
-
-class NoticeTypesController extends Controller
-{
-    /**
-     * @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);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加公告分类
-     * @api {POST} addNoticeType 添加公告分类
-     * @apiGroup Notice
-     * @apiName addNoticeType
-     * @apiParam   {String}  name 公告分类名称
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{
-     *              "id":1,
-     *              "name":"通告"
-     *          }
-     *     }
-     */
-    function add_type(Request $request)
-    {
-        $data = $request->all();
-        $name = $request->has('name') ? $request->input('name') : '';
-        if(empty($name)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        if(NoticeService::existNoticeTypeName($name)) {
-            return response()->error("NAME_EXIST");
-        }
-
-        $notice_types = NoticeService::addNoticeType($data);
-        $id = $notice_types['id'];
-        $name = $notice_types['name'];
-        return response()->success(compact('id', 'name'));
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除公告分类
-     * @api {POST} rmNoticeType 删除公告分类
-     * @apiGroup Notice
-     * @apiName rmNoticeType
-     * @apiParam   {Number}  id 公告分类ID
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function rm_type(Request $request) {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if(!is_numeric($id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        NoticeService::rmNoticeType($id);
-
-        return response()->success();
-    }
-    
-}

+ 0 - 348
app/Http/Controllers/Manage/Notice/NoticesController.php

@@ -1,348 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Manage\Notice;
-
-use App\Http\Controllers\Controller;
-use App\Http\Controllers\Manage\Notice\Transformers\NoticeSmsTransformer;
-use App\Http\Controllers\Manage\Notice\Transformers\NoticeTransformer;
-use App\Libs\SMS;
-use App\Modules\Channel\Services\ChannelUserService;
-use App\Modules\Notice\Models\Notice;
-use App\Modules\Notice\Services\NoticeService;
-use App\Modules\Notice\Services\NoticeSmsService;
-use Illuminate\Http\Request;
-
-class NoticesController extends Controller
-{
-    /**
-     * @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') : '';
-        $status = $request->has('status') ? $request->input('status') : '';
-
-        $notices = NoticeService::getAllNoticeList($notice_type_id, $status);
-        return response()->pagination(new NoticeTransformer(), $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);
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 添加一个公告
-     * @api {POST} addNotice 添加公告
-     * @apiGroup Notice
-     * @apiName addNotice
-     * @apiParam   {Number}  [notice_type_id] 公告分类id.
-     * @apiParam   {String}  title 公告标题.
-     * @apiParam   {String}  content 公告内容.
-     * @apiParam   {Number}  is_popup 通知方式. 0:普通;1:弹框;
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function add_notice(Request $request)
-    {
-        $data = $request->all();
-
-        $title = $request->has('title') ? $request->input('title') : '';
-        if (empty($title)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $content = $request->has('content') ? $request->input('content') : '';
-        if (empty($content)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $notice_type_id = $request->has('notice_type_id') ? $request->input('notice_type_id') : '';
-        $data['is_popup'] = 0;
-
-        $data = NoticeService::addNotice($data);
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 修改一个公告
-     * @api {POST} updateNotice 修改一个公告
-     * @apiGroup Notice
-     * @apiName updateNotice
-     * @apiParam   {Number}  id 公告id.
-     * @apiParam   {Number}  [notice_type_id] 公告分类id.
-     * @apiParam   {String}  title 公告标题.
-     * @apiParam   {String}  content 公告内容.
-     * @apiParam   {Number}  [is_popup] 通知方式.0:普通;1:弹框;
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function update_notice(Request $request)
-    {
-        $id = $request->has('id') ? $request->input('id') : '';
-        if (!is_numeric($id)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $title = $request->has('title') ? $request->input('title') : '';
-        if (empty($title)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $content = $request->has('content') ? $request->input('content') : '';
-        if (empty($content)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $notice_type_id = $request->has('notice_type_id') ? $request->input('notice_type_id') : '';
-
-        $is_popup = $request->has('is_popup') ? $request->input('is_popup') : '';
-        if (!is_numeric($is_popup)) {
-            $is_popup = 0;
-        }
-        $data['is_popup'] = $is_popup;
-
-        $notice = NoticeService::getNotice($id);
-        if (empty($notice)) {
-            return response()->error("PARAM_ERROR");
-        }
-
-        $notice['title'] = $title;
-        $notice['content'] = $content;
-        $notice['notice_type_id'] = $notice_type_id;
-        $notice['is_popup'] = $is_popup;
-
-        $noticeUp = NoticeService::updateNotice($notice);
-
-        return response()->success();
-    }
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 删除一个公告
-     * @api {POST} rmNotice 删除一个公告
-     * @apiGroup Notice
-     * @apiName rmNotice
-     * @apiParam   {Number}  id 公告id.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function rm_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");
-        }
-        $notice['status'] = -1;
-        $noticeUp = NoticeService::updateNotice($notice);
-
-        return response()->success();
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 发送短信通知
-     * @api {POST} noticeSms 发送短信通知
-     * @apiGroup Notice
-     * @apiName noticeSms
-     * @apiParam   {String}  phones 公告标题.多个用小写逗号分开 13245677654,13256778989,
-     * @apiParam   {String}  content 公告内容.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function send_sms(Request $request)
-    {
-        $content = $request->has('content') ? $request->input('content') : '';
-        if (empty($content)) {
-            return response()->error("PARAM_ERROR");
-        }
-        $phoneInput = $request->has('phones') ? $request->input('phones') : '';
-        if (empty($phoneInput)) {
-            return response()->error("PARAM_ERROR");
-        }
-        if ($phoneInput == 'all') {
-            $isEnabled = 1;
-            $params = [
-                'is_enabled' => $isEnabled,
-            ];
-            $result = ChannelUserService::getChannelList($params, true);
-            foreach ($result as $rr) {
-                $phone = $rr->phone;
-                if (!empty($phone) && strlen($phone) > 10 && strlen($phone) < 15) {
-                    $code = SMS::send($phone, $content);
-                    if ($code && $code == 1) {
-                        //成功
-                    } else {
-                    }
-                }
-            }
-        } else {
-            $phones = '';
-            if ($phoneInput) {
-                $phones = explode(',', $phoneInput);
-            }
-            if (empty($phones) || count($phones) == 0) {
-                return response()->error("PARAM_ERROR");
-            }
-
-            foreach ($phones as $p) {
-                if (!empty($p) && strlen($p) > 10 && strlen($p) < 15) {
-                    $code = SMS::send($p, $content);
-                    if ($code && $code == 1) {
-                        //成功
-                    } else {
-                    }
-                }
-            }
-        }
-
-        $dataSms['phons'] = $phoneInput;
-        $dataSms['content'] = $content;
-
-        $data = NoticeSmsService::addNoticeSms($dataSms);
-
-        return response()->success($data);
-    }
-
-
-    /**
-     * @apiVersion 1.0.0
-     * @apiDescription 短信通知列表
-     * @api {POST} noticeSmsList 短信通知列表
-     * @apiGroup Notice
-     * @apiName noticeSmsList
-     * @apiParam   {String}  phones 公告标题.多个用小写逗号分开 13245677654,13256778989,
-     * @apiParam   {String}  content 公告内容.
-     * @apiSuccessExample {json} Success-Response:
-     *
-     *     {
-     *         "code": 0,
-     *         "msg": "",
-     *         "data":{}
-     *     }
-     */
-    function send_sms_list(Request $request)
-    {
-        $data = NoticeSmsService::getNoticeSms();
-        return response()->pagination(new NoticeSmsTransformer(), $data);
-    }
-
-    function getNoticeContent(Request $request)
-    {
-        $content = $request->has('content') ? $request->input('content') : '';
-        if (empty($content)) {
-            return response()->error("PARAM_EMPTY");
-        }
-        $content = Notice::getReplyConent($content);
-        return response()->success(compact('content'));
-    }
-}

+ 0 - 0
app/Http/Controllers/Manage/Notice/Transformers/NoticeSmsTransformer.php


Some files were not shown because too many files changed in this diff