Parcourir la source

Merge branch 'dev' into we7

dyjh il y a 6 ans
Parent
commit
ccddfabe20

+ 442 - 1
app/Http/Controllers/Api/V1/AlbumBossController.php

xqd
@@ -8,10 +8,451 @@
 
 namespace App\Http\Controllers\Api\V1;
 
-
+use App\Models\AlbumAgentModel;
+use App\Models\AlbumProductModel;
+use App\Models\AlbumUserModel;
+use App\Models\AlbumWatchRecord;
+use App\Models\CustomerDetailsModel;
+use Illuminate\Http\Request;
+use Validator, Response,Auth;
 use App\Services\Base\ErrorCode;
 
 class AlbumBossController extends Controller
 {
+    /**
+     * @api {get} /api/album_boss/get_top 经销商排行榜(get_top)
+     * @apiDescription 经销商排行榜(get_top)
+     * @apiGroup Boss
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}    [store_id]  商户id
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "agent": [
+     *              {
+     *                  "id": 3,
+     *                  "avatar": "http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg",
+     *                  "name": "张三",
+     *                  "get_count": "客户数量",
+     *              }
+     *          ],
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function getTop(Request $request)
+    {
+        $userAuth = Auth('api')->user();
+        if (!$userAuth) {
+            return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
+        }
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required'
+        ], [
+            'store_id.required' => '缺少商户参数',
+        ]);
+
+        if ($userAuth->role != 4) {
+            return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
+        }
+
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+        $store_id = $request->input('store_id');
+        $agentData = AlbumAgentModel::where('store_id', $store_id)->orderByDesc('get_count')->paginate(20);
+        foreach ($agentData as $value) {
+            $user = AlbumUserModel::where([['id', $value->user_id], ['store_id', $store_id]])->get(['avatar']);
+            $value->avatar = $user->avatar;
+        }
+
+        return $this->api($agentData, 0, 'success');
+    }
+
+    /**
+     * @api {post} /api/album_boss/agent_customer 经销商客户(agent_customer)
+     * @apiDescription 经销商客户(agent_customer)
+     * @apiGroup Boss
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}    [store_id]  商户id
+     * @apiParam {int}    [agent_id]  经销商id
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "agent": [
+     *              {
+     *                  "id": 3,
+     *                  "avatar": "http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg",
+     *                  "name": "张三",
+     *                  "address": "四川省",
+     *                  "phone": "8208208820",
+     *                  "lon": "100.123123",
+     *                  "lat": "123.123123",
+     *              }
+     *          ],
+     *         "customer": [
+     *              {
+     *                  "id": 3,
+     *                  "avatar": "http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg",
+     *                  "name": "张三",
+     *                  "address": "四川省甘肃市"
+     *               }
+     *          ]
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function agentCustomer(Request $request)
+    {
+        $userAuth = Auth('api')->user();
+        if (!$userAuth) {
+            return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
+        }
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required',
+            'agent_id' => 'required',
+            'pageNum' => 'required',
+        ], [
+            'store_id.required' => '缺少商户参数',
+            'agent_id.required' => '缺少经销商参数',
+            'pageNum.required' => '缺少页码参数',
+        ]);
+
+        if ($userAuth->role != 4) {
+            return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
+        }
+
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        $data = $request->input();
+        $agent = AlbumAgentModel::where([['store_id', $data['store_id']], ['id', $data['agent_id']]])->first();
+        $userCount = AlbumWatchRecord::where([
+            ['agent_id', $agent->id], ['store_id',$data['store_id']]
+        ])->groupBy('open_id')->get();
+        $i = 0;
+        foreach ($userCount as $value) {
+            if ($i >= (($data['pageNum'] + 1) * 20)) {
+                break;
+            }
+            if ($i >= ($data['pageNum'] * 20) && $i < (($data['pageNum'] + 1) * 20)) {
+                $user = AlbumUserModel::where('open_id', $value->open_id)->first(['avatar', 'username', 'address']);
+                $userComment = CustomerDetailsModel::where('open_id', $value->open_id)->first(['comment']);
+                $customer[] = [
+                    'name' => $userComment->comment,
+                    'avatar' => $user->avatar,
+                    'username' => $user->username,
+                    'address' => $user->address
+                ];
+                $i++;
+            }
+        }
+
+        return $this->api(compact('agent', 'customer'), 0, 'success');
+    }
+
+
+
+    /**
+     * @api {post} /api/album_boss/agent_statistical 经销商数据(agent_statistical)
+     * @apiDescription 经销商数据(agent_statistical)
+     * @apiGroup Boss
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}    [store_id]  商户id
+     * @apiParam {int}    [agent_id]  经销商id
+     * @apiParam {int}    [start]     开始时间
+     * @apiParam {int}    [end]       结束时间
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "favoriteCount":11,
+     *         "downloadCount":11,
+     *         "shareCount":11,
+     *         "newCustomerCount":11,
+     *         "totalCustomerCount":11,
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function agentStatistical(Request $request)
+    {
+        $userAuth = Auth('api')->user();
+        if (!$userAuth) {
+            return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
+        }
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required',
+            'agent_id' => 'required',
+        ], [
+            'store_id.required' => '缺少商户参数',
+            'agent_id.required' => '缺少经销商参数',
+        ]);
+
+        if ($userAuth->role != 4) {
+            return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
+        }
+
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        $data = $request->input();
+        $end = $request->input('end');
+        $start = $request->input('start');
+        if (!$end) {
+            $end = time();
+        }
+        if (!$start) {
+            $start = 0;
+        }
+        $end = date('Y-m-d H:i:s', $end);
+        $start = date('Y-m-d H:i:s', $start);
+        $favoriteCount = AlbumWatchRecord::where([
+            ['agent_id', $data['agent_id']],
+            ['store_id', $data['store_id']],
+            ['action', 1],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
+
+        $downloadCount = AlbumWatchRecord::where([
+            ['agent_id', $data['agent_id']],
+            ['store_id', $data['store_id']],
+            ['action', 9],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
+
+        $shareCount = AlbumWatchRecord::where([
+            ['agent_id', $data['agent_id']],
+            ['store_id', $data['store_id']],
+            ['action', 8],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
+
+        $newCustomerCount = AlbumWatchRecord::where([
+            ['agent_id', $data['agent_id']],
+            ['store_id', $data['store_id']],
+            ['is_new', 1],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
+
+        $totalCustomerCount = AlbumWatchRecord::where([
+            ['agent_id', $data['agent_id']],
+            ['store_id', $data['store_id']],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->groupBy('open_id')->count();
+
+        return $this->api(compact('shareCount', 'totalCustomerCount', 'newCustomerCount', 'downloadCount', 'favoriteCount'));
+    }
+
+    /**
+     * @api {post} /api/album_boss/agent_overview 经销商总览(agent_overview)
+     * @apiDescription 经销商总览(agent_overview)
+     * @apiGroup Boss
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}    [store_id]  商户id
+     * @apiParam {int}    [start]     开始时间
+     * @apiParam {int}    [end]       结束时间
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "customerFollow":11,
+     *         "downloadCount":11,
+     *         "shareCount":11,
+     *         "newCustomerCount":11,
+     *         "totalCustomerCount":11,
+     *         "activeCustomers": [
+     *              {
+     *                  "day" : 03/25,
+     *                  "num" : 111
+     *              }
+     *          ],
+     *          "newCustomers": [
+     *              {
+     *                  "day" : 03/25,
+     *                  "num" : 111
+     *              }
+     *          ]
+     *          "arrFavorite": [
+     *              {
+     *                  'name':'asdawd',
+     *                  'point':'asdawd',
+     *                  'num':'1',
+     *              }
+     *          ]
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function albumOverview(Request $request)
+    {
+
+        $userAuth = Auth('api')->user();
+        if (!$userAuth) {
+            return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
+        }
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required',
+        ], [
+            'store_id.required' => '缺少商户参数',
+        ]);
+
+        if ($userAuth->role != 4) {
+            return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
+        }
+
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        $end = $request->input('end');
+        $start = $request->input('start');
+        $store_id = $request->input('store_id');
+        if (!$end) {
+            $end = time();
+        }
+        if (!$start) {
+            $start = 0;
+        }
+        $end = date('Y-m-d H:i:s', $end);
+        $start = date('Y-m-d H:i:s', $start);
+        $resGoods = AlbumWatchRecord::where([
+            ['store_id',$store_id],['action',3],['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->get();
+        $arrFavorite = array();
+        $total = 0;
+
+        foreach ($resGoods as $key => $val) {
+            $goods_data = json_decode($val->detail, true);
+            $goods_id = $goods_data['goods_id'];
+            $goods = AlbumProductModel::find($goods_id);
+            if (!$goods) {
+                continue;
+            }
+            if (isset($arr[$goods->id])) {
+                $arrFavorite[$goods->id]['num']++;
+            } else {
+                $arrFavorite[$goods->id]['num'] = 1;
+                $arrFavorite[$goods->id]['name'] = $goods->name;
+            }
+            $total++;
+        }
+        $activeCustomers = array();
+        $newCustomers = array();
+        for ($d = 0; $d < 15; $d++) {
+            $Start = mktime(0, 0, 0, date('m'), date('d'), date('y')) + 86400 * $d;
+            $End = $Start + 86400;
+            $End = date('Y-m-d H:i:s', $End);
+            $Start = date('Y-m-d H:i:s', $Start);
+            $customerNum = AlbumWatchRecord::where([
+                ['store_id', $store_id],
+                ['updated_at','>=',$Start],
+                ['updated_at','<=',$End]
+            ])->orderByDesc('id')->groupBy('open_id')->count();
+            $newCustomer = AlbumWatchRecord::where([
+                ['store_id', $store_id],
+                ['is_new', 1],
+                ['updated_at','>=',$Start],
+                ['updated_at','<=',$End]
+            ])->orderByDesc('id')->count();
+            $activeCustomers[] = [
+                'day' => date('m', $Start) . '-' . date('d', $End),
+                'num' => $customerNum
+            ];
+            $newCustomers[] = [
+                'day' => date('m', $Start) . '-' . date('d', $End),
+                'num' => $newCustomer
+            ];
+        }
+        $customerFollow = CustomerDetailsModel::where('store_id', $store_id)->count();
+        $downloadCount = AlbumWatchRecord::where([
+            ['store_id', $store_id],
+            ['action', 9],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
+
+        $shareCount = AlbumWatchRecord::where([
+            ['store_id', $store_id],
+            ['action', 8],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
+
+        $newCustomerCount = AlbumWatchRecord::where([
+            ['store_id', $store_id],
+            ['is_new', 1],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->count();
 
+        $totalCustomerCount = AlbumWatchRecord::where([
+            ['store_id', $store_id],
+            ['updated_at','>=',$start],
+            ['updated_at','<=',$end]
+        ])->orderByDesc('id')->groupBy('open_id')->count();
+        return $this->api(compact('totalCustomerCount', 'newCustomerCount', 'shareCount', 'downloadCount', 'customerFollow', 'newCustomers', 'activeCustomers', 'arrFavorite'));
+    }
 }

+ 10 - 2
app/Http/Controllers/Api/V1/AlbumController.php

xqd xqd
@@ -223,6 +223,14 @@ class AlbumController extends Controller
                 $add_record['action'] = 4;
                 $add_record['store_id'] = $datas['store_id'];
                 $add_record['detail'] = null;
+                $check_new_customer = AlbumWatchRecord::where([
+                    ['agent_id', $userAuth->up_agent_id],['open_id', $check->open_id],['store_id', $datas['store_id']]
+                ])->first();
+                if ($check_new_customer) {
+                    $add_record['is_new'] = 0;
+                } else {
+                    $add_record['is_new'] = 1;
+                }
                 AlbumWatchRecord::create($add_record);
                 //   dd($add_record);
                 // print_r($add_record['agent_id']);die;
@@ -980,12 +988,12 @@ class AlbumController extends Controller
         $validator = Validator::make($request->all(), [
             'store_id' => 'required',
             'open_id' => 'required',
-           // 'end' => 'required',
+            // 'end' => 'required',
             //'start' => 'required',
         ],[
             'store_id.required'=>'缺少商户参数',
             'open_id.required'=>'缺少风格参数',
-           // 'end.required'=>'缺少结束时间参数',
+            // 'end.required'=>'缺少结束时间参数',
             //'start.required'=>'缺少开始时间参数',
         ]);
         if ($validator->fails()) {

+ 19 - 0
app/Http/Controllers/Api/V1/AlbumPosterController.php

xqd xqd
@@ -11,6 +11,8 @@ namespace App\Http\Controllers\Api\V1;
 use App\Models\AlbumAgentModel;
 use App\Models\AlbumManufacturerModel;
 use App\Models\AlbumPosterModel;
+use App\Models\AlbumUserModel;
+use App\Models\AlbumWatchRecord;
 use App\Services\Base\ErrorCode;
 use EasyWeChat\Factory;
 use Grafika\Color;
@@ -215,7 +217,24 @@ class AlbumPosterController extends Controller
         } else {
             $agent_id = $userAuth->up_agent_id == 0 ? 0 : $userAuth->up_agent_id;
         }
+
         $data = $request->input();
+
+        if ($userAuth->up_agent_id != 0) {
+            $add_record['agent_id'] = $userAuth->up_agent_id;
+            $add_record['open_id'] = $userAuth->open_id;
+            $add_record['action'] = 9;
+            $add_record['store_id'] = $data['store_id'];
+            $add_record['detail'] = '保存了图片';
+            $user_agent = AlbumAgentModel::where('id', $userAuth->up_agent_id)->first();
+            $agent = AlbumUserModel::where('id', $user_agent->user_id)->first();
+
+            $album = new AlbumController();
+            $album->sendLogsMessage($data['store_id'], $agent->open_id, 9, $userAuth->username, $agent->g_open_id);
+
+            AlbumWatchRecord::create($add_record);
+        }
+
         $info = AlbumPosterModel::where('store_id', $data['store_id'])->first()->toArray();
         $editor = Grafika::createEditor();
         $editor->open($image_poster, public_path() . '/base/poster/img/poster_canvas.png');

+ 2 - 1
app/Http/Controllers/Api/V1/Controller.php

xqd
@@ -22,7 +22,8 @@ class Controller extends BaseController
         $this->middleware('auth:api', [
             'except' => [
                 'upload', 'getCode', 'reset', 'login', 'get', 'register', 'alipayNotify', 'wechatpayNotify', 'get', 'area', 'get_province', 'get_city', 'get_county', 'albumStyle', 'test', 'index', 'companyInfo', 'shop2', 'cardIndex', 'cardUserInfo', 'cardUserProgress', 'cardUserHonor', 'cardUserProject', 'CardUserTrend', 'projectDetail', 'trendDetail', 'albumSetting', 'albumXyxLogin', 'albumCat', 'albumchecklogin', 'albumGoods', 'albumGoodsDetail', 'albumSetPrice', 'albumXcxLogin', 'albumContentList', 'albumSearchGoods','albumContentDetail','albumFavoriteList','albumAddFavorite','albumFavoriteDel','getAttr','getOrder','getProgress','getReviewCount', 'furnitureNewsDetail','furnitureSetting','furnitureXcxLogin','furnitureGoodsList','serviceLogin','getFurnitureAds','getPhoneNumber','getQrcode','orderCount','searchList','printOrder','saveFormId','furnitureNewsList','getMoreComments','addToLike','albumSavePhone','albumGetStatistical','test',
-                'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId','albumAddAgent','albumGetBanner','albumGetDataGoods','newgoods_list','newgoods_index','albumGetAgentAdress','albumSetCustomer','albumGetCustomer','albumGetDataCat','albumCustomerGoods','albumCustomerGoodsDetail','albumGetDataCatSingle','albumGetCountOfFavorite','albumGetUserInfo','albumStatistical','posterInfo','createPoster','posterDel','albumAgentPriceSet'
+                'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId','albumAddAgent','albumGetBanner','albumGetDataGoods','newgoods_list','newgoods_index','albumGetAgentAdress','albumSetCustomer','albumGetCustomer','albumGetDataCat','albumCustomerGoods','albumCustomerGoodsDetail','albumGetDataCatSingle','albumGetCountOfFavorite','albumGetUserInfo','albumStatistical','posterInfo','createPoster','posterDel','albumAgentPriceSet', 'getTop', 'agentCustomer'
+                , 'agentStatistical', 'albumOverview'
             ]
         ]);
 

+ 3 - 0
app/Models/AlbumUserModel.php

xqd
@@ -40,6 +40,9 @@ class AlbumUserModel extends Authenticatable
     protected $fillable = [
         'username',
         'wechat_open_id',
+        'address',
+        'lng',
+        'lat',
         'g_open_id',
         'open_id',
         'wechat_union_id',

+ 2 - 0
app/Services/Base/ErrorCode.php

xqd xqd
@@ -14,6 +14,7 @@ namespace App\Services\Base;
 
 final class ErrorCode {
     //错误常量定义
+    const NOT_BOSS = 606;
     const ATTACHMENT_DELETE_FAILED = 605;
     const ATTACHMENT_MOVE_FAILED = 604;
     const ATTACHMENT_RECORD_DELETE_FAILED = 606;
@@ -76,6 +77,7 @@ final class ErrorCode {
 
     //错误常量枚举
     private static $_msg = [
+        self::NOT_BOSS => '该用户没有Boss权限',
         self::ORDER_NOT_EXIST => '订单没有找到',
         self::APPID_NOT_EXIST => 'appid不存在',
         self::ADDRESS_NOT_EXIST => '地址不存在',

+ 35 - 0
database/migrations/2019_04_14_105335_add_address_info_to_album_user.php

xqd
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddAddressInfoToAlbumUser extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_user', function (Blueprint $table) {
+            //
+            $table->string('address', 255)->nullable()->default(null)->comment('地址');
+            $table->string('lng', 100)->nullable()->default(null);
+            $table->string('lat', 100)->nullable()->default(null);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_user', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 33 - 0
database/migrations/2019_04_14_141741_add_is_new_to_album_watch_record.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddIsNewToAlbumWatchRecord extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_watch_record', function (Blueprint $table) {
+            //
+            $table->unsignedInteger('is_new')->default(0)->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_watch_record', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 230 - 0
public/apidoc/api_data.js

xqd
@@ -2041,6 +2041,236 @@ define({ "api": [
     "groupTitle": "Auth",
     "name": "PostApiAuthLogin"
   },
+  {
+    "type": "get",
+    "url": "/api/album_boss/get_top",
+    "title": "经销商排行榜(get_top)",
+    "description": "<p>经销商排行榜(get_top)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"agent\": [\n             {\n                 \"id\": 3,\n                 \"avatar\": \"http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg\",\n                 \"name\": \"张三\",\n                 \"get_count\": \"客户数量\",\n             }\n         ],\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "GetApiAlbum_bossGet_top"
+  },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_customer",
+    "title": "经销商客户(agent_customer)",
+    "description": "<p>经销商客户(agent_customer)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "agent_id",
+            "description": "<p>经销商id</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"agent\": [\n             {\n                 \"id\": 3,\n                 \"avatar\": \"http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg\",\n                 \"name\": \"张三\",\n                 \"address\": \"四川省\",\n                 \"phone\": \"8208208820\",\n                 \"lon\": \"100.123123\",\n                 \"lat\": \"123.123123\",\n             }\n         ],\n        \"customer\": [\n             {\n                 \"id\": 3,\n                 \"avatar\": \"http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg\",\n                 \"name\": \"张三\",\n                 \"address\": \"四川省甘肃市\"\n              }\n         ]\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_customer"
+  },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_overview",
+    "title": "经销商总览(agent_overview)",
+    "description": "<p>经销商总览(agent_overview)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "start",
+            "description": "<p>开始时间</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "end",
+            "description": "<p>结束时间</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"customerFollow\":11,\n        \"downloadCount\":11,\n        \"shareCount\":11,\n        \"newCustomerCount\":11,\n        \"totalCustomerCount\":11,\n        \"activeCustomers\": [\n             {\n                 \"day\" : 03/25,\n                 \"num\" : 111\n             }\n         ],\n         \"newCustomers\": [\n             {\n                 \"day\" : 03/25,\n                 \"num\" : 111\n             }\n         ]\n         \"arrFavorite\": [\n             {\n                 'name':'asdawd',\n                 'point':'asdawd',\n                 'num':'1',\n             }\n         ]\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_overview"
+  },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_statistical",
+    "title": "经销商数据(agent_statistical)",
+    "description": "<p>经销商数据(agent_statistical)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "agent_id",
+            "description": "<p>经销商id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "start",
+            "description": "<p>开始时间</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "end",
+            "description": "<p>结束时间</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"favoriteCount\":11,\n        \"downloadCount\":11,\n        \"shareCount\":11,\n        \"newCustomerCount\":11,\n        \"totalCustomerCount\":11,\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_statistical"
+  },
   {
     "type": "get",
     "url": "/api/car/delete",

+ 230 - 0
public/apidoc/api_data.json

xqd
@@ -2041,6 +2041,236 @@
     "groupTitle": "Auth",
     "name": "PostApiAuthLogin"
   },
+  {
+    "type": "get",
+    "url": "/api/album_boss/get_top",
+    "title": "经销商排行榜(get_top)",
+    "description": "<p>经销商排行榜(get_top)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"agent\": [\n             {\n                 \"id\": 3,\n                 \"avatar\": \"http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg\",\n                 \"name\": \"张三\",\n                 \"get_count\": \"客户数量\",\n             }\n         ],\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "GetApiAlbum_bossGet_top"
+  },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_customer",
+    "title": "经销商客户(agent_customer)",
+    "description": "<p>经销商客户(agent_customer)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "agent_id",
+            "description": "<p>经销商id</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"agent\": [\n             {\n                 \"id\": 3,\n                 \"avatar\": \"http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg\",\n                 \"name\": \"张三\",\n                 \"address\": \"四川省\",\n                 \"phone\": \"8208208820\",\n                 \"lon\": \"100.123123\",\n                 \"lat\": \"123.123123\",\n             }\n         ],\n        \"customer\": [\n             {\n                 \"id\": 3,\n                 \"avatar\": \"http://admin.xcx.com/upload/images/20180519/02f2dbe0e1046d7cea8b3b52d5642fb8.jpg\",\n                 \"name\": \"张三\",\n                 \"address\": \"四川省甘肃市\"\n              }\n         ]\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_customer"
+  },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_overview",
+    "title": "经销商总览(agent_overview)",
+    "description": "<p>经销商总览(agent_overview)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "start",
+            "description": "<p>开始时间</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "end",
+            "description": "<p>结束时间</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"customerFollow\":11,\n        \"downloadCount\":11,\n        \"shareCount\":11,\n        \"newCustomerCount\":11,\n        \"totalCustomerCount\":11,\n        \"activeCustomers\": [\n             {\n                 \"day\" : 03/25,\n                 \"num\" : 111\n             }\n         ],\n         \"newCustomers\": [\n             {\n                 \"day\" : 03/25,\n                 \"num\" : 111\n             }\n         ]\n         \"arrFavorite\": [\n             {\n                 'name':'asdawd',\n                 'point':'asdawd',\n                 'num':'1',\n             }\n         ]\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_overview"
+  },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_statistical",
+    "title": "经销商数据(agent_statistical)",
+    "description": "<p>经销商数据(agent_statistical)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "agent_id",
+            "description": "<p>经销商id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "start",
+            "description": "<p>开始时间</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "end",
+            "description": "<p>结束时间</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"favoriteCount\":11,\n        \"downloadCount\":11,\n        \"shareCount\":11,\n        \"newCustomerCount\":11,\n        \"totalCustomerCount\":11,\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_statistical"
+  },
   {
     "type": "get",
     "url": "/api/car/delete",

+ 1 - 1
public/apidoc/api_project.js

xqd
@@ -9,7 +9,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-03-28T09:03:36.904Z",
+    "time": "2019-04-14T07:43:32.349Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 1 - 1
public/apidoc/api_project.json

xqd
@@ -9,7 +9,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-03-28T09:03:36.904Z",
+    "time": "2019-04-14T07:43:32.349Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 5 - 0
resources/views/admin/album/user/index.blade.php

xqd
@@ -85,6 +85,11 @@
                                                         class="btn btn-success">设为经理
                                                 </button>
                                             @endif
+                                            @if($item->role !== 3)
+                                                <button onclick="window.location.href='{{ U('Album/User/role',['id'=>$item->id,'role'=>4]) }}'"
+                                                        class="btn btn-waring">设为Boss
+                                                </button>
+                                            @endif
                                         </td>
                                     </tr>
                                 @endforeach

+ 21 - 0
routes/api.php

xqd
@@ -493,6 +493,27 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'furniture.newgoods_addbooking',
         'uses' => 'FurnitureController@newgoods_addbooking',
     ]);
+/*
+ *  AlbumBoss
+ */
+    $api->get('album_boss/get_top', [
+        'as' => 'album_boss.get_top',
+        'uses' => 'AlbumBossController@getTop',
+    ]);
+
+    $api->post('album_boss/agent_customer', [
+        'as' => 'album_boss.agent_customer',
+        'uses' => 'AlbumBossController@agentCustomer',
+    ]);
 
+    $api->post('album_boss/agent_statistical', [
+        'as' => 'album_boss.agent_statistical',
+        'uses' => 'AlbumBossController@agentStatistical',
+    ]);
+
+    $api->post('album_boss/agent_overview', [
+        'as' => 'album_boss.agent_overview',
+        'uses' => 'AlbumBossController@albumOverview',
+    ]);
 
 });